diff options
Diffstat (limited to 'drivers/acpi')
127 files changed, 4217 insertions, 3660 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 230c53852231..94b8d820c512 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -10,9 +10,8 @@ menu "ACPI (Advanced Configuration and Power Interface) Support" | |||
10 | config ACPI | 10 | config ACPI |
11 | bool "ACPI Support" | 11 | bool "ACPI Support" |
12 | depends on IA64 || X86 | 12 | depends on IA64 || X86 |
13 | depends on PCI | ||
13 | select PM | 14 | select PM |
14 | select PCI | ||
15 | |||
16 | default y | 15 | default y |
17 | ---help--- | 16 | ---help--- |
18 | Advanced Configuration and Power Interface (ACPI) support for | 17 | Advanced Configuration and Power Interface (ACPI) support for |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index d882bf87fa96..e0a95ba72371 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -74,7 +74,7 @@ struct acpi_memory_device { | |||
74 | unsigned short caching; /* memory cache attribute */ | 74 | unsigned short caching; /* memory cache attribute */ |
75 | unsigned short write_protect; /* memory read/write attribute */ | 75 | unsigned short write_protect; /* memory read/write attribute */ |
76 | u64 start_addr; /* Memory Range start physical addr */ | 76 | u64 start_addr; /* Memory Range start physical addr */ |
77 | u64 end_addr; /* Memory Range end physical addr */ | 77 | u64 length; /* Memory Range length */ |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static int | 80 | static int |
@@ -97,12 +97,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
97 | if (ACPI_SUCCESS(status)) { | 97 | if (ACPI_SUCCESS(status)) { |
98 | if (address64.resource_type == ACPI_MEMORY_RANGE) { | 98 | if (address64.resource_type == ACPI_MEMORY_RANGE) { |
99 | /* Populate the structure */ | 99 | /* Populate the structure */ |
100 | mem_device->caching = | 100 | mem_device->caching = address64.info.mem.caching; |
101 | address64.info.mem.caching; | ||
102 | mem_device->write_protect = | 101 | mem_device->write_protect = |
103 | address64.info.mem.write_protect; | 102 | address64.info.mem.write_protect; |
104 | mem_device->start_addr = address64.minimum; | 103 | mem_device->start_addr = address64.minimum; |
105 | mem_device->end_addr = address64.maximum; | 104 | mem_device->length = address64.address_length; |
106 | } | 105 | } |
107 | } | 106 | } |
108 | 107 | ||
@@ -199,8 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
199 | * Tell the VM there is more memory here... | 198 | * Tell the VM there is more memory here... |
200 | * Note: Assume that this function returns zero on success | 199 | * Note: Assume that this function returns zero on success |
201 | */ | 200 | */ |
202 | result = add_memory(mem_device->start_addr, | 201 | result = add_memory(mem_device->start_addr, mem_device->length); |
203 | (mem_device->end_addr - mem_device->start_addr) + 1); | ||
204 | if (result) { | 202 | if (result) { |
205 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); | 203 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); |
206 | mem_device->state = MEMORY_INVALID_STATE; | 204 | mem_device->state = MEMORY_INVALID_STATE; |
@@ -249,7 +247,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) | |||
249 | { | 247 | { |
250 | int result; | 248 | int result; |
251 | u64 start = mem_device->start_addr; | 249 | u64 start = mem_device->start_addr; |
252 | u64 len = mem_device->end_addr - start + 1; | 250 | u64 len = mem_device->length; |
253 | 251 | ||
254 | ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); | 252 | ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); |
255 | 253 | ||
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index f4c87750dbf2..839f423d738d 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -817,7 +817,7 @@ typedef int (proc_writefunc) (struct file * file, const char __user * buffer, | |||
817 | unsigned long count, void *data); | 817 | unsigned long count, void *data); |
818 | 818 | ||
819 | static int | 819 | static int |
820 | __init asus_proc_add(char *name, proc_writefunc * writefunc, | 820 | asus_proc_add(char *name, proc_writefunc * writefunc, |
821 | proc_readfunc * readfunc, mode_t mode, | 821 | proc_readfunc * readfunc, mode_t mode, |
822 | struct acpi_device *device) | 822 | struct acpi_device *device) |
823 | { | 823 | { |
@@ -836,7 +836,7 @@ __init asus_proc_add(char *name, proc_writefunc * writefunc, | |||
836 | return 0; | 836 | return 0; |
837 | } | 837 | } |
838 | 838 | ||
839 | static int __init asus_hotk_add_fs(struct acpi_device *device) | 839 | static int asus_hotk_add_fs(struct acpi_device *device) |
840 | { | 840 | { |
841 | struct proc_dir_entry *proc; | 841 | struct proc_dir_entry *proc; |
842 | mode_t mode; | 842 | mode_t mode; |
@@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) | |||
954 | * This function is used to initialize the hotk with right values. In this | 954 | * This function is used to initialize the hotk with right values. In this |
955 | * method, we can make all the detection we want, and modify the hotk struct | 955 | * method, we can make all the detection we want, and modify the hotk struct |
956 | */ | 956 | */ |
957 | static int __init asus_hotk_get_info(void) | 957 | static int asus_hotk_get_info(void) |
958 | { | 958 | { |
959 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 959 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
960 | struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; | 960 | struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -970,7 +970,7 @@ static int __init asus_hotk_get_info(void) | |||
970 | * HID), this bit will be moved. A global variable asus_info contains | 970 | * HID), this bit will be moved. A global variable asus_info contains |
971 | * the DSDT header. | 971 | * the DSDT header. |
972 | */ | 972 | */ |
973 | status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); | 973 | status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); |
974 | if (ACPI_FAILURE(status)) | 974 | if (ACPI_FAILURE(status)) |
975 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); | 975 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); |
976 | else | 976 | else |
@@ -1101,7 +1101,7 @@ static int __init asus_hotk_get_info(void) | |||
1101 | return AE_OK; | 1101 | return AE_OK; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | static int __init asus_hotk_check(void) | 1104 | static int asus_hotk_check(void) |
1105 | { | 1105 | { |
1106 | int result = 0; | 1106 | int result = 0; |
1107 | 1107 | ||
@@ -1119,7 +1119,9 @@ static int __init asus_hotk_check(void) | |||
1119 | return result; | 1119 | return result; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | static int __init asus_hotk_add(struct acpi_device *device) | 1122 | static int asus_hotk_found; |
1123 | |||
1124 | static int asus_hotk_add(struct acpi_device *device) | ||
1123 | { | 1125 | { |
1124 | acpi_status status = AE_OK; | 1126 | acpi_status status = AE_OK; |
1125 | int result; | 1127 | int result; |
@@ -1180,6 +1182,8 @@ static int __init asus_hotk_add(struct acpi_device *device) | |||
1180 | } | 1182 | } |
1181 | } | 1183 | } |
1182 | 1184 | ||
1185 | asus_hotk_found = 1; | ||
1186 | |||
1183 | end: | 1187 | end: |
1184 | if (result) { | 1188 | if (result) { |
1185 | kfree(hotk); | 1189 | kfree(hotk); |
@@ -1226,12 +1230,24 @@ static int __init asus_acpi_init(void) | |||
1226 | asus_proc_dir->owner = THIS_MODULE; | 1230 | asus_proc_dir->owner = THIS_MODULE; |
1227 | 1231 | ||
1228 | result = acpi_bus_register_driver(&asus_hotk_driver); | 1232 | result = acpi_bus_register_driver(&asus_hotk_driver); |
1229 | if (result < 1) { | 1233 | if (result < 0) { |
1230 | acpi_bus_unregister_driver(&asus_hotk_driver); | ||
1231 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | 1234 | remove_proc_entry(PROC_ASUS, acpi_root_dir); |
1232 | return -ENODEV; | 1235 | return -ENODEV; |
1233 | } | 1236 | } |
1234 | 1237 | ||
1238 | /* | ||
1239 | * This is a bit of a kludge. We only want this module loaded | ||
1240 | * for ASUS systems, but there's currently no way to probe the | ||
1241 | * ACPI namespace for ASUS HIDs. So we just return failure if | ||
1242 | * we didn't find one, which will cause the module to be | ||
1243 | * unloaded. | ||
1244 | */ | ||
1245 | if (!asus_hotk_found) { | ||
1246 | acpi_bus_unregister_driver(&asus_hotk_driver); | ||
1247 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | ||
1248 | return result; | ||
1249 | } | ||
1250 | |||
1235 | return 0; | 1251 | return 0; |
1236 | } | 1252 | } |
1237 | 1253 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 606f8733a776..dd3983cece92 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME("acpi_bus") | |||
43 | extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); | 43 | extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | FADT_DESCRIPTOR acpi_fadt; | 46 | struct fadt_descriptor acpi_fadt; |
47 | EXPORT_SYMBOL(acpi_fadt); | 47 | EXPORT_SYMBOL(acpi_fadt); |
48 | 48 | ||
49 | struct acpi_device *acpi_root; | 49 | struct acpi_device *acpi_root; |
@@ -205,12 +205,14 @@ int acpi_bus_set_power(acpi_handle handle, int state) | |||
205 | * Get device's current power state if it's unknown | 205 | * Get device's current power state if it's unknown |
206 | * This means device power state isn't initialized or previous setting failed | 206 | * This means device power state isn't initialized or previous setting failed |
207 | */ | 207 | */ |
208 | if (device->power.state == ACPI_STATE_UNKNOWN) | 208 | if (!device->flags.force_power_state) { |
209 | acpi_bus_get_power(device->handle, &device->power.state); | 209 | if (device->power.state == ACPI_STATE_UNKNOWN) |
210 | if (state == device->power.state) { | 210 | acpi_bus_get_power(device->handle, &device->power.state); |
211 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", | 211 | if (state == device->power.state) { |
212 | state)); | 212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", |
213 | return_VALUE(0); | 213 | state)); |
214 | return_VALUE(0); | ||
215 | } | ||
214 | } | 216 | } |
215 | if (!device->power.states[state].flags.valid) { | 217 | if (!device->power.states[state].flags.valid) { |
216 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", | 218 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", |
@@ -596,6 +598,8 @@ void __init acpi_early_init(void) | |||
596 | if (acpi_disabled) | 598 | if (acpi_disabled) |
597 | return_VOID; | 599 | return_VOID; |
598 | 600 | ||
601 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); | ||
602 | |||
599 | /* enable workarounds, unless strict ACPI spec. compliance */ | 603 | /* enable workarounds, unless strict ACPI spec. compliance */ |
600 | if (!acpi_strict) | 604 | if (!acpi_strict) |
601 | acpi_gbl_enable_interpreter_slack = TRUE; | 605 | acpi_gbl_enable_interpreter_slack = TRUE; |
@@ -617,7 +621,7 @@ void __init acpi_early_init(void) | |||
617 | /* | 621 | /* |
618 | * Get a separate copy of the FADT for use by other drivers. | 622 | * Get a separate copy of the FADT for use by other drivers. |
619 | */ | 623 | */ |
620 | status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer); | 624 | status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &buffer); |
621 | if (ACPI_FAILURE(status)) { | 625 | if (ACPI_FAILURE(status)) { |
622 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); | 626 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); |
623 | goto error0; | 627 | goto error0; |
@@ -743,8 +747,6 @@ static int __init acpi_init(void) | |||
743 | 747 | ||
744 | ACPI_FUNCTION_TRACE("acpi_init"); | 748 | ACPI_FUNCTION_TRACE("acpi_init"); |
745 | 749 | ||
746 | printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); | ||
747 | |||
748 | if (acpi_disabled) { | 750 | if (acpi_disabled) { |
749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); | 751 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); |
750 | return_VALUE(-ENODEV); | 752 | return_VALUE(-ENODEV); |
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 76bc0463f6de..a6d77efb41a0 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
@@ -87,7 +87,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
87 | union acpi_operand_object *second_desc = NULL; | 87 | union acpi_operand_object *second_desc = NULL; |
88 | u32 flags; | 88 | u32 flags; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ds_create_buffer_field"); | 90 | ACPI_FUNCTION_TRACE(ds_create_buffer_field); |
91 | 91 | ||
92 | /* Get the name_string argument */ | 92 | /* Get the name_string argument */ |
93 | 93 | ||
@@ -210,7 +210,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
210 | acpi_status status; | 210 | acpi_status status; |
211 | acpi_integer position; | 211 | acpi_integer position; |
212 | 212 | ||
213 | ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info); | 213 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); |
214 | 214 | ||
215 | /* First field starts at bit zero */ | 215 | /* First field starts at bit zero */ |
216 | 216 | ||
@@ -342,7 +342,7 @@ acpi_ds_create_field(union acpi_parse_object *op, | |||
342 | union acpi_parse_object *arg; | 342 | union acpi_parse_object *arg; |
343 | struct acpi_create_field_info info; | 343 | struct acpi_create_field_info info; |
344 | 344 | ||
345 | ACPI_FUNCTION_TRACE_PTR("ds_create_field", op); | 345 | ACPI_FUNCTION_TRACE_PTR(ds_create_field, op); |
346 | 346 | ||
347 | /* First arg is the name of the parent op_region (must already exist) */ | 347 | /* First arg is the name of the parent op_region (must already exist) */ |
348 | 348 | ||
@@ -399,7 +399,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
399 | struct acpi_namespace_node *node; | 399 | struct acpi_namespace_node *node; |
400 | u8 type = 0; | 400 | u8 type = 0; |
401 | 401 | ||
402 | ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); |
403 | 403 | ||
404 | switch (walk_state->opcode) { | 404 | switch (walk_state->opcode) { |
405 | case AML_FIELD_OP: | 405 | case AML_FIELD_OP: |
@@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
425 | * Walk the list of entries in the field_list | 425 | * Walk the list of entries in the field_list |
426 | */ | 426 | */ |
427 | while (arg) { | 427 | while (arg) { |
428 | |||
428 | /* Ignore OFFSET and ACCESSAS terms here */ | 429 | /* Ignore OFFSET and ACCESSAS terms here */ |
429 | 430 | ||
430 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { | 431 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { |
@@ -481,7 +482,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
481 | union acpi_parse_object *arg; | 482 | union acpi_parse_object *arg; |
482 | struct acpi_create_field_info info; | 483 | struct acpi_create_field_info info; |
483 | 484 | ||
484 | ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op); | 485 | ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op); |
485 | 486 | ||
486 | /* First arg is the name of the parent op_region (must already exist) */ | 487 | /* First arg is the name of the parent op_region (must already exist) */ |
487 | 488 | ||
@@ -554,7 +555,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op, | |||
554 | union acpi_parse_object *arg; | 555 | union acpi_parse_object *arg; |
555 | struct acpi_create_field_info info; | 556 | struct acpi_create_field_info info; |
556 | 557 | ||
557 | ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op); | 558 | ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op); |
558 | 559 | ||
559 | /* First arg is the name of the Index register (must already exist) */ | 560 | /* First arg is the name of the Index register (must already exist) */ |
560 | 561 | ||
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index e65a07ad2422..bbdf990e9f65 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -184,7 +184,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
184 | * | 184 | * |
185 | * RETURN: Status | 185 | * RETURN: Status |
186 | * | 186 | * |
187 | * DESCRIPTION: Walk the namespace starting at "start_node" and perform any | 187 | * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any |
188 | * necessary initialization on the objects found therein | 188 | * necessary initialization on the objects found therein |
189 | * | 189 | * |
190 | ******************************************************************************/ | 190 | ******************************************************************************/ |
@@ -196,7 +196,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
196 | acpi_status status; | 196 | acpi_status status; |
197 | struct acpi_init_walk_info info; | 197 | struct acpi_init_walk_info info; |
198 | 198 | ||
199 | ACPI_FUNCTION_TRACE("ds_initialize_objects"); | 199 | ACPI_FUNCTION_TRACE(ds_initialize_objects); |
200 | 200 | ||
201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
202 | "**** Starting initialization of namespace objects ****\n")); | 202 | "**** Starting initialization of namespace objects ****\n")); |
@@ -213,7 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, | 213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, |
214 | acpi_ds_init_one_object, &info, NULL); | 214 | acpi_ds_init_one_object, &info, NULL); |
215 | if (ACPI_FAILURE(status)) { | 215 | if (ACPI_FAILURE(status)) { |
216 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 216 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
217 | } | 217 | } |
218 | 218 | ||
219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index c475546535b6..bc9aca4e7401 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
81 | /* Invoke the global exception handler */ | 81 | /* Invoke the global exception handler */ |
82 | 82 | ||
83 | if (acpi_gbl_exception_handler) { | 83 | if (acpi_gbl_exception_handler) { |
84 | |||
84 | /* Exit the interpreter, allow handler to execute methods */ | 85 | /* Exit the interpreter, allow handler to execute methods */ |
85 | 86 | ||
86 | acpi_ex_exit_interpreter(); | 87 | acpi_ex_exit_interpreter(); |
@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
100 | } | 101 | } |
101 | #ifdef ACPI_DISASSEMBLER | 102 | #ifdef ACPI_DISASSEMBLER |
102 | if (ACPI_FAILURE(status)) { | 103 | if (ACPI_FAILURE(status)) { |
104 | |||
103 | /* Display method locals/args if disassembler is present */ | 105 | /* Display method locals/args if disassembler is present */ |
104 | 106 | ||
105 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); | 107 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); |
@@ -132,7 +134,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
132 | { | 134 | { |
133 | acpi_status status = AE_OK; | 135 | acpi_status status = AE_OK; |
134 | 136 | ||
135 | ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); | 137 | ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node); |
136 | 138 | ||
137 | if (!method_node) { | 139 | if (!method_node) { |
138 | return_ACPI_STATUS(AE_NULL_ENTRY); | 140 | return_ACPI_STATUS(AE_NULL_ENTRY); |
@@ -168,11 +170,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
168 | 170 | ||
169 | /* | 171 | /* |
170 | * Get a unit from the method semaphore. This releases the | 172 | * Get a unit from the method semaphore. This releases the |
171 | * interpreter if we block | 173 | * interpreter if we block (then reacquires it) |
172 | */ | 174 | */ |
173 | status = | 175 | status = |
174 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, | 176 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, |
175 | ACPI_WAIT_FOREVER); | 177 | ACPI_WAIT_FOREVER); |
178 | if (ACPI_FAILURE(status)) { | ||
179 | return_ACPI_STATUS(status); | ||
180 | } | ||
176 | } | 181 | } |
177 | 182 | ||
178 | /* | 183 | /* |
@@ -183,7 +188,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
183 | if (!obj_desc->method.owner_id) { | 188 | if (!obj_desc->method.owner_id) { |
184 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | 189 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); |
185 | if (ACPI_FAILURE(status)) { | 190 | if (ACPI_FAILURE(status)) { |
186 | return_ACPI_STATUS(status); | 191 | goto cleanup; |
187 | } | 192 | } |
188 | } | 193 | } |
189 | 194 | ||
@@ -193,6 +198,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
193 | */ | 198 | */ |
194 | obj_desc->method.thread_count++; | 199 | obj_desc->method.thread_count++; |
195 | return_ACPI_STATUS(status); | 200 | return_ACPI_STATUS(status); |
201 | |||
202 | cleanup: | ||
203 | /* On error, must signal the method semaphore if present */ | ||
204 | |||
205 | if (obj_desc->method.semaphore) { | ||
206 | (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); | ||
207 | } | ||
208 | return_ACPI_STATUS(status); | ||
196 | } | 209 | } |
197 | 210 | ||
198 | /******************************************************************************* | 211 | /******************************************************************************* |
@@ -218,10 +231,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
218 | struct acpi_namespace_node *method_node; | 231 | struct acpi_namespace_node *method_node; |
219 | struct acpi_walk_state *next_walk_state = NULL; | 232 | struct acpi_walk_state *next_walk_state = NULL; |
220 | union acpi_operand_object *obj_desc; | 233 | union acpi_operand_object *obj_desc; |
221 | struct acpi_parameter_info info; | 234 | struct acpi_evaluate_info *info; |
222 | u32 i; | 235 | u32 i; |
223 | 236 | ||
224 | ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); | 237 | ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state); |
225 | 238 | ||
226 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 239 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
227 | "Execute method %p, currentstate=%p\n", | 240 | "Execute method %p, currentstate=%p\n", |
@@ -240,25 +253,31 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
240 | return_ACPI_STATUS(AE_NULL_OBJECT); | 253 | return_ACPI_STATUS(AE_NULL_OBJECT); |
241 | } | 254 | } |
242 | 255 | ||
243 | /* Init for new method, wait on concurrency semaphore */ | 256 | /* Init for new method, possibly wait on concurrency semaphore */ |
244 | 257 | ||
245 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 258 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
246 | this_walk_state->method_node); | 259 | this_walk_state->method_node); |
247 | if (ACPI_FAILURE(status)) { | 260 | if (ACPI_FAILURE(status)) { |
248 | goto cleanup; | 261 | return_ACPI_STATUS(status); |
249 | } | 262 | } |
250 | 263 | ||
264 | /* | ||
265 | * 1) Parse the method. All "normal" methods are parsed for each execution. | ||
266 | * Internal methods (_OSI, etc.) do not require parsing. | ||
267 | */ | ||
251 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { | 268 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { |
252 | /* 1) Parse: Create a new walk state for the preempting walk */ | 269 | |
270 | /* Create a new walk state for the parse */ | ||
253 | 271 | ||
254 | next_walk_state = | 272 | next_walk_state = |
255 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, | 273 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, |
256 | obj_desc, NULL); | 274 | obj_desc, NULL); |
257 | if (!next_walk_state) { | 275 | if (!next_walk_state) { |
258 | return_ACPI_STATUS(AE_NO_MEMORY); | 276 | status = AE_NO_MEMORY; |
277 | goto cleanup; | ||
259 | } | 278 | } |
260 | 279 | ||
261 | /* Create and init a Root Node */ | 280 | /* Create and init a parse tree root */ |
262 | 281 | ||
263 | op = acpi_ps_create_scope_op(); | 282 | op = acpi_ps_create_scope_op(); |
264 | if (!op) { | 283 | if (!op) { |
@@ -271,17 +290,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
271 | obj_desc->method.aml_length, | 290 | obj_desc->method.aml_length, |
272 | NULL, 1); | 291 | NULL, 1); |
273 | if (ACPI_FAILURE(status)) { | 292 | if (ACPI_FAILURE(status)) { |
274 | acpi_ds_delete_walk_state(next_walk_state); | 293 | acpi_ps_delete_parse_tree(op); |
275 | goto cleanup; | 294 | goto cleanup; |
276 | } | 295 | } |
277 | 296 | ||
278 | /* Begin AML parse */ | 297 | /* Begin AML parse (deletes next_walk_state) */ |
279 | 298 | ||
280 | status = acpi_ps_parse_aml(next_walk_state); | 299 | status = acpi_ps_parse_aml(next_walk_state); |
281 | acpi_ps_delete_parse_tree(op); | 300 | acpi_ps_delete_parse_tree(op); |
301 | if (ACPI_FAILURE(status)) { | ||
302 | goto cleanup; | ||
303 | } | ||
282 | } | 304 | } |
283 | 305 | ||
284 | /* 2) Execute: Create a new state for the preempting walk */ | 306 | /* 2) Begin method execution. Create a new walk state */ |
285 | 307 | ||
286 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, | 308 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, |
287 | NULL, obj_desc, thread); | 309 | NULL, obj_desc, thread); |
@@ -289,6 +311,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
289 | status = AE_NO_MEMORY; | 311 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 312 | goto cleanup; |
291 | } | 313 | } |
314 | |||
292 | /* | 315 | /* |
293 | * The resolved arguments were put on the previous walk state's operand | 316 | * The resolved arguments were put on the previous walk state's operand |
294 | * stack. Operands on the previous walk state stack always | 317 | * stack. Operands on the previous walk state stack always |
@@ -296,12 +319,24 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
296 | */ | 319 | */ |
297 | this_walk_state->operands[this_walk_state->num_operands] = NULL; | 320 | this_walk_state->operands[this_walk_state->num_operands] = NULL; |
298 | 321 | ||
299 | info.parameters = &this_walk_state->operands[0]; | 322 | /* |
300 | info.parameter_type = ACPI_PARAM_ARGS; | 323 | * Allocate and initialize the evaluation information block |
324 | * TBD: this is somewhat inefficient, should change interface to | ||
325 | * ds_init_aml_walk. For now, keeps this struct off the CPU stack | ||
326 | */ | ||
327 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
328 | if (!info) { | ||
329 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
330 | } | ||
331 | |||
332 | info->parameters = &this_walk_state->operands[0]; | ||
333 | info->parameter_type = ACPI_PARAM_ARGS; | ||
301 | 334 | ||
302 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, | 335 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, |
303 | obj_desc->method.aml_start, | 336 | obj_desc->method.aml_start, |
304 | obj_desc->method.aml_length, &info, 3); | 337 | obj_desc->method.aml_length, info, 3); |
338 | |||
339 | ACPI_FREE(info); | ||
305 | if (ACPI_FAILURE(status)) { | 340 | if (ACPI_FAILURE(status)) { |
306 | goto cleanup; | 341 | goto cleanup; |
307 | } | 342 | } |
@@ -323,6 +358,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
323 | "Starting nested execution, newstate=%p\n", | 358 | "Starting nested execution, newstate=%p\n", |
324 | next_walk_state)); | 359 | next_walk_state)); |
325 | 360 | ||
361 | /* Invoke an internal method if necessary */ | ||
362 | |||
326 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 363 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
327 | status = obj_desc->method.implementation(next_walk_state); | 364 | status = obj_desc->method.implementation(next_walk_state); |
328 | } | 365 | } |
@@ -330,16 +367,14 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
330 | return_ACPI_STATUS(status); | 367 | return_ACPI_STATUS(status); |
331 | 368 | ||
332 | cleanup: | 369 | cleanup: |
333 | /* Decrement the thread count on the method parse tree */ | ||
334 | 370 | ||
335 | if (next_walk_state && (next_walk_state->method_desc)) { | 371 | /* On error, we must terminate the method properly */ |
336 | next_walk_state->method_desc->method.thread_count--; | ||
337 | } | ||
338 | 372 | ||
339 | /* On error, we must delete the new walk state */ | 373 | acpi_ds_terminate_control_method(obj_desc, next_walk_state); |
374 | if (next_walk_state) { | ||
375 | acpi_ds_delete_walk_state(next_walk_state); | ||
376 | } | ||
340 | 377 | ||
341 | acpi_ds_terminate_control_method(next_walk_state); | ||
342 | acpi_ds_delete_walk_state(next_walk_state); | ||
343 | return_ACPI_STATUS(status); | 378 | return_ACPI_STATUS(status); |
344 | } | 379 | } |
345 | 380 | ||
@@ -362,25 +397,33 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
362 | union acpi_operand_object *return_desc) | 397 | union acpi_operand_object *return_desc) |
363 | { | 398 | { |
364 | acpi_status status; | 399 | acpi_status status; |
400 | int same_as_implicit_return; | ||
365 | 401 | ||
366 | ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_restart_control_method, walk_state); |
367 | 403 | ||
368 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 404 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
369 | "****Restart [%4.4s] Op %p return_value_from_callee %p\n", | 405 | "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", |
370 | (char *)&walk_state->method_node->name, | 406 | (char *)&walk_state->method_node->name, |
371 | walk_state->method_call_op, return_desc)); | 407 | walk_state->method_call_op, return_desc)); |
372 | 408 | ||
373 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 409 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
374 | " return_from_this_method_used?=%X res_stack %p Walk %p\n", | 410 | " ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n", |
375 | walk_state->return_used, | 411 | walk_state->return_used, |
376 | walk_state->results, walk_state)); | 412 | walk_state->results, walk_state)); |
377 | 413 | ||
378 | /* Did the called method return a value? */ | 414 | /* Did the called method return a value? */ |
379 | 415 | ||
380 | if (return_desc) { | 416 | if (return_desc) { |
417 | |||
418 | /* Is the implicit return object the same as the return desc? */ | ||
419 | |||
420 | same_as_implicit_return = | ||
421 | (walk_state->implicit_return_obj == return_desc); | ||
422 | |||
381 | /* Are we actually going to use the return value? */ | 423 | /* Are we actually going to use the return value? */ |
382 | 424 | ||
383 | if (walk_state->return_used) { | 425 | if (walk_state->return_used) { |
426 | |||
384 | /* Save the return value from the previous method */ | 427 | /* Save the return value from the previous method */ |
385 | 428 | ||
386 | status = acpi_ds_result_push(return_desc, walk_state); | 429 | status = acpi_ds_result_push(return_desc, walk_state); |
@@ -397,18 +440,23 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
397 | } | 440 | } |
398 | 441 | ||
399 | /* | 442 | /* |
400 | * The following code is the | 443 | * The following code is the optional support for the so-called |
401 | * optional support for a so-called "implicit return". Some AML code | 444 | * "implicit return". Some AML code assumes that the last value of the |
402 | * assumes that the last value of the method is "implicitly" returned | 445 | * method is "implicitly" returned to the caller, in the absence of an |
403 | * to the caller. Just save the last result as the return value. | 446 | * explicit return value. |
447 | * | ||
448 | * Just save the last result of the method as the return value. | ||
449 | * | ||
404 | * NOTE: this is optional because the ASL language does not actually | 450 | * NOTE: this is optional because the ASL language does not actually |
405 | * support this behavior. | 451 | * support this behavior. |
406 | */ | 452 | */ |
407 | else if (!acpi_ds_do_implicit_return | 453 | else if (!acpi_ds_do_implicit_return |
408 | (return_desc, walk_state, FALSE)) { | 454 | (return_desc, walk_state, FALSE) |
455 | || same_as_implicit_return) { | ||
409 | /* | 456 | /* |
410 | * Delete the return value if it will not be used by the | 457 | * Delete the return value if it will not be used by the |
411 | * calling method | 458 | * calling method or remove one reference if the explicit return |
459 | * is the same as the implicit return value. | ||
412 | */ | 460 | */ |
413 | acpi_ut_remove_reference(return_desc); | 461 | acpi_ut_remove_reference(return_desc); |
414 | } | 462 | } |
@@ -421,7 +469,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
421 | * | 469 | * |
422 | * FUNCTION: acpi_ds_terminate_control_method | 470 | * FUNCTION: acpi_ds_terminate_control_method |
423 | * | 471 | * |
424 | * PARAMETERS: walk_state - State of the method | 472 | * PARAMETERS: method_desc - Method object |
473 | * walk_state - State associated with the method | ||
425 | * | 474 | * |
426 | * RETURN: None | 475 | * RETURN: None |
427 | * | 476 | * |
@@ -431,95 +480,100 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
431 | * | 480 | * |
432 | ******************************************************************************/ | 481 | ******************************************************************************/ |
433 | 482 | ||
434 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 483 | void |
484 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
485 | struct acpi_walk_state *walk_state) | ||
435 | { | 486 | { |
436 | union acpi_operand_object *obj_desc; | ||
437 | struct acpi_namespace_node *method_node; | 487 | struct acpi_namespace_node *method_node; |
438 | acpi_status status; | 488 | acpi_status status; |
439 | 489 | ||
440 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 490 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); |
441 | 491 | ||
442 | if (!walk_state) { | 492 | /* method_desc is required, walk_state is optional */ |
443 | return_VOID; | ||
444 | } | ||
445 | 493 | ||
446 | /* The current method object was saved in the walk state */ | 494 | if (!method_desc) { |
447 | |||
448 | obj_desc = walk_state->method_desc; | ||
449 | if (!obj_desc) { | ||
450 | return_VOID; | 495 | return_VOID; |
451 | } | 496 | } |
452 | 497 | ||
453 | /* Delete all arguments and locals */ | 498 | if (walk_state) { |
454 | 499 | ||
455 | acpi_ds_method_data_delete_all(walk_state); | 500 | /* Delete all arguments and locals */ |
501 | |||
502 | acpi_ds_method_data_delete_all(walk_state); | ||
503 | } | ||
456 | 504 | ||
457 | /* | 505 | /* |
458 | * Lock the parser while we terminate this method. | 506 | * Lock the parser while we terminate this method. |
459 | * If this is the last thread executing the method, | 507 | * If this is the last thread executing the method, |
460 | * we have additional cleanup to perform | 508 | * we have additional cleanup to perform |
461 | */ | 509 | */ |
462 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 510 | status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); |
463 | if (ACPI_FAILURE(status)) { | 511 | if (ACPI_FAILURE(status)) { |
464 | return_VOID; | 512 | return_VOID; |
465 | } | 513 | } |
466 | 514 | ||
467 | /* Signal completion of the execution of this method if necessary */ | 515 | /* Signal completion of the execution of this method if necessary */ |
468 | 516 | ||
469 | if (walk_state->method_desc->method.semaphore) { | 517 | if (method_desc->method.semaphore) { |
470 | status = | 518 | status = |
471 | acpi_os_signal_semaphore(walk_state->method_desc->method. | 519 | acpi_os_signal_semaphore(method_desc->method.semaphore, 1); |
472 | semaphore, 1); | ||
473 | if (ACPI_FAILURE(status)) { | 520 | if (ACPI_FAILURE(status)) { |
474 | ACPI_ERROR((AE_INFO, | ||
475 | "Could not signal method semaphore")); | ||
476 | 521 | ||
477 | /* Ignore error and continue cleanup */ | 522 | /* Ignore error and continue */ |
523 | |||
524 | ACPI_EXCEPTION((AE_INFO, status, | ||
525 | "Could not signal method semaphore")); | ||
478 | } | 526 | } |
479 | } | 527 | } |
480 | 528 | ||
481 | /* | 529 | if (walk_state) { |
482 | * There are no more threads executing this method. Perform | 530 | /* |
483 | * additional cleanup. | 531 | * Delete any objects created by this method during execution. |
484 | * | 532 | * The method Node is stored in the walk state |
485 | * The method Node is stored in the walk state | 533 | */ |
486 | */ | 534 | method_node = walk_state->method_node; |
487 | method_node = walk_state->method_node; | ||
488 | 535 | ||
489 | /* Lock namespace for possible update */ | 536 | /* Lock namespace for possible update */ |
490 | 537 | ||
491 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 538 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
492 | if (ACPI_FAILURE(status)) { | 539 | if (ACPI_FAILURE(status)) { |
493 | goto exit; | 540 | goto exit; |
494 | } | 541 | } |
495 | 542 | ||
496 | /* | 543 | /* |
497 | * Delete any namespace entries created immediately underneath | 544 | * Delete any namespace entries created immediately underneath |
498 | * the method | 545 | * the method |
499 | */ | 546 | */ |
500 | if (method_node->child) { | 547 | if (method_node && method_node->child) { |
501 | acpi_ns_delete_namespace_subtree(method_node); | 548 | acpi_ns_delete_namespace_subtree(method_node); |
549 | } | ||
550 | |||
551 | /* | ||
552 | * Delete any namespace entries created anywhere else within | ||
553 | * the namespace by the execution of this method | ||
554 | */ | ||
555 | acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); | ||
556 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
502 | } | 557 | } |
503 | 558 | ||
504 | /* | 559 | /* Decrement the thread count on the method */ |
505 | * Delete any namespace entries created anywhere else within | 560 | |
506 | * the namespace by the execution of this method | 561 | if (method_desc->method.thread_count) { |
507 | */ | 562 | method_desc->method.thread_count--; |
508 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. | 563 | } else { |
509 | owner_id); | 564 | ACPI_ERROR((AE_INFO, "Invalid zero thread count in method")); |
510 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 565 | } |
511 | 566 | ||
512 | /* Are there any other threads currently executing this method? */ | 567 | /* Are there any other threads currently executing this method? */ |
513 | 568 | ||
514 | if (walk_state->method_desc->method.thread_count) { | 569 | if (method_desc->method.thread_count) { |
515 | /* | 570 | /* |
516 | * Additional threads. Do not release the owner_id in this case, | 571 | * Additional threads. Do not release the owner_id in this case, |
517 | * we immediately reuse it for the next thread executing this method | 572 | * we immediately reuse it for the next thread executing this method |
518 | */ | 573 | */ |
519 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 574 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
520 | "*** Completed execution of one thread, %d threads remaining\n", | 575 | "*** Completed execution of one thread, %d threads remaining\n", |
521 | walk_state->method_desc->method. | 576 | method_desc->method.thread_count)); |
522 | thread_count)); | ||
523 | } else { | 577 | } else { |
524 | /* This is the only executing thread for this method */ | 578 | /* This is the only executing thread for this method */ |
525 | 579 | ||
@@ -533,22 +587,20 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
533 | * This code is here because we must wait until the last thread exits | 587 | * This code is here because we must wait until the last thread exits |
534 | * before creating the synchronization semaphore. | 588 | * before creating the synchronization semaphore. |
535 | */ | 589 | */ |
536 | if ((walk_state->method_desc->method.concurrency == 1) && | 590 | if ((method_desc->method.concurrency == 1) && |
537 | (!walk_state->method_desc->method.semaphore)) { | 591 | (!method_desc->method.semaphore)) { |
538 | status = acpi_os_create_semaphore(1, 1, | 592 | status = acpi_os_create_semaphore(1, 1, |
539 | &walk_state-> | 593 | &method_desc->method. |
540 | method_desc->method. | ||
541 | semaphore); | 594 | semaphore); |
542 | } | 595 | } |
543 | 596 | ||
544 | /* No more threads, we can free the owner_id */ | 597 | /* No more threads, we can free the owner_id */ |
545 | 598 | ||
546 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | 599 | acpi_ut_release_owner_id(&method_desc->method.owner_id); |
547 | owner_id); | ||
548 | } | 600 | } |
549 | 601 | ||
550 | exit: | 602 | exit: |
551 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); | 603 | (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); |
552 | return_VOID; | 604 | return_VOID; |
553 | } | 605 | } |
554 | 606 | ||
@@ -581,7 +633,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
581 | union acpi_parse_object *op; | 633 | union acpi_parse_object *op; |
582 | struct acpi_walk_state *walk_state; | 634 | struct acpi_walk_state *walk_state; |
583 | 635 | ||
584 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | 636 | ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); |
585 | 637 | ||
586 | /* Parameter Validation */ | 638 | /* Parameter Validation */ |
587 | 639 | ||
@@ -590,7 +642,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
590 | } | 642 | } |
591 | 643 | ||
592 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 644 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
593 | "**** Parsing [%4.4s] **** named_obj=%p\n", | 645 | "**** Parsing [%4.4s] **** NamedObj=%p\n", |
594 | acpi_ut_get_node_name(node), node)); | 646 | acpi_ut_get_node_name(node), node)); |
595 | 647 | ||
596 | /* Extract the method object from the method Node */ | 648 | /* Extract the method object from the method Node */ |
@@ -669,7 +721,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
669 | } | 721 | } |
670 | 722 | ||
671 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 723 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
672 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 724 | "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", |
673 | acpi_ut_get_node_name(node), node, op)); | 725 | acpi_ut_get_node_name(node), node, op)); |
674 | 726 | ||
675 | /* | 727 | /* |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index c025674f938b..459160ff9058 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -81,7 +81,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
81 | * special data types. | 81 | * special data types. |
82 | * | 82 | * |
83 | * NOTES: walk_state fields are initialized to zero by the | 83 | * NOTES: walk_state fields are initialized to zero by the |
84 | * ACPI_MEM_CALLOCATE(). | 84 | * ACPI_ALLOCATE_ZEROED(). |
85 | * | 85 | * |
86 | * A pseudo-Namespace Node is assigned to each argument and local | 86 | * A pseudo-Namespace Node is assigned to each argument and local |
87 | * so that ref_of() can return a pointer to the Node. | 87 | * so that ref_of() can return a pointer to the Node. |
@@ -92,7 +92,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
92 | { | 92 | { |
93 | u32 i; | 93 | u32 i; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE("ds_method_data_init"); | 95 | ACPI_FUNCTION_TRACE(ds_method_data_init); |
96 | 96 | ||
97 | /* Init the method arguments */ | 97 | /* Init the method arguments */ |
98 | 98 | ||
@@ -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; |
@@ -140,7 +140,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) | |||
140 | { | 140 | { |
141 | u32 index; | 141 | u32 index; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE("ds_method_data_delete_all"); | 143 | ACPI_FUNCTION_TRACE(ds_method_data_delete_all); |
144 | 144 | ||
145 | /* Detach the locals */ | 145 | /* Detach the locals */ |
146 | 146 | ||
@@ -199,7 +199,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
199 | acpi_status status; | 199 | acpi_status status; |
200 | u32 index = 0; | 200 | u32 index = 0; |
201 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params); | 202 | ACPI_FUNCTION_TRACE_PTR(ds_method_data_init_args, params); |
203 | 203 | ||
204 | if (!params) { | 204 | if (!params) { |
205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -251,7 +251,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
251 | struct acpi_walk_state *walk_state, | 251 | struct acpi_walk_state *walk_state, |
252 | struct acpi_namespace_node **node) | 252 | struct acpi_namespace_node **node) |
253 | { | 253 | { |
254 | ACPI_FUNCTION_TRACE("ds_method_data_get_node"); | 254 | ACPI_FUNCTION_TRACE(ds_method_data_get_node); |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * Method Locals and Arguments are supported | 257 | * Method Locals and Arguments are supported |
@@ -318,10 +318,10 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
318 | acpi_status status; | 318 | acpi_status status; |
319 | struct acpi_namespace_node *node; | 319 | struct acpi_namespace_node *node; |
320 | 320 | ||
321 | ACPI_FUNCTION_TRACE("ds_method_data_set_value"); | 321 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); |
322 | 322 | ||
323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
324 | "new_obj %p Opcode %X, Refs=%d [%s]\n", object, | 324 | "NewObj %p Opcode %X, Refs=%d [%s]\n", object, |
325 | opcode, object->common.reference_count, | 325 | opcode, object->common.reference_count, |
326 | acpi_ut_get_type_name(object->common.type))); | 326 | acpi_ut_get_type_name(object->common.type))); |
327 | 327 | ||
@@ -336,7 +336,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
336 | * Increment ref count so object can't be deleted while installed. | 336 | * Increment ref count so object can't be deleted while installed. |
337 | * NOTE: We do not copy the object in order to preserve the call by | 337 | * NOTE: We do not copy the object in order to preserve the call by |
338 | * reference semantics of ACPI Control Method invocation. | 338 | * reference semantics of ACPI Control Method invocation. |
339 | * (See ACPI specification 2.0_c) | 339 | * (See ACPI Specification 2.0_c) |
340 | */ | 340 | */ |
341 | acpi_ut_add_reference(object); | 341 | acpi_ut_add_reference(object); |
342 | 342 | ||
@@ -351,7 +351,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
351 | * FUNCTION: acpi_ds_method_data_get_value | 351 | * FUNCTION: acpi_ds_method_data_get_value |
352 | * | 352 | * |
353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
354 | * Index - which local_var or argument to get | 354 | * Index - Which local_var or argument to get |
355 | * walk_state - Current walk state object | 355 | * walk_state - Current walk state object |
356 | * dest_desc - Where Arg or Local value is returned | 356 | * dest_desc - Where Arg or Local value is returned |
357 | * | 357 | * |
@@ -372,7 +372,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
372 | struct acpi_namespace_node *node; | 372 | struct acpi_namespace_node *node; |
373 | union acpi_operand_object *object; | 373 | union acpi_operand_object *object; |
374 | 374 | ||
375 | ACPI_FUNCTION_TRACE("ds_method_data_get_value"); | 375 | ACPI_FUNCTION_TRACE(ds_method_data_get_value); |
376 | 376 | ||
377 | /* Validate the object descriptor */ | 377 | /* Validate the object descriptor */ |
378 | 378 | ||
@@ -459,7 +459,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
459 | * FUNCTION: acpi_ds_method_data_delete_value | 459 | * FUNCTION: acpi_ds_method_data_delete_value |
460 | * | 460 | * |
461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
462 | * Index - which local_var or argument to delete | 462 | * Index - Which local_var or argument to delete |
463 | * walk_state - Current walk state object | 463 | * walk_state - Current walk state object |
464 | * | 464 | * |
465 | * RETURN: None | 465 | * RETURN: None |
@@ -477,7 +477,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
477 | struct acpi_namespace_node *node; | 477 | struct acpi_namespace_node *node; |
478 | union acpi_operand_object *object; | 478 | union acpi_operand_object *object; |
479 | 479 | ||
480 | ACPI_FUNCTION_TRACE("ds_method_data_delete_value"); | 480 | ACPI_FUNCTION_TRACE(ds_method_data_delete_value); |
481 | 481 | ||
482 | /* Get the namespace node for the arg/local */ | 482 | /* Get the namespace node for the arg/local */ |
483 | 483 | ||
@@ -538,7 +538,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
538 | union acpi_operand_object *current_obj_desc; | 538 | union acpi_operand_object *current_obj_desc; |
539 | union acpi_operand_object *new_obj_desc; | 539 | union acpi_operand_object *new_obj_desc; |
540 | 540 | ||
541 | ACPI_FUNCTION_TRACE("ds_store_object_to_local"); | 541 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); |
542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", | 542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", |
543 | opcode, index, obj_desc)); | 543 | opcode, index, obj_desc)); |
544 | 544 | ||
@@ -614,7 +614,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
614 | && (current_obj_desc->reference.opcode == | 614 | && (current_obj_desc->reference.opcode == |
615 | AML_REF_OF_OP)) { | 615 | AML_REF_OF_OP)) { |
616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
617 | "Arg (%p) is an obj_ref(Node), storing in node %p\n", | 617 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", |
618 | new_obj_desc, | 618 | new_obj_desc, |
619 | current_obj_desc)); | 619 | current_obj_desc)); |
620 | 620 | ||
@@ -688,7 +688,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
688 | struct acpi_namespace_node *node; | 688 | struct acpi_namespace_node *node; |
689 | union acpi_operand_object *object; | 689 | union acpi_operand_object *object; |
690 | 690 | ||
691 | ACPI_FUNCTION_TRACE("ds_method_data_get_type"); | 691 | ACPI_FUNCTION_TRACE(ds_method_data_get_type); |
692 | 692 | ||
693 | /* Get the namespace node for the arg/local */ | 693 | /* Get the namespace node for the arg/local */ |
694 | 694 | ||
@@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
701 | 701 | ||
702 | object = acpi_ns_get_attached_object(node); | 702 | object = acpi_ns_get_attached_object(node); |
703 | if (!object) { | 703 | if (!object) { |
704 | |||
704 | /* Uninitialized local/arg, return TYPE_ANY */ | 705 | /* Uninitialized local/arg, return TYPE_ANY */ |
705 | 706 | ||
706 | return_VALUE(ACPI_TYPE_ANY); | 707 | return_VALUE(ACPI_TYPE_ANY); |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 8b21f0f9e517..72190abb1d59 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -81,7 +81,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
81 | union acpi_operand_object *obj_desc; | 81 | union acpi_operand_object *obj_desc; |
82 | acpi_status status; | 82 | acpi_status status; |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("ds_build_internal_object"); | 84 | ACPI_FUNCTION_TRACE(ds_build_internal_object); |
85 | 85 | ||
86 | *obj_desc_ptr = NULL; | 86 | *obj_desc_ptr = NULL; |
87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
@@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
103 | common. | 103 | common. |
104 | node))); | 104 | node))); |
105 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
106 | |||
106 | /* Check if we are resolving a named reference within a package */ | 107 | /* Check if we are resolving a named reference within a package */ |
107 | 108 | ||
108 | if ((status == AE_NOT_FOUND) | 109 | if ((status == AE_NOT_FOUND) |
@@ -186,7 +187,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
186 | union acpi_parse_object *byte_list; | 187 | union acpi_parse_object *byte_list; |
187 | u32 byte_list_length = 0; | 188 | u32 byte_list_length = 0; |
188 | 189 | ||
189 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); | 190 | ACPI_FUNCTION_TRACE(ds_build_internal_buffer_obj); |
190 | 191 | ||
191 | /* | 192 | /* |
192 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". | 193 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". |
@@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
195 | */ | 196 | */ |
196 | obj_desc = *obj_desc_ptr; | 197 | obj_desc = *obj_desc_ptr; |
197 | if (!obj_desc) { | 198 | if (!obj_desc) { |
199 | |||
198 | /* Create a new buffer object */ | 200 | /* Create a new buffer object */ |
199 | 201 | ||
200 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 202 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
@@ -243,7 +245,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
243 | "Buffer defined with zero length in AML, creating\n")); | 245 | "Buffer defined with zero length in AML, creating\n")); |
244 | } else { | 246 | } else { |
245 | obj_desc->buffer.pointer = | 247 | obj_desc->buffer.pointer = |
246 | ACPI_MEM_CALLOCATE(obj_desc->buffer.length); | 248 | ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length); |
247 | if (!obj_desc->buffer.pointer) { | 249 | if (!obj_desc->buffer.pointer) { |
248 | acpi_ut_delete_object_desc(obj_desc); | 250 | acpi_ut_delete_object_desc(obj_desc); |
249 | return_ACPI_STATUS(AE_NO_MEMORY); | 251 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -291,7 +293,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
291 | acpi_status status = AE_OK; | 293 | acpi_status status = AE_OK; |
292 | acpi_native_uint i; | 294 | acpi_native_uint i; |
293 | 295 | ||
294 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); | 296 | ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); |
295 | 297 | ||
296 | /* Find the parent of a possibly nested package */ | 298 | /* Find the parent of a possibly nested package */ |
297 | 299 | ||
@@ -339,9 +341,10 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
339 | * individual objects). Add an extra pointer slot so | 341 | * individual objects). Add an extra pointer slot so |
340 | * that the list is always null terminated. | 342 | * that the list is always null terminated. |
341 | */ | 343 | */ |
342 | obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> | 344 | obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
343 | package.count + | 345 | obj_desc->package. |
344 | 1) * sizeof(void *)); | 346 | count + |
347 | 1) * sizeof(void *)); | ||
345 | 348 | ||
346 | if (!obj_desc->package.elements) { | 349 | if (!obj_desc->package.elements) { |
347 | acpi_ut_delete_object_desc(obj_desc); | 350 | acpi_ut_delete_object_desc(obj_desc); |
@@ -355,6 +358,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
355 | arg = arg->common.next; | 358 | arg = arg->common.next; |
356 | for (i = 0; arg; i++) { | 359 | for (i = 0; arg; i++) { |
357 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 360 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
361 | |||
358 | /* Object (package or buffer) is already built */ | 362 | /* Object (package or buffer) is already built */ |
359 | 363 | ||
360 | obj_desc->package.elements[i] = | 364 | obj_desc->package.elements[i] = |
@@ -396,7 +400,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
396 | acpi_status status; | 400 | acpi_status status; |
397 | union acpi_operand_object *obj_desc; | 401 | union acpi_operand_object *obj_desc; |
398 | 402 | ||
399 | ACPI_FUNCTION_TRACE_PTR("ds_create_node", op); | 403 | ACPI_FUNCTION_TRACE_PTR(ds_create_node, op); |
400 | 404 | ||
401 | /* | 405 | /* |
402 | * Because of the execution pass through the non-control-method | 406 | * Because of the execution pass through the non-control-method |
@@ -408,6 +412,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
408 | } | 412 | } |
409 | 413 | ||
410 | if (!op->common.value.arg) { | 414 | if (!op->common.value.arg) { |
415 | |||
411 | /* No arguments, there is nothing to do */ | 416 | /* No arguments, there is nothing to do */ |
412 | 417 | ||
413 | return_ACPI_STATUS(AE_OK); | 418 | return_ACPI_STATUS(AE_OK); |
@@ -464,11 +469,12 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
464 | union acpi_operand_object *obj_desc; | 469 | union acpi_operand_object *obj_desc; |
465 | acpi_status status = AE_OK; | 470 | acpi_status status = AE_OK; |
466 | 471 | ||
467 | ACPI_FUNCTION_TRACE("ds_init_object_from_op"); | 472 | ACPI_FUNCTION_TRACE(ds_init_object_from_op); |
468 | 473 | ||
469 | obj_desc = *ret_obj_desc; | 474 | obj_desc = *ret_obj_desc; |
470 | op_info = acpi_ps_get_opcode_info(opcode); | 475 | op_info = acpi_ps_get_opcode_info(opcode); |
471 | if (op_info->class == AML_CLASS_UNKNOWN) { | 476 | if (op_info->class == AML_CLASS_UNKNOWN) { |
477 | |||
472 | /* Unknown opcode */ | 478 | /* Unknown opcode */ |
473 | 479 | ||
474 | return_ACPI_STATUS(AE_TYPE); | 480 | return_ACPI_STATUS(AE_TYPE); |
@@ -626,6 +632,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
626 | default: /* Other literals, etc.. */ | 632 | default: /* Other literals, etc.. */ |
627 | 633 | ||
628 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 634 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
635 | |||
629 | /* Node was saved in Op */ | 636 | /* Node was saved in Op */ |
630 | 637 | ||
631 | obj_desc->reference.node = op->common.node; | 638 | obj_desc->reference.node = op->common.node; |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 6229c10674e1..5b974a8fe614 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node, | |||
91 | union acpi_parse_object *op; | 91 | union acpi_parse_object *op; |
92 | struct acpi_walk_state *walk_state; | 92 | struct acpi_walk_state *walk_state; |
93 | 93 | ||
94 | ACPI_FUNCTION_TRACE("ds_execute_arguments"); | 94 | ACPI_FUNCTION_TRACE(ds_execute_arguments); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Allocate a new parser op to be the root of the parsed tree | 97 | * Allocate a new parser op to be the root of the parsed tree |
@@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
193 | struct acpi_namespace_node *node; | 193 | struct acpi_namespace_node *node; |
194 | acpi_status status; | 194 | acpi_status status; |
195 | 195 | ||
196 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); |
197 | 197 | ||
198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
199 | return_ACPI_STATUS(AE_OK); | 199 | return_ACPI_STATUS(AE_OK); |
@@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
206 | 206 | ||
207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); | 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); |
209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", | 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", |
210 | acpi_ut_get_node_name(node))); | 210 | acpi_ut_get_node_name(node))); |
211 | 211 | ||
212 | /* Execute the AML code for the term_arg arguments */ | 212 | /* Execute the AML code for the term_arg arguments */ |
@@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) | |||
235 | struct acpi_namespace_node *node; | 235 | struct acpi_namespace_node *node; |
236 | acpi_status status; | 236 | acpi_status status; |
237 | 237 | ||
238 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); | 238 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); |
239 | 239 | ||
240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
241 | return_ACPI_STATUS(AE_OK); | 241 | return_ACPI_STATUS(AE_OK); |
@@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) | |||
279 | struct acpi_namespace_node *node; | 279 | struct acpi_namespace_node *node; |
280 | acpi_status status; | 280 | acpi_status status; |
281 | 281 | ||
282 | ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); | 282 | ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); |
283 | 283 | ||
284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
285 | return_ACPI_STATUS(AE_OK); | 285 | return_ACPI_STATUS(AE_OK); |
@@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
324 | acpi_status status; | 324 | acpi_status status; |
325 | union acpi_operand_object *extra_desc; | 325 | union acpi_operand_object *extra_desc; |
326 | 326 | ||
327 | ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); | 327 | ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); |
328 | 328 | ||
329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
330 | return_ACPI_STATUS(AE_OK); | 330 | return_ACPI_STATUS(AE_OK); |
@@ -342,8 +342,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
343 | (ACPI_TYPE_REGION, node, NULL)); | 343 | (ACPI_TYPE_REGION, node, NULL)); |
344 | 344 | ||
345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", |
346 | "[%4.4s] op_region Arg Init at AML %p\n", | ||
347 | acpi_ut_get_node_name(node), | 346 | acpi_ut_get_node_name(node), |
348 | extra_desc->extra.aml_start)); | 347 | extra_desc->extra.aml_start)); |
349 | 348 | ||
@@ -352,6 +351,28 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
352 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 351 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), |
353 | extra_desc->extra.aml_length, | 352 | extra_desc->extra.aml_length, |
354 | extra_desc->extra.aml_start); | 353 | extra_desc->extra.aml_start); |
354 | if (ACPI_FAILURE(status)) { | ||
355 | return_ACPI_STATUS(status); | ||
356 | } | ||
357 | |||
358 | /* Validate the region address/length via the host OS */ | ||
359 | |||
360 | status = acpi_os_validate_address(obj_desc->region.space_id, | ||
361 | obj_desc->region.address, | ||
362 | (acpi_size) obj_desc->region.length); | ||
363 | if (ACPI_FAILURE(status)) { | ||
364 | /* | ||
365 | * Invalid address/length. We will emit an error message and mark | ||
366 | * the region as invalid, so that it will cause an additional error if | ||
367 | * it is ever used. Then return AE_OK. | ||
368 | */ | ||
369 | ACPI_EXCEPTION((AE_INFO, status, | ||
370 | "During address validation of OpRegion [%4.4s]", | ||
371 | node->name.ascii)); | ||
372 | obj_desc->common.flags |= AOPOBJ_INVALID; | ||
373 | status = AE_OK; | ||
374 | } | ||
375 | |||
355 | return_ACPI_STATUS(status); | 376 | return_ACPI_STATUS(status); |
356 | } | 377 | } |
357 | 378 | ||
@@ -411,7 +432,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
411 | u8 field_flags; | 432 | u8 field_flags; |
412 | acpi_status status; | 433 | acpi_status status; |
413 | 434 | ||
414 | ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); | 435 | ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc); |
415 | 436 | ||
416 | /* Host object must be a Buffer */ | 437 | /* Host object must be a Buffer */ |
417 | 438 | ||
@@ -457,7 +478,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
457 | 478 | ||
458 | if (bit_count == 0) { | 479 | if (bit_count == 0) { |
459 | ACPI_ERROR((AE_INFO, | 480 | ACPI_ERROR((AE_INFO, |
460 | "Attempt to create_field of length zero")); | 481 | "Attempt to CreateField of length zero")); |
461 | status = AE_AML_OPERAND_VALUE; | 482 | status = AE_AML_OPERAND_VALUE; |
462 | goto cleanup; | 483 | goto cleanup; |
463 | } | 484 | } |
@@ -595,7 +616,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
595 | struct acpi_namespace_node *node; | 616 | struct acpi_namespace_node *node; |
596 | union acpi_parse_object *next_op; | 617 | union acpi_parse_object *next_op; |
597 | 618 | ||
598 | ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); | 619 | ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op); |
599 | 620 | ||
600 | /* | 621 | /* |
601 | * This is where we evaluate the address and length fields of the | 622 | * This is where we evaluate the address and length fields of the |
@@ -627,7 +648,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
627 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 648 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
628 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 649 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
629 | walk_state->num_operands, | 650 | walk_state->num_operands, |
630 | "after acpi_ex_resolve_operands"); | 651 | "after AcpiExResolveOperands"); |
631 | 652 | ||
632 | if (ACPI_FAILURE(status)) { | 653 | if (ACPI_FAILURE(status)) { |
633 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", | 654 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", |
@@ -640,6 +661,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
640 | /* Initialize the Buffer Field */ | 661 | /* Initialize the Buffer Field */ |
641 | 662 | ||
642 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 663 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
664 | |||
643 | /* NOTE: Slightly different operands for this opcode */ | 665 | /* NOTE: Slightly different operands for this opcode */ |
644 | 666 | ||
645 | status = | 667 | status = |
@@ -685,7 +707,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
685 | struct acpi_namespace_node *node; | 707 | struct acpi_namespace_node *node; |
686 | union acpi_parse_object *next_op; | 708 | union acpi_parse_object *next_op; |
687 | 709 | ||
688 | ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); | 710 | ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op); |
689 | 711 | ||
690 | /* | 712 | /* |
691 | * This is where we evaluate the address and length fields of the | 713 | * This is where we evaluate the address and length fields of the |
@@ -718,7 +740,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
718 | 740 | ||
719 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 741 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
720 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 742 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
721 | 1, "after acpi_ex_resolve_operands"); | 743 | 1, "after AcpiExResolveOperands"); |
722 | 744 | ||
723 | obj_desc = acpi_ns_get_attached_object(node); | 745 | obj_desc = acpi_ns_get_attached_object(node); |
724 | if (!obj_desc) { | 746 | if (!obj_desc) { |
@@ -744,7 +766,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
744 | operand_desc->integer.value; | 766 | operand_desc->integer.value; |
745 | acpi_ut_remove_reference(operand_desc); | 767 | acpi_ut_remove_reference(operand_desc); |
746 | 768 | ||
747 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 769 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
748 | obj_desc, | 770 | obj_desc, |
749 | ACPI_FORMAT_UINT64(obj_desc->region.address), | 771 | ACPI_FORMAT_UINT64(obj_desc->region.address), |
750 | obj_desc->region.length)); | 772 | obj_desc->region.length)); |
@@ -780,7 +802,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
780 | union acpi_operand_object *arg_desc; | 802 | union acpi_operand_object *arg_desc; |
781 | u32 length; | 803 | u32 length; |
782 | 804 | ||
783 | ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); | 805 | ACPI_FUNCTION_TRACE(ds_eval_data_object_operands); |
784 | 806 | ||
785 | /* The first operand (for all of these data objects) is the length */ | 807 | /* The first operand (for all of these data objects) is the length */ |
786 | 808 | ||
@@ -874,7 +896,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | |||
874 | acpi_status status = AE_OK; | 896 | acpi_status status = AE_OK; |
875 | union acpi_generic_state *control_state; | 897 | union acpi_generic_state *control_state; |
876 | 898 | ||
877 | ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); | 899 | ACPI_FUNCTION_NAME(ds_exec_begin_control_op); |
878 | 900 | ||
879 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, | 901 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, |
880 | op->common.aml_opcode, walk_state)); | 902 | op->common.aml_opcode, walk_state)); |
@@ -952,7 +974,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
952 | acpi_status status = AE_OK; | 974 | acpi_status status = AE_OK; |
953 | union acpi_generic_state *control_state; | 975 | union acpi_generic_state *control_state; |
954 | 976 | ||
955 | ACPI_FUNCTION_NAME("ds_exec_end_control_op"); | 977 | ACPI_FUNCTION_NAME(ds_exec_end_control_op); |
956 | 978 | ||
957 | switch (op->common.aml_opcode) { | 979 | switch (op->common.aml_opcode) { |
958 | case AML_IF_OP: | 980 | case AML_IF_OP: |
@@ -984,6 +1006,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
984 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | 1006 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); |
985 | 1007 | ||
986 | if (walk_state->control_state->common.value) { | 1008 | if (walk_state->control_state->common.value) { |
1009 | |||
987 | /* Predicate was true, go back and evaluate it again! */ | 1010 | /* Predicate was true, go back and evaluate it again! */ |
988 | 1011 | ||
989 | status = AE_CTRL_PENDING; | 1012 | status = AE_CTRL_PENDING; |
@@ -1014,6 +1037,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1014 | * has been bubbled up the tree | 1037 | * has been bubbled up the tree |
1015 | */ | 1038 | */ |
1016 | if (op->common.value.arg) { | 1039 | if (op->common.value.arg) { |
1040 | |||
1017 | /* Since we have a real Return(), delete any implicit return */ | 1041 | /* Since we have a real Return(), delete any implicit return */ |
1018 | 1042 | ||
1019 | acpi_ds_clear_implicit_return(walk_state); | 1043 | acpi_ds_clear_implicit_return(walk_state); |
@@ -1047,6 +1071,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1047 | walk_state->return_desc = walk_state->operands[0]; | 1071 | walk_state->return_desc = walk_state->operands[0]; |
1048 | } else if ((walk_state->results) && | 1072 | } else if ((walk_state->results) && |
1049 | (walk_state->results->results.num_results > 0)) { | 1073 | (walk_state->results->results.num_results > 0)) { |
1074 | |||
1050 | /* Since we have a real Return(), delete any implicit return */ | 1075 | /* Since we have a real Return(), delete any implicit return */ |
1051 | 1076 | ||
1052 | acpi_ds_clear_implicit_return(walk_state); | 1077 | acpi_ds_clear_implicit_return(walk_state); |
@@ -1095,7 +1120,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1095 | } | 1120 | } |
1096 | 1121 | ||
1097 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1122 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1098 | "Completed RETURN_OP State=%p, ret_val=%p\n", | 1123 | "Completed RETURN_OP State=%p, RetVal=%p\n", |
1099 | walk_state, walk_state->return_desc)); | 1124 | walk_state, walk_state->return_desc)); |
1100 | 1125 | ||
1101 | /* End the control method execution right now */ | 1126 | /* End the control method execution right now */ |
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 53356a591ac1..05230baf5de8 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("dsutils") | |||
68 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) | 69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) |
70 | { | 70 | { |
71 | ACPI_FUNCTION_NAME("ds_clear_implicit_return"); | 71 | ACPI_FUNCTION_NAME(ds_clear_implicit_return); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Slack must be enabled for this feature | 74 | * Slack must be enabled for this feature |
@@ -115,7 +115,7 @@ u8 | |||
115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, | 115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, |
116 | struct acpi_walk_state *walk_state, u8 add_reference) | 116 | struct acpi_walk_state *walk_state, u8 add_reference) |
117 | { | 117 | { |
118 | ACPI_FUNCTION_NAME("ds_do_implicit_return"); | 118 | ACPI_FUNCTION_NAME(ds_do_implicit_return); |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * Slack must be enabled for this feature, and we must | 121 | * Slack must be enabled for this feature, and we must |
@@ -171,7 +171,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
171 | { | 171 | { |
172 | const struct acpi_opcode_info *parent_info; | 172 | const struct acpi_opcode_info *parent_info; |
173 | 173 | ||
174 | ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op); | 174 | ACPI_FUNCTION_TRACE_PTR(ds_is_result_used, op); |
175 | 175 | ||
176 | /* Must have both an Op and a Result Object */ | 176 | /* Must have both an Op and a Result Object */ |
177 | 177 | ||
@@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
202 | */ | 202 | */ |
203 | if ((!op->common.parent) || | 203 | if ((!op->common.parent) || |
204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
205 | |||
205 | /* No parent, the return value cannot possibly be used */ | 206 | /* No parent, the return value cannot possibly be used */ |
206 | 207 | ||
207 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 208 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
@@ -340,7 +341,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
340 | union acpi_operand_object *obj_desc; | 341 | union acpi_operand_object *obj_desc; |
341 | acpi_status status; | 342 | acpi_status status; |
342 | 343 | ||
343 | ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); | 344 | ACPI_FUNCTION_TRACE_PTR(ds_delete_result_if_not_used, result_obj); |
344 | 345 | ||
345 | if (!op) { | 346 | if (!op) { |
346 | ACPI_ERROR((AE_INFO, "Null Op")); | 347 | ACPI_ERROR((AE_INFO, "Null Op")); |
@@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
352 | } | 353 | } |
353 | 354 | ||
354 | if (!acpi_ds_is_result_used(op, walk_state)) { | 355 | if (!acpi_ds_is_result_used(op, walk_state)) { |
356 | |||
355 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ | 357 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ |
356 | 358 | ||
357 | status = acpi_ds_result_pop(&obj_desc, walk_state); | 359 | status = acpi_ds_result_pop(&obj_desc, walk_state); |
@@ -382,7 +384,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state) | |||
382 | u32 i; | 384 | u32 i; |
383 | acpi_status status = AE_OK; | 385 | acpi_status status = AE_OK; |
384 | 386 | ||
385 | ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state); | 387 | ACPI_FUNCTION_TRACE_PTR(ds_resolve_operands, walk_state); |
386 | 388 | ||
387 | /* | 389 | /* |
388 | * Attempt to resolve each of the valid operands | 390 | * Attempt to resolve each of the valid operands |
@@ -417,7 +419,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state) | |||
417 | { | 419 | { |
418 | u32 i; | 420 | u32 i; |
419 | 421 | ||
420 | ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state); | 422 | ACPI_FUNCTION_TRACE_PTR(ds_clear_operands, walk_state); |
421 | 423 | ||
422 | /* Remove a reference on each operand on the stack */ | 424 | /* Remove a reference on each operand on the stack */ |
423 | 425 | ||
@@ -465,7 +467,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
465 | acpi_interpreter_mode interpreter_mode; | 467 | acpi_interpreter_mode interpreter_mode; |
466 | const struct acpi_opcode_info *op_info; | 468 | const struct acpi_opcode_info *op_info; |
467 | 469 | ||
468 | ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg); | 470 | ACPI_FUNCTION_TRACE_PTR(ds_create_operand, arg); |
469 | 471 | ||
470 | /* A valid name must be looked up in the namespace */ | 472 | /* A valid name must be looked up in the namespace */ |
471 | 473 | ||
@@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
498 | */ | 500 | */ |
499 | if ((walk_state->deferred_node) && | 501 | if ((walk_state->deferred_node) && |
500 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) | 502 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) |
501 | && (arg_index != 0)) { | 503 | && (arg_index == |
504 | (u32) ((walk_state->opcode == | ||
505 | AML_CREATE_FIELD_OP) ? 3 : 2))) { | ||
502 | obj_desc = | 506 | obj_desc = |
503 | ACPI_CAST_PTR(union acpi_operand_object, | 507 | ACPI_CAST_PTR(union acpi_operand_object, |
504 | walk_state->deferred_node); | 508 | walk_state->deferred_node); |
@@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
521 | && (parent_op->common.aml_opcode != AML_REGION_OP) | 525 | && (parent_op->common.aml_opcode != AML_REGION_OP) |
522 | && (parent_op->common.aml_opcode != | 526 | && (parent_op->common.aml_opcode != |
523 | AML_INT_NAMEPATH_OP)) { | 527 | AML_INT_NAMEPATH_OP)) { |
528 | |||
524 | /* Enter name into namespace if not found */ | 529 | /* Enter name into namespace if not found */ |
525 | 530 | ||
526 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; | 531 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; |
@@ -572,7 +577,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
572 | 577 | ||
573 | /* Free the namestring created above */ | 578 | /* Free the namestring created above */ |
574 | 579 | ||
575 | ACPI_MEM_FREE(name_string); | 580 | ACPI_FREE(name_string); |
576 | 581 | ||
577 | /* Check status from the lookup */ | 582 | /* Check status from the lookup */ |
578 | 583 | ||
@@ -696,7 +701,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
696 | union acpi_parse_object *arg; | 701 | union acpi_parse_object *arg; |
697 | u32 arg_count = 0; | 702 | u32 arg_count = 0; |
698 | 703 | ||
699 | ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg); | 704 | ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); |
700 | 705 | ||
701 | /* For all arguments in the list... */ | 706 | /* For all arguments in the list... */ |
702 | 707 | ||
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index f1af655ff113..3acbd9145d72 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <acpi/acinterp.h> | 49 | #include <acpi/acinterp.h> |
50 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acdebug.h> | 51 | #include <acpi/acdebug.h> |
52 | #include <acpi/acdisasm.h> | ||
53 | 52 | ||
54 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME("dswexec") | 54 | ACPI_MODULE_NAME("dswexec") |
@@ -93,7 +92,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
93 | union acpi_operand_object *obj_desc; | 92 | union acpi_operand_object *obj_desc; |
94 | union acpi_operand_object *local_obj_desc = NULL; | 93 | union acpi_operand_object *local_obj_desc = NULL; |
95 | 94 | ||
96 | ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state); | 95 | ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state); |
97 | 96 | ||
98 | walk_state->control_state->common.state = 0; | 97 | walk_state->control_state->common.state = 0; |
99 | 98 | ||
@@ -123,7 +122,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
123 | 122 | ||
124 | if (!obj_desc) { | 123 | if (!obj_desc) { |
125 | ACPI_ERROR((AE_INFO, | 124 | ACPI_ERROR((AE_INFO, |
126 | "No predicate obj_desc=%p State=%p", | 125 | "No predicate ObjDesc=%p State=%p", |
127 | obj_desc, walk_state)); | 126 | obj_desc, walk_state)); |
128 | 127 | ||
129 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 128 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
@@ -140,7 +139,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
140 | 139 | ||
141 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { | 140 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { |
142 | ACPI_ERROR((AE_INFO, | 141 | ACPI_ERROR((AE_INFO, |
143 | "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X", | 142 | "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", |
144 | obj_desc, walk_state, | 143 | obj_desc, walk_state, |
145 | ACPI_GET_OBJECT_TYPE(obj_desc))); | 144 | ACPI_GET_OBJECT_TYPE(obj_desc))); |
146 | 145 | ||
@@ -214,7 +213,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
214 | acpi_status status = AE_OK; | 213 | acpi_status status = AE_OK; |
215 | u32 opcode_class; | 214 | u32 opcode_class; |
216 | 215 | ||
217 | ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state); | 216 | ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state); |
218 | 217 | ||
219 | op = walk_state->op; | 218 | op = walk_state->op; |
220 | if (!op) { | 219 | if (!op) { |
@@ -296,7 +295,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
296 | 295 | ||
297 | case AML_CLASS_NAMED_OBJECT: | 296 | case AML_CLASS_NAMED_OBJECT: |
298 | 297 | ||
299 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 298 | if (walk_state->walk_type & ACPI_WALK_METHOD) { |
300 | /* | 299 | /* |
301 | * Found a named object declaration during method execution; | 300 | * Found a named object declaration during method execution; |
302 | * we must enter this object into the namespace. The created | 301 | * we must enter this object into the namespace. The created |
@@ -354,7 +353,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
354 | union acpi_parse_object *next_op; | 353 | union acpi_parse_object *next_op; |
355 | union acpi_parse_object *first_arg; | 354 | union acpi_parse_object *first_arg; |
356 | 355 | ||
357 | ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state); | 356 | ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state); |
358 | 357 | ||
359 | op = walk_state->op; | 358 | op = walk_state->op; |
360 | op_type = walk_state->op_info->type; | 359 | op_type = walk_state->op_info->type; |
@@ -409,6 +408,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
409 | * being the object_type and size_of operators. | 408 | * being the object_type and size_of operators. |
410 | */ | 409 | */ |
411 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { | 410 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { |
411 | |||
412 | /* Resolve all operands */ | 412 | /* Resolve all operands */ |
413 | 413 | ||
414 | status = acpi_ex_resolve_operands(walk_state->opcode, | 414 | status = acpi_ex_resolve_operands(walk_state->opcode, |
@@ -423,7 +423,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
423 | acpi_ps_get_opcode_name | 423 | acpi_ps_get_opcode_name |
424 | (walk_state->opcode), | 424 | (walk_state->opcode), |
425 | walk_state->num_operands, | 425 | walk_state->num_operands, |
426 | "after ex_resolve_operands"); | 426 | "after ExResolveOperands"); |
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
@@ -437,7 +437,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); | 437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); |
438 | } else { | 438 | } else { |
439 | /* | 439 | /* |
440 | * Treat constructs of the form "Store(local_x,local_x)" as noops when the | 440 | * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the |
441 | * Local is uninitialized. | 441 | * Local is uninitialized. |
442 | */ | 442 | */ |
443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && | 443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && |
@@ -548,6 +548,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
548 | */ | 548 | */ |
549 | status = acpi_ds_resolve_operands(walk_state); | 549 | status = acpi_ds_resolve_operands(walk_state); |
550 | if (ACPI_FAILURE(status)) { | 550 | if (ACPI_FAILURE(status)) { |
551 | |||
551 | /* On error, clear all resolved operands */ | 552 | /* On error, clear all resolved operands */ |
552 | 553 | ||
553 | acpi_ds_clear_operands(walk_state); | 554 | acpi_ds_clear_operands(walk_state); |
@@ -569,7 +570,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
569 | case AML_TYPE_CREATE_FIELD: | 570 | case AML_TYPE_CREATE_FIELD: |
570 | 571 | ||
571 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 572 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
572 | "Executing create_field Buffer/Index Op=%p\n", | 573 | "Executing CreateField Buffer/Index Op=%p\n", |
573 | op)); | 574 | op)); |
574 | 575 | ||
575 | status = acpi_ds_load2_end_op(walk_state); | 576 | status = acpi_ds_load2_end_op(walk_state); |
@@ -584,7 +585,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
584 | case AML_TYPE_CREATE_OBJECT: | 585 | case AML_TYPE_CREATE_OBJECT: |
585 | 586 | ||
586 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 587 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
587 | "Executing create_object (Buffer/Package) Op=%p\n", | 588 | "Executing CreateObject (Buffer/Package) Op=%p\n", |
588 | op)); | 589 | op)); |
589 | 590 | ||
590 | switch (op->common.parent->common.aml_opcode) { | 591 | switch (op->common.parent->common.aml_opcode) { |
@@ -657,7 +658,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
657 | 658 | ||
658 | if (op->common.aml_opcode == AML_REGION_OP) { | 659 | if (op->common.aml_opcode == AML_REGION_OP) { |
659 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 660 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
660 | "Executing op_region Address/Length Op=%p\n", | 661 | "Executing OpRegion Address/Length Op=%p\n", |
661 | op)); | 662 | op)); |
662 | 663 | ||
663 | status = | 664 | status = |
@@ -722,6 +723,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
722 | cleanup: | 723 | cleanup: |
723 | 724 | ||
724 | if (walk_state->result_obj) { | 725 | if (walk_state->result_obj) { |
726 | |||
725 | /* Break to debugger to display result */ | 727 | /* Break to debugger to display result */ |
726 | 728 | ||
727 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 729 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index d3d24da31c81..35074399c617 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
127 | char *path; | 127 | char *path; |
128 | u32 flags; | 128 | u32 flags; |
129 | 129 | ||
130 | ACPI_FUNCTION_TRACE("ds_load1_begin_op"); | 130 | ACPI_FUNCTION_TRACE(ds_load1_begin_op); |
131 | 131 | ||
132 | op = walk_state->op; | 132 | op = walk_state->op; |
133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -178,12 +178,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
178 | * Target of Scope() not found. Generate an External for it, and | 178 | * Target of Scope() not found. Generate an External for it, and |
179 | * insert the name into the namespace. | 179 | * insert the name into the namespace. |
180 | */ | 180 | */ |
181 | acpi_dm_add_to_external_list(path); | 181 | acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); |
182 | status = | 182 | status = |
183 | acpi_ns_lookup(walk_state->scope_info, path, | 183 | acpi_ns_lookup(walk_state->scope_info, path, |
184 | object_type, ACPI_IMODE_LOAD_PASS1, | 184 | object_type, ACPI_IMODE_LOAD_PASS1, |
185 | ACPI_NS_SEARCH_PARENT, walk_state, | 185 | ACPI_NS_SEARCH_PARENT, walk_state, |
186 | &(node)); | 186 | &node); |
187 | } | 187 | } |
188 | #endif | 188 | #endif |
189 | if (ACPI_FAILURE(status)) { | 189 | if (ACPI_FAILURE(status)) { |
@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
261 | */ | 261 | */ |
262 | 262 | ||
263 | if (walk_state->deferred_node) { | 263 | if (walk_state->deferred_node) { |
264 | |||
264 | /* This name is already in the namespace, get the node */ | 265 | /* This name is already in the namespace, get the node */ |
265 | 266 | ||
266 | node = walk_state->deferred_node; | 267 | node = walk_state->deferred_node; |
@@ -300,10 +301,41 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
300 | status = | 301 | status = |
301 | acpi_ns_lookup(walk_state->scope_info, path, object_type, | 302 | acpi_ns_lookup(walk_state->scope_info, path, object_type, |
302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, | 303 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, |
303 | &(node)); | 304 | &node); |
304 | if (ACPI_FAILURE(status)) { | 305 | if (ACPI_FAILURE(status)) { |
305 | ACPI_ERROR_NAMESPACE(path, status); | 306 | if (status == AE_ALREADY_EXISTS) { |
306 | return_ACPI_STATUS(status); | 307 | |
308 | /* The name already exists in this scope */ | ||
309 | |||
310 | if (node->flags & ANOBJ_IS_EXTERNAL) { | ||
311 | /* | ||
312 | * Allow one create on an object or segment that was | ||
313 | * previously declared External | ||
314 | */ | ||
315 | node->flags &= ~ANOBJ_IS_EXTERNAL; | ||
316 | node->type = (u8) object_type; | ||
317 | |||
318 | /* Just retyped a node, probably will need to open a scope */ | ||
319 | |||
320 | if (acpi_ns_opens_scope(object_type)) { | ||
321 | status = | ||
322 | acpi_ds_scope_stack_push | ||
323 | (node, object_type, | ||
324 | walk_state); | ||
325 | if (ACPI_FAILURE(status)) { | ||
326 | return_ACPI_STATUS | ||
327 | (status); | ||
328 | } | ||
329 | } | ||
330 | status = AE_OK; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | if (ACPI_FAILURE(status)) { | ||
335 | |||
336 | ACPI_ERROR_NAMESPACE(path, status); | ||
337 | return_ACPI_STATUS(status); | ||
338 | } | ||
307 | } | 339 | } |
308 | break; | 340 | break; |
309 | } | 341 | } |
@@ -311,6 +343,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
311 | /* Common exit */ | 343 | /* Common exit */ |
312 | 344 | ||
313 | if (!op) { | 345 | if (!op) { |
346 | |||
314 | /* Create a new op */ | 347 | /* Create a new op */ |
315 | 348 | ||
316 | op = acpi_ps_alloc_op(walk_state->opcode); | 349 | op = acpi_ps_alloc_op(walk_state->opcode); |
@@ -359,7 +392,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
359 | acpi_object_type object_type; | 392 | acpi_object_type object_type; |
360 | acpi_status status = AE_OK; | 393 | acpi_status status = AE_OK; |
361 | 394 | ||
362 | ACPI_FUNCTION_TRACE("ds_load1_end_op"); | 395 | ACPI_FUNCTION_TRACE(ds_load1_end_op); |
363 | 396 | ||
364 | op = walk_state->op; | 397 | op = walk_state->op; |
365 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 398 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -413,6 +446,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
413 | #endif | 446 | #endif |
414 | 447 | ||
415 | if (op->common.aml_opcode == AML_NAME_OP) { | 448 | if (op->common.aml_opcode == AML_NAME_OP) { |
449 | |||
416 | /* For Name opcode, get the object type from the argument */ | 450 | /* For Name opcode, get the object type from the argument */ |
417 | 451 | ||
418 | if (op->common.value.arg) { | 452 | if (op->common.value.arg) { |
@@ -445,7 +479,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
445 | * arguments.) | 479 | * arguments.) |
446 | */ | 480 | */ |
447 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 481 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
448 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 482 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
449 | walk_state, op, op->named.node)); | 483 | walk_state, op, op->named.node)); |
450 | 484 | ||
451 | if (!acpi_ns_get_attached_object(op->named.node)) { | 485 | if (!acpi_ns_get_attached_object(op->named.node)) { |
@@ -511,7 +545,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
511 | acpi_object_type object_type; | 545 | acpi_object_type object_type; |
512 | char *buffer_ptr; | 546 | char *buffer_ptr; |
513 | 547 | ||
514 | ACPI_FUNCTION_TRACE("ds_load2_begin_op"); | 548 | ACPI_FUNCTION_TRACE(ds_load2_begin_op); |
515 | 549 | ||
516 | op = walk_state->op; | 550 | op = walk_state->op; |
517 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 551 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -521,6 +555,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
521 | if ((walk_state->control_state) && | 555 | if ((walk_state->control_state) && |
522 | (walk_state->control_state->common.state == | 556 | (walk_state->control_state->common.state == |
523 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | 557 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { |
558 | |||
524 | /* We are executing a while loop outside of a method */ | 559 | /* We are executing a while loop outside of a method */ |
525 | 560 | ||
526 | status = acpi_ds_exec_begin_op(walk_state, out_op); | 561 | status = acpi_ds_exec_begin_op(walk_state, out_op); |
@@ -554,10 +589,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
554 | /* Get the name we are going to enter or lookup in the namespace */ | 589 | /* Get the name we are going to enter or lookup in the namespace */ |
555 | 590 | ||
556 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 591 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
592 | |||
557 | /* For Namepath op, get the path string */ | 593 | /* For Namepath op, get the path string */ |
558 | 594 | ||
559 | buffer_ptr = op->common.value.string; | 595 | buffer_ptr = op->common.value.string; |
560 | if (!buffer_ptr) { | 596 | if (!buffer_ptr) { |
597 | |||
561 | /* No name, just exit */ | 598 | /* No name, just exit */ |
562 | 599 | ||
563 | return_ACPI_STATUS(AE_OK); | 600 | return_ACPI_STATUS(AE_OK); |
@@ -680,6 +717,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
680 | /* All other opcodes */ | 717 | /* All other opcodes */ |
681 | 718 | ||
682 | if (op && op->common.node) { | 719 | if (op && op->common.node) { |
720 | |||
683 | /* This op/node was previously entered into the namespace */ | 721 | /* This op/node was previously entered into the namespace */ |
684 | 722 | ||
685 | node = op->common.node; | 723 | node = op->common.node; |
@@ -705,6 +743,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
705 | * Note: Name may already exist if we are executing a deferred opcode. | 743 | * Note: Name may already exist if we are executing a deferred opcode. |
706 | */ | 744 | */ |
707 | if (walk_state->deferred_node) { | 745 | if (walk_state->deferred_node) { |
746 | |||
708 | /* This name is already in the namespace, get the node */ | 747 | /* This name is already in the namespace, get the node */ |
709 | 748 | ||
710 | node = walk_state->deferred_node; | 749 | node = walk_state->deferred_node; |
@@ -727,6 +766,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
727 | } | 766 | } |
728 | 767 | ||
729 | if (!op) { | 768 | if (!op) { |
769 | |||
730 | /* Create a new op */ | 770 | /* Create a new op */ |
731 | 771 | ||
732 | op = acpi_ps_alloc_op(walk_state->opcode); | 772 | op = acpi_ps_alloc_op(walk_state->opcode); |
@@ -776,7 +816,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
776 | u32 i; | 816 | u32 i; |
777 | #endif | 817 | #endif |
778 | 818 | ||
779 | ACPI_FUNCTION_TRACE("ds_load2_end_op"); | 819 | ACPI_FUNCTION_TRACE(ds_load2_end_op); |
780 | 820 | ||
781 | op = walk_state->op; | 821 | op = walk_state->op; |
782 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", | 822 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", |
@@ -870,7 +910,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
870 | */ | 910 | */ |
871 | 911 | ||
872 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 912 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
873 | "Create-Load [%s] State=%p Op=%p named_obj=%p\n", | 913 | "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", |
874 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 914 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
875 | walk_state, op, node)); | 915 | walk_state, op, node)); |
876 | 916 | ||
@@ -1045,7 +1085,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1045 | * arguments.) | 1085 | * arguments.) |
1046 | */ | 1086 | */ |
1047 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1087 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1048 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 1088 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
1049 | walk_state, op, op->named.node)); | 1089 | walk_state, op, op->named.node)); |
1050 | 1090 | ||
1051 | if (!acpi_ns_get_attached_object(op->named.node)) { | 1091 | if (!acpi_ns_get_attached_object(op->named.node)) { |
@@ -1090,7 +1130,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1090 | case AML_CLASS_METHOD_CALL: | 1130 | case AML_CLASS_METHOD_CALL: |
1091 | 1131 | ||
1092 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1132 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1093 | "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", | 1133 | "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", |
1094 | walk_state, op, node)); | 1134 | walk_state, op, node)); |
1095 | 1135 | ||
1096 | /* | 1136 | /* |
@@ -1104,7 +1144,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1104 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, | 1144 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, |
1105 | &(new_node)); | 1145 | &(new_node)); |
1106 | if (ACPI_SUCCESS(status)) { | 1146 | if (ACPI_SUCCESS(status)) { |
1107 | |||
1108 | /* | 1147 | /* |
1109 | * Make sure that what we found is indeed a method | 1148 | * Make sure that what we found is indeed a method |
1110 | * We didn't search for a method on purpose, to see if the name | 1149 | * We didn't search for a method on purpose, to see if the name |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index ada21ef4a174..c9228972f5f6 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -63,9 +63,10 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) | |||
63 | { | 63 | { |
64 | union acpi_generic_state *scope_info; | 64 | union acpi_generic_state *scope_info; |
65 | 65 | ||
66 | ACPI_FUNCTION_NAME("ds_scope_stack_clear"); | 66 | ACPI_FUNCTION_NAME(ds_scope_stack_clear); |
67 | 67 | ||
68 | while (walk_state->scope_info) { | 68 | while (walk_state->scope_info) { |
69 | |||
69 | /* Pop a scope off the stack */ | 70 | /* Pop a scope off the stack */ |
70 | 71 | ||
71 | scope_info = walk_state->scope_info; | 72 | scope_info = walk_state->scope_info; |
@@ -102,9 +103,10 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
102 | union acpi_generic_state *scope_info; | 103 | union acpi_generic_state *scope_info; |
103 | union acpi_generic_state *old_scope_info; | 104 | union acpi_generic_state *old_scope_info; |
104 | 105 | ||
105 | ACPI_FUNCTION_TRACE("ds_scope_stack_push"); | 106 | ACPI_FUNCTION_TRACE(ds_scope_stack_push); |
106 | 107 | ||
107 | if (!node) { | 108 | if (!node) { |
109 | |||
108 | /* Invalid scope */ | 110 | /* Invalid scope */ |
109 | 111 | ||
110 | ACPI_ERROR((AE_INFO, "Null scope parameter")); | 112 | ACPI_ERROR((AE_INFO, "Null scope parameter")); |
@@ -126,7 +128,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
126 | 128 | ||
127 | /* Init new scope object */ | 129 | /* Init new scope object */ |
128 | 130 | ||
129 | scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; | 131 | scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE; |
130 | scope_info->scope.node = node; | 132 | scope_info->scope.node = node; |
131 | scope_info->common.value = (u16) type; | 133 | scope_info->common.value = (u16) type; |
132 | 134 | ||
@@ -176,7 +178,7 @@ acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state) | |||
176 | union acpi_generic_state *scope_info; | 178 | union acpi_generic_state *scope_info; |
177 | union acpi_generic_state *new_scope_info; | 179 | union acpi_generic_state *new_scope_info; |
178 | 180 | ||
179 | ACPI_FUNCTION_TRACE("ds_scope_stack_pop"); | 181 | ACPI_FUNCTION_TRACE(ds_scope_stack_pop); |
180 | 182 | ||
181 | /* | 183 | /* |
182 | * Pop scope info object off the stack. | 184 | * Pop scope info object off the stack. |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index fa78cb74ee36..7817e5522679 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -66,7 +66,6 @@ void *acpi_ds_obj_stack_get_value(u32 index, | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #ifdef ACPI_FUTURE_USAGE | 68 | #ifdef ACPI_FUTURE_USAGE |
69 | |||
70 | /******************************************************************************* | 69 | /******************************************************************************* |
71 | * | 70 | * |
72 | * FUNCTION: acpi_ds_result_remove | 71 | * FUNCTION: acpi_ds_result_remove |
@@ -88,7 +87,7 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
88 | { | 87 | { |
89 | union acpi_generic_state *state; | 88 | union acpi_generic_state *state; |
90 | 89 | ||
91 | ACPI_FUNCTION_NAME("ds_result_remove"); | 90 | ACPI_FUNCTION_NAME(ds_result_remove); |
92 | 91 | ||
93 | state = walk_state->results; | 92 | state = walk_state->results; |
94 | if (!state) { | 93 | if (!state) { |
@@ -128,7 +127,6 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
128 | 127 | ||
129 | return (AE_OK); | 128 | return (AE_OK); |
130 | } | 129 | } |
131 | |||
132 | #endif /* ACPI_FUTURE_USAGE */ | 130 | #endif /* ACPI_FUTURE_USAGE */ |
133 | 131 | ||
134 | /******************************************************************************* | 132 | /******************************************************************************* |
@@ -152,7 +150,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
152 | acpi_native_uint index; | 150 | acpi_native_uint index; |
153 | union acpi_generic_state *state; | 151 | union acpi_generic_state *state; |
154 | 152 | ||
155 | ACPI_FUNCTION_NAME("ds_result_pop"); | 153 | ACPI_FUNCTION_NAME(ds_result_pop); |
156 | 154 | ||
157 | state = walk_state->results; | 155 | state = walk_state->results; |
158 | if (!state) { | 156 | if (!state) { |
@@ -170,6 +168,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
170 | state->results.num_results--; | 168 | state->results.num_results--; |
171 | 169 | ||
172 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { | 170 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { |
171 | |||
173 | /* Check for a valid result object */ | 172 | /* Check for a valid result object */ |
174 | 173 | ||
175 | if (state->results.obj_desc[index - 1]) { | 174 | if (state->results.obj_desc[index - 1]) { |
@@ -213,7 +212,7 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, | |||
213 | acpi_native_uint index; | 212 | acpi_native_uint index; |
214 | union acpi_generic_state *state; | 213 | union acpi_generic_state *state; |
215 | 214 | ||
216 | ACPI_FUNCTION_NAME("ds_result_pop_from_bottom"); | 215 | ACPI_FUNCTION_NAME(ds_result_pop_from_bottom); |
217 | 216 | ||
218 | state = walk_state->results; | 217 | state = walk_state->results; |
219 | if (!state) { | 218 | if (!state) { |
@@ -278,7 +277,7 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
278 | { | 277 | { |
279 | union acpi_generic_state *state; | 278 | union acpi_generic_state *state; |
280 | 279 | ||
281 | ACPI_FUNCTION_NAME("ds_result_push"); | 280 | ACPI_FUNCTION_NAME(ds_result_push); |
282 | 281 | ||
283 | state = walk_state->results; | 282 | state = walk_state->results; |
284 | if (!state) { | 283 | if (!state) { |
@@ -331,14 +330,14 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | |||
331 | { | 330 | { |
332 | union acpi_generic_state *state; | 331 | union acpi_generic_state *state; |
333 | 332 | ||
334 | ACPI_FUNCTION_NAME("ds_result_stack_push"); | 333 | ACPI_FUNCTION_NAME(ds_result_stack_push); |
335 | 334 | ||
336 | state = acpi_ut_create_generic_state(); | 335 | state = acpi_ut_create_generic_state(); |
337 | if (!state) { | 336 | if (!state) { |
338 | return (AE_NO_MEMORY); | 337 | return (AE_NO_MEMORY); |
339 | } | 338 | } |
340 | 339 | ||
341 | state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; | 340 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; |
342 | acpi_ut_push_generic_state(&walk_state->results, state); | 341 | acpi_ut_push_generic_state(&walk_state->results, state); |
343 | 342 | ||
344 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", | 343 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", |
@@ -363,7 +362,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
363 | { | 362 | { |
364 | union acpi_generic_state *state; | 363 | union acpi_generic_state *state; |
365 | 364 | ||
366 | ACPI_FUNCTION_NAME("ds_result_stack_pop"); | 365 | ACPI_FUNCTION_NAME(ds_result_stack_pop); |
367 | 366 | ||
368 | /* Check for stack underflow */ | 367 | /* Check for stack underflow */ |
369 | 368 | ||
@@ -376,7 +375,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
376 | state = acpi_ut_pop_generic_state(&walk_state->results); | 375 | state = acpi_ut_pop_generic_state(&walk_state->results); |
377 | 376 | ||
378 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
379 | "Result=%p remaining_results=%X State=%p\n", | 378 | "Result=%p RemainingResults=%X State=%p\n", |
380 | state, state->results.num_results, walk_state)); | 379 | state, state->results.num_results, walk_state)); |
381 | 380 | ||
382 | acpi_ut_delete_generic_state(state); | 381 | acpi_ut_delete_generic_state(state); |
@@ -400,7 +399,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
400 | acpi_status | 399 | acpi_status |
401 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) | 400 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) |
402 | { | 401 | { |
403 | ACPI_FUNCTION_NAME("ds_obj_stack_push"); | 402 | ACPI_FUNCTION_NAME(ds_obj_stack_push); |
404 | 403 | ||
405 | /* Check for stack overflow */ | 404 | /* Check for stack overflow */ |
406 | 405 | ||
@@ -445,9 +444,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) | |||
445 | { | 444 | { |
446 | u32 i; | 445 | u32 i; |
447 | 446 | ||
448 | ACPI_FUNCTION_NAME("ds_obj_stack_pop"); | 447 | ACPI_FUNCTION_NAME(ds_obj_stack_pop); |
449 | 448 | ||
450 | for (i = 0; i < pop_count; i++) { | 449 | for (i = 0; i < pop_count; i++) { |
450 | |||
451 | /* Check for stack underflow */ | 451 | /* Check for stack underflow */ |
452 | 452 | ||
453 | if (walk_state->num_operands == 0) { | 453 | if (walk_state->num_operands == 0) { |
@@ -491,9 +491,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
491 | u32 i; | 491 | u32 i; |
492 | union acpi_operand_object *obj_desc; | 492 | union acpi_operand_object *obj_desc; |
493 | 493 | ||
494 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); | 494 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); |
495 | 495 | ||
496 | for (i = 0; i < pop_count; i++) { | 496 | for (i = 0; i < pop_count; i++) { |
497 | |||
497 | /* Check for stack underflow */ | 498 | /* Check for stack underflow */ |
498 | 499 | ||
499 | if (walk_state->num_operands == 0) { | 500 | if (walk_state->num_operands == 0) { |
@@ -538,13 +539,13 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
538 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state | 539 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state |
539 | *thread) | 540 | *thread) |
540 | { | 541 | { |
541 | ACPI_FUNCTION_NAME("ds_get_current_walk_state"); | 542 | ACPI_FUNCTION_NAME(ds_get_current_walk_state); |
542 | 543 | ||
543 | if (!thread) { | 544 | if (!thread) { |
544 | return (NULL); | 545 | return (NULL); |
545 | } | 546 | } |
546 | 547 | ||
547 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n", | 548 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current WalkState %p\n", |
548 | thread->walk_state_list)); | 549 | thread->walk_state_list)); |
549 | 550 | ||
550 | return (thread->walk_state_list); | 551 | return (thread->walk_state_list); |
@@ -567,7 +568,7 @@ void | |||
567 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, | 568 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, |
568 | struct acpi_thread_state *thread) | 569 | struct acpi_thread_state *thread) |
569 | { | 570 | { |
570 | ACPI_FUNCTION_TRACE("ds_push_walk_state"); | 571 | ACPI_FUNCTION_TRACE(ds_push_walk_state); |
571 | 572 | ||
572 | walk_state->next = thread->walk_state_list; | 573 | walk_state->next = thread->walk_state_list; |
573 | thread->walk_state_list = walk_state; | 574 | thread->walk_state_list = walk_state; |
@@ -593,11 +594,12 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
593 | { | 594 | { |
594 | struct acpi_walk_state *walk_state; | 595 | struct acpi_walk_state *walk_state; |
595 | 596 | ||
596 | ACPI_FUNCTION_TRACE("ds_pop_walk_state"); | 597 | ACPI_FUNCTION_TRACE(ds_pop_walk_state); |
597 | 598 | ||
598 | walk_state = thread->walk_state_list; | 599 | walk_state = thread->walk_state_list; |
599 | 600 | ||
600 | if (walk_state) { | 601 | if (walk_state) { |
602 | |||
601 | /* Next walk state becomes the current walk state */ | 603 | /* Next walk state becomes the current walk state */ |
602 | 604 | ||
603 | thread->walk_state_list = walk_state->next; | 605 | thread->walk_state_list = walk_state->next; |
@@ -618,7 +620,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
618 | * | 620 | * |
619 | * PARAMETERS: owner_id - ID for object creation | 621 | * PARAMETERS: owner_id - ID for object creation |
620 | * Origin - Starting point for this walk | 622 | * Origin - Starting point for this walk |
621 | * mth_desc - Method object | 623 | * method_desc - Method object |
622 | * Thread - Current thread state | 624 | * Thread - Current thread state |
623 | * | 625 | * |
624 | * RETURN: Pointer to the new walk state. | 626 | * RETURN: Pointer to the new walk state. |
@@ -632,24 +634,24 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
632 | union acpi_parse_object | 634 | union acpi_parse_object |
633 | *origin, | 635 | *origin, |
634 | union acpi_operand_object | 636 | union acpi_operand_object |
635 | *mth_desc, | 637 | *method_desc, |
636 | struct acpi_thread_state | 638 | struct acpi_thread_state |
637 | *thread) | 639 | *thread) |
638 | { | 640 | { |
639 | struct acpi_walk_state *walk_state; | 641 | struct acpi_walk_state *walk_state; |
640 | acpi_status status; | 642 | acpi_status status; |
641 | 643 | ||
642 | ACPI_FUNCTION_TRACE("ds_create_walk_state"); | 644 | ACPI_FUNCTION_TRACE(ds_create_walk_state); |
643 | 645 | ||
644 | walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); | 646 | walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state)); |
645 | if (!walk_state) { | 647 | if (!walk_state) { |
646 | return_PTR(NULL); | 648 | return_PTR(NULL); |
647 | } | 649 | } |
648 | 650 | ||
649 | walk_state->data_type = ACPI_DESC_TYPE_WALK; | 651 | walk_state->descriptor_type = ACPI_DESC_TYPE_WALK; |
652 | walk_state->method_desc = method_desc; | ||
650 | walk_state->owner_id = owner_id; | 653 | walk_state->owner_id = owner_id; |
651 | walk_state->origin = origin; | 654 | walk_state->origin = origin; |
652 | walk_state->method_desc = mth_desc; | ||
653 | walk_state->thread = thread; | 655 | walk_state->thread = thread; |
654 | 656 | ||
655 | walk_state->parser_state.start_op = origin; | 657 | walk_state->parser_state.start_op = origin; |
@@ -664,7 +666,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
664 | 666 | ||
665 | status = acpi_ds_result_stack_push(walk_state); | 667 | status = acpi_ds_result_stack_push(walk_state); |
666 | if (ACPI_FAILURE(status)) { | 668 | if (ACPI_FAILURE(status)) { |
667 | ACPI_MEM_FREE(walk_state); | 669 | ACPI_FREE(walk_state); |
668 | return_PTR(NULL); | 670 | return_PTR(NULL); |
669 | } | 671 | } |
670 | 672 | ||
@@ -701,13 +703,13 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
701 | struct acpi_namespace_node *method_node, | 703 | struct acpi_namespace_node *method_node, |
702 | u8 * aml_start, | 704 | u8 * aml_start, |
703 | u32 aml_length, | 705 | u32 aml_length, |
704 | struct acpi_parameter_info *info, u8 pass_number) | 706 | struct acpi_evaluate_info *info, u8 pass_number) |
705 | { | 707 | { |
706 | acpi_status status; | 708 | acpi_status status; |
707 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 709 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
708 | union acpi_parse_object *extra_op; | 710 | union acpi_parse_object *extra_op; |
709 | 711 | ||
710 | ACPI_FUNCTION_TRACE("ds_init_aml_walk"); | 712 | ACPI_FUNCTION_TRACE(ds_init_aml_walk); |
711 | 713 | ||
712 | walk_state->parser_state.aml = | 714 | walk_state->parser_state.aml = |
713 | walk_state->parser_state.aml_start = aml_start; | 715 | walk_state->parser_state.aml_start = aml_start; |
@@ -778,6 +780,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
778 | } | 780 | } |
779 | 781 | ||
780 | if (parser_state->start_node) { | 782 | if (parser_state->start_node) { |
783 | |||
781 | /* Push start scope on scope stack and make it current */ | 784 | /* Push start scope on scope stack and make it current */ |
782 | 785 | ||
783 | status = | 786 | status = |
@@ -810,21 +813,24 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
810 | { | 813 | { |
811 | union acpi_generic_state *state; | 814 | union acpi_generic_state *state; |
812 | 815 | ||
813 | ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state); | 816 | ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state); |
814 | 817 | ||
815 | if (!walk_state) { | 818 | if (!walk_state) { |
816 | return; | 819 | return; |
817 | } | 820 | } |
818 | 821 | ||
819 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 822 | if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) { |
820 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", | 823 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", |
821 | walk_state)); | 824 | walk_state)); |
822 | return; | 825 | return; |
823 | } | 826 | } |
824 | 827 | ||
828 | /* There should not be any open scopes */ | ||
829 | |||
825 | if (walk_state->parser_state.scope) { | 830 | if (walk_state->parser_state.scope) { |
826 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", | 831 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", |
827 | walk_state)); | 832 | walk_state)); |
833 | acpi_ps_cleanup_scope(&walk_state->parser_state); | ||
828 | } | 834 | } |
829 | 835 | ||
830 | /* Always must free any linked control states */ | 836 | /* Always must free any linked control states */ |
@@ -854,7 +860,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
854 | acpi_ut_delete_generic_state(state); | 860 | acpi_ut_delete_generic_state(state); |
855 | } | 861 | } |
856 | 862 | ||
857 | ACPI_MEM_FREE(walk_state); | 863 | ACPI_FREE(walk_state); |
858 | return_VOID; | 864 | return_VOID; |
859 | } | 865 | } |
860 | 866 | ||
@@ -879,7 +885,7 @@ acpi_ds_result_insert(void *object, | |||
879 | { | 885 | { |
880 | union acpi_generic_state *state; | 886 | union acpi_generic_state *state; |
881 | 887 | ||
882 | ACPI_FUNCTION_NAME("ds_result_insert"); | 888 | ACPI_FUNCTION_NAME(ds_result_insert); |
883 | 889 | ||
884 | state = walk_state->results; | 890 | state = walk_state->results; |
885 | if (!state) { | 891 | if (!state) { |
@@ -937,7 +943,7 @@ acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) | |||
937 | { | 943 | { |
938 | u32 i; | 944 | u32 i; |
939 | 945 | ||
940 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state); | 946 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state); |
941 | 947 | ||
942 | /* The stack size is configurable, but fixed */ | 948 | /* The stack size is configurable, but fixed */ |
943 | 949 | ||
@@ -969,7 +975,7 @@ acpi_status | |||
969 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | 975 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, |
970 | struct acpi_walk_state *walk_state) | 976 | struct acpi_walk_state *walk_state) |
971 | { | 977 | { |
972 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_object"); | 978 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_object); |
973 | 979 | ||
974 | /* Check for stack underflow */ | 980 | /* Check for stack underflow */ |
975 | 981 | ||
@@ -1025,7 +1031,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | |||
1025 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) | 1031 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) |
1026 | { | 1032 | { |
1027 | 1033 | ||
1028 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state); | 1034 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state); |
1029 | 1035 | ||
1030 | /* Can't do it if the stack is empty */ | 1036 | /* Can't do it if the stack is empty */ |
1031 | 1037 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index eee0864ba300..18b3ea9dace2 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -116,7 +116,7 @@ union acpi_ec { | |||
116 | struct acpi_generic_address command_addr; | 116 | struct acpi_generic_address command_addr; |
117 | struct acpi_generic_address data_addr; | 117 | struct acpi_generic_address data_addr; |
118 | unsigned long global_lock; | 118 | unsigned long global_lock; |
119 | spinlock_t lock; | 119 | struct semaphore sem; |
120 | } poll; | 120 | } poll; |
121 | }; | 121 | }; |
122 | 122 | ||
@@ -323,7 +323,6 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) | |||
323 | { | 323 | { |
324 | acpi_status status = AE_OK; | 324 | acpi_status status = AE_OK; |
325 | int result = 0; | 325 | int result = 0; |
326 | unsigned long flags = 0; | ||
327 | u32 glk = 0; | 326 | u32 glk = 0; |
328 | 327 | ||
329 | ACPI_FUNCTION_TRACE("acpi_ec_read"); | 328 | ACPI_FUNCTION_TRACE("acpi_ec_read"); |
@@ -339,8 +338,11 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) | |||
339 | return_VALUE(-ENODEV); | 338 | return_VALUE(-ENODEV); |
340 | } | 339 | } |
341 | 340 | ||
342 | spin_lock_irqsave(&ec->poll.lock, flags); | 341 | if (down_interruptible(&ec->poll.sem)) { |
343 | 342 | result = -ERESTARTSYS; | |
343 | goto end_nosem; | ||
344 | } | ||
345 | |||
344 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, | 346 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, |
345 | &ec->common.command_addr); | 347 | &ec->common.command_addr); |
346 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 348 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
@@ -358,8 +360,8 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) | |||
358 | *data, address)); | 360 | *data, address)); |
359 | 361 | ||
360 | end: | 362 | end: |
361 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 363 | up(&ec->poll.sem); |
362 | 364 | end_nosem: | |
363 | if (ec->common.global_lock) | 365 | if (ec->common.global_lock) |
364 | acpi_release_global_lock(glk); | 366 | acpi_release_global_lock(glk); |
365 | 367 | ||
@@ -370,7 +372,6 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | |||
370 | { | 372 | { |
371 | int result = 0; | 373 | int result = 0; |
372 | acpi_status status = AE_OK; | 374 | acpi_status status = AE_OK; |
373 | unsigned long flags = 0; | ||
374 | u32 glk = 0; | 375 | u32 glk = 0; |
375 | 376 | ||
376 | ACPI_FUNCTION_TRACE("acpi_ec_write"); | 377 | ACPI_FUNCTION_TRACE("acpi_ec_write"); |
@@ -384,8 +385,11 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | |||
384 | return_VALUE(-ENODEV); | 385 | return_VALUE(-ENODEV); |
385 | } | 386 | } |
386 | 387 | ||
387 | spin_lock_irqsave(&ec->poll.lock, flags); | 388 | if (down_interruptible(&ec->poll.sem)) { |
388 | 389 | result = -ERESTARTSYS; | |
390 | goto end_nosem; | ||
391 | } | ||
392 | |||
389 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, | 393 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, |
390 | &ec->common.command_addr); | 394 | &ec->common.command_addr); |
391 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 395 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
@@ -406,8 +410,8 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | |||
406 | data, address)); | 410 | data, address)); |
407 | 411 | ||
408 | end: | 412 | end: |
409 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 413 | up(&ec->poll.sem); |
410 | 414 | end_nosem: | |
411 | if (ec->common.global_lock) | 415 | if (ec->common.global_lock) |
412 | acpi_release_global_lock(glk); | 416 | acpi_release_global_lock(glk); |
413 | 417 | ||
@@ -568,7 +572,6 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) | |||
568 | { | 572 | { |
569 | int result = 0; | 573 | int result = 0; |
570 | acpi_status status = AE_OK; | 574 | acpi_status status = AE_OK; |
571 | unsigned long flags = 0; | ||
572 | u32 glk = 0; | 575 | u32 glk = 0; |
573 | 576 | ||
574 | ACPI_FUNCTION_TRACE("acpi_ec_query"); | 577 | ACPI_FUNCTION_TRACE("acpi_ec_query"); |
@@ -589,8 +592,11 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) | |||
589 | * Note that successful completion of the query causes the ACPI_EC_SCI | 592 | * Note that successful completion of the query causes the ACPI_EC_SCI |
590 | * bit to be cleared (and thus clearing the interrupt source). | 593 | * bit to be cleared (and thus clearing the interrupt source). |
591 | */ | 594 | */ |
592 | spin_lock_irqsave(&ec->poll.lock, flags); | 595 | if (down_interruptible(&ec->poll.sem)) { |
593 | 596 | result = -ERESTARTSYS; | |
597 | goto end_nosem; | ||
598 | } | ||
599 | |||
594 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, | 600 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, |
595 | &ec->common.command_addr); | 601 | &ec->common.command_addr); |
596 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 602 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
@@ -602,8 +608,8 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) | |||
602 | result = -ENODATA; | 608 | result = -ENODATA; |
603 | 609 | ||
604 | end: | 610 | end: |
605 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 611 | up(&ec->poll.sem); |
606 | 612 | end_nosem: | |
607 | if (ec->common.global_lock) | 613 | if (ec->common.global_lock) |
608 | acpi_release_global_lock(glk); | 614 | acpi_release_global_lock(glk); |
609 | 615 | ||
@@ -680,7 +686,6 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) | |||
680 | { | 686 | { |
681 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; | 687 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; |
682 | u32 value = 0; | 688 | u32 value = 0; |
683 | unsigned long flags = 0; | ||
684 | static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; | 689 | static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; |
685 | const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', | 690 | const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', |
686 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | 691 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' |
@@ -691,9 +696,11 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) | |||
691 | if (!ec_cxt) | 696 | if (!ec_cxt) |
692 | goto end; | 697 | goto end; |
693 | 698 | ||
694 | spin_lock_irqsave(&ec->poll.lock, flags); | 699 | if (down_interruptible (&ec->poll.sem)) { |
700 | return_VOID; | ||
701 | } | ||
695 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); | 702 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); |
696 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 703 | up(&ec->poll.sem); |
697 | 704 | ||
698 | /* TBD: Implement asynch events! | 705 | /* TBD: Implement asynch events! |
699 | * NOTE: All we care about are EC-SCI's. Other EC events are | 706 | * NOTE: All we care about are EC-SCI's. Other EC events are |
@@ -763,8 +770,7 @@ static u32 acpi_ec_gpe_poll_handler(void *data) | |||
763 | 770 | ||
764 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | 771 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
765 | 772 | ||
766 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 773 | status = acpi_os_execute(OSL_EC_POLL_HANDLER, acpi_ec_gpe_query, ec); |
767 | acpi_ec_gpe_query, ec); | ||
768 | 774 | ||
769 | if (status == AE_OK) | 775 | if (status == AE_OK) |
770 | return ACPI_INTERRUPT_HANDLED; | 776 | return ACPI_INTERRUPT_HANDLED; |
@@ -799,7 +805,7 @@ static u32 acpi_ec_gpe_intr_handler(void *data) | |||
799 | 805 | ||
800 | if (value & ACPI_EC_FLAG_SCI) { | 806 | if (value & ACPI_EC_FLAG_SCI) { |
801 | atomic_add(1, &ec->intr.pending_gpe); | 807 | atomic_add(1, &ec->intr.pending_gpe); |
802 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 808 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
803 | acpi_ec_gpe_query, ec); | 809 | acpi_ec_gpe_query, ec); |
804 | return status == AE_OK ? | 810 | return status == AE_OK ? |
805 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 811 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
@@ -991,7 +997,6 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
991 | int result = 0; | 997 | int result = 0; |
992 | acpi_status status = AE_OK; | 998 | acpi_status status = AE_OK; |
993 | union acpi_ec *ec = NULL; | 999 | union acpi_ec *ec = NULL; |
994 | unsigned long uid; | ||
995 | 1000 | ||
996 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1001 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
997 | 1002 | ||
@@ -1005,7 +1010,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1005 | 1010 | ||
1006 | ec->common.handle = device->handle; | 1011 | ec->common.handle = device->handle; |
1007 | ec->common.uid = -1; | 1012 | ec->common.uid = -1; |
1008 | spin_lock_init(&ec->poll.lock); | 1013 | init_MUTEX(&ec->poll.sem); |
1009 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1014 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
1010 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1015 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
1011 | acpi_driver_data(device) = ec; | 1016 | acpi_driver_data(device) = ec; |
@@ -1014,10 +1019,9 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1014 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1019 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1015 | &ec->common.global_lock); | 1020 | &ec->common.global_lock); |
1016 | 1021 | ||
1017 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1022 | /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: |
1018 | we now have the *real* EC info, so kill the makeshift one. */ | 1023 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1019 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1024 | if (ec_ecdt) { |
1020 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1021 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1025 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1022 | ACPI_ADR_SPACE_EC, | 1026 | ACPI_ADR_SPACE_EC, |
1023 | &acpi_ec_space_handler); | 1027 | &acpi_ec_space_handler); |
@@ -1062,7 +1066,6 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1062 | int result = 0; | 1066 | int result = 0; |
1063 | acpi_status status = AE_OK; | 1067 | acpi_status status = AE_OK; |
1064 | union acpi_ec *ec = NULL; | 1068 | union acpi_ec *ec = NULL; |
1065 | unsigned long uid; | ||
1066 | 1069 | ||
1067 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1070 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
1068 | 1071 | ||
@@ -1088,10 +1091,9 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1088 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1091 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1089 | &ec->common.global_lock); | 1092 | &ec->common.global_lock); |
1090 | 1093 | ||
1091 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1094 | /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: |
1092 | we now have the *real* EC info, so kill the makeshift one. */ | 1095 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1093 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1096 | if (ec_ecdt) { |
1094 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1095 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1097 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1096 | ACPI_ADR_SPACE_EC, | 1098 | ACPI_ADR_SPACE_EC, |
1097 | &acpi_ec_space_handler); | 1099 | &acpi_ec_space_handler); |
@@ -1300,7 +1302,7 @@ acpi_fake_ecdt_poll_callback(acpi_handle handle, | |||
1300 | &ec_ecdt->common.gpe_bit); | 1302 | &ec_ecdt->common.gpe_bit); |
1301 | if (ACPI_FAILURE(status)) | 1303 | if (ACPI_FAILURE(status)) |
1302 | return status; | 1304 | return status; |
1303 | spin_lock_init(&ec_ecdt->poll.lock); | 1305 | init_MUTEX(&ec_ecdt->poll.sem); |
1304 | ec_ecdt->common.global_lock = TRUE; | 1306 | ec_ecdt->common.global_lock = TRUE; |
1305 | ec_ecdt->common.handle = handle; | 1307 | ec_ecdt->common.handle = handle; |
1306 | 1308 | ||
@@ -1416,7 +1418,7 @@ static int __init acpi_ec_poll_get_real_ecdt(void) | |||
1416 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | 1418 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; |
1417 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | 1419 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; |
1418 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; | 1420 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; |
1419 | spin_lock_init(&ec_ecdt->poll.lock); | 1421 | init_MUTEX(&ec_ecdt->poll.sem); |
1420 | /* use the GL just to be safe */ | 1422 | /* use the GL just to be safe */ |
1421 | ec_ecdt->common.global_lock = TRUE; | 1423 | ec_ecdt->common.global_lock = TRUE; |
1422 | ec_ecdt->common.uid = ecdt_ptr->uid; | 1424 | ec_ecdt->common.uid = ecdt_ptr->uid; |
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index c9ac05c4685f..919037d6acff 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -68,7 +68,7 @@ acpi_status acpi_ev_initialize_events(void) | |||
68 | { | 68 | { |
69 | acpi_status status; | 69 | acpi_status status; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ev_initialize_events"); | 71 | ACPI_FUNCTION_TRACE(ev_initialize_events); |
72 | 72 | ||
73 | /* Make sure we have ACPI tables */ | 73 | /* Make sure we have ACPI tables */ |
74 | 74 | ||
@@ -118,7 +118,7 @@ acpi_status acpi_ev_install_fadt_gpes(void) | |||
118 | { | 118 | { |
119 | acpi_status status; | 119 | acpi_status status; |
120 | 120 | ||
121 | ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); | 121 | ACPI_FUNCTION_TRACE(ev_install_fadt_gpes); |
122 | 122 | ||
123 | /* Namespace must be locked */ | 123 | /* Namespace must be locked */ |
124 | 124 | ||
@@ -157,7 +157,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void) | |||
157 | { | 157 | { |
158 | acpi_status status; | 158 | acpi_status status; |
159 | 159 | ||
160 | ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers"); | 160 | ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers); |
161 | 161 | ||
162 | /* Install the SCI handler */ | 162 | /* Install the SCI handler */ |
163 | 163 | ||
@@ -241,7 +241,7 @@ u32 acpi_ev_fixed_event_detect(void) | |||
241 | u32 fixed_enable; | 241 | u32 fixed_enable; |
242 | acpi_native_uint i; | 242 | acpi_native_uint i; |
243 | 243 | ||
244 | ACPI_FUNCTION_NAME("ev_fixed_event_detect"); | 244 | ACPI_FUNCTION_NAME(ev_fixed_event_detect); |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * Read the fixed feature status and enable registers, as all the cases | 247 | * Read the fixed feature status and enable registers, as all the cases |
@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void) | |||
260 | * Check for all possible Fixed Events and dispatch those that are active | 260 | * Check for all possible Fixed Events and dispatch those that are active |
261 | */ | 261 | */ |
262 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 262 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
263 | |||
263 | /* Both the status and enable bits must be on for this event */ | 264 | /* Both the status and enable bits must be on for this event */ |
264 | 265 | ||
265 | if ((fixed_status & acpi_gbl_fixed_event_info[i]. | 266 | if ((fixed_status & acpi_gbl_fixed_event_info[i]. |
266 | status_bit_mask) | 267 | status_bit_mask) |
267 | && (fixed_enable & acpi_gbl_fixed_event_info[i]. | 268 | && (fixed_enable & acpi_gbl_fixed_event_info[i]. |
268 | enable_bit_mask)) { | 269 | enable_bit_mask)) { |
270 | |||
269 | /* Found an active (signalled) event */ | 271 | /* Found an active (signalled) event */ |
270 | 272 | ||
271 | int_status |= acpi_ev_fixed_event_dispatch((u32) i); | 273 | int_status |= acpi_ev_fixed_event_dispatch((u32) i); |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f64f977dd3d5..f01d339407f8 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -69,7 +69,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) | |||
69 | { | 69 | { |
70 | acpi_status status; | 70 | acpi_status status; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ev_set_gpe_type"); | 72 | ACPI_FUNCTION_TRACE(ev_set_gpe_type); |
73 | 73 | ||
74 | /* Validate type and update register enable masks */ | 74 | /* Validate type and update register enable masks */ |
75 | 75 | ||
@@ -115,7 +115,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
115 | struct acpi_gpe_register_info *gpe_register_info; | 115 | struct acpi_gpe_register_info *gpe_register_info; |
116 | u8 register_bit; | 116 | u8 register_bit; |
117 | 117 | ||
118 | ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks"); | 118 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); |
119 | 119 | ||
120 | gpe_register_info = gpe_event_info->register_info; | 120 | gpe_register_info = gpe_event_info->register_info; |
121 | if (!gpe_register_info) { | 121 | if (!gpe_register_info) { |
@@ -178,7 +178,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | |||
178 | { | 178 | { |
179 | acpi_status status; | 179 | acpi_status status; |
180 | 180 | ||
181 | ACPI_FUNCTION_TRACE("ev_enable_gpe"); | 181 | ACPI_FUNCTION_TRACE(ev_enable_gpe); |
182 | 182 | ||
183 | /* Make sure HW enable masks are updated */ | 183 | /* Make sure HW enable masks are updated */ |
184 | 184 | ||
@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | |||
207 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); | 207 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); |
208 | 208 | ||
209 | if (write_to_hardware) { | 209 | if (write_to_hardware) { |
210 | |||
210 | /* Clear the GPE (of stale events), then enable it */ | 211 | /* Clear the GPE (of stale events), then enable it */ |
211 | 212 | ||
212 | status = acpi_hw_clear_gpe(gpe_event_info); | 213 | status = acpi_hw_clear_gpe(gpe_event_info); |
@@ -243,7 +244,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
243 | { | 244 | { |
244 | acpi_status status; | 245 | acpi_status status; |
245 | 246 | ||
246 | ACPI_FUNCTION_TRACE("ev_disable_gpe"); | 247 | ACPI_FUNCTION_TRACE(ev_disable_gpe); |
247 | 248 | ||
248 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { | 249 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { |
249 | return_ACPI_STATUS(AE_OK); | 250 | return_ACPI_STATUS(AE_OK); |
@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
313 | /* A NULL gpe_block means use the FADT-defined GPE block(s) */ | 314 | /* A NULL gpe_block means use the FADT-defined GPE block(s) */ |
314 | 315 | ||
315 | if (!gpe_device) { | 316 | if (!gpe_device) { |
317 | |||
316 | /* Examine GPE Block 0 and 1 (These blocks are permanent) */ | 318 | /* Examine GPE Block 0 and 1 (These blocks are permanent) */ |
317 | 319 | ||
318 | for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { | 320 | for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { |
@@ -380,10 +382,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
380 | u32 status_reg; | 382 | u32 status_reg; |
381 | u32 enable_reg; | 383 | u32 enable_reg; |
382 | acpi_cpu_flags flags; | 384 | acpi_cpu_flags flags; |
385 | acpi_cpu_flags hw_flags; | ||
383 | acpi_native_uint i; | 386 | acpi_native_uint i; |
384 | acpi_native_uint j; | 387 | acpi_native_uint j; |
385 | 388 | ||
386 | ACPI_FUNCTION_NAME("ev_gpe_detect"); | 389 | ACPI_FUNCTION_NAME(ev_gpe_detect); |
387 | 390 | ||
388 | /* Check for the case where there are no GPEs */ | 391 | /* Check for the case where there are no GPEs */ |
389 | 392 | ||
@@ -391,9 +394,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
391 | return (int_status); | 394 | return (int_status); |
392 | } | 395 | } |
393 | 396 | ||
394 | /* Examine all GPE blocks attached to this interrupt level */ | 397 | /* We need to hold the GPE lock now, hardware lock in the loop */ |
395 | 398 | ||
396 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 399 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
400 | |||
401 | /* Examine all GPE blocks attached to this interrupt level */ | ||
402 | |||
397 | gpe_block = gpe_xrupt_list->gpe_block_list_head; | 403 | gpe_block = gpe_xrupt_list->gpe_block_list_head; |
398 | while (gpe_block) { | 404 | while (gpe_block) { |
399 | /* | 405 | /* |
@@ -402,10 +408,13 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
402 | * Find all currently active GP events. | 408 | * Find all currently active GP events. |
403 | */ | 409 | */ |
404 | for (i = 0; i < gpe_block->register_count; i++) { | 410 | for (i = 0; i < gpe_block->register_count; i++) { |
411 | |||
405 | /* Get the next status/enable pair */ | 412 | /* Get the next status/enable pair */ |
406 | 413 | ||
407 | gpe_register_info = &gpe_block->register_info[i]; | 414 | gpe_register_info = &gpe_block->register_info[i]; |
408 | 415 | ||
416 | hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | ||
417 | |||
409 | /* Read the Status Register */ | 418 | /* Read the Status Register */ |
410 | 419 | ||
411 | status = | 420 | status = |
@@ -414,6 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
414 | &gpe_register_info-> | 423 | &gpe_register_info-> |
415 | status_address); | 424 | status_address); |
416 | if (ACPI_FAILURE(status)) { | 425 | if (ACPI_FAILURE(status)) { |
426 | acpi_os_release_lock(acpi_gbl_hardware_lock, | ||
427 | hw_flags); | ||
417 | goto unlock_and_exit; | 428 | goto unlock_and_exit; |
418 | } | 429 | } |
419 | 430 | ||
@@ -424,6 +435,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
424 | &enable_reg, | 435 | &enable_reg, |
425 | &gpe_register_info-> | 436 | &gpe_register_info-> |
426 | enable_address); | 437 | enable_address); |
438 | acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags); | ||
439 | |||
427 | if (ACPI_FAILURE(status)) { | 440 | if (ACPI_FAILURE(status)) { |
428 | goto unlock_and_exit; | 441 | goto unlock_and_exit; |
429 | } | 442 | } |
@@ -437,6 +450,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
437 | 450 | ||
438 | enabled_status_byte = (u8) (status_reg & enable_reg); | 451 | enabled_status_byte = (u8) (status_reg & enable_reg); |
439 | if (!enabled_status_byte) { | 452 | if (!enabled_status_byte) { |
453 | |||
440 | /* No active GPEs in this register, move on */ | 454 | /* No active GPEs in this register, move on */ |
441 | 455 | ||
442 | continue; | 456 | continue; |
@@ -445,6 +459,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
445 | /* Now look at the individual GPEs in this byte register */ | 459 | /* Now look at the individual GPEs in this byte register */ |
446 | 460 | ||
447 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 461 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
462 | |||
448 | /* Examine one GPE bit */ | 463 | /* Examine one GPE bit */ |
449 | 464 | ||
450 | if (enabled_status_byte & | 465 | if (enabled_status_byte & |
@@ -483,9 +498,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
483 | * | 498 | * |
484 | * RETURN: None | 499 | * RETURN: None |
485 | * | 500 | * |
486 | * DESCRIPTION: Perform the actual execution of a GPE control method. This | 501 | * DESCRIPTION: Perform the actual execution of a GPE control method. This |
487 | * function is called from an invocation of acpi_os_queue_for_execution | 502 | * function is called from an invocation of acpi_os_execute and |
488 | * (and therefore does NOT execute at interrupt level) so that | 503 | * therefore does NOT execute at interrupt level - so that |
489 | * the control method itself is not executed in the context of | 504 | * the control method itself is not executed in the context of |
490 | * an interrupt handler. | 505 | * an interrupt handler. |
491 | * | 506 | * |
@@ -494,12 +509,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
494 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | 509 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) |
495 | { | 510 | { |
496 | struct acpi_gpe_event_info *gpe_event_info = (void *)context; | 511 | struct acpi_gpe_event_info *gpe_event_info = (void *)context; |
497 | u32 gpe_number = 0; | ||
498 | acpi_status status; | 512 | acpi_status status; |
499 | struct acpi_gpe_event_info local_gpe_event_info; | 513 | struct acpi_gpe_event_info local_gpe_event_info; |
500 | struct acpi_parameter_info info; | 514 | struct acpi_evaluate_info *info; |
501 | 515 | ||
502 | ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method"); | 516 | ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); |
503 | 517 | ||
504 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 518 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
505 | if (ACPI_FAILURE(status)) { | 519 | if (ACPI_FAILURE(status)) { |
@@ -535,22 +549,35 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
535 | */ | 549 | */ |
536 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == | 550 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == |
537 | ACPI_GPE_DISPATCH_METHOD) { | 551 | ACPI_GPE_DISPATCH_METHOD) { |
538 | /* | ||
539 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | ||
540 | * control method that corresponds to this GPE | ||
541 | */ | ||
542 | info.node = local_gpe_event_info.dispatch.method_node; | ||
543 | info.parameters = | ||
544 | ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info); | ||
545 | info.parameter_type = ACPI_PARAM_GPE; | ||
546 | 552 | ||
547 | status = acpi_ns_evaluate_by_handle(&info); | 553 | /* Allocate the evaluation information block */ |
554 | |||
555 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
556 | if (!info) { | ||
557 | status = AE_NO_MEMORY; | ||
558 | } else { | ||
559 | /* | ||
560 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | ||
561 | * control method that corresponds to this GPE | ||
562 | */ | ||
563 | info->prefix_node = | ||
564 | local_gpe_event_info.dispatch.method_node; | ||
565 | info->parameters = | ||
566 | ACPI_CAST_PTR(union acpi_operand_object *, | ||
567 | gpe_event_info); | ||
568 | info->parameter_type = ACPI_PARAM_GPE; | ||
569 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
570 | |||
571 | status = acpi_ns_evaluate(info); | ||
572 | ACPI_FREE(info); | ||
573 | } | ||
574 | |||
548 | if (ACPI_FAILURE(status)) { | 575 | if (ACPI_FAILURE(status)) { |
549 | ACPI_EXCEPTION((AE_INFO, status, | 576 | ACPI_EXCEPTION((AE_INFO, status, |
550 | "While evaluating method [%4.4s] for GPE[%2X]", | 577 | "While evaluating GPE method [%4.4s]", |
551 | acpi_ut_get_node_name | 578 | acpi_ut_get_node_name |
552 | (local_gpe_event_info.dispatch. | 579 | (local_gpe_event_info.dispatch. |
553 | method_node), gpe_number)); | 580 | method_node))); |
554 | } | 581 | } |
555 | } | 582 | } |
556 | 583 | ||
@@ -593,7 +620,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
593 | { | 620 | { |
594 | acpi_status status; | 621 | acpi_status status; |
595 | 622 | ||
596 | ACPI_FUNCTION_TRACE("ev_gpe_dispatch"); | 623 | ACPI_FUNCTION_TRACE(ev_gpe_dispatch); |
597 | 624 | ||
598 | /* | 625 | /* |
599 | * If edge-triggered, clear the GPE status bit now. Note that | 626 | * If edge-triggered, clear the GPE status bit now. Note that |
@@ -669,9 +696,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
669 | * Execute the method associated with the GPE | 696 | * Execute the method associated with the GPE |
670 | * NOTE: Level-triggered GPEs are cleared after the method completes. | 697 | * NOTE: Level-triggered GPEs are cleared after the method completes. |
671 | */ | 698 | */ |
672 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 699 | status = acpi_os_execute(OSL_GPE_HANDLER, |
673 | acpi_ev_asynch_execute_gpe_method, | 700 | acpi_ev_asynch_execute_gpe_method, |
674 | gpe_event_info); | 701 | gpe_event_info); |
675 | if (ACPI_FAILURE(status)) { | 702 | if (ACPI_FAILURE(status)) { |
676 | ACPI_EXCEPTION((AE_INFO, status, | 703 | ACPI_EXCEPTION((AE_INFO, status, |
677 | "Unable to queue handler for GPE[%2X] - event disabled", | 704 | "Unable to queue handler for GPE[%2X] - event disabled", |
@@ -716,7 +743,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
716 | * | 743 | * |
717 | * DESCRIPTION: Determine if a a GPE is "wake-only". | 744 | * DESCRIPTION: Determine if a a GPE is "wake-only". |
718 | * | 745 | * |
719 | * Called from Notify() code in interpreter when a "device_wake" | 746 | * Called from Notify() code in interpreter when a "DeviceWake" |
720 | * Notify comes in. | 747 | * Notify comes in. |
721 | * | 748 | * |
722 | ******************************************************************************/ | 749 | ******************************************************************************/ |
@@ -726,7 +753,7 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
726 | { | 753 | { |
727 | acpi_status status; | 754 | acpi_status status; |
728 | 755 | ||
729 | ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe"); | 756 | ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe); |
730 | 757 | ||
731 | if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ | 758 | if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ |
732 | ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ | 759 | ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 0fd00b5ad650..95ddeb48bc0f 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -131,14 +131,14 @@ 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; |
138 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
139 | acpi_cpu_flags flags; | 139 | acpi_cpu_flags flags; |
140 | 140 | ||
141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); | 141 | ACPI_FUNCTION_TRACE(ev_walk_gpe_list); |
142 | 142 | ||
143 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 143 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
144 | 144 | ||
@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | |||
146 | 146 | ||
147 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | 147 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; |
148 | while (gpe_xrupt_info) { | 148 | while (gpe_xrupt_info) { |
149 | |||
149 | /* Walk all Gpe Blocks attached to this interrupt level */ | 150 | /* Walk all Gpe Blocks attached to this interrupt level */ |
150 | 151 | ||
151 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | 152 | gpe_block = gpe_xrupt_info->gpe_block_list_head; |
152 | while (gpe_block) { | 153 | while (gpe_block) { |
154 | |||
153 | /* One callback per GPE block */ | 155 | /* One callback per GPE block */ |
154 | 156 | ||
155 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); | 157 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); |
@@ -190,11 +192,12 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
190 | acpi_native_uint i; | 192 | acpi_native_uint i; |
191 | acpi_native_uint j; | 193 | acpi_native_uint j; |
192 | 194 | ||
193 | ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); | 195 | ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers); |
194 | 196 | ||
195 | /* Examine each GPE Register within the block */ | 197 | /* Examine each GPE Register within the block */ |
196 | 198 | ||
197 | for (i = 0; i < gpe_block->register_count; i++) { | 199 | for (i = 0; i < gpe_block->register_count; i++) { |
200 | |||
198 | /* Now look at the individual GPEs in this byte register */ | 201 | /* Now look at the individual GPEs in this byte register */ |
199 | 202 | ||
200 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 203 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
@@ -204,7 +207,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
204 | 207 | ||
205 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 208 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
206 | ACPI_GPE_DISPATCH_HANDLER) { | 209 | ACPI_GPE_DISPATCH_HANDLER) { |
207 | ACPI_MEM_FREE(gpe_event_info->dispatch.handler); | 210 | ACPI_FREE(gpe_event_info->dispatch.handler); |
208 | gpe_event_info->dispatch.handler = NULL; | 211 | gpe_event_info->dispatch.handler = NULL; |
209 | gpe_event_info->flags &= | 212 | gpe_event_info->flags &= |
210 | ~ACPI_GPE_DISPATCH_MASK; | 213 | ~ACPI_GPE_DISPATCH_MASK; |
@@ -248,7 +251,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
248 | u8 type; | 251 | u8 type; |
249 | acpi_status status; | 252 | acpi_status status; |
250 | 253 | ||
251 | ACPI_FUNCTION_TRACE("ev_save_method_info"); | 254 | ACPI_FUNCTION_TRACE(ev_save_method_info); |
252 | 255 | ||
253 | /* | 256 | /* |
254 | * _Lxx and _Exx GPE method support | 257 | * _Lxx and _Exx GPE method support |
@@ -279,9 +282,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
279 | default: | 282 | default: |
280 | /* Unknown method type, just ignore it! */ | 283 | /* Unknown method type, just ignore it! */ |
281 | 284 | ||
282 | ACPI_ERROR((AE_INFO, | 285 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
283 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)", | 286 | "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)", |
284 | name)); | 287 | name)); |
285 | return_ACPI_STATUS(AE_OK); | 288 | return_ACPI_STATUS(AE_OK); |
286 | } | 289 | } |
287 | 290 | ||
@@ -289,11 +292,12 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
289 | 292 | ||
290 | gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); | 293 | gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); |
291 | if (gpe_number == ACPI_UINT32_MAX) { | 294 | if (gpe_number == ACPI_UINT32_MAX) { |
295 | |||
292 | /* Conversion failed; invalid method, just ignore it */ | 296 | /* Conversion failed; invalid method, just ignore it */ |
293 | 297 | ||
294 | ACPI_ERROR((AE_INFO, | 298 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
295 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", | 299 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", |
296 | name)); | 300 | name)); |
297 | return_ACPI_STATUS(AE_OK); | 301 | return_ACPI_STATUS(AE_OK); |
298 | } | 302 | } |
299 | 303 | ||
@@ -364,13 +368,14 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
364 | u32 gpe_number; | 368 | u32 gpe_number; |
365 | acpi_status status; | 369 | acpi_status status; |
366 | 370 | ||
367 | ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe"); | 371 | ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe); |
368 | 372 | ||
369 | /* Check for a _PRW method under this device */ | 373 | /* Check for a _PRW method under this device */ |
370 | 374 | ||
371 | status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, | 375 | status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, |
372 | ACPI_BTYPE_PACKAGE, &pkg_desc); | 376 | ACPI_BTYPE_PACKAGE, &pkg_desc); |
373 | if (ACPI_FAILURE(status)) { | 377 | if (ACPI_FAILURE(status)) { |
378 | |||
374 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ | 379 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ |
375 | 380 | ||
376 | return_ACPI_STATUS(AE_OK); | 381 | return_ACPI_STATUS(AE_OK); |
@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
394 | obj_desc = pkg_desc->package.elements[0]; | 399 | obj_desc = pkg_desc->package.elements[0]; |
395 | 400 | ||
396 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 401 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
402 | |||
397 | /* Use FADT-defined GPE device (from definition of _PRW) */ | 403 | /* Use FADT-defined GPE device (from definition of _PRW) */ |
398 | 404 | ||
399 | target_gpe_device = acpi_gbl_fadt_gpe_device; | 405 | target_gpe_device = acpi_gbl_fadt_gpe_device; |
@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
402 | 408 | ||
403 | gpe_number = (u32) obj_desc->integer.value; | 409 | gpe_number = (u32) obj_desc->integer.value; |
404 | } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 410 | } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { |
411 | |||
405 | /* Package contains a GPE reference and GPE number within a GPE block */ | 412 | /* Package contains a GPE reference and GPE number within a GPE block */ |
406 | 413 | ||
407 | if ((obj_desc->package.count < 2) || | 414 | if ((obj_desc->package.count < 2) || |
@@ -482,7 +489,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
482 | acpi_status status; | 489 | acpi_status status; |
483 | acpi_cpu_flags flags; | 490 | acpi_cpu_flags flags; |
484 | 491 | ||
485 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); | 492 | ACPI_FUNCTION_TRACE(ev_get_gpe_xrupt_block); |
486 | 493 | ||
487 | /* No need for lock since we are not changing any list elements here */ | 494 | /* No need for lock since we are not changing any list elements here */ |
488 | 495 | ||
@@ -497,7 +504,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
497 | 504 | ||
498 | /* Not found, must allocate a new xrupt descriptor */ | 505 | /* Not found, must allocate a new xrupt descriptor */ |
499 | 506 | ||
500 | gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); | 507 | gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info)); |
501 | if (!gpe_xrupt) { | 508 | if (!gpe_xrupt) { |
502 | return_PTR(NULL); | 509 | return_PTR(NULL); |
503 | } | 510 | } |
@@ -556,7 +563,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
556 | acpi_status status; | 563 | acpi_status status; |
557 | acpi_cpu_flags flags; | 564 | acpi_cpu_flags flags; |
558 | 565 | ||
559 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); | 566 | ACPI_FUNCTION_TRACE(ev_delete_gpe_xrupt); |
560 | 567 | ||
561 | /* We never want to remove the SCI interrupt handler */ | 568 | /* We never want to remove the SCI interrupt handler */ |
562 | 569 | ||
@@ -588,7 +595,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
588 | 595 | ||
589 | /* Free the block */ | 596 | /* Free the block */ |
590 | 597 | ||
591 | ACPI_MEM_FREE(gpe_xrupt); | 598 | ACPI_FREE(gpe_xrupt); |
592 | return_ACPI_STATUS(AE_OK); | 599 | return_ACPI_STATUS(AE_OK); |
593 | } | 600 | } |
594 | 601 | ||
@@ -614,7 +621,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
614 | acpi_status status; | 621 | acpi_status status; |
615 | acpi_cpu_flags flags; | 622 | acpi_cpu_flags flags; |
616 | 623 | ||
617 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 624 | ACPI_FUNCTION_TRACE(ev_install_gpe_block); |
618 | 625 | ||
619 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 626 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
620 | if (ACPI_FAILURE(status)) { | 627 | if (ACPI_FAILURE(status)) { |
@@ -667,7 +674,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
667 | acpi_status status; | 674 | acpi_status status; |
668 | acpi_cpu_flags flags; | 675 | acpi_cpu_flags flags; |
669 | 676 | ||
670 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 677 | ACPI_FUNCTION_TRACE(ev_install_gpe_block); |
671 | 678 | ||
672 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 679 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
673 | if (ACPI_FAILURE(status)) { | 680 | if (ACPI_FAILURE(status)) { |
@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
679 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); | 686 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); |
680 | 687 | ||
681 | if (!gpe_block->previous && !gpe_block->next) { | 688 | if (!gpe_block->previous && !gpe_block->next) { |
689 | |||
682 | /* This is the last gpe_block on this interrupt */ | 690 | /* This is the last gpe_block on this interrupt */ |
683 | 691 | ||
684 | status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); | 692 | status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); |
@@ -704,9 +712,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
704 | 712 | ||
705 | /* Free the gpe_block */ | 713 | /* Free the gpe_block */ |
706 | 714 | ||
707 | ACPI_MEM_FREE(gpe_block->register_info); | 715 | ACPI_FREE(gpe_block->register_info); |
708 | ACPI_MEM_FREE(gpe_block->event_info); | 716 | ACPI_FREE(gpe_block->event_info); |
709 | ACPI_MEM_FREE(gpe_block); | 717 | ACPI_FREE(gpe_block); |
710 | 718 | ||
711 | unlock_and_exit: | 719 | unlock_and_exit: |
712 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 720 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
@@ -736,17 +744,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
736 | acpi_native_uint j; | 744 | acpi_native_uint j; |
737 | acpi_status status; | 745 | acpi_status status; |
738 | 746 | ||
739 | ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks"); | 747 | ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks); |
740 | 748 | ||
741 | /* Allocate the GPE register information block */ | 749 | /* Allocate the GPE register information block */ |
742 | 750 | ||
743 | gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> | 751 | gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block-> |
744 | register_count * | 752 | register_count * |
745 | sizeof(struct | 753 | sizeof(struct |
746 | acpi_gpe_register_info)); | 754 | acpi_gpe_register_info)); |
747 | if (!gpe_register_info) { | 755 | if (!gpe_register_info) { |
748 | ACPI_ERROR((AE_INFO, | 756 | ACPI_ERROR((AE_INFO, |
749 | "Could not allocate the gpe_register_info table")); | 757 | "Could not allocate the GpeRegisterInfo table")); |
750 | return_ACPI_STATUS(AE_NO_MEMORY); | 758 | return_ACPI_STATUS(AE_NO_MEMORY); |
751 | } | 759 | } |
752 | 760 | ||
@@ -754,13 +762,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
754 | * Allocate the GPE event_info block. There are eight distinct GPEs | 762 | * Allocate the GPE event_info block. There are eight distinct GPEs |
755 | * per register. Initialization to zeros is sufficient. | 763 | * per register. Initialization to zeros is sufficient. |
756 | */ | 764 | */ |
757 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> | 765 | gpe_event_info = ACPI_ALLOCATE_ZEROED(((acpi_size) gpe_block-> |
758 | register_count * | 766 | register_count * |
759 | ACPI_GPE_REGISTER_WIDTH) * | 767 | ACPI_GPE_REGISTER_WIDTH) * |
760 | sizeof(struct acpi_gpe_event_info)); | 768 | sizeof(struct |
769 | acpi_gpe_event_info)); | ||
761 | if (!gpe_event_info) { | 770 | if (!gpe_event_info) { |
762 | ACPI_ERROR((AE_INFO, | 771 | ACPI_ERROR((AE_INFO, |
763 | "Could not allocate the gpe_event_info table")); | 772 | "Could not allocate the GpeEventInfo table")); |
764 | status = AE_NO_MEMORY; | 773 | status = AE_NO_MEMORY; |
765 | goto error_exit; | 774 | goto error_exit; |
766 | } | 775 | } |
@@ -780,6 +789,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
780 | this_event = gpe_event_info; | 789 | this_event = gpe_event_info; |
781 | 790 | ||
782 | for (i = 0; i < gpe_block->register_count; i++) { | 791 | for (i = 0; i < gpe_block->register_count; i++) { |
792 | |||
783 | /* Init the register_info for this GPE register (8 GPEs) */ | 793 | /* Init the register_info for this GPE register (8 GPEs) */ |
784 | 794 | ||
785 | this_register->base_gpe_number = | 795 | this_register->base_gpe_number = |
@@ -839,10 +849,10 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
839 | 849 | ||
840 | error_exit: | 850 | error_exit: |
841 | if (gpe_register_info) { | 851 | if (gpe_register_info) { |
842 | ACPI_MEM_FREE(gpe_register_info); | 852 | ACPI_FREE(gpe_register_info); |
843 | } | 853 | } |
844 | if (gpe_event_info) { | 854 | if (gpe_event_info) { |
845 | ACPI_MEM_FREE(gpe_event_info); | 855 | ACPI_FREE(gpe_event_info); |
846 | } | 856 | } |
847 | 857 | ||
848 | return_ACPI_STATUS(status); | 858 | return_ACPI_STATUS(status); |
@@ -878,7 +888,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
878 | acpi_status status; | 888 | acpi_status status; |
879 | struct acpi_gpe_block_info *gpe_block; | 889 | struct acpi_gpe_block_info *gpe_block; |
880 | 890 | ||
881 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); | 891 | ACPI_FUNCTION_TRACE(ev_create_gpe_block); |
882 | 892 | ||
883 | if (!register_count) { | 893 | if (!register_count) { |
884 | return_ACPI_STATUS(AE_OK); | 894 | return_ACPI_STATUS(AE_OK); |
@@ -886,7 +896,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
886 | 896 | ||
887 | /* Allocate a new GPE block */ | 897 | /* Allocate a new GPE block */ |
888 | 898 | ||
889 | gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); | 899 | gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info)); |
890 | if (!gpe_block) { | 900 | if (!gpe_block) { |
891 | return_ACPI_STATUS(AE_NO_MEMORY); | 901 | return_ACPI_STATUS(AE_NO_MEMORY); |
892 | } | 902 | } |
@@ -906,7 +916,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
906 | */ | 916 | */ |
907 | status = acpi_ev_create_gpe_info_blocks(gpe_block); | 917 | status = acpi_ev_create_gpe_info_blocks(gpe_block); |
908 | if (ACPI_FAILURE(status)) { | 918 | if (ACPI_FAILURE(status)) { |
909 | ACPI_MEM_FREE(gpe_block); | 919 | ACPI_FREE(gpe_block); |
910 | return_ACPI_STATUS(status); | 920 | return_ACPI_STATUS(status); |
911 | } | 921 | } |
912 | 922 | ||
@@ -914,7 +924,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
914 | 924 | ||
915 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); | 925 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); |
916 | if (ACPI_FAILURE(status)) { | 926 | if (ACPI_FAILURE(status)) { |
917 | ACPI_MEM_FREE(gpe_block); | 927 | ACPI_FREE(gpe_block); |
918 | return_ACPI_STATUS(status); | 928 | return_ACPI_STATUS(status); |
919 | } | 929 | } |
920 | 930 | ||
@@ -971,7 +981,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
971 | acpi_native_uint i; | 981 | acpi_native_uint i; |
972 | acpi_native_uint j; | 982 | acpi_native_uint j; |
973 | 983 | ||
974 | ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); | 984 | ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); |
975 | 985 | ||
976 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ | 986 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ |
977 | 987 | ||
@@ -1013,6 +1023,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1013 | 1023 | ||
1014 | for (i = 0; i < gpe_block->register_count; i++) { | 1024 | for (i = 0; i < gpe_block->register_count; i++) { |
1015 | for (j = 0; j < 8; j++) { | 1025 | for (j = 0; j < 8; j++) { |
1026 | |||
1016 | /* Get the info block for this particular GPE */ | 1027 | /* Get the info block for this particular GPE */ |
1017 | 1028 | ||
1018 | gpe_event_info = | 1029 | gpe_event_info = |
@@ -1040,7 +1051,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1040 | 1051 | ||
1041 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); | 1052 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); |
1042 | if (ACPI_FAILURE(status)) { | 1053 | if (ACPI_FAILURE(status)) { |
1043 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p", | 1054 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", |
1044 | gpe_block)); | 1055 | gpe_block)); |
1045 | } | 1056 | } |
1046 | 1057 | ||
@@ -1066,7 +1077,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1066 | u32 gpe_number_max = 0; | 1077 | u32 gpe_number_max = 0; |
1067 | acpi_status status; | 1078 | acpi_status status; |
1068 | 1079 | ||
1069 | ACPI_FUNCTION_TRACE("ev_gpe_initialize"); | 1080 | ACPI_FUNCTION_TRACE(ev_gpe_initialize); |
1070 | 1081 | ||
1071 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 1082 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
1072 | if (ACPI_FAILURE(status)) { | 1083 | if (ACPI_FAILURE(status)) { |
@@ -1099,6 +1110,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1099 | * particular block is not supported. | 1110 | * particular block is not supported. |
1100 | */ | 1111 | */ |
1101 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { | 1112 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { |
1113 | |||
1102 | /* GPE block 0 exists (has both length and address > 0) */ | 1114 | /* GPE block 0 exists (has both length and address > 0) */ |
1103 | 1115 | ||
1104 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); | 1116 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); |
@@ -1121,6 +1133,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1121 | } | 1133 | } |
1122 | 1134 | ||
1123 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { | 1135 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { |
1136 | |||
1124 | /* GPE block 1 exists (has both length and address > 0) */ | 1137 | /* GPE block 1 exists (has both length and address > 0) */ |
1125 | 1138 | ||
1126 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); | 1139 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); |
@@ -1168,6 +1181,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1168 | /* Exit if there are no GPE registers */ | 1181 | /* Exit if there are no GPE registers */ |
1169 | 1182 | ||
1170 | if ((register_count0 + register_count1) == 0) { | 1183 | if ((register_count0 + register_count1) == 0) { |
1184 | |||
1171 | /* GPEs are not required by ACPI, this is OK */ | 1185 | /* GPEs are not required by ACPI, this is OK */ |
1172 | 1186 | ||
1173 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 1187 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 0909ba69577e..6eef4efddcf6 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -49,12 +49,13 @@ | |||
49 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evmisc") | 50 | ACPI_MODULE_NAME("evmisc") |
51 | 51 | ||
52 | /* Names for Notify() values, used for debug output */ | ||
52 | #ifdef ACPI_DEBUG_OUTPUT | 53 | #ifdef ACPI_DEBUG_OUTPUT |
53 | static const char *acpi_notify_value_names[] = { | 54 | static const char *acpi_notify_value_names[] = { |
54 | "Bus Check", | 55 | "Bus Check", |
55 | "Device Check", | 56 | "Device Check", |
56 | "Device Wake", | 57 | "Device Wake", |
57 | "Eject request", | 58 | "Eject Request", |
58 | "Device Check Light", | 59 | "Device Check Light", |
59 | "Frequency Mismatch", | 60 | "Frequency Mismatch", |
60 | "Bus Mode Mismatch", | 61 | "Bus Mode Mismatch", |
@@ -124,7 +125,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
124 | union acpi_generic_state *notify_info; | 125 | union acpi_generic_state *notify_info; |
125 | acpi_status status = AE_OK; | 126 | acpi_status status = AE_OK; |
126 | 127 | ||
127 | ACPI_FUNCTION_NAME("ev_queue_notify_request"); | 128 | ACPI_FUNCTION_NAME(ev_queue_notify_request); |
128 | 129 | ||
129 | /* | 130 | /* |
130 | * For value 3 (Ejection Request), some device method may need to be run. | 131 | * For value 3 (Ejection Request), some device method may need to be run. |
@@ -150,6 +151,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
150 | 151 | ||
151 | obj_desc = acpi_ns_get_attached_object(node); | 152 | obj_desc = acpi_ns_get_attached_object(node); |
152 | if (obj_desc) { | 153 | if (obj_desc) { |
154 | |||
153 | /* We have the notify object, Get the right handler */ | 155 | /* We have the notify object, Get the right handler */ |
154 | 156 | ||
155 | switch (node->type) { | 157 | switch (node->type) { |
@@ -184,14 +186,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
184 | return (AE_NO_MEMORY); | 186 | return (AE_NO_MEMORY); |
185 | } | 187 | } |
186 | 188 | ||
187 | notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; | 189 | notify_info->common.descriptor_type = |
190 | ACPI_DESC_TYPE_STATE_NOTIFY; | ||
188 | notify_info->notify.node = node; | 191 | notify_info->notify.node = node; |
189 | notify_info->notify.value = (u16) notify_value; | 192 | notify_info->notify.value = (u16) notify_value; |
190 | notify_info->notify.handler_obj = handler_obj; | 193 | notify_info->notify.handler_obj = handler_obj; |
191 | 194 | ||
192 | status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, | 195 | status = |
193 | acpi_ev_notify_dispatch, | 196 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, |
194 | notify_info); | 197 | notify_info); |
195 | if (ACPI_FAILURE(status)) { | 198 | if (ACPI_FAILURE(status)) { |
196 | acpi_ut_delete_generic_state(notify_info); | 199 | acpi_ut_delete_generic_state(notify_info); |
197 | } | 200 | } |
@@ -240,6 +243,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) | |||
240 | * to the device. | 243 | * to the device. |
241 | */ | 244 | */ |
242 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { | 245 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { |
246 | |||
243 | /* Global system notification handler */ | 247 | /* Global system notification handler */ |
244 | 248 | ||
245 | if (acpi_gbl_system_notify.handler) { | 249 | if (acpi_gbl_system_notify.handler) { |
@@ -297,6 +301,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) | |||
297 | /* Signal threads that are waiting for the lock */ | 301 | /* Signal threads that are waiting for the lock */ |
298 | 302 | ||
299 | if (acpi_gbl_global_lock_thread_count) { | 303 | if (acpi_gbl_global_lock_thread_count) { |
304 | |||
300 | /* Send sufficient units to the semaphore */ | 305 | /* Send sufficient units to the semaphore */ |
301 | 306 | ||
302 | status = | 307 | status = |
@@ -335,15 +340,16 @@ static u32 acpi_ev_global_lock_handler(void *context) | |||
335 | */ | 340 | */ |
336 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 341 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); |
337 | if (acquired) { | 342 | if (acquired) { |
343 | |||
338 | /* Got the lock, now wake all threads waiting for it */ | 344 | /* Got the lock, now wake all threads waiting for it */ |
339 | 345 | ||
340 | acpi_gbl_global_lock_acquired = TRUE; | 346 | acpi_gbl_global_lock_acquired = TRUE; |
341 | 347 | ||
342 | /* Run the Global Lock thread which will signal all waiting threads */ | 348 | /* Run the Global Lock thread which will signal all waiting threads */ |
343 | 349 | ||
344 | status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, | 350 | status = |
345 | acpi_ev_global_lock_thread, | 351 | acpi_os_execute(OSL_GLOBAL_LOCK_HANDLER, |
346 | context); | 352 | acpi_ev_global_lock_thread, context); |
347 | if (ACPI_FAILURE(status)) { | 353 | if (ACPI_FAILURE(status)) { |
348 | ACPI_EXCEPTION((AE_INFO, status, | 354 | ACPI_EXCEPTION((AE_INFO, status, |
349 | "Could not queue Global Lock thread")); | 355 | "Could not queue Global Lock thread")); |
@@ -371,7 +377,7 @@ acpi_status acpi_ev_init_global_lock_handler(void) | |||
371 | { | 377 | { |
372 | acpi_status status; | 378 | acpi_status status; |
373 | 379 | ||
374 | ACPI_FUNCTION_TRACE("ev_init_global_lock_handler"); | 380 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); |
375 | 381 | ||
376 | acpi_gbl_global_lock_present = TRUE; | 382 | acpi_gbl_global_lock_present = TRUE; |
377 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, | 383 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, |
@@ -413,7 +419,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
413 | acpi_status status = AE_OK; | 419 | acpi_status status = AE_OK; |
414 | u8 acquired = FALSE; | 420 | u8 acquired = FALSE; |
415 | 421 | ||
416 | ACPI_FUNCTION_TRACE("ev_acquire_global_lock"); | 422 | ACPI_FUNCTION_TRACE(ev_acquire_global_lock); |
417 | 423 | ||
418 | #ifndef ACPI_APPLICATION | 424 | #ifndef ACPI_APPLICATION |
419 | /* Make sure that we actually have a global lock */ | 425 | /* Make sure that we actually have a global lock */ |
@@ -439,6 +445,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
439 | 445 | ||
440 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 446 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); |
441 | if (acquired) { | 447 | if (acquired) { |
448 | |||
442 | /* We got the lock */ | 449 | /* We got the lock */ |
443 | 450 | ||
444 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 451 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -458,8 +465,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
458 | * Acquire the global lock semaphore first. | 465 | * Acquire the global lock semaphore first. |
459 | * Since this wait will block, we must release the interpreter | 466 | * Since this wait will block, we must release the interpreter |
460 | */ | 467 | */ |
461 | status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, | 468 | status = |
462 | timeout); | 469 | acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, |
470 | timeout); | ||
463 | return_ACPI_STATUS(status); | 471 | return_ACPI_STATUS(status); |
464 | } | 472 | } |
465 | 473 | ||
@@ -480,7 +488,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
480 | u8 pending = FALSE; | 488 | u8 pending = FALSE; |
481 | acpi_status status = AE_OK; | 489 | acpi_status status = AE_OK; |
482 | 490 | ||
483 | ACPI_FUNCTION_TRACE("ev_release_global_lock"); | 491 | ACPI_FUNCTION_TRACE(ev_release_global_lock); |
484 | 492 | ||
485 | if (!acpi_gbl_global_lock_thread_count) { | 493 | if (!acpi_gbl_global_lock_thread_count) { |
486 | ACPI_WARNING((AE_INFO, | 494 | ACPI_WARNING((AE_INFO, |
@@ -492,6 +500,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
492 | 500 | ||
493 | acpi_gbl_global_lock_thread_count--; | 501 | acpi_gbl_global_lock_thread_count--; |
494 | if (acpi_gbl_global_lock_thread_count) { | 502 | if (acpi_gbl_global_lock_thread_count) { |
503 | |||
495 | /* There are still some threads holding the lock, cannot release */ | 504 | /* There are still some threads holding the lock, cannot release */ |
496 | 505 | ||
497 | return_ACPI_STATUS(AE_OK); | 506 | return_ACPI_STATUS(AE_OK); |
@@ -533,7 +542,7 @@ void acpi_ev_terminate(void) | |||
533 | acpi_native_uint i; | 542 | acpi_native_uint i; |
534 | acpi_status status; | 543 | acpi_status status; |
535 | 544 | ||
536 | ACPI_FUNCTION_TRACE("ev_terminate"); | 545 | ACPI_FUNCTION_TRACE(ev_terminate); |
537 | 546 | ||
538 | if (acpi_gbl_events_initialized) { | 547 | if (acpi_gbl_events_initialized) { |
539 | /* | 548 | /* |
@@ -573,7 +582,7 @@ void acpi_ev_terminate(void) | |||
573 | if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { | 582 | if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { |
574 | status = acpi_disable(); | 583 | status = acpi_disable(); |
575 | if (ACPI_FAILURE(status)) { | 584 | if (ACPI_FAILURE(status)) { |
576 | ACPI_WARNING((AE_INFO, "acpi_disable failed")); | 585 | ACPI_WARNING((AE_INFO, "AcpiDisable failed")); |
577 | } | 586 | } |
578 | } | 587 | } |
579 | return_VOID; | 588 | return_VOID; |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 6da58e776413..094a17e4c86d 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -83,7 +83,7 @@ acpi_status acpi_ev_install_region_handlers(void) | |||
83 | acpi_status status; | 83 | acpi_status status; |
84 | acpi_native_uint i; | 84 | acpi_native_uint i; |
85 | 85 | ||
86 | ACPI_FUNCTION_TRACE("ev_install_region_handlers"); | 86 | ACPI_FUNCTION_TRACE(ev_install_region_handlers); |
87 | 87 | ||
88 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 88 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
89 | if (ACPI_FAILURE(status)) { | 89 | if (ACPI_FAILURE(status)) { |
@@ -153,7 +153,7 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
153 | acpi_status status; | 153 | acpi_status status; |
154 | acpi_native_uint i; | 154 | acpi_native_uint i; |
155 | 155 | ||
156 | ACPI_FUNCTION_TRACE("ev_initialize_op_regions"); | 156 | ACPI_FUNCTION_TRACE(ev_initialize_op_regions); |
157 | 157 | ||
158 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 158 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
159 | if (ACPI_FAILURE(status)) { | 159 | if (ACPI_FAILURE(status)) { |
@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
164 | * Run the _REG methods for op_regions in each default address space | 164 | * Run the _REG methods for op_regions in each default address space |
165 | */ | 165 | */ |
166 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { | 166 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { |
167 | |||
167 | /* TBD: Make sure handler is the DEFAULT handler, otherwise | 168 | /* TBD: Make sure handler is the DEFAULT handler, otherwise |
168 | * _REG will have already been run. | 169 | * _REG will have already been run. |
169 | */ | 170 | */ |
@@ -192,12 +193,12 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
192 | acpi_status | 193 | acpi_status |
193 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | 194 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) |
194 | { | 195 | { |
195 | struct acpi_parameter_info info; | 196 | struct acpi_evaluate_info *info; |
196 | union acpi_operand_object *params[3]; | 197 | union acpi_operand_object *args[3]; |
197 | union acpi_operand_object *region_obj2; | 198 | union acpi_operand_object *region_obj2; |
198 | acpi_status status; | 199 | acpi_status status; |
199 | 200 | ||
200 | ACPI_FUNCTION_TRACE("ev_execute_reg_method"); | 201 | ACPI_FUNCTION_TRACE(ev_execute_reg_method); |
201 | 202 | ||
202 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 203 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
203 | if (!region_obj2) { | 204 | if (!region_obj2) { |
@@ -208,48 +209,60 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
208 | return_ACPI_STATUS(AE_OK); | 209 | return_ACPI_STATUS(AE_OK); |
209 | } | 210 | } |
210 | 211 | ||
212 | /* Allocate and initialize the evaluation information block */ | ||
213 | |||
214 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
215 | if (!info) { | ||
216 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
217 | } | ||
218 | |||
219 | info->prefix_node = region_obj2->extra.method_REG; | ||
220 | info->pathname = NULL; | ||
221 | info->parameters = args; | ||
222 | info->parameter_type = ACPI_PARAM_ARGS; | ||
223 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
224 | |||
211 | /* | 225 | /* |
212 | * The _REG method has two arguments: | 226 | * The _REG method has two arguments: |
213 | * | 227 | * |
214 | * Arg0, Integer: Operation region space ID | 228 | * Arg0 - Integer: |
215 | * Same value as region_obj->Region.space_id | 229 | * Operation region space ID Same value as region_obj->Region.space_id |
216 | * Arg1, Integer: connection status | 230 | * |
217 | * 1 for connecting the handler, | 231 | * Arg1 - Integer: |
218 | * 0 for disconnecting the handler | 232 | * connection status 1 for connecting the handler, 0 for disconnecting |
219 | * Passed as a parameter | 233 | * the handler (Passed as a parameter) |
220 | */ | 234 | */ |
221 | params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 235 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
222 | if (!params[0]) { | 236 | if (!args[0]) { |
223 | return_ACPI_STATUS(AE_NO_MEMORY); | 237 | status = AE_NO_MEMORY; |
238 | goto cleanup1; | ||
224 | } | 239 | } |
225 | 240 | ||
226 | params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 241 | args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
227 | if (!params[1]) { | 242 | if (!args[1]) { |
228 | status = AE_NO_MEMORY; | 243 | status = AE_NO_MEMORY; |
229 | goto cleanup; | 244 | goto cleanup2; |
230 | } | 245 | } |
231 | 246 | ||
232 | /* Setup the parameter objects */ | 247 | /* Setup the parameter objects */ |
233 | 248 | ||
234 | params[0]->integer.value = region_obj->region.space_id; | 249 | args[0]->integer.value = region_obj->region.space_id; |
235 | params[1]->integer.value = function; | 250 | args[1]->integer.value = function; |
236 | params[2] = NULL; | 251 | args[2] = NULL; |
237 | |||
238 | info.node = region_obj2->extra.method_REG; | ||
239 | info.parameters = params; | ||
240 | info.parameter_type = ACPI_PARAM_ARGS; | ||
241 | 252 | ||
242 | /* Execute the method, no return value */ | 253 | /* Execute the method, no return value */ |
243 | 254 | ||
244 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 255 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
245 | (ACPI_TYPE_METHOD, info.node, NULL)); | 256 | (ACPI_TYPE_METHOD, info->prefix_node, NULL)); |
246 | status = acpi_ns_evaluate_by_handle(&info); | ||
247 | 257 | ||
248 | acpi_ut_remove_reference(params[1]); | 258 | status = acpi_ns_evaluate(info); |
259 | acpi_ut_remove_reference(args[1]); | ||
249 | 260 | ||
250 | cleanup: | 261 | cleanup2: |
251 | acpi_ut_remove_reference(params[0]); | 262 | acpi_ut_remove_reference(args[0]); |
252 | 263 | ||
264 | cleanup1: | ||
265 | ACPI_FREE(info); | ||
253 | return_ACPI_STATUS(status); | 266 | return_ACPI_STATUS(status); |
254 | } | 267 | } |
255 | 268 | ||
@@ -261,7 +274,8 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
261 | * Function - Read or Write operation | 274 | * Function - Read or Write operation |
262 | * Address - Where in the space to read or write | 275 | * Address - Where in the space to read or write |
263 | * bit_width - Field width in bits (8, 16, 32, or 64) | 276 | * bit_width - Field width in bits (8, 16, 32, or 64) |
264 | * Value - Pointer to in or out value | 277 | * Value - Pointer to in or out value, must be |
278 | * full 64-bit acpi_integer | ||
265 | * | 279 | * |
266 | * RETURN: Status | 280 | * RETURN: Status |
267 | * | 281 | * |
@@ -274,7 +288,7 @@ acpi_status | |||
274 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 288 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
275 | u32 function, | 289 | u32 function, |
276 | acpi_physical_address address, | 290 | acpi_physical_address address, |
277 | u32 bit_width, void *value) | 291 | u32 bit_width, acpi_integer * value) |
278 | { | 292 | { |
279 | acpi_status status; | 293 | acpi_status status; |
280 | acpi_status status2; | 294 | acpi_status status2; |
@@ -284,7 +298,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
284 | union acpi_operand_object *region_obj2; | 298 | union acpi_operand_object *region_obj2; |
285 | void *region_context = NULL; | 299 | void *region_context = NULL; |
286 | 300 | ||
287 | ACPI_FUNCTION_TRACE("ev_address_space_dispatch"); | 301 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); |
288 | 302 | ||
289 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 303 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
290 | if (!region_obj2) { | 304 | if (!region_obj2) { |
@@ -315,6 +329,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
315 | */ | 329 | */ |
316 | region_setup = handler_desc->address_space.setup; | 330 | region_setup = handler_desc->address_space.setup; |
317 | if (!region_setup) { | 331 | if (!region_setup) { |
332 | |||
318 | /* No initialization routine, exit with error */ | 333 | /* No initialization routine, exit with error */ |
319 | 334 | ||
320 | ACPI_ERROR((AE_INFO, | 335 | ACPI_ERROR((AE_INFO, |
@@ -361,9 +376,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
361 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; | 376 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; |
362 | 377 | ||
363 | if (region_obj2->extra.region_context) { | 378 | if (region_obj2->extra.region_context) { |
379 | |||
364 | /* The handler for this region was already installed */ | 380 | /* The handler for this region was already installed */ |
365 | 381 | ||
366 | ACPI_MEM_FREE(region_context); | 382 | ACPI_FREE(region_context); |
367 | } else { | 383 | } else { |
368 | /* | 384 | /* |
369 | * Save the returned context for use in all accesses to | 385 | * Save the returned context for use in all accesses to |
@@ -386,9 +402,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
386 | acpi_ut_get_region_name(region_obj->region. | 402 | acpi_ut_get_region_name(region_obj->region. |
387 | space_id))); | 403 | space_id))); |
388 | 404 | ||
389 | if (! | 405 | if (!(handler_desc->address_space.handler_flags & |
390 | (handler_desc->address_space. | 406 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
391 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
392 | /* | 407 | /* |
393 | * For handlers other than the default (supplied) handlers, we must | 408 | * For handlers other than the default (supplied) handlers, we must |
394 | * exit the interpreter because the handler *might* block -- we don't | 409 | * exit the interpreter because the handler *might* block -- we don't |
@@ -409,9 +424,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
409 | space_id))); | 424 | space_id))); |
410 | } | 425 | } |
411 | 426 | ||
412 | if (! | 427 | if (!(handler_desc->address_space.handler_flags & |
413 | (handler_desc->address_space. | 428 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
414 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
415 | /* | 429 | /* |
416 | * We just returned from a non-default handler, we must re-enter the | 430 | * We just returned from a non-default handler, we must re-enter the |
417 | * interpreter | 431 | * interpreter |
@@ -451,7 +465,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
451 | union acpi_operand_object *region_obj2; | 465 | union acpi_operand_object *region_obj2; |
452 | acpi_status status; | 466 | acpi_status status; |
453 | 467 | ||
454 | ACPI_FUNCTION_TRACE("ev_detach_region"); | 468 | ACPI_FUNCTION_TRACE(ev_detach_region); |
455 | 469 | ||
456 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 470 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
457 | if (!region_obj2) { | 471 | if (!region_obj2) { |
@@ -463,6 +477,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
463 | 477 | ||
464 | handler_obj = region_obj->region.handler; | 478 | handler_obj = region_obj->region.handler; |
465 | if (!handler_obj) { | 479 | if (!handler_obj) { |
480 | |||
466 | /* This region has no handler, all done */ | 481 | /* This region has no handler, all done */ |
467 | 482 | ||
468 | return_VOID; | 483 | return_VOID; |
@@ -474,6 +489,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
474 | last_obj_ptr = &handler_obj->address_space.region_list; | 489 | last_obj_ptr = &handler_obj->address_space.region_list; |
475 | 490 | ||
476 | while (obj_desc) { | 491 | while (obj_desc) { |
492 | |||
477 | /* Is this the correct Region? */ | 493 | /* Is this the correct Region? */ |
478 | 494 | ||
479 | if (obj_desc == region_obj) { | 495 | if (obj_desc == region_obj) { |
@@ -583,7 +599,7 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, | |||
583 | u8 acpi_ns_is_locked) | 599 | u8 acpi_ns_is_locked) |
584 | { | 600 | { |
585 | 601 | ||
586 | ACPI_FUNCTION_TRACE("ev_attach_region"); | 602 | ACPI_FUNCTION_TRACE(ev_attach_region); |
587 | 603 | ||
588 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 604 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
589 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", | 605 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", |
@@ -636,7 +652,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
636 | struct acpi_namespace_node *node; | 652 | struct acpi_namespace_node *node; |
637 | acpi_status status; | 653 | acpi_status status; |
638 | 654 | ||
639 | ACPI_FUNCTION_NAME("ev_install_handler"); | 655 | ACPI_FUNCTION_NAME(ev_install_handler); |
640 | 656 | ||
641 | handler_obj = (union acpi_operand_object *)context; | 657 | handler_obj = (union acpi_operand_object *)context; |
642 | 658 | ||
@@ -666,6 +682,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
666 | 682 | ||
667 | obj_desc = acpi_ns_get_attached_object(node); | 683 | obj_desc = acpi_ns_get_attached_object(node); |
668 | if (!obj_desc) { | 684 | if (!obj_desc) { |
685 | |||
669 | /* No object, just exit */ | 686 | /* No object, just exit */ |
670 | 687 | ||
671 | return (AE_OK); | 688 | return (AE_OK); |
@@ -674,10 +691,12 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
674 | /* Devices are handled different than regions */ | 691 | /* Devices are handled different than regions */ |
675 | 692 | ||
676 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { | 693 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { |
694 | |||
677 | /* Check if this Device already has a handler for this address space */ | 695 | /* Check if this Device already has a handler for this address space */ |
678 | 696 | ||
679 | next_handler_obj = obj_desc->device.handler; | 697 | next_handler_obj = obj_desc->device.handler; |
680 | while (next_handler_obj) { | 698 | while (next_handler_obj) { |
699 | |||
681 | /* Found a handler, is it for the same address space? */ | 700 | /* Found a handler, is it for the same address space? */ |
682 | 701 | ||
683 | if (next_handler_obj->address_space.space_id == | 702 | if (next_handler_obj->address_space.space_id == |
@@ -764,9 +783,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
764 | union acpi_operand_object *handler_obj; | 783 | union acpi_operand_object *handler_obj; |
765 | acpi_status status; | 784 | acpi_status status; |
766 | acpi_object_type type; | 785 | acpi_object_type type; |
767 | u16 flags = 0; | 786 | u8 flags = 0; |
768 | 787 | ||
769 | ACPI_FUNCTION_TRACE("ev_install_space_handler"); | 788 | ACPI_FUNCTION_TRACE(ev_install_space_handler); |
770 | 789 | ||
771 | /* | 790 | /* |
772 | * This registration is valid for only the types below | 791 | * This registration is valid for only the types below |
@@ -839,6 +858,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
839 | /* Walk the handler list for this device */ | 858 | /* Walk the handler list for this device */ |
840 | 859 | ||
841 | while (handler_obj) { | 860 | while (handler_obj) { |
861 | |||
842 | /* Same space_id indicates a handler already installed */ | 862 | /* Same space_id indicates a handler already installed */ |
843 | 863 | ||
844 | if (handler_obj->address_space.space_id == space_id) { | 864 | if (handler_obj->address_space.space_id == space_id) { |
@@ -921,7 +941,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
921 | /* Init handler obj */ | 941 | /* Init handler obj */ |
922 | 942 | ||
923 | handler_obj->address_space.space_id = (u8) space_id; | 943 | handler_obj->address_space.space_id = (u8) space_id; |
924 | handler_obj->address_space.hflags = flags; | 944 | handler_obj->address_space.handler_flags = flags; |
925 | handler_obj->address_space.region_list = NULL; | 945 | handler_obj->address_space.region_list = NULL; |
926 | handler_obj->address_space.node = node; | 946 | handler_obj->address_space.node = node; |
927 | handler_obj->address_space.handler = handler; | 947 | handler_obj->address_space.handler = handler; |
@@ -979,7 +999,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
979 | { | 999 | { |
980 | acpi_status status; | 1000 | acpi_status status; |
981 | 1001 | ||
982 | ACPI_FUNCTION_TRACE("ev_execute_reg_methods"); | 1002 | ACPI_FUNCTION_TRACE(ev_execute_reg_methods); |
983 | 1003 | ||
984 | /* | 1004 | /* |
985 | * Run all _REG methods for all Operation Regions for this | 1005 | * Run all _REG methods for all Operation Regions for this |
@@ -1001,7 +1021,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
1001 | * | 1021 | * |
1002 | * PARAMETERS: walk_namespace callback | 1022 | * PARAMETERS: walk_namespace callback |
1003 | * | 1023 | * |
1004 | * DESCRIPTION: Run _REg method for region objects of the requested space_iD | 1024 | * DESCRIPTION: Run _REG method for region objects of the requested space_iD |
1005 | * | 1025 | * |
1006 | ******************************************************************************/ | 1026 | ******************************************************************************/ |
1007 | 1027 | ||
@@ -1035,6 +1055,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, | |||
1035 | 1055 | ||
1036 | obj_desc = acpi_ns_get_attached_object(node); | 1056 | obj_desc = acpi_ns_get_attached_object(node); |
1037 | if (!obj_desc) { | 1057 | if (!obj_desc) { |
1058 | |||
1038 | /* No object, just exit */ | 1059 | /* No object, just exit */ |
1039 | 1060 | ||
1040 | return (AE_OK); | 1061 | return (AE_OK); |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index baed8c1a1b9f..5b3c7a85eb9a 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -71,11 +71,22 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
71 | (union acpi_operand_object *)handle; | 71 | (union acpi_operand_object *)handle; |
72 | struct acpi_mem_space_context *local_region_context; | 72 | struct acpi_mem_space_context *local_region_context; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); | 74 | ACPI_FUNCTION_TRACE(ev_system_memory_region_setup); |
75 | 75 | ||
76 | if (function == ACPI_REGION_DEACTIVATE) { | 76 | if (function == ACPI_REGION_DEACTIVATE) { |
77 | if (*region_context) { | 77 | if (*region_context) { |
78 | ACPI_MEM_FREE(*region_context); | 78 | local_region_context = |
79 | (struct acpi_mem_space_context *)*region_context; | ||
80 | |||
81 | /* Delete a cached mapping if present */ | ||
82 | |||
83 | if (local_region_context->mapped_length) { | ||
84 | acpi_os_unmap_memory(local_region_context-> | ||
85 | mapped_logical_address, | ||
86 | local_region_context-> | ||
87 | mapped_length); | ||
88 | } | ||
89 | ACPI_FREE(local_region_context); | ||
79 | *region_context = NULL; | 90 | *region_context = NULL; |
80 | } | 91 | } |
81 | return_ACPI_STATUS(AE_OK); | 92 | return_ACPI_STATUS(AE_OK); |
@@ -84,7 +95,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
84 | /* Create a new context */ | 95 | /* Create a new context */ |
85 | 96 | ||
86 | local_region_context = | 97 | local_region_context = |
87 | ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); | 98 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context)); |
88 | if (!(local_region_context)) { | 99 | if (!(local_region_context)) { |
89 | return_ACPI_STATUS(AE_NO_MEMORY); | 100 | return_ACPI_STATUS(AE_NO_MEMORY); |
90 | } | 101 | } |
@@ -118,7 +129,7 @@ acpi_ev_io_space_region_setup(acpi_handle handle, | |||
118 | u32 function, | 129 | u32 function, |
119 | void *handler_context, void **region_context) | 130 | void *handler_context, void **region_context) |
120 | { | 131 | { |
121 | ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); | 132 | ACPI_FUNCTION_TRACE(ev_io_space_region_setup); |
122 | 133 | ||
123 | if (function == ACPI_REGION_DEACTIVATE) { | 134 | if (function == ACPI_REGION_DEACTIVATE) { |
124 | *region_context = NULL; | 135 | *region_context = NULL; |
@@ -161,7 +172,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
161 | (union acpi_operand_object *)handle; | 172 | (union acpi_operand_object *)handle; |
162 | struct acpi_device_id object_hID; | 173 | struct acpi_device_id object_hID; |
163 | 174 | ||
164 | ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); | 175 | ACPI_FUNCTION_TRACE(ev_pci_config_region_setup); |
165 | 176 | ||
166 | handler_obj = region_obj->region.handler; | 177 | handler_obj = region_obj->region.handler; |
167 | if (!handler_obj) { | 178 | if (!handler_obj) { |
@@ -178,7 +189,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
178 | *region_context = NULL; | 189 | *region_context = NULL; |
179 | if (function == ACPI_REGION_DEACTIVATE) { | 190 | if (function == ACPI_REGION_DEACTIVATE) { |
180 | if (pci_id) { | 191 | if (pci_id) { |
181 | ACPI_MEM_FREE(pci_id); | 192 | ACPI_FREE(pci_id); |
182 | } | 193 | } |
183 | return_ACPI_STATUS(status); | 194 | return_ACPI_STATUS(status); |
184 | } | 195 | } |
@@ -199,6 +210,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
199 | * handlers with that device. | 210 | * handlers with that device. |
200 | */ | 211 | */ |
201 | if (handler_obj->address_space.node == acpi_gbl_root_node) { | 212 | if (handler_obj->address_space.node == acpi_gbl_root_node) { |
213 | |||
202 | /* Start search from the parent object */ | 214 | /* Start search from the parent object */ |
203 | 215 | ||
204 | pci_root_node = parent_node; | 216 | pci_root_node = parent_node; |
@@ -220,6 +232,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
220 | PCI_EXPRESS_ROOT_HID_STRING, | 232 | PCI_EXPRESS_ROOT_HID_STRING, |
221 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) | 233 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) |
222 | { | 234 | { |
235 | |||
223 | /* Install a handler for this PCI root bridge */ | 236 | /* Install a handler for this PCI root bridge */ |
224 | 237 | ||
225 | status = | 238 | status = |
@@ -235,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
235 | } else { | 248 | } else { |
236 | ACPI_EXCEPTION((AE_INFO, | 249 | ACPI_EXCEPTION((AE_INFO, |
237 | status, | 250 | status, |
238 | "Could not install pci_config handler for Root Bridge %4.4s", | 251 | "Could not install PciConfig handler for Root Bridge %4.4s", |
239 | acpi_ut_get_node_name | 252 | acpi_ut_get_node_name |
240 | (pci_root_node))); | 253 | (pci_root_node))); |
241 | } | 254 | } |
@@ -262,7 +275,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
262 | 275 | ||
263 | /* Region is still not initialized. Create a new context */ | 276 | /* Region is still not initialized. Create a new context */ |
264 | 277 | ||
265 | pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); | 278 | pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id)); |
266 | if (!pci_id) { | 279 | if (!pci_id) { |
267 | return_ACPI_STATUS(AE_NO_MEMORY); | 280 | return_ACPI_STATUS(AE_NO_MEMORY); |
268 | } | 281 | } |
@@ -337,7 +350,7 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle, | |||
337 | u32 function, | 350 | u32 function, |
338 | void *handler_context, void **region_context) | 351 | void *handler_context, void **region_context) |
339 | { | 352 | { |
340 | ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); | 353 | ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup); |
341 | 354 | ||
342 | return_ACPI_STATUS(AE_OK); | 355 | return_ACPI_STATUS(AE_OK); |
343 | } | 356 | } |
@@ -364,7 +377,7 @@ acpi_ev_cmos_region_setup(acpi_handle handle, | |||
364 | u32 function, | 377 | u32 function, |
365 | void *handler_context, void **region_context) | 378 | void *handler_context, void **region_context) |
366 | { | 379 | { |
367 | ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); | 380 | ACPI_FUNCTION_TRACE(ev_cmos_region_setup); |
368 | 381 | ||
369 | return_ACPI_STATUS(AE_OK); | 382 | return_ACPI_STATUS(AE_OK); |
370 | } | 383 | } |
@@ -389,7 +402,7 @@ acpi_ev_default_region_setup(acpi_handle handle, | |||
389 | u32 function, | 402 | u32 function, |
390 | void *handler_context, void **region_context) | 403 | void *handler_context, void **region_context) |
391 | { | 404 | { |
392 | ACPI_FUNCTION_TRACE("ev_default_region_setup"); | 405 | ACPI_FUNCTION_TRACE(ev_default_region_setup); |
393 | 406 | ||
394 | if (function == ACPI_REGION_DEACTIVATE) { | 407 | if (function == ACPI_REGION_DEACTIVATE) { |
395 | *region_context = NULL; | 408 | *region_context = NULL; |
@@ -435,7 +448,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
435 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | 448 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; |
436 | union acpi_operand_object *region_obj2; | 449 | union acpi_operand_object *region_obj2; |
437 | 450 | ||
438 | ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); | 451 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); |
439 | 452 | ||
440 | if (!region_obj) { | 453 | if (!region_obj) { |
441 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 454 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -462,8 +475,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
462 | 475 | ||
463 | /* Find any "_REG" method associated with this region definition */ | 476 | /* Find any "_REG" method associated with this region definition */ |
464 | 477 | ||
465 | status = acpi_ns_search_node(*reg_name_ptr, node, | 478 | status = |
466 | ACPI_TYPE_METHOD, &method_node); | 479 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, |
480 | &method_node); | ||
467 | if (ACPI_SUCCESS(status)) { | 481 | if (ACPI_SUCCESS(status)) { |
468 | /* | 482 | /* |
469 | * The _REG method is optional and there can be only one per region | 483 | * The _REG method is optional and there can be only one per region |
@@ -478,11 +492,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
478 | * ie: acpi_gbl_root_node->parent_entry being set to NULL | 492 | * ie: acpi_gbl_root_node->parent_entry being set to NULL |
479 | */ | 493 | */ |
480 | while (node) { | 494 | while (node) { |
495 | |||
481 | /* Check to see if a handler exists */ | 496 | /* Check to see if a handler exists */ |
482 | 497 | ||
483 | handler_obj = NULL; | 498 | handler_obj = NULL; |
484 | obj_desc = acpi_ns_get_attached_object(node); | 499 | obj_desc = acpi_ns_get_attached_object(node); |
485 | if (obj_desc) { | 500 | if (obj_desc) { |
501 | |||
486 | /* Can only be a handler if the object exists */ | 502 | /* Can only be a handler if the object exists */ |
487 | 503 | ||
488 | switch (node->type) { | 504 | switch (node->type) { |
@@ -507,10 +523,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
507 | } | 523 | } |
508 | 524 | ||
509 | while (handler_obj) { | 525 | while (handler_obj) { |
526 | |||
510 | /* Is this handler of the correct type? */ | 527 | /* Is this handler of the correct type? */ |
511 | 528 | ||
512 | if (handler_obj->address_space.space_id == | 529 | if (handler_obj->address_space.space_id == |
513 | space_id) { | 530 | space_id) { |
531 | |||
514 | /* Found correct handler */ | 532 | /* Found correct handler */ |
515 | 533 | ||
516 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 534 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -571,7 +589,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
571 | /* If we get here, there is no handler for this region */ | 589 | /* If we get here, there is no handler for this region */ |
572 | 590 | ||
573 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 591 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
574 | "No handler for region_type %s(%X) (region_obj %p)\n", | 592 | "No handler for RegionType %s(%X) (RegionObj %p)\n", |
575 | acpi_ut_get_region_name(space_id), space_id, | 593 | acpi_ut_get_region_name(space_id), space_id, |
576 | region_obj)); | 594 | region_obj)); |
577 | 595 | ||
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 9a622169008a..8106215ad554 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -69,7 +69,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) | |||
69 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; | 69 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; |
70 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; | 70 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler"); | 72 | ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * We are guaranteed by the ACPI CA initialization/shutdown code that | 75 | * We are guaranteed by the ACPI CA initialization/shutdown code that |
@@ -108,7 +108,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) | |||
108 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; | 108 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; |
109 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; | 109 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; |
110 | 110 | ||
111 | ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler"); | 111 | ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler); |
112 | 112 | ||
113 | /* | 113 | /* |
114 | * We are guaranteed by the ACPI CA initialization/shutdown code that | 114 | * We are guaranteed by the ACPI CA initialization/shutdown code that |
@@ -140,7 +140,7 @@ u32 acpi_ev_install_sci_handler(void) | |||
140 | { | 140 | { |
141 | u32 status = AE_OK; | 141 | u32 status = AE_OK; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE("ev_install_sci_handler"); | 143 | ACPI_FUNCTION_TRACE(ev_install_sci_handler); |
144 | 144 | ||
145 | status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, | 145 | status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, |
146 | acpi_ev_sci_xrupt_handler, | 146 | acpi_ev_sci_xrupt_handler, |
@@ -171,7 +171,7 @@ acpi_status acpi_ev_remove_sci_handler(void) | |||
171 | { | 171 | { |
172 | acpi_status status; | 172 | acpi_status status; |
173 | 173 | ||
174 | ACPI_FUNCTION_TRACE("ev_remove_sci_handler"); | 174 | ACPI_FUNCTION_TRACE(ev_remove_sci_handler); |
175 | 175 | ||
176 | /* Just let the OS remove the handler and disable the level */ | 176 | /* Just let the OS remove the handler and disable the level */ |
177 | 177 | ||
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index b38b39dde543..76c34a66e0e0 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acevents.h> | 46 | #include <acpi/acevents.h> |
@@ -68,7 +66,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
68 | { | 66 | { |
69 | acpi_status status; | 67 | acpi_status status; |
70 | 68 | ||
71 | ACPI_FUNCTION_TRACE("acpi_install_exception_handler"); | 69 | ACPI_FUNCTION_TRACE(acpi_install_exception_handler); |
72 | 70 | ||
73 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 71 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
74 | if (ACPI_FAILURE(status)) { | 72 | if (ACPI_FAILURE(status)) { |
@@ -90,6 +88,8 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
90 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 88 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
91 | return_ACPI_STATUS(status); | 89 | return_ACPI_STATUS(status); |
92 | } | 90 | } |
91 | |||
92 | ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) | ||
93 | #endif /* ACPI_FUTURE_USAGE */ | 93 | #endif /* ACPI_FUTURE_USAGE */ |
94 | 94 | ||
95 | /******************************************************************************* | 95 | /******************************************************************************* |
@@ -107,14 +107,13 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
107 | * event. | 107 | * event. |
108 | * | 108 | * |
109 | ******************************************************************************/ | 109 | ******************************************************************************/ |
110 | |||
111 | acpi_status | 110 | acpi_status |
112 | acpi_install_fixed_event_handler(u32 event, | 111 | acpi_install_fixed_event_handler(u32 event, |
113 | acpi_event_handler handler, void *context) | 112 | acpi_event_handler handler, void *context) |
114 | { | 113 | { |
115 | acpi_status status; | 114 | acpi_status status; |
116 | 115 | ||
117 | ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler"); | 116 | ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler); |
118 | 117 | ||
119 | /* Parameter validation */ | 118 | /* Parameter validation */ |
120 | 119 | ||
@@ -161,7 +160,7 @@ acpi_install_fixed_event_handler(u32 event, | |||
161 | return_ACPI_STATUS(status); | 160 | return_ACPI_STATUS(status); |
162 | } | 161 | } |
163 | 162 | ||
164 | EXPORT_SYMBOL(acpi_install_fixed_event_handler); | 163 | ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) |
165 | 164 | ||
166 | /******************************************************************************* | 165 | /******************************************************************************* |
167 | * | 166 | * |
@@ -175,13 +174,12 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler); | |||
175 | * DESCRIPTION: Disables the event and unregisters the event handler. | 174 | * DESCRIPTION: Disables the event and unregisters the event handler. |
176 | * | 175 | * |
177 | ******************************************************************************/ | 176 | ******************************************************************************/ |
178 | |||
179 | acpi_status | 177 | acpi_status |
180 | acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) | 178 | acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) |
181 | { | 179 | { |
182 | acpi_status status = AE_OK; | 180 | acpi_status status = AE_OK; |
183 | 181 | ||
184 | ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler"); | 182 | ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler); |
185 | 183 | ||
186 | /* Parameter validation */ | 184 | /* Parameter validation */ |
187 | 185 | ||
@@ -216,7 +214,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) | |||
216 | return_ACPI_STATUS(status); | 214 | return_ACPI_STATUS(status); |
217 | } | 215 | } |
218 | 216 | ||
219 | EXPORT_SYMBOL(acpi_remove_fixed_event_handler); | 217 | ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) |
220 | 218 | ||
221 | /******************************************************************************* | 219 | /******************************************************************************* |
222 | * | 220 | * |
@@ -235,7 +233,6 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler); | |||
235 | * DESCRIPTION: Install a handler for notifies on an ACPI device | 233 | * DESCRIPTION: Install a handler for notifies on an ACPI device |
236 | * | 234 | * |
237 | ******************************************************************************/ | 235 | ******************************************************************************/ |
238 | |||
239 | acpi_status | 236 | acpi_status |
240 | acpi_install_notify_handler(acpi_handle device, | 237 | acpi_install_notify_handler(acpi_handle device, |
241 | u32 handler_type, | 238 | u32 handler_type, |
@@ -246,7 +243,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
246 | struct acpi_namespace_node *node; | 243 | struct acpi_namespace_node *node; |
247 | acpi_status status; | 244 | acpi_status status; |
248 | 245 | ||
249 | ACPI_FUNCTION_TRACE("acpi_install_notify_handler"); | 246 | ACPI_FUNCTION_TRACE(acpi_install_notify_handler); |
250 | 247 | ||
251 | /* Parameter validation */ | 248 | /* Parameter validation */ |
252 | 249 | ||
@@ -275,6 +272,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
275 | * only one <external> global handler can be regsitered (per notify type). | 272 | * only one <external> global handler can be regsitered (per notify type). |
276 | */ | 273 | */ |
277 | if (device == ACPI_ROOT_OBJECT) { | 274 | if (device == ACPI_ROOT_OBJECT) { |
275 | |||
278 | /* Make sure the handler is not already installed */ | 276 | /* Make sure the handler is not already installed */ |
279 | 277 | ||
280 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 278 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
@@ -317,6 +315,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
317 | 315 | ||
318 | obj_desc = acpi_ns_get_attached_object(node); | 316 | obj_desc = acpi_ns_get_attached_object(node); |
319 | if (obj_desc) { | 317 | if (obj_desc) { |
318 | |||
320 | /* Object exists - make sure there's no handler */ | 319 | /* Object exists - make sure there's no handler */ |
321 | 320 | ||
322 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 321 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
@@ -370,6 +369,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
370 | } | 369 | } |
371 | 370 | ||
372 | if (handler_type == ACPI_ALL_NOTIFY) { | 371 | if (handler_type == ACPI_ALL_NOTIFY) { |
372 | |||
373 | /* Extra ref if installed in both */ | 373 | /* Extra ref if installed in both */ |
374 | 374 | ||
375 | acpi_ut_add_reference(notify_obj); | 375 | acpi_ut_add_reference(notify_obj); |
@@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
381 | return_ACPI_STATUS(status); | 381 | return_ACPI_STATUS(status); |
382 | } | 382 | } |
383 | 383 | ||
384 | EXPORT_SYMBOL(acpi_install_notify_handler); | 384 | ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) |
385 | 385 | ||
386 | /******************************************************************************* | 386 | /******************************************************************************* |
387 | * | 387 | * |
@@ -399,7 +399,6 @@ EXPORT_SYMBOL(acpi_install_notify_handler); | |||
399 | * DESCRIPTION: Remove a handler for notifies on an ACPI device | 399 | * DESCRIPTION: Remove a handler for notifies on an ACPI device |
400 | * | 400 | * |
401 | ******************************************************************************/ | 401 | ******************************************************************************/ |
402 | |||
403 | acpi_status | 402 | acpi_status |
404 | acpi_remove_notify_handler(acpi_handle device, | 403 | acpi_remove_notify_handler(acpi_handle device, |
405 | u32 handler_type, acpi_notify_handler handler) | 404 | u32 handler_type, acpi_notify_handler handler) |
@@ -409,7 +408,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
409 | struct acpi_namespace_node *node; | 408 | struct acpi_namespace_node *node; |
410 | acpi_status status; | 409 | acpi_status status; |
411 | 410 | ||
412 | ACPI_FUNCTION_TRACE("acpi_remove_notify_handler"); | 411 | ACPI_FUNCTION_TRACE(acpi_remove_notify_handler); |
413 | 412 | ||
414 | /* Parameter validation */ | 413 | /* Parameter validation */ |
415 | 414 | ||
@@ -535,7 +534,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
535 | return_ACPI_STATUS(status); | 534 | return_ACPI_STATUS(status); |
536 | } | 535 | } |
537 | 536 | ||
538 | EXPORT_SYMBOL(acpi_remove_notify_handler); | 537 | ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) |
539 | 538 | ||
540 | /******************************************************************************* | 539 | /******************************************************************************* |
541 | * | 540 | * |
@@ -554,7 +553,6 @@ EXPORT_SYMBOL(acpi_remove_notify_handler); | |||
554 | * DESCRIPTION: Install a handler for a General Purpose Event. | 553 | * DESCRIPTION: Install a handler for a General Purpose Event. |
555 | * | 554 | * |
556 | ******************************************************************************/ | 555 | ******************************************************************************/ |
557 | |||
558 | acpi_status | 556 | acpi_status |
559 | acpi_install_gpe_handler(acpi_handle gpe_device, | 557 | acpi_install_gpe_handler(acpi_handle gpe_device, |
560 | u32 gpe_number, | 558 | u32 gpe_number, |
@@ -565,7 +563,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
565 | acpi_status status; | 563 | acpi_status status; |
566 | acpi_cpu_flags flags; | 564 | acpi_cpu_flags flags; |
567 | 565 | ||
568 | ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); | 566 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); |
569 | 567 | ||
570 | /* Parameter validation */ | 568 | /* Parameter validation */ |
571 | 569 | ||
@@ -596,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
596 | 594 | ||
597 | /* Allocate and init handler object */ | 595 | /* Allocate and init handler object */ |
598 | 596 | ||
599 | handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); | 597 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); |
600 | if (!handler) { | 598 | if (!handler) { |
601 | status = AE_NO_MEMORY; | 599 | status = AE_NO_MEMORY; |
602 | goto unlock_and_exit; | 600 | goto unlock_and_exit; |
@@ -630,7 +628,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
630 | return_ACPI_STATUS(status); | 628 | return_ACPI_STATUS(status); |
631 | } | 629 | } |
632 | 630 | ||
633 | EXPORT_SYMBOL(acpi_install_gpe_handler); | 631 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) |
634 | 632 | ||
635 | /******************************************************************************* | 633 | /******************************************************************************* |
636 | * | 634 | * |
@@ -646,7 +644,6 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); | |||
646 | * DESCRIPTION: Remove a handler for a General Purpose acpi_event. | 644 | * DESCRIPTION: Remove a handler for a General Purpose acpi_event. |
647 | * | 645 | * |
648 | ******************************************************************************/ | 646 | ******************************************************************************/ |
649 | |||
650 | acpi_status | 647 | acpi_status |
651 | acpi_remove_gpe_handler(acpi_handle gpe_device, | 648 | acpi_remove_gpe_handler(acpi_handle gpe_device, |
652 | u32 gpe_number, acpi_event_handler address) | 649 | u32 gpe_number, acpi_event_handler address) |
@@ -656,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
656 | acpi_status status; | 653 | acpi_status status; |
657 | acpi_cpu_flags flags; | 654 | acpi_cpu_flags flags; |
658 | 655 | ||
659 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); | 656 | ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler); |
660 | 657 | ||
661 | /* Parameter validation */ | 658 | /* Parameter validation */ |
662 | 659 | ||
@@ -724,14 +721,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
724 | 721 | ||
725 | /* Now we can free the handler object */ | 722 | /* Now we can free the handler object */ |
726 | 723 | ||
727 | ACPI_MEM_FREE(handler); | 724 | ACPI_FREE(handler); |
728 | 725 | ||
729 | unlock_and_exit: | 726 | unlock_and_exit: |
730 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 727 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
731 | return_ACPI_STATUS(status); | 728 | return_ACPI_STATUS(status); |
732 | } | 729 | } |
733 | 730 | ||
734 | EXPORT_SYMBOL(acpi_remove_gpe_handler); | 731 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) |
735 | 732 | ||
736 | /******************************************************************************* | 733 | /******************************************************************************* |
737 | * | 734 | * |
@@ -746,7 +743,6 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); | |||
746 | * DESCRIPTION: Acquire the ACPI Global Lock | 743 | * DESCRIPTION: Acquire the ACPI Global Lock |
747 | * | 744 | * |
748 | ******************************************************************************/ | 745 | ******************************************************************************/ |
749 | |||
750 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | 746 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) |
751 | { | 747 | { |
752 | acpi_status status; | 748 | acpi_status status; |
@@ -771,7 +767,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
771 | return (status); | 767 | return (status); |
772 | } | 768 | } |
773 | 769 | ||
774 | EXPORT_SYMBOL(acpi_acquire_global_lock); | 770 | ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) |
775 | 771 | ||
776 | /******************************************************************************* | 772 | /******************************************************************************* |
777 | * | 773 | * |
@@ -784,7 +780,6 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); | |||
784 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. | 780 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. |
785 | * | 781 | * |
786 | ******************************************************************************/ | 782 | ******************************************************************************/ |
787 | |||
788 | acpi_status acpi_release_global_lock(u32 handle) | 783 | acpi_status acpi_release_global_lock(u32 handle) |
789 | { | 784 | { |
790 | acpi_status status; | 785 | acpi_status status; |
@@ -797,4 +792,4 @@ acpi_status acpi_release_global_lock(u32 handle) | |||
797 | return (status); | 792 | return (status); |
798 | } | 793 | } |
799 | 794 | ||
800 | EXPORT_SYMBOL(acpi_release_global_lock); | 795 | ACPI_EXPORT_SYMBOL(acpi_release_global_lock) |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index ec9ce8429f15..7ebc2efac936 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acevents.h> | 45 | #include <acpi/acevents.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
@@ -65,7 +63,7 @@ acpi_status acpi_enable(void) | |||
65 | { | 63 | { |
66 | acpi_status status = AE_OK; | 64 | acpi_status status = AE_OK; |
67 | 65 | ||
68 | ACPI_FUNCTION_TRACE("acpi_enable"); | 66 | ACPI_FUNCTION_TRACE(acpi_enable); |
69 | 67 | ||
70 | /* Make sure we have the FADT */ | 68 | /* Make sure we have the FADT */ |
71 | 69 | ||
@@ -94,6 +92,8 @@ acpi_status acpi_enable(void) | |||
94 | return_ACPI_STATUS(status); | 92 | return_ACPI_STATUS(status); |
95 | } | 93 | } |
96 | 94 | ||
95 | ACPI_EXPORT_SYMBOL(acpi_enable) | ||
96 | |||
97 | /******************************************************************************* | 97 | /******************************************************************************* |
98 | * | 98 | * |
99 | * FUNCTION: acpi_disable | 99 | * FUNCTION: acpi_disable |
@@ -105,12 +105,11 @@ acpi_status acpi_enable(void) | |||
105 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. | 105 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. |
106 | * | 106 | * |
107 | ******************************************************************************/ | 107 | ******************************************************************************/ |
108 | |||
109 | acpi_status acpi_disable(void) | 108 | acpi_status acpi_disable(void) |
110 | { | 109 | { |
111 | acpi_status status = AE_OK; | 110 | acpi_status status = AE_OK; |
112 | 111 | ||
113 | ACPI_FUNCTION_TRACE("acpi_disable"); | 112 | ACPI_FUNCTION_TRACE(acpi_disable); |
114 | 113 | ||
115 | if (!acpi_gbl_FADT) { | 114 | if (!acpi_gbl_FADT) { |
116 | ACPI_WARNING((AE_INFO, "No FADT information present!")); | 115 | ACPI_WARNING((AE_INFO, "No FADT information present!")); |
@@ -137,6 +136,8 @@ acpi_status acpi_disable(void) | |||
137 | return_ACPI_STATUS(status); | 136 | return_ACPI_STATUS(status); |
138 | } | 137 | } |
139 | 138 | ||
139 | ACPI_EXPORT_SYMBOL(acpi_disable) | ||
140 | |||
140 | /******************************************************************************* | 141 | /******************************************************************************* |
141 | * | 142 | * |
142 | * FUNCTION: acpi_enable_event | 143 | * FUNCTION: acpi_enable_event |
@@ -149,13 +150,12 @@ acpi_status acpi_disable(void) | |||
149 | * DESCRIPTION: Enable an ACPI event (fixed) | 150 | * DESCRIPTION: Enable an ACPI event (fixed) |
150 | * | 151 | * |
151 | ******************************************************************************/ | 152 | ******************************************************************************/ |
152 | |||
153 | acpi_status acpi_enable_event(u32 event, u32 flags) | 153 | acpi_status acpi_enable_event(u32 event, u32 flags) |
154 | { | 154 | { |
155 | acpi_status status = AE_OK; | 155 | acpi_status status = AE_OK; |
156 | u32 value; | 156 | u32 value; |
157 | 157 | ||
158 | ACPI_FUNCTION_TRACE("acpi_enable_event"); | 158 | ACPI_FUNCTION_TRACE(acpi_enable_event); |
159 | 159 | ||
160 | /* Decode the Fixed Event */ | 160 | /* Decode the Fixed Event */ |
161 | 161 | ||
@@ -193,7 +193,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags) | |||
193 | return_ACPI_STATUS(status); | 193 | return_ACPI_STATUS(status); |
194 | } | 194 | } |
195 | 195 | ||
196 | EXPORT_SYMBOL(acpi_enable_event); | 196 | ACPI_EXPORT_SYMBOL(acpi_enable_event) |
197 | 197 | ||
198 | /******************************************************************************* | 198 | /******************************************************************************* |
199 | * | 199 | * |
@@ -208,13 +208,12 @@ EXPORT_SYMBOL(acpi_enable_event); | |||
208 | * DESCRIPTION: Set the type of an individual GPE | 208 | * DESCRIPTION: Set the type of an individual GPE |
209 | * | 209 | * |
210 | ******************************************************************************/ | 210 | ******************************************************************************/ |
211 | |||
212 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | 211 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) |
213 | { | 212 | { |
214 | acpi_status status = AE_OK; | 213 | acpi_status status = AE_OK; |
215 | struct acpi_gpe_event_info *gpe_event_info; | 214 | struct acpi_gpe_event_info *gpe_event_info; |
216 | 215 | ||
217 | ACPI_FUNCTION_TRACE("acpi_set_gpe_type"); | 216 | ACPI_FUNCTION_TRACE(acpi_set_gpe_type); |
218 | 217 | ||
219 | /* Ensure that we have a valid GPE number */ | 218 | /* Ensure that we have a valid GPE number */ |
220 | 219 | ||
@@ -236,7 +235,7 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | |||
236 | return_ACPI_STATUS(status); | 235 | return_ACPI_STATUS(status); |
237 | } | 236 | } |
238 | 237 | ||
239 | EXPORT_SYMBOL(acpi_set_gpe_type); | 238 | ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) |
240 | 239 | ||
241 | /******************************************************************************* | 240 | /******************************************************************************* |
242 | * | 241 | * |
@@ -252,13 +251,12 @@ EXPORT_SYMBOL(acpi_set_gpe_type); | |||
252 | * DESCRIPTION: Enable an ACPI event (general purpose) | 251 | * DESCRIPTION: Enable an ACPI event (general purpose) |
253 | * | 252 | * |
254 | ******************************************************************************/ | 253 | ******************************************************************************/ |
255 | |||
256 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 254 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
257 | { | 255 | { |
258 | acpi_status status = AE_OK; | 256 | acpi_status status = AE_OK; |
259 | struct acpi_gpe_event_info *gpe_event_info; | 257 | struct acpi_gpe_event_info *gpe_event_info; |
260 | 258 | ||
261 | ACPI_FUNCTION_TRACE("acpi_enable_gpe"); | 259 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
262 | 260 | ||
263 | /* Use semaphore lock if not executing at interrupt level */ | 261 | /* Use semaphore lock if not executing at interrupt level */ |
264 | 262 | ||
@@ -288,7 +286,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
288 | return_ACPI_STATUS(status); | 286 | return_ACPI_STATUS(status); |
289 | } | 287 | } |
290 | 288 | ||
291 | EXPORT_SYMBOL(acpi_enable_gpe); | 289 | ACPI_EXPORT_SYMBOL(acpi_enable_gpe) |
292 | 290 | ||
293 | /******************************************************************************* | 291 | /******************************************************************************* |
294 | * | 292 | * |
@@ -304,13 +302,12 @@ EXPORT_SYMBOL(acpi_enable_gpe); | |||
304 | * DESCRIPTION: Disable an ACPI event (general purpose) | 302 | * DESCRIPTION: Disable an ACPI event (general purpose) |
305 | * | 303 | * |
306 | ******************************************************************************/ | 304 | ******************************************************************************/ |
307 | |||
308 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 305 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
309 | { | 306 | { |
310 | acpi_status status = AE_OK; | 307 | acpi_status status = AE_OK; |
311 | struct acpi_gpe_event_info *gpe_event_info; | 308 | struct acpi_gpe_event_info *gpe_event_info; |
312 | 309 | ||
313 | ACPI_FUNCTION_TRACE("acpi_disable_gpe"); | 310 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
314 | 311 | ||
315 | /* Use semaphore lock if not executing at interrupt level */ | 312 | /* Use semaphore lock if not executing at interrupt level */ |
316 | 313 | ||
@@ -338,6 +335,8 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
338 | return_ACPI_STATUS(status); | 335 | return_ACPI_STATUS(status); |
339 | } | 336 | } |
340 | 337 | ||
338 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | ||
339 | |||
341 | /******************************************************************************* | 340 | /******************************************************************************* |
342 | * | 341 | * |
343 | * FUNCTION: acpi_disable_event | 342 | * FUNCTION: acpi_disable_event |
@@ -350,13 +349,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
350 | * DESCRIPTION: Disable an ACPI event (fixed) | 349 | * DESCRIPTION: Disable an ACPI event (fixed) |
351 | * | 350 | * |
352 | ******************************************************************************/ | 351 | ******************************************************************************/ |
353 | |||
354 | acpi_status acpi_disable_event(u32 event, u32 flags) | 352 | acpi_status acpi_disable_event(u32 event, u32 flags) |
355 | { | 353 | { |
356 | acpi_status status = AE_OK; | 354 | acpi_status status = AE_OK; |
357 | u32 value; | 355 | u32 value; |
358 | 356 | ||
359 | ACPI_FUNCTION_TRACE("acpi_disable_event"); | 357 | ACPI_FUNCTION_TRACE(acpi_disable_event); |
360 | 358 | ||
361 | /* Decode the Fixed Event */ | 359 | /* Decode the Fixed Event */ |
362 | 360 | ||
@@ -392,7 +390,7 @@ acpi_status acpi_disable_event(u32 event, u32 flags) | |||
392 | return_ACPI_STATUS(status); | 390 | return_ACPI_STATUS(status); |
393 | } | 391 | } |
394 | 392 | ||
395 | EXPORT_SYMBOL(acpi_disable_event); | 393 | ACPI_EXPORT_SYMBOL(acpi_disable_event) |
396 | 394 | ||
397 | /******************************************************************************* | 395 | /******************************************************************************* |
398 | * | 396 | * |
@@ -405,12 +403,11 @@ EXPORT_SYMBOL(acpi_disable_event); | |||
405 | * DESCRIPTION: Clear an ACPI event (fixed) | 403 | * DESCRIPTION: Clear an ACPI event (fixed) |
406 | * | 404 | * |
407 | ******************************************************************************/ | 405 | ******************************************************************************/ |
408 | |||
409 | acpi_status acpi_clear_event(u32 event) | 406 | acpi_status acpi_clear_event(u32 event) |
410 | { | 407 | { |
411 | acpi_status status = AE_OK; | 408 | acpi_status status = AE_OK; |
412 | 409 | ||
413 | ACPI_FUNCTION_TRACE("acpi_clear_event"); | 410 | ACPI_FUNCTION_TRACE(acpi_clear_event); |
414 | 411 | ||
415 | /* Decode the Fixed Event */ | 412 | /* Decode the Fixed Event */ |
416 | 413 | ||
@@ -429,7 +426,7 @@ acpi_status acpi_clear_event(u32 event) | |||
429 | return_ACPI_STATUS(status); | 426 | return_ACPI_STATUS(status); |
430 | } | 427 | } |
431 | 428 | ||
432 | EXPORT_SYMBOL(acpi_clear_event); | 429 | ACPI_EXPORT_SYMBOL(acpi_clear_event) |
433 | 430 | ||
434 | /******************************************************************************* | 431 | /******************************************************************************* |
435 | * | 432 | * |
@@ -444,13 +441,12 @@ EXPORT_SYMBOL(acpi_clear_event); | |||
444 | * DESCRIPTION: Clear an ACPI event (general purpose) | 441 | * DESCRIPTION: Clear an ACPI event (general purpose) |
445 | * | 442 | * |
446 | ******************************************************************************/ | 443 | ******************************************************************************/ |
447 | |||
448 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 444 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
449 | { | 445 | { |
450 | acpi_status status = AE_OK; | 446 | acpi_status status = AE_OK; |
451 | struct acpi_gpe_event_info *gpe_event_info; | 447 | struct acpi_gpe_event_info *gpe_event_info; |
452 | 448 | ||
453 | ACPI_FUNCTION_TRACE("acpi_clear_gpe"); | 449 | ACPI_FUNCTION_TRACE(acpi_clear_gpe); |
454 | 450 | ||
455 | /* Use semaphore lock if not executing at interrupt level */ | 451 | /* Use semaphore lock if not executing at interrupt level */ |
456 | 452 | ||
@@ -478,6 +474,8 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
478 | return_ACPI_STATUS(status); | 474 | return_ACPI_STATUS(status); |
479 | } | 475 | } |
480 | 476 | ||
477 | ACPI_EXPORT_SYMBOL(acpi_clear_gpe) | ||
478 | |||
481 | #ifdef ACPI_FUTURE_USAGE | 479 | #ifdef ACPI_FUTURE_USAGE |
482 | /******************************************************************************* | 480 | /******************************************************************************* |
483 | * | 481 | * |
@@ -492,12 +490,11 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
492 | * DESCRIPTION: Obtains and returns the current status of the event | 490 | * DESCRIPTION: Obtains and returns the current status of the event |
493 | * | 491 | * |
494 | ******************************************************************************/ | 492 | ******************************************************************************/ |
495 | |||
496 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | 493 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) |
497 | { | 494 | { |
498 | acpi_status status = AE_OK; | 495 | acpi_status status = AE_OK; |
499 | 496 | ||
500 | ACPI_FUNCTION_TRACE("acpi_get_event_status"); | 497 | ACPI_FUNCTION_TRACE(acpi_get_event_status); |
501 | 498 | ||
502 | if (!event_status) { | 499 | if (!event_status) { |
503 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 500 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -518,6 +515,8 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
518 | return_ACPI_STATUS(status); | 515 | return_ACPI_STATUS(status); |
519 | } | 516 | } |
520 | 517 | ||
518 | ACPI_EXPORT_SYMBOL(acpi_get_event_status) | ||
519 | |||
521 | /******************************************************************************* | 520 | /******************************************************************************* |
522 | * | 521 | * |
523 | * FUNCTION: acpi_get_gpe_status | 522 | * FUNCTION: acpi_get_gpe_status |
@@ -533,7 +532,6 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
533 | * DESCRIPTION: Get status of an event (general purpose) | 532 | * DESCRIPTION: Get status of an event (general purpose) |
534 | * | 533 | * |
535 | ******************************************************************************/ | 534 | ******************************************************************************/ |
536 | |||
537 | acpi_status | 535 | acpi_status |
538 | acpi_get_gpe_status(acpi_handle gpe_device, | 536 | acpi_get_gpe_status(acpi_handle gpe_device, |
539 | u32 gpe_number, u32 flags, acpi_event_status * event_status) | 537 | u32 gpe_number, u32 flags, acpi_event_status * event_status) |
@@ -541,7 +539,7 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
541 | acpi_status status = AE_OK; | 539 | acpi_status status = AE_OK; |
542 | struct acpi_gpe_event_info *gpe_event_info; | 540 | struct acpi_gpe_event_info *gpe_event_info; |
543 | 541 | ||
544 | ACPI_FUNCTION_TRACE("acpi_get_gpe_status"); | 542 | ACPI_FUNCTION_TRACE(acpi_get_gpe_status); |
545 | 543 | ||
546 | /* Use semaphore lock if not executing at interrupt level */ | 544 | /* Use semaphore lock if not executing at interrupt level */ |
547 | 545 | ||
@@ -570,6 +568,8 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
570 | } | 568 | } |
571 | return_ACPI_STATUS(status); | 569 | return_ACPI_STATUS(status); |
572 | } | 570 | } |
571 | |||
572 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) | ||
573 | #endif /* ACPI_FUTURE_USAGE */ | 573 | #endif /* ACPI_FUTURE_USAGE */ |
574 | 574 | ||
575 | /******************************************************************************* | 575 | /******************************************************************************* |
@@ -586,7 +586,6 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
586 | * DESCRIPTION: Create and Install a block of GPE registers | 586 | * DESCRIPTION: Create and Install a block of GPE registers |
587 | * | 587 | * |
588 | ******************************************************************************/ | 588 | ******************************************************************************/ |
589 | |||
590 | acpi_status | 589 | acpi_status |
591 | acpi_install_gpe_block(acpi_handle gpe_device, | 590 | acpi_install_gpe_block(acpi_handle gpe_device, |
592 | struct acpi_generic_address *gpe_block_address, | 591 | struct acpi_generic_address *gpe_block_address, |
@@ -597,7 +596,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
597 | struct acpi_namespace_node *node; | 596 | struct acpi_namespace_node *node; |
598 | struct acpi_gpe_block_info *gpe_block; | 597 | struct acpi_gpe_block_info *gpe_block; |
599 | 598 | ||
600 | ACPI_FUNCTION_TRACE("acpi_install_gpe_block"); | 599 | ACPI_FUNCTION_TRACE(acpi_install_gpe_block); |
601 | 600 | ||
602 | if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { | 601 | if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { |
603 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 602 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -636,6 +635,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
636 | 635 | ||
637 | obj_desc = acpi_ns_get_attached_object(node); | 636 | obj_desc = acpi_ns_get_attached_object(node); |
638 | if (!obj_desc) { | 637 | if (!obj_desc) { |
638 | |||
639 | /* No object, create a new one */ | 639 | /* No object, create a new one */ |
640 | 640 | ||
641 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); | 641 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); |
@@ -665,7 +665,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
665 | return_ACPI_STATUS(status); | 665 | return_ACPI_STATUS(status); |
666 | } | 666 | } |
667 | 667 | ||
668 | EXPORT_SYMBOL(acpi_install_gpe_block); | 668 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_block) |
669 | 669 | ||
670 | /******************************************************************************* | 670 | /******************************************************************************* |
671 | * | 671 | * |
@@ -678,14 +678,13 @@ EXPORT_SYMBOL(acpi_install_gpe_block); | |||
678 | * DESCRIPTION: Remove a previously installed block of GPE registers | 678 | * DESCRIPTION: Remove a previously installed block of GPE registers |
679 | * | 679 | * |
680 | ******************************************************************************/ | 680 | ******************************************************************************/ |
681 | |||
682 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | 681 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) |
683 | { | 682 | { |
684 | union acpi_operand_object *obj_desc; | 683 | union acpi_operand_object *obj_desc; |
685 | acpi_status status; | 684 | acpi_status status; |
686 | struct acpi_namespace_node *node; | 685 | struct acpi_namespace_node *node; |
687 | 686 | ||
688 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_block"); | 687 | ACPI_FUNCTION_TRACE(acpi_remove_gpe_block); |
689 | 688 | ||
690 | if (!gpe_device) { | 689 | if (!gpe_device) { |
691 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 690 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -721,4 +720,4 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | |||
721 | return_ACPI_STATUS(status); | 720 | return_ACPI_STATUS(status); |
722 | } | 721 | } |
723 | 722 | ||
724 | EXPORT_SYMBOL(acpi_remove_gpe_block); | 723 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) |
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index abf5caca9ae5..e8b86a0baad0 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acevents.h> | 47 | #include <acpi/acevents.h> |
@@ -75,7 +73,7 @@ acpi_install_address_space_handler(acpi_handle device, | |||
75 | struct acpi_namespace_node *node; | 73 | struct acpi_namespace_node *node; |
76 | acpi_status status; | 74 | acpi_status status; |
77 | 75 | ||
78 | ACPI_FUNCTION_TRACE("acpi_install_address_space_handler"); | 76 | ACPI_FUNCTION_TRACE(acpi_install_address_space_handler); |
79 | 77 | ||
80 | /* Parameter validation */ | 78 | /* Parameter validation */ |
81 | 79 | ||
@@ -114,7 +112,7 @@ acpi_install_address_space_handler(acpi_handle device, | |||
114 | return_ACPI_STATUS(status); | 112 | return_ACPI_STATUS(status); |
115 | } | 113 | } |
116 | 114 | ||
117 | EXPORT_SYMBOL(acpi_install_address_space_handler); | 115 | ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler) |
118 | 116 | ||
119 | /******************************************************************************* | 117 | /******************************************************************************* |
120 | * | 118 | * |
@@ -129,7 +127,6 @@ EXPORT_SYMBOL(acpi_install_address_space_handler); | |||
129 | * DESCRIPTION: Remove a previously installed handler. | 127 | * DESCRIPTION: Remove a previously installed handler. |
130 | * | 128 | * |
131 | ******************************************************************************/ | 129 | ******************************************************************************/ |
132 | |||
133 | acpi_status | 130 | acpi_status |
134 | acpi_remove_address_space_handler(acpi_handle device, | 131 | acpi_remove_address_space_handler(acpi_handle device, |
135 | acpi_adr_space_type space_id, | 132 | acpi_adr_space_type space_id, |
@@ -142,7 +139,7 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
142 | struct acpi_namespace_node *node; | 139 | struct acpi_namespace_node *node; |
143 | acpi_status status; | 140 | acpi_status status; |
144 | 141 | ||
145 | ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler"); | 142 | ACPI_FUNCTION_TRACE(acpi_remove_address_space_handler); |
146 | 143 | ||
147 | /* Parameter validation */ | 144 | /* Parameter validation */ |
148 | 145 | ||
@@ -176,9 +173,11 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
176 | handler_obj = obj_desc->device.handler; | 173 | handler_obj = obj_desc->device.handler; |
177 | last_obj_ptr = &obj_desc->device.handler; | 174 | last_obj_ptr = &obj_desc->device.handler; |
178 | while (handler_obj) { | 175 | while (handler_obj) { |
176 | |||
179 | /* We have a handler, see if user requested this one */ | 177 | /* We have a handler, see if user requested this one */ |
180 | 178 | ||
181 | if (handler_obj->address_space.space_id == space_id) { | 179 | if (handler_obj->address_space.space_id == space_id) { |
180 | |||
182 | /* Matched space_id, first dereference this in the Regions */ | 181 | /* Matched space_id, first dereference this in the Regions */ |
183 | 182 | ||
184 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 183 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -229,7 +228,7 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
229 | /* The handler does not exist */ | 228 | /* The handler does not exist */ |
230 | 229 | ||
231 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 230 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
232 | "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", | 231 | "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n", |
233 | handler, acpi_ut_get_region_name(space_id), space_id, | 232 | handler, acpi_ut_get_region_name(space_id), space_id, |
234 | node, obj_desc)); | 233 | node, obj_desc)); |
235 | 234 | ||
@@ -240,4 +239,4 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
240 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
241 | } | 240 | } |
242 | 241 | ||
243 | EXPORT_SYMBOL(acpi_remove_address_space_handler); | 242 | ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler) |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index a29782fe3ecf..823352435e08 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -82,7 +82,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
82 | struct acpi_table_desc table_info; | 82 | struct acpi_table_desc table_info; |
83 | union acpi_operand_object *obj_desc; | 83 | union acpi_operand_object *obj_desc; |
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE("ex_add_table"); | 85 | ACPI_FUNCTION_TRACE(ex_add_table); |
86 | 86 | ||
87 | /* Create an object to be the table handle */ | 87 | /* Create an object to be the table handle */ |
88 | 88 | ||
@@ -100,7 +100,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
100 | 100 | ||
101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); | 101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); |
102 | 102 | ||
103 | table_info.type = ACPI_TABLE_SSDT; | 103 | table_info.type = ACPI_TABLE_ID_SSDT; |
104 | table_info.pointer = table; | 104 | table_info.pointer = table; |
105 | table_info.length = (acpi_size) table->length; | 105 | table_info.length = (acpi_size) table->length; |
106 | table_info.allocation = ACPI_MEM_ALLOCATED; | 106 | table_info.allocation = ACPI_MEM_ALLOCATED; |
@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
110 | 110 | ||
111 | if (ACPI_FAILURE(status)) { | 111 | if (ACPI_FAILURE(status)) { |
112 | if (status == AE_ALREADY_EXISTS) { | 112 | if (status == AE_ALREADY_EXISTS) { |
113 | |||
113 | /* Table already exists, just return the handle */ | 114 | /* Table already exists, just return the handle */ |
114 | 115 | ||
115 | return_ACPI_STATUS(AE_OK); | 116 | return_ACPI_STATUS(AE_OK); |
@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
121 | 122 | ||
122 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); | 123 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); |
123 | if (ACPI_FAILURE(status)) { | 124 | if (ACPI_FAILURE(status)) { |
125 | |||
124 | /* Uninstall table on error */ | 126 | /* Uninstall table on error */ |
125 | 127 | ||
126 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | 128 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
@@ -160,7 +162,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
160 | struct acpi_namespace_node *parameter_node = NULL; | 162 | struct acpi_namespace_node *parameter_node = NULL; |
161 | union acpi_operand_object *ddb_handle; | 163 | union acpi_operand_object *ddb_handle; |
162 | 164 | ||
163 | ACPI_FUNCTION_TRACE("ex_load_table_op"); | 165 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
164 | 166 | ||
165 | #if 0 | 167 | #if 0 |
166 | /* | 168 | /* |
@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
169 | */ | 171 | */ |
170 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); | 172 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); |
171 | if (status == AE_OK) { | 173 | if (status == AE_OK) { |
174 | |||
172 | /* Signature matched -- don't allow override */ | 175 | /* Signature matched -- don't allow override */ |
173 | 176 | ||
174 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 177 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
@@ -211,9 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
211 | * location within the namespace where the table will be loaded. | 214 | * location within the namespace where the table will be loaded. |
212 | */ | 215 | */ |
213 | status = | 216 | status = |
214 | acpi_ns_get_node_by_path(operand[3]->string.pointer, | 217 | acpi_ns_get_node(start_node, operand[3]->string.pointer, |
215 | start_node, ACPI_NS_SEARCH_PARENT, | 218 | ACPI_NS_SEARCH_PARENT, &parent_node); |
216 | &parent_node); | ||
217 | if (ACPI_FAILURE(status)) { | 219 | if (ACPI_FAILURE(status)) { |
218 | return_ACPI_STATUS(status); | 220 | return_ACPI_STATUS(status); |
219 | } | 221 | } |
@@ -234,9 +236,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
234 | /* Find the node referenced by the parameter_path_string */ | 236 | /* Find the node referenced by the parameter_path_string */ |
235 | 237 | ||
236 | status = | 238 | status = |
237 | acpi_ns_get_node_by_path(operand[4]->string.pointer, | 239 | acpi_ns_get_node(start_node, operand[4]->string.pointer, |
238 | start_node, ACPI_NS_SEARCH_PARENT, | 240 | ACPI_NS_SEARCH_PARENT, ¶meter_node); |
239 | ¶meter_node); | ||
240 | if (ACPI_FAILURE(status)) { | 241 | if (ACPI_FAILURE(status)) { |
241 | return_ACPI_STATUS(status); | 242 | return_ACPI_STATUS(status); |
242 | } | 243 | } |
@@ -252,6 +253,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
252 | /* Parameter Data (optional) */ | 253 | /* Parameter Data (optional) */ |
253 | 254 | ||
254 | if (parameter_node) { | 255 | if (parameter_node) { |
256 | |||
255 | /* Store the parameter data into the optional parameter object */ | 257 | /* Store the parameter data into the optional parameter object */ |
256 | 258 | ||
257 | status = acpi_ex_store(operand[5], | 259 | status = acpi_ex_store(operand[5], |
@@ -294,9 +296,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
294 | struct acpi_table_header *table_ptr = NULL; | 296 | struct acpi_table_header *table_ptr = NULL; |
295 | acpi_physical_address address; | 297 | acpi_physical_address address; |
296 | struct acpi_table_header table_header; | 298 | struct acpi_table_header table_header; |
299 | acpi_integer temp; | ||
297 | u32 i; | 300 | u32 i; |
298 | 301 | ||
299 | ACPI_FUNCTION_TRACE("ex_load_op"); | 302 | ACPI_FUNCTION_TRACE(ex_load_op); |
300 | 303 | ||
301 | /* Object can be either an op_region or a Field */ | 304 | /* Object can be either an op_region or a Field */ |
302 | 305 | ||
@@ -322,7 +325,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
322 | 325 | ||
323 | address = obj_desc->region.address; | 326 | address = obj_desc->region.address; |
324 | 327 | ||
325 | /* Get the table length from the table header */ | 328 | /* Get part of the table header to get the table length */ |
326 | 329 | ||
327 | table_header.length = 0; | 330 | table_header.length = 0; |
328 | for (i = 0; i < 8; i++) { | 331 | for (i = 0; i < 8; i++) { |
@@ -330,11 +333,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
330 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 333 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
331 | (acpi_physical_address) | 334 | (acpi_physical_address) |
332 | (i + address), 8, | 335 | (i + address), 8, |
333 | ((u8 *) & | 336 | &temp); |
334 | table_header) + i); | ||
335 | if (ACPI_FAILURE(status)) { | 337 | if (ACPI_FAILURE(status)) { |
336 | return_ACPI_STATUS(status); | 338 | return_ACPI_STATUS(status); |
337 | } | 339 | } |
340 | |||
341 | /* Get the one valid byte of the returned 64-bit value */ | ||
342 | |||
343 | ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp; | ||
338 | } | 344 | } |
339 | 345 | ||
340 | /* Sanity check the table length */ | 346 | /* Sanity check the table length */ |
@@ -345,7 +351,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
345 | 351 | ||
346 | /* Allocate a buffer for the entire table */ | 352 | /* Allocate a buffer for the entire table */ |
347 | 353 | ||
348 | table_ptr = ACPI_MEM_ALLOCATE(table_header.length); | 354 | table_ptr = ACPI_ALLOCATE(table_header.length); |
349 | if (!table_ptr) { | 355 | if (!table_ptr) { |
350 | return_ACPI_STATUS(AE_NO_MEMORY); | 356 | return_ACPI_STATUS(AE_NO_MEMORY); |
351 | } | 357 | } |
@@ -357,11 +363,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
357 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 363 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
358 | (acpi_physical_address) | 364 | (acpi_physical_address) |
359 | (i + address), 8, | 365 | (i + address), 8, |
360 | ((u8 *) table_ptr + | 366 | &temp); |
361 | i)); | ||
362 | if (ACPI_FAILURE(status)) { | 367 | if (ACPI_FAILURE(status)) { |
363 | goto cleanup; | 368 | goto cleanup; |
364 | } | 369 | } |
370 | |||
371 | /* Get the one valid byte of the returned 64-bit value */ | ||
372 | |||
373 | ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp; | ||
365 | } | 374 | } |
366 | break; | 375 | break; |
367 | 376 | ||
@@ -407,12 +416,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
407 | 416 | ||
408 | /* The table must be either an SSDT or a PSDT */ | 417 | /* The table must be either an SSDT or a PSDT */ |
409 | 418 | ||
410 | if ((!ACPI_STRNCMP(table_ptr->signature, | 419 | if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) && |
411 | acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, | 420 | (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) { |
412 | acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && | ||
413 | (!ACPI_STRNCMP(table_ptr->signature, | ||
414 | acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, | ||
415 | acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { | ||
416 | ACPI_ERROR((AE_INFO, | 421 | ACPI_ERROR((AE_INFO, |
417 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", | 422 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", |
418 | table_ptr->signature)); | 423 | table_ptr->signature)); |
@@ -424,6 +429,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
424 | 429 | ||
425 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); | 430 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); |
426 | if (ACPI_FAILURE(status)) { | 431 | if (ACPI_FAILURE(status)) { |
432 | |||
427 | /* On error, table_ptr was deallocated above */ | 433 | /* On error, table_ptr was deallocated above */ |
428 | 434 | ||
429 | return_ACPI_STATUS(status); | 435 | return_ACPI_STATUS(status); |
@@ -442,7 +448,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
442 | 448 | ||
443 | cleanup: | 449 | cleanup: |
444 | if (ACPI_FAILURE(status)) { | 450 | if (ACPI_FAILURE(status)) { |
445 | ACPI_MEM_FREE(table_ptr); | 451 | ACPI_FREE(table_ptr); |
446 | } | 452 | } |
447 | return_ACPI_STATUS(status); | 453 | return_ACPI_STATUS(status); |
448 | } | 454 | } |
@@ -465,7 +471,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
465 | union acpi_operand_object *table_desc = ddb_handle; | 471 | union acpi_operand_object *table_desc = ddb_handle; |
466 | struct acpi_table_desc *table_info; | 472 | struct acpi_table_desc *table_info; |
467 | 473 | ||
468 | ACPI_FUNCTION_TRACE("ex_unload_table"); | 474 | ACPI_FUNCTION_TRACE(ex_unload_table); |
469 | 475 | ||
470 | /* | 476 | /* |
471 | * Validate the handle | 477 | * Validate the handle |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index e6d52e12d77a..b732e399b1ef 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -79,7 +79,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
79 | u32 count; | 79 | u32 count; |
80 | acpi_status status; | 80 | acpi_status status; |
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); | 82 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc); |
83 | 83 | ||
84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
85 | case ACPI_TYPE_INTEGER: | 85 | case ACPI_TYPE_INTEGER: |
@@ -199,7 +199,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, | |||
199 | union acpi_operand_object *return_desc; | 199 | union acpi_operand_object *return_desc; |
200 | u8 *new_buf; | 200 | u8 *new_buf; |
201 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); | 202 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc); |
203 | 203 | ||
204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
205 | case ACPI_TYPE_BUFFER: | 205 | case ACPI_TYPE_BUFFER: |
@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
319 | remainder = 0; | 319 | remainder = 0; |
320 | 320 | ||
321 | for (i = decimal_length; i > 0; i--) { | 321 | for (i = decimal_length; i > 0; i--) { |
322 | |||
322 | /* Divide by nth factor of 10 */ | 323 | /* Divide by nth factor of 10 */ |
323 | 324 | ||
324 | digit = integer; | 325 | digit = integer; |
@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
346 | 347 | ||
347 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); | 348 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); |
348 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { | 349 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { |
350 | |||
349 | /* Get one hex digit, most significant digits first */ | 351 | /* Get one hex digit, most significant digits first */ |
350 | 352 | ||
351 | string[k] = | 353 | string[k] = |
@@ -400,7 +402,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
400 | u16 base = 16; | 402 | u16 base = 16; |
401 | u8 separator = ','; | 403 | u8 separator = ','; |
402 | 404 | ||
403 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); | 405 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc); |
404 | 406 | ||
405 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 407 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
406 | case ACPI_TYPE_STRING: | 408 | case ACPI_TYPE_STRING: |
@@ -567,7 +569,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
567 | { | 569 | { |
568 | acpi_status status = AE_OK; | 570 | acpi_status status = AE_OK; |
569 | 571 | ||
570 | ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); | 572 | ACPI_FUNCTION_TRACE(ex_convert_to_target_type); |
571 | 573 | ||
572 | /* Default behavior */ | 574 | /* Default behavior */ |
573 | 575 | ||
@@ -657,7 +659,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
657 | 659 | ||
658 | default: | 660 | default: |
659 | ACPI_ERROR((AE_INFO, | 661 | ACPI_ERROR((AE_INFO, |
660 | "Unknown Target type ID 0x%X aml_opcode %X dest_type %s", | 662 | "Unknown Target type ID 0x%X AmlOpcode %X DestType %s", |
661 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> | 663 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> |
662 | runtime_args), | 664 | runtime_args), |
663 | walk_state->opcode, | 665 | walk_state->opcode, |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 680575402835..106dc7219df7 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -69,7 +69,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
69 | struct acpi_namespace_node *alias_node; | 69 | struct acpi_namespace_node *alias_node; |
70 | acpi_status status = AE_OK; | 70 | acpi_status status = AE_OK; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ex_create_alias"); | 72 | ACPI_FUNCTION_TRACE(ex_create_alias); |
73 | 73 | ||
74 | /* Get the source/alias operands (both namespace nodes) */ | 74 | /* Get the source/alias operands (both namespace nodes) */ |
75 | 75 | ||
@@ -164,7 +164,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) | |||
164 | acpi_status status; | 164 | acpi_status status; |
165 | union acpi_operand_object *obj_desc; | 165 | union acpi_operand_object *obj_desc; |
166 | 166 | ||
167 | ACPI_FUNCTION_TRACE("ex_create_event"); | 167 | ACPI_FUNCTION_TRACE(ex_create_event); |
168 | 168 | ||
169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); | 169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); |
170 | if (!obj_desc) { | 170 | if (!obj_desc) { |
@@ -216,7 +216,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) | |||
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | union acpi_operand_object *obj_desc; | 217 | union acpi_operand_object *obj_desc; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); | 219 | ACPI_FUNCTION_TRACE_PTR(ex_create_mutex, ACPI_WALK_OPERANDS); |
220 | 220 | ||
221 | /* Create the new mutex object */ | 221 | /* Create the new mutex object */ |
222 | 222 | ||
@@ -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 | /* |
@@ -280,7 +281,7 @@ acpi_ex_create_region(u8 * aml_start, | |||
280 | struct acpi_namespace_node *node; | 281 | struct acpi_namespace_node *node; |
281 | union acpi_operand_object *region_obj2; | 282 | union acpi_operand_object *region_obj2; |
282 | 283 | ||
283 | ACPI_FUNCTION_TRACE("ex_create_region"); | 284 | ACPI_FUNCTION_TRACE(ex_create_region); |
284 | 285 | ||
285 | /* Get the Namespace Node */ | 286 | /* Get the Namespace Node */ |
286 | 287 | ||
@@ -300,7 +301,7 @@ acpi_ex_create_region(u8 * aml_start, | |||
300 | */ | 301 | */ |
301 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && | 302 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && |
302 | (region_space < ACPI_USER_REGION_BEGIN)) { | 303 | (region_space < ACPI_USER_REGION_BEGIN)) { |
303 | ACPI_ERROR((AE_INFO, "Invalid address_space type %X", | 304 | ACPI_ERROR((AE_INFO, "Invalid AddressSpace type %X", |
304 | region_space)); | 305 | region_space)); |
305 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); | 306 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); |
306 | } | 307 | } |
@@ -364,7 +365,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) | |||
364 | struct acpi_table_header *table; | 365 | struct acpi_table_header *table; |
365 | union acpi_operand_object *region_obj2; | 366 | union acpi_operand_object *region_obj2; |
366 | 367 | ||
367 | ACPI_FUNCTION_TRACE("ex_create_table_region"); | 368 | ACPI_FUNCTION_TRACE(ex_create_table_region); |
368 | 369 | ||
369 | /* Get the Node from the object stack */ | 370 | /* Get the Node from the object stack */ |
370 | 371 | ||
@@ -452,7 +453,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) | |||
452 | union acpi_operand_object *obj_desc; | 453 | union acpi_operand_object *obj_desc; |
453 | acpi_status status; | 454 | acpi_status status; |
454 | 455 | ||
455 | ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); | 456 | ACPI_FUNCTION_TRACE_PTR(ex_create_processor, walk_state); |
456 | 457 | ||
457 | /* Create the processor object */ | 458 | /* Create the processor object */ |
458 | 459 | ||
@@ -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 | ||
@@ -499,7 +500,7 @@ acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state) | |||
499 | acpi_status status; | 500 | acpi_status status; |
500 | union acpi_operand_object *obj_desc; | 501 | union acpi_operand_object *obj_desc; |
501 | 502 | ||
502 | ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); | 503 | ACPI_FUNCTION_TRACE_PTR(ex_create_power_resource, walk_state); |
503 | 504 | ||
504 | /* Create the power resource object */ | 505 | /* Create the power resource object */ |
505 | 506 | ||
@@ -549,7 +550,7 @@ acpi_ex_create_method(u8 * aml_start, | |||
549 | acpi_status status; | 550 | acpi_status status; |
550 | u8 method_flags; | 551 | u8 method_flags; |
551 | 552 | ||
552 | ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); | 553 | ACPI_FUNCTION_TRACE_PTR(ex_create_method, walk_state); |
553 | 554 | ||
554 | /* Create a new method object */ | 555 | /* Create a new method object */ |
555 | 556 | ||
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index a7cca8d4f855..7b9718e976bf 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -61,6 +61,10 @@ static void acpi_ex_out_pointer(char *title, void *value); | |||
61 | 61 | ||
62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); | 62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); |
63 | 63 | ||
64 | static void | ||
65 | acpi_ex_dump_object(union acpi_operand_object *obj_desc, | ||
66 | struct acpi_exdump_info *info); | ||
67 | |||
64 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); | 68 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); |
65 | 69 | ||
66 | static void | 70 | static void |
@@ -119,7 +123,7 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = { | |||
119 | 123 | ||
120 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { | 124 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { |
121 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, | 125 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, |
122 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, | 126 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"}, |
123 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, | 127 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, |
124 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, | 128 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, |
125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, | 129 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, |
@@ -263,12 +267,10 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { | |||
263 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} | 267 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} |
264 | }; | 268 | }; |
265 | 269 | ||
266 | static struct acpi_exdump_info acpi_ex_dump_node[6] = { | 270 | static struct acpi_exdump_info acpi_ex_dump_node[5] = { |
267 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, | 271 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, |
268 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, | 272 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, |
269 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, | 273 | {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"}, | 274 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, |
273 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} | 275 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} |
274 | }; | 276 | }; |
@@ -330,7 +332,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
330 | 332 | ||
331 | if (!info) { | 333 | if (!info) { |
332 | acpi_os_printf | 334 | acpi_os_printf |
333 | ("ex_dump_object: Display not implemented for object type %s\n", | 335 | ("ExDumpObject: Display not implemented for object type %s\n", |
334 | acpi_ut_get_object_type_name(obj_desc)); | 336 | acpi_ut_get_object_type_name(obj_desc)); |
335 | return; | 337 | return; |
336 | } | 338 | } |
@@ -454,7 +456,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
454 | u32 length; | 456 | u32 length; |
455 | u32 index; | 457 | u32 index; |
456 | 458 | ||
457 | ACPI_FUNCTION_NAME("ex_dump_operand") | 459 | ACPI_FUNCTION_NAME(ex_dump_operand) |
458 | 460 | ||
459 | if (! | 461 | if (! |
460 | ((ACPI_LV_EXEC & acpi_dbg_level) | 462 | ((ACPI_LV_EXEC & acpi_dbg_level) |
@@ -463,6 +465,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
463 | } | 465 | } |
464 | 466 | ||
465 | if (!obj_desc) { | 467 | if (!obj_desc) { |
468 | |||
466 | /* This could be a null element of a package */ | 469 | /* This could be a null element of a package */ |
467 | 470 | ||
468 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); | 471 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); |
@@ -522,7 +525,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
522 | 525 | ||
523 | case AML_REF_OF_OP: | 526 | case AML_REF_OF_OP: |
524 | 527 | ||
525 | acpi_os_printf("Reference: (ref_of) %p\n", | 528 | acpi_os_printf("Reference: (RefOf) %p\n", |
526 | obj_desc->reference.object); | 529 | obj_desc->reference.object); |
527 | break; | 530 | break; |
528 | 531 | ||
@@ -532,6 +535,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
532 | obj_desc->reference.offset); | 535 | obj_desc->reference.offset); |
533 | 536 | ||
534 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 537 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
538 | |||
535 | /* Value is an Integer */ | 539 | /* Value is an Integer */ |
536 | 540 | ||
537 | acpi_os_printf(" value is [%8.8X%8.8x]", | 541 | acpi_os_printf(" value is [%8.8X%8.8x]", |
@@ -610,7 +614,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
610 | 614 | ||
611 | case ACPI_TYPE_PACKAGE: | 615 | case ACPI_TYPE_PACKAGE: |
612 | 616 | ||
613 | acpi_os_printf("Package [Len %X] element_array %p\n", | 617 | acpi_os_printf("Package [Len %X] ElementArray %p\n", |
614 | obj_desc->package.count, | 618 | obj_desc->package.count, |
615 | obj_desc->package.elements); | 619 | obj_desc->package.elements); |
616 | 620 | ||
@@ -662,13 +666,13 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
662 | 666 | ||
663 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 667 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
664 | 668 | ||
665 | acpi_os_printf("bank_field\n"); | 669 | acpi_os_printf("BankField\n"); |
666 | break; | 670 | break; |
667 | 671 | ||
668 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 672 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
669 | 673 | ||
670 | acpi_os_printf | 674 | acpi_os_printf |
671 | ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", | 675 | ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", |
672 | obj_desc->field.bit_length, | 676 | obj_desc->field.bit_length, |
673 | obj_desc->field.access_byte_width, | 677 | obj_desc->field.access_byte_width, |
674 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, | 678 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, |
@@ -681,12 +685,12 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
681 | 685 | ||
682 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 686 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
683 | 687 | ||
684 | acpi_os_printf("index_field\n"); | 688 | acpi_os_printf("IndexField\n"); |
685 | break; | 689 | break; |
686 | 690 | ||
687 | case ACPI_TYPE_BUFFER_FIELD: | 691 | case ACPI_TYPE_BUFFER_FIELD: |
688 | 692 | ||
689 | acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", | 693 | acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n", |
690 | obj_desc->buffer_field.bit_length, | 694 | obj_desc->buffer_field.bit_length, |
691 | obj_desc->buffer_field.base_byte_offset, | 695 | obj_desc->buffer_field.base_byte_offset, |
692 | obj_desc->buffer_field.start_field_bit_offset); | 696 | obj_desc->buffer_field.start_field_bit_offset); |
@@ -777,7 +781,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, | |||
777 | { | 781 | { |
778 | acpi_native_uint i; | 782 | acpi_native_uint i; |
779 | 783 | ||
780 | ACPI_FUNCTION_NAME("ex_dump_operands"); | 784 | ACPI_FUNCTION_NAME(ex_dump_operands); |
781 | 785 | ||
782 | if (!ident) { | 786 | if (!ident) { |
783 | ident = "?"; | 787 | ident = "?"; |
@@ -901,7 +905,7 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) | |||
901 | acpi_os_printf("Could not convert name to pathname\n"); | 905 | acpi_os_printf("Could not convert name to pathname\n"); |
902 | } else { | 906 | } else { |
903 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); | 907 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); |
904 | ACPI_MEM_FREE(ret_buf.pointer); | 908 | ACPI_FREE(ret_buf.pointer); |
905 | } | 909 | } |
906 | } else if (obj_desc->reference.object) { | 910 | } else if (obj_desc->reference.object) { |
907 | acpi_os_printf("\nReferenced Object: %p\n", | 911 | acpi_os_printf("\nReferenced Object: %p\n", |
@@ -1017,7 +1021,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
1017 | void | 1021 | void |
1018 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | 1022 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) |
1019 | { | 1023 | { |
1020 | ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); | 1024 | ACPI_FUNCTION_TRACE(ex_dump_object_descriptor); |
1021 | 1025 | ||
1022 | if (!obj_desc) { | 1026 | if (!obj_desc) { |
1023 | return_VOID; | 1027 | return_VOID; |
@@ -1046,7 +1050,7 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
1046 | 1050 | ||
1047 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 1051 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
1048 | acpi_os_printf | 1052 | acpi_os_printf |
1049 | ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", | 1053 | ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", |
1050 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); | 1054 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); |
1051 | return_VOID; | 1055 | return_VOID; |
1052 | } | 1056 | } |
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index e259201ce9a0..9ea9c3a67ca9 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -73,7 +73,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
73 | void *buffer; | 73 | void *buffer; |
74 | u8 locked; | 74 | u8 locked; |
75 | 75 | ||
76 | ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc); | 76 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); |
77 | 77 | ||
78 | /* Parameter validation */ | 78 | /* Parameter validation */ |
79 | 79 | ||
@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
142 | length = | 142 | length = |
143 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); | 143 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); |
144 | if (length > acpi_gbl_integer_byte_width) { | 144 | if (length > acpi_gbl_integer_byte_width) { |
145 | |||
145 | /* Field is too large for an Integer, create a Buffer instead */ | 146 | /* Field is too large for an Integer, create a Buffer instead */ |
146 | 147 | ||
147 | buffer_desc = acpi_ut_create_buffer_object(length); | 148 | buffer_desc = acpi_ut_create_buffer_object(length); |
@@ -163,11 +164,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
163 | } | 164 | } |
164 | 165 | ||
165 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 166 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
166 | "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", | 167 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", |
167 | obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, | 168 | obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, |
168 | (u32) length)); | 169 | (u32) length)); |
169 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 170 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
170 | "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", | 171 | "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", |
171 | obj_desc->common_field.bit_length, | 172 | obj_desc->common_field.bit_length, |
172 | obj_desc->common_field.start_field_bit_offset, | 173 | obj_desc->common_field.start_field_bit_offset, |
173 | obj_desc->common_field.base_byte_offset)); | 174 | obj_desc->common_field.base_byte_offset)); |
@@ -219,7 +220,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
219 | u8 locked; | 220 | u8 locked; |
220 | union acpi_operand_object *buffer_desc; | 221 | union acpi_operand_object *buffer_desc; |
221 | 222 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc); | 223 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); |
223 | 224 | ||
224 | /* Parameter validation */ | 225 | /* Parameter validation */ |
225 | 226 | ||
@@ -329,9 +330,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
329 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); | 330 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); |
330 | 331 | ||
331 | if (length < required_length) { | 332 | if (length < required_length) { |
333 | |||
332 | /* We need to create a new buffer */ | 334 | /* We need to create a new buffer */ |
333 | 335 | ||
334 | new_buffer = ACPI_MEM_CALLOCATE(required_length); | 336 | new_buffer = ACPI_ALLOCATE_ZEROED(required_length); |
335 | if (!new_buffer) { | 337 | if (!new_buffer) { |
336 | return_ACPI_STATUS(AE_NO_MEMORY); | 338 | return_ACPI_STATUS(AE_NO_MEMORY); |
337 | } | 339 | } |
@@ -347,14 +349,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
347 | } | 349 | } |
348 | 350 | ||
349 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 351 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
350 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", | 352 | "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", |
351 | source_desc, | 353 | source_desc, |
352 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE | 354 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE |
353 | (source_desc)), | 355 | (source_desc)), |
354 | ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); | 356 | ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); |
355 | 357 | ||
356 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 358 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
357 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", | 359 | "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", |
358 | obj_desc, | 360 | obj_desc, |
359 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), | 361 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), |
360 | ACPI_GET_OBJECT_TYPE(obj_desc), | 362 | ACPI_GET_OBJECT_TYPE(obj_desc), |
@@ -375,7 +377,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
375 | /* Free temporary buffer if we used one */ | 377 | /* Free temporary buffer if we used one */ |
376 | 378 | ||
377 | if (new_buffer) { | 379 | if (new_buffer) { |
378 | ACPI_MEM_FREE(new_buffer); | 380 | ACPI_FREE(new_buffer); |
379 | } | 381 | } |
380 | 382 | ||
381 | return_ACPI_STATUS(status); | 383 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index bd1af35f7fcf..051053f7cccb 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -87,7 +87,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
87 | acpi_status status = AE_OK; | 87 | acpi_status status = AE_OK; |
88 | union acpi_operand_object *rgn_desc; | 88 | union acpi_operand_object *rgn_desc; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset); | 90 | ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset); |
91 | 91 | ||
92 | rgn_desc = obj_desc->common_field.region_obj; | 92 | rgn_desc = obj_desc->common_field.region_obj; |
93 | 93 | ||
@@ -112,7 +112,18 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /* Exit if Address/Length have been disallowed by the host OS */ | ||
116 | |||
117 | if (rgn_desc->common.flags & AOPOBJ_INVALID) { | ||
118 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * Exit now for SMBus address space, it has a non-linear address space | ||
123 | * and the request cannot be directly validated | ||
124 | */ | ||
115 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { | 125 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { |
126 | |||
116 | /* SMBus has a non-linear address space */ | 127 | /* SMBus has a non-linear address space */ |
117 | 128 | ||
118 | return_ACPI_STATUS(AE_OK); | 129 | return_ACPI_STATUS(AE_OK); |
@@ -134,10 +145,10 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
134 | * length of one field datum (access width) must fit within the region. | 145 | * length of one field datum (access width) must fit within the region. |
135 | * (Region length is specified in bytes) | 146 | * (Region length is specified in bytes) |
136 | */ | 147 | */ |
137 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + | 148 | if (rgn_desc->region.length < |
138 | field_datum_byte_offset + | 149 | (obj_desc->common_field.base_byte_offset + |
139 | obj_desc->common_field. | 150 | field_datum_byte_offset + |
140 | access_byte_width)) { | 151 | obj_desc->common_field.access_byte_width)) { |
141 | if (acpi_gbl_enable_interpreter_slack) { | 152 | if (acpi_gbl_enable_interpreter_slack) { |
142 | /* | 153 | /* |
143 | * Slack mode only: We will go ahead and allow access to this | 154 | * Slack mode only: We will go ahead and allow access to this |
@@ -217,7 +228,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
217 | union acpi_operand_object *rgn_desc; | 228 | union acpi_operand_object *rgn_desc; |
218 | acpi_physical_address address; | 229 | acpi_physical_address address; |
219 | 230 | ||
220 | ACPI_FUNCTION_TRACE("ex_access_region"); | 231 | ACPI_FUNCTION_TRACE(ex_access_region); |
221 | 232 | ||
222 | /* | 233 | /* |
223 | * Ensure that the region operands are fully evaluated and verify | 234 | * Ensure that the region operands are fully evaluated and verify |
@@ -246,7 +257,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
246 | } | 257 | } |
247 | 258 | ||
248 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, | 259 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, |
249 | " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", | 260 | " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", |
250 | acpi_ut_get_region_name(rgn_desc->region. | 261 | acpi_ut_get_region_name(rgn_desc->region. |
251 | space_id), | 262 | space_id), |
252 | rgn_desc->region.space_id, | 263 | rgn_desc->region.space_id, |
@@ -352,7 +363,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
352 | acpi_status status; | 363 | acpi_status status; |
353 | acpi_integer local_value; | 364 | acpi_integer local_value; |
354 | 365 | ||
355 | ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset); | 366 | ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); |
356 | 367 | ||
357 | if (read_write == ACPI_READ) { | 368 | if (read_write == ACPI_READ) { |
358 | if (!value) { | 369 | if (!value) { |
@@ -487,10 +498,11 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
487 | } | 498 | } |
488 | 499 | ||
489 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 500 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
490 | "I/O to Data Register: value_ptr %p\n", | 501 | "I/O to Data Register: ValuePtr %p\n", |
491 | value)); | 502 | value)); |
492 | 503 | ||
493 | if (read_write == ACPI_READ) { | 504 | if (read_write == ACPI_READ) { |
505 | |||
494 | /* Read the datum from the data_register */ | 506 | /* Read the datum from the data_register */ |
495 | 507 | ||
496 | status = | 508 | status = |
@@ -559,7 +571,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
559 | acpi_integer merged_value; | 571 | acpi_integer merged_value; |
560 | acpi_integer current_value; | 572 | acpi_integer current_value; |
561 | 573 | ||
562 | ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask); | 574 | ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); |
563 | 575 | ||
564 | /* Start with the new bits */ | 576 | /* Start with the new bits */ |
565 | 577 | ||
@@ -568,6 +580,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
568 | /* If the mask is all ones, we don't need to worry about the update rule */ | 580 | /* If the mask is all ones, we don't need to worry about the update rule */ |
569 | 581 | ||
570 | if (mask != ACPI_INTEGER_MAX) { | 582 | if (mask != ACPI_INTEGER_MAX) { |
583 | |||
571 | /* Decode the update rule */ | 584 | /* Decode the update rule */ |
572 | 585 | ||
573 | switch (obj_desc->common_field. | 586 | switch (obj_desc->common_field. |
@@ -614,7 +627,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
614 | default: | 627 | default: |
615 | 628 | ||
616 | ACPI_ERROR((AE_INFO, | 629 | ACPI_ERROR((AE_INFO, |
617 | "Unknown update_rule value: %X", | 630 | "Unknown UpdateRule value: %X", |
618 | (obj_desc->common_field. | 631 | (obj_desc->common_field. |
619 | field_flags & | 632 | field_flags & |
620 | AML_FIELD_UPDATE_RULE_MASK))); | 633 | AML_FIELD_UPDATE_RULE_MASK))); |
@@ -623,7 +636,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
623 | } | 636 | } |
624 | 637 | ||
625 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 638 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
626 | "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", | 639 | "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", |
627 | ACPI_FORMAT_UINT64(mask), | 640 | ACPI_FORMAT_UINT64(mask), |
628 | field_datum_byte_offset, | 641 | field_datum_byte_offset, |
629 | obj_desc->common_field.access_byte_width, | 642 | obj_desc->common_field.access_byte_width, |
@@ -666,7 +679,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
666 | u32 field_datum_count; | 679 | u32 field_datum_count; |
667 | u32 i; | 680 | u32 i; |
668 | 681 | ||
669 | ACPI_FUNCTION_TRACE("ex_extract_from_field"); | 682 | ACPI_FUNCTION_TRACE(ex_extract_from_field); |
670 | 683 | ||
671 | /* Validate target buffer and clear it */ | 684 | /* Validate target buffer and clear it */ |
672 | 685 | ||
@@ -704,6 +717,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
704 | /* Read the rest of the field */ | 717 | /* Read the rest of the field */ |
705 | 718 | ||
706 | for (i = 1; i < field_datum_count; i++) { | 719 | for (i = 1; i < field_datum_count; i++) { |
720 | |||
707 | /* Get next input datum from the field */ | 721 | /* Get next input datum from the field */ |
708 | 722 | ||
709 | field_offset += obj_desc->common_field.access_byte_width; | 723 | field_offset += obj_desc->common_field.access_byte_width; |
@@ -771,6 +785,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
771 | { | 785 | { |
772 | acpi_status status; | 786 | acpi_status status; |
773 | acpi_integer mask; | 787 | acpi_integer mask; |
788 | acpi_integer width_mask; | ||
774 | acpi_integer merged_datum; | 789 | acpi_integer merged_datum; |
775 | acpi_integer raw_datum = 0; | 790 | acpi_integer raw_datum = 0; |
776 | u32 field_offset = 0; | 791 | u32 field_offset = 0; |
@@ -780,7 +795,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
780 | u32 field_datum_count; | 795 | u32 field_datum_count; |
781 | u32 i; | 796 | u32 i; |
782 | 797 | ||
783 | ACPI_FUNCTION_TRACE("ex_insert_into_field"); | 798 | ACPI_FUNCTION_TRACE(ex_insert_into_field); |
784 | 799 | ||
785 | /* Validate input buffer */ | 800 | /* Validate input buffer */ |
786 | 801 | ||
@@ -795,15 +810,20 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
795 | 810 | ||
796 | /* Compute the number of datums (access width data items) */ | 811 | /* Compute the number of datums (access width data items) */ |
797 | 812 | ||
813 | width_mask = | ||
814 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width); | ||
798 | mask = | 815 | mask = |
799 | ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); | 816 | width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field. |
800 | datum_count = | 817 | start_field_bit_offset); |
801 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, | 818 | |
802 | obj_desc->common_field.access_bit_width); | 819 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
803 | field_datum_count = | 820 | obj_desc->common_field.access_bit_width); |
804 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | 821 | |
805 | obj_desc->common_field.start_field_bit_offset, | 822 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
806 | obj_desc->common_field.access_bit_width); | 823 | obj_desc->common_field. |
824 | start_field_bit_offset, | ||
825 | obj_desc->common_field. | ||
826 | access_bit_width); | ||
807 | 827 | ||
808 | /* Get initial Datum from the input buffer */ | 828 | /* Get initial Datum from the input buffer */ |
809 | 829 | ||
@@ -817,6 +837,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
817 | /* Write the entire field */ | 837 | /* Write the entire field */ |
818 | 838 | ||
819 | for (i = 1; i < field_datum_count; i++) { | 839 | for (i = 1; i < field_datum_count; i++) { |
840 | |||
820 | /* Write merged datum to the target field */ | 841 | /* Write merged datum to the target field */ |
821 | 842 | ||
822 | merged_datum &= mask; | 843 | merged_datum &= mask; |
@@ -833,7 +854,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
833 | merged_datum = raw_datum >> | 854 | merged_datum = raw_datum >> |
834 | (obj_desc->common_field.access_bit_width - | 855 | (obj_desc->common_field.access_bit_width - |
835 | obj_desc->common_field.start_field_bit_offset); | 856 | obj_desc->common_field.start_field_bit_offset); |
836 | mask = ACPI_INTEGER_MAX; | 857 | mask = width_mask; |
837 | 858 | ||
838 | if (i == datum_count) { | 859 | if (i == datum_count) { |
839 | break; | 860 | break; |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 48c18d29222a..bd98aab017cf 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
72 | union acpi_operand_object *reference_obj; | 72 | union acpi_operand_object *reference_obj; |
73 | union acpi_operand_object *referenced_obj; | 73 | union acpi_operand_object *referenced_obj; |
74 | 74 | ||
75 | ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); | 75 | ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc); |
76 | 76 | ||
77 | *return_desc = NULL; | 77 | *return_desc = NULL; |
78 | 78 | ||
@@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
168 | acpi_size length1; | 168 | acpi_size length1; |
169 | acpi_size new_length; | 169 | acpi_size new_length; |
170 | 170 | ||
171 | ACPI_FUNCTION_TRACE("ex_concat_template"); | 171 | ACPI_FUNCTION_TRACE(ex_concat_template); |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Find the end_tag descriptor in each resource template. | 174 | * Find the end_tag descriptor in each resource template. |
@@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
250 | char *new_buf; | 250 | char *new_buf; |
251 | acpi_status status; | 251 | acpi_status status; |
252 | 252 | ||
253 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); | 253 | ACPI_FUNCTION_TRACE(ex_do_concatenate); |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Convert the second operand if necessary. The first operand | 256 | * Convert the second operand if necessary. The first operand |
@@ -445,10 +445,24 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | |||
445 | 445 | ||
446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ | 446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ |
447 | 447 | ||
448 | /* | ||
449 | * We need to check if the shiftcount is larger than the integer bit | ||
450 | * width since the behavior of this is not well-defined in the C language. | ||
451 | */ | ||
452 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
453 | return (0); | ||
454 | } | ||
448 | return (integer0 << integer1); | 455 | return (integer0 << integer1); |
449 | 456 | ||
450 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ | 457 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ |
451 | 458 | ||
459 | /* | ||
460 | * We need to check if the shiftcount is larger than the integer bit | ||
461 | * width since the behavior of this is not well-defined in the C language. | ||
462 | */ | ||
463 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
464 | return (0); | ||
465 | } | ||
452 | return (integer0 >> integer1); | 466 | return (integer0 >> integer1); |
453 | 467 | ||
454 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ | 468 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ |
@@ -489,7 +503,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode, | |||
489 | acpi_status status = AE_OK; | 503 | acpi_status status = AE_OK; |
490 | u8 local_result = FALSE; | 504 | u8 local_result = FALSE; |
491 | 505 | ||
492 | ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); | 506 | ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op); |
493 | 507 | ||
494 | switch (opcode) { | 508 | switch (opcode) { |
495 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ | 509 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ |
@@ -557,7 +571,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
557 | u8 local_result = FALSE; | 571 | u8 local_result = FALSE; |
558 | int compare; | 572 | int compare; |
559 | 573 | ||
560 | ACPI_FUNCTION_TRACE("ex_do_logical_op"); | 574 | ACPI_FUNCTION_TRACE(ex_do_logical_op); |
561 | 575 | ||
562 | /* | 576 | /* |
563 | * Convert the second operand if necessary. The first operand | 577 | * Convert the second operand if necessary. The first operand |
@@ -649,6 +663,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
649 | /* Length and all bytes must be equal */ | 663 | /* Length and all bytes must be equal */ |
650 | 664 | ||
651 | if ((length0 == length1) && (compare == 0)) { | 665 | if ((length0 == length1) && (compare == 0)) { |
666 | |||
652 | /* Length and all bytes match ==> TRUE */ | 667 | /* Length and all bytes match ==> TRUE */ |
653 | 668 | ||
654 | local_result = TRUE; | 669 | local_result = TRUE; |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index f843b22e20b9..93098d68cadf 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -61,7 +61,7 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
61 | * | 61 | * |
62 | * RETURN: None | 62 | * RETURN: None |
63 | * | 63 | * |
64 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list | 64 | * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | 67 | ||
@@ -95,7 +95,7 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) | |||
95 | * | 95 | * |
96 | * RETURN: None | 96 | * RETURN: None |
97 | * | 97 | * |
98 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk | 98 | * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk |
99 | * | 99 | * |
100 | ******************************************************************************/ | 100 | ******************************************************************************/ |
101 | 101 | ||
@@ -144,7 +144,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
144 | { | 144 | { |
145 | acpi_status status; | 145 | acpi_status status; |
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc); | 147 | ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex, obj_desc); |
148 | 148 | ||
149 | if (!obj_desc) { | 149 | if (!obj_desc) { |
150 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 150 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -165,7 +165,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
165 | */ | 165 | */ |
166 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 166 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
167 | ACPI_ERROR((AE_INFO, | 167 | ACPI_ERROR((AE_INFO, |
168 | "Cannot acquire Mutex [%4.4s], incorrect sync_level", | 168 | "Cannot acquire Mutex [%4.4s], incorrect SyncLevel", |
169 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 169 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
170 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 170 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
171 | } | 171 | } |
@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
173 | /* Support for multiple acquires by the owning thread */ | 173 | /* Support for multiple acquires by the owning thread */ |
174 | 174 | ||
175 | if (obj_desc->mutex.owner_thread) { | 175 | if (obj_desc->mutex.owner_thread) { |
176 | |||
176 | /* Special case for Global Lock, allow all threads */ | 177 | /* Special case for Global Lock, allow all threads */ |
177 | 178 | ||
178 | if ((obj_desc->mutex.owner_thread->thread_id == | 179 | if ((obj_desc->mutex.owner_thread->thread_id == |
@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
192 | 193 | ||
193 | status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); | 194 | status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); |
194 | if (ACPI_FAILURE(status)) { | 195 | if (ACPI_FAILURE(status)) { |
196 | |||
195 | /* Includes failure from a timeout on time_desc */ | 197 | /* Includes failure from a timeout on time_desc */ |
196 | 198 | ||
197 | return_ACPI_STATUS(status); | 199 | return_ACPI_STATUS(status); |
@@ -232,7 +234,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
232 | { | 234 | { |
233 | acpi_status status; | 235 | acpi_status status; |
234 | 236 | ||
235 | ACPI_FUNCTION_TRACE("ex_release_mutex"); | 237 | ACPI_FUNCTION_TRACE(ex_release_mutex); |
236 | 238 | ||
237 | if (!obj_desc) { | 239 | if (!obj_desc) { |
238 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 240 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -277,7 +279,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
277 | */ | 279 | */ |
278 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 280 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
279 | ACPI_ERROR((AE_INFO, | 281 | ACPI_ERROR((AE_INFO, |
280 | "Cannot release Mutex [%4.4s], incorrect sync_level", | 282 | "Cannot release Mutex [%4.4s], incorrect SyncLevel", |
281 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 283 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
282 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 284 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
283 | } | 285 | } |
@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
286 | 288 | ||
287 | obj_desc->mutex.acquisition_depth--; | 289 | obj_desc->mutex.acquisition_depth--; |
288 | if (obj_desc->mutex.acquisition_depth != 0) { | 290 | if (obj_desc->mutex.acquisition_depth != 0) { |
291 | |||
289 | /* Just decrement the depth and return */ | 292 | /* Just decrement the depth and return */ |
290 | 293 | ||
291 | return_ACPI_STATUS(AE_OK); | 294 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 054fe5e1a314..d3d70364626c 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -77,7 +77,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
77 | char *name_string; | 77 | char *name_string; |
78 | u32 size_needed; | 78 | u32 size_needed; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ex_allocate_name_string"); | 80 | ACPI_FUNCTION_TRACE(ex_allocate_name_string); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. | 83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. |
@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
85 | * This may actually be somewhat longer than needed. | 85 | * This may actually be somewhat longer than needed. |
86 | */ | 86 | */ |
87 | if (prefix_count == ACPI_UINT32_MAX) { | 87 | if (prefix_count == ACPI_UINT32_MAX) { |
88 | |||
88 | /* Special case for root */ | 89 | /* Special case for root */ |
89 | 90 | ||
90 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; | 91 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; |
@@ -97,7 +98,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
97 | * Allocate a buffer for the name. | 98 | * Allocate a buffer for the name. |
98 | * This buffer must be deleted by the caller! | 99 | * This buffer must be deleted by the caller! |
99 | */ | 100 | */ |
100 | name_string = ACPI_MEM_ALLOCATE(size_needed); | 101 | name_string = ACPI_ALLOCATE(size_needed); |
101 | if (!name_string) { | 102 | if (!name_string) { |
102 | ACPI_ERROR((AE_INFO, | 103 | ACPI_ERROR((AE_INFO, |
103 | "Could not allocate size %d", size_needed)); | 104 | "Could not allocate size %d", size_needed)); |
@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
119 | /* Set up Dual or Multi prefixes if needed */ | 120 | /* Set up Dual or Multi prefixes if needed */ |
120 | 121 | ||
121 | if (num_name_segs > 2) { | 122 | if (num_name_segs > 2) { |
123 | |||
122 | /* Set up multi prefixes */ | 124 | /* Set up multi prefixes */ |
123 | 125 | ||
124 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; | 126 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; |
125 | *temp_ptr++ = (char)num_name_segs; | 127 | *temp_ptr++ = (char)num_name_segs; |
126 | } else if (2 == num_name_segs) { | 128 | } else if (2 == num_name_segs) { |
129 | |||
127 | /* Set up dual prefixes */ | 130 | /* Set up dual prefixes */ |
128 | 131 | ||
129 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; | 132 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; |
@@ -159,7 +162,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
159 | u32 index; | 162 | u32 index; |
160 | char char_buf[5]; | 163 | char char_buf[5]; |
161 | 164 | ||
162 | ACPI_FUNCTION_TRACE("ex_name_segment"); | 165 | ACPI_FUNCTION_TRACE(ex_name_segment); |
163 | 166 | ||
164 | /* | 167 | /* |
165 | * If first character is a digit, then we know that we aren't looking at a | 168 | * If first character is a digit, then we know that we aren't looking at a |
@@ -176,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
176 | 179 | ||
177 | for (index = 0; | 180 | for (index = 0; |
178 | (index < ACPI_NAME_SIZE) | 181 | (index < ACPI_NAME_SIZE) |
179 | && (acpi_ut_valid_acpi_character(*aml_address)); index++) { | 182 | && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { |
180 | char_buf[index] = *aml_address++; | 183 | char_buf[index] = *aml_address++; |
181 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); | 184 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); |
182 | } | 185 | } |
@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
184 | /* Valid name segment */ | 187 | /* Valid name segment */ |
185 | 188 | ||
186 | if (index == 4) { | 189 | if (index == 4) { |
190 | |||
187 | /* Found 4 valid characters */ | 191 | /* Found 4 valid characters */ |
188 | 192 | ||
189 | char_buf[4] = '\0'; | 193 | char_buf[4] = '\0'; |
@@ -249,11 +253,12 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
249 | u32 prefix_count = 0; | 253 | u32 prefix_count = 0; |
250 | u8 has_prefix = FALSE; | 254 | u8 has_prefix = FALSE; |
251 | 255 | ||
252 | ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); | 256 | ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address); |
253 | 257 | ||
254 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || | 258 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || |
255 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || | 259 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || |
256 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { | 260 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { |
261 | |||
257 | /* Disallow prefixes for types associated with field_unit names */ | 262 | /* Disallow prefixes for types associated with field_unit names */ |
258 | 263 | ||
259 | name_string = acpi_ex_allocate_name_string(0, 1); | 264 | name_string = acpi_ex_allocate_name_string(0, 1); |
@@ -272,7 +277,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
272 | case AML_ROOT_PREFIX: | 277 | case AML_ROOT_PREFIX: |
273 | 278 | ||
274 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 279 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
275 | "root_prefix(\\) at %p\n", | 280 | "RootPrefix(\\) at %p\n", |
276 | aml_address)); | 281 | aml_address)); |
277 | 282 | ||
278 | /* | 283 | /* |
@@ -290,7 +295,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
290 | 295 | ||
291 | do { | 296 | do { |
292 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 297 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
293 | "parent_prefix (^) at %p\n", | 298 | "ParentPrefix (^) at %p\n", |
294 | aml_address)); | 299 | aml_address)); |
295 | 300 | ||
296 | aml_address++; | 301 | aml_address++; |
@@ -314,7 +319,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
314 | case AML_DUAL_NAME_PREFIX: | 319 | case AML_DUAL_NAME_PREFIX: |
315 | 320 | ||
316 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 321 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
317 | "dual_name_prefix at %p\n", | 322 | "DualNamePrefix at %p\n", |
318 | aml_address)); | 323 | aml_address)); |
319 | 324 | ||
320 | aml_address++; | 325 | aml_address++; |
@@ -341,7 +346,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
341 | case AML_MULTI_NAME_PREFIX_OP: | 346 | case AML_MULTI_NAME_PREFIX_OP: |
342 | 347 | ||
343 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 348 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
344 | "multi_name_prefix at %p\n", | 349 | "MultiNamePrefix at %p\n", |
345 | aml_address)); | 350 | aml_address)); |
346 | 351 | ||
347 | /* Fetch count of segments remaining in name path */ | 352 | /* Fetch count of segments remaining in name path */ |
@@ -377,7 +382,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
377 | 382 | ||
378 | if (prefix_count == ACPI_UINT32_MAX) { | 383 | if (prefix_count == ACPI_UINT32_MAX) { |
379 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 384 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
380 | "name_seg is \"\\\" followed by NULL\n")); | 385 | "NameSeg is \"\\\" followed by NULL\n")); |
381 | } | 386 | } |
382 | 387 | ||
383 | /* Consume the NULL byte */ | 388 | /* Consume the NULL byte */ |
@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
410 | } | 415 | } |
411 | 416 | ||
412 | if (AE_CTRL_PENDING == status && has_prefix) { | 417 | if (AE_CTRL_PENDING == status && has_prefix) { |
418 | |||
413 | /* Ran out of segments after processing a prefix */ | 419 | /* Ran out of segments after processing a prefix */ |
414 | 420 | ||
415 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); | 421 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); |
@@ -418,7 +424,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
418 | 424 | ||
419 | if (ACPI_FAILURE(status)) { | 425 | if (ACPI_FAILURE(status)) { |
420 | if (name_string) { | 426 | if (name_string) { |
421 | ACPI_MEM_FREE(name_string); | 427 | ACPI_FREE(name_string); |
422 | } | 428 | } |
423 | return_ACPI_STATUS(status); | 429 | return_ACPI_STATUS(status); |
424 | } | 430 | } |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 23d0823bcd5e..6374d8be88e0 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |||
89 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
90 | union acpi_operand_object *return_desc = NULL; | 90 | union acpi_operand_object *return_desc = NULL; |
91 | 91 | ||
92 | ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", | 92 | ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R, |
93 | acpi_ps_get_opcode_name(walk_state->opcode)); | 93 | acpi_ps_get_opcode_name(walk_state->opcode)); |
94 | 94 | ||
95 | /* Examine the AML opcode */ | 95 | /* Examine the AML opcode */ |
@@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) | |||
150 | union acpi_operand_object **operand = &walk_state->operands[0]; | 150 | union acpi_operand_object **operand = &walk_state->operands[0]; |
151 | acpi_status status = AE_OK; | 151 | acpi_status status = AE_OK; |
152 | 152 | ||
153 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", | 153 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R, |
154 | acpi_ps_get_opcode_name(walk_state->opcode)); | 154 | acpi_ps_get_opcode_name(walk_state->opcode)); |
155 | 155 | ||
156 | /* Examine the AML opcode */ | 156 | /* Examine the AML opcode */ |
@@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) | |||
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | union acpi_operand_object **operand = &walk_state->operands[0]; | 217 | union acpi_operand_object **operand = &walk_state->operands[0]; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", | 219 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R, |
220 | acpi_ps_get_opcode_name(walk_state->opcode)); | 220 | acpi_ps_get_opcode_name(walk_state->opcode)); |
221 | 221 | ||
222 | /* Examine the AML opcode */ | 222 | /* Examine the AML opcode */ |
@@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
264 | acpi_integer power_of_ten; | 264 | acpi_integer power_of_ten; |
265 | acpi_integer digit; | 265 | acpi_integer digit; |
266 | 266 | ||
267 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", | 267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, |
268 | acpi_ps_get_opcode_name(walk_state->opcode)); | 268 | acpi_ps_get_opcode_name(walk_state->opcode)); |
269 | 269 | ||
270 | /* Examine the AML opcode */ | 270 | /* Examine the AML opcode */ |
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
322 | 322 | ||
323 | /* Since the bit position is one-based, subtract from 33 (65) */ | 323 | /* Since the bit position is one-based, subtract from 33 (65) */ |
324 | 324 | ||
325 | return_desc->integer.value = temp32 == 0 ? 0 : | 325 | return_desc->integer.value = |
326 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | 326 | temp32 == |
327 | 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | ||
327 | break; | 328 | break; |
328 | 329 | ||
329 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | 330 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ |
@@ -342,6 +343,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
342 | for (i = 0; | 343 | for (i = 0; |
343 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); | 344 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); |
344 | i++) { | 345 | i++) { |
346 | |||
345 | /* Get the least significant 4-bit BCD digit */ | 347 | /* Get the least significant 4-bit BCD digit */ |
346 | 348 | ||
347 | temp32 = ((u32) digit) & 0xF; | 349 | temp32 = ((u32) digit) & 0xF; |
@@ -487,6 +489,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
487 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 489 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
488 | ACPI_EXPLICIT_CONVERT_DECIMAL); | 490 | ACPI_EXPLICIT_CONVERT_DECIMAL); |
489 | if (return_desc == operand[0]) { | 491 | if (return_desc == operand[0]) { |
492 | |||
490 | /* No conversion performed, add ref to handle return value */ | 493 | /* No conversion performed, add ref to handle return value */ |
491 | acpi_ut_add_reference(return_desc); | 494 | acpi_ut_add_reference(return_desc); |
492 | } | 495 | } |
@@ -497,6 +500,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
497 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 500 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
498 | ACPI_EXPLICIT_CONVERT_HEX); | 501 | ACPI_EXPLICIT_CONVERT_HEX); |
499 | if (return_desc == operand[0]) { | 502 | if (return_desc == operand[0]) { |
503 | |||
500 | /* No conversion performed, add ref to handle return value */ | 504 | /* No conversion performed, add ref to handle return value */ |
501 | acpi_ut_add_reference(return_desc); | 505 | acpi_ut_add_reference(return_desc); |
502 | } | 506 | } |
@@ -506,6 +510,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
506 | 510 | ||
507 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); | 511 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); |
508 | if (return_desc == operand[0]) { | 512 | if (return_desc == operand[0]) { |
513 | |||
509 | /* No conversion performed, add ref to handle return value */ | 514 | /* No conversion performed, add ref to handle return value */ |
510 | acpi_ut_add_reference(return_desc); | 515 | acpi_ut_add_reference(return_desc); |
511 | } | 516 | } |
@@ -516,6 +521,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
516 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, | 521 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, |
517 | ACPI_ANY_BASE); | 522 | ACPI_ANY_BASE); |
518 | if (return_desc == operand[0]) { | 523 | if (return_desc == operand[0]) { |
524 | |||
519 | /* No conversion performed, add ref to handle return value */ | 525 | /* No conversion performed, add ref to handle return value */ |
520 | acpi_ut_add_reference(return_desc); | 526 | acpi_ut_add_reference(return_desc); |
521 | } | 527 | } |
@@ -541,6 +547,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
541 | } | 547 | } |
542 | 548 | ||
543 | if (ACPI_SUCCESS(status)) { | 549 | if (ACPI_SUCCESS(status)) { |
550 | |||
544 | /* Store the return value computed above into the target object */ | 551 | /* Store the return value computed above into the target object */ |
545 | 552 | ||
546 | status = acpi_ex_store(return_desc, operand[1], walk_state); | 553 | status = acpi_ex_store(return_desc, operand[1], walk_state); |
@@ -548,16 +555,18 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
548 | 555 | ||
549 | cleanup: | 556 | cleanup: |
550 | 557 | ||
551 | if (!walk_state->result_obj) { | ||
552 | walk_state->result_obj = return_desc; | ||
553 | } | ||
554 | |||
555 | /* Delete return object on error */ | 558 | /* Delete return object on error */ |
556 | 559 | ||
557 | if (ACPI_FAILURE(status)) { | 560 | if (ACPI_FAILURE(status)) { |
558 | acpi_ut_remove_reference(return_desc); | 561 | acpi_ut_remove_reference(return_desc); |
559 | } | 562 | } |
560 | 563 | ||
564 | /* Save return object on success */ | ||
565 | |||
566 | else if (!walk_state->result_obj) { | ||
567 | walk_state->result_obj = return_desc; | ||
568 | } | ||
569 | |||
561 | return_ACPI_STATUS(status); | 570 | return_ACPI_STATUS(status); |
562 | } | 571 | } |
563 | 572 | ||
@@ -582,7 +591,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
582 | u32 type; | 591 | u32 type; |
583 | acpi_integer value; | 592 | acpi_integer value; |
584 | 593 | ||
585 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", | 594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, |
586 | acpi_ps_get_opcode_name(walk_state->opcode)); | 595 | acpi_ps_get_opcode_name(walk_state->opcode)); |
587 | 596 | ||
588 | /* Examine the AML opcode */ | 597 | /* Examine the AML opcode */ |
@@ -625,6 +634,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
625 | temp_desc = operand[0]; | 634 | temp_desc = operand[0]; |
626 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == | 635 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == |
627 | ACPI_DESC_TYPE_OPERAND) { | 636 | ACPI_DESC_TYPE_OPERAND) { |
637 | |||
628 | /* Internal reference object - prevent deletion */ | 638 | /* Internal reference object - prevent deletion */ |
629 | 639 | ||
630 | acpi_ut_add_reference(temp_desc); | 640 | acpi_ut_add_reference(temp_desc); |
@@ -689,6 +699,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
689 | if (ACPI_FAILURE(status)) { | 699 | if (ACPI_FAILURE(status)) { |
690 | goto cleanup; | 700 | goto cleanup; |
691 | } | 701 | } |
702 | |||
692 | /* Allocate a descriptor to hold the type. */ | 703 | /* Allocate a descriptor to hold the type. */ |
693 | 704 | ||
694 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 705 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
@@ -777,8 +788,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
777 | 788 | ||
778 | /* Check for a method local or argument, or standalone String */ | 789 | /* Check for a method local or argument, or standalone String */ |
779 | 790 | ||
780 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | 791 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == |
781 | ACPI_DESC_TYPE_NAMED) { | 792 | ACPI_DESC_TYPE_NAMED) { |
793 | temp_desc = | ||
794 | acpi_ns_get_attached_object((struct | ||
795 | acpi_namespace_node *) | ||
796 | operand[0]); | ||
797 | if (temp_desc | ||
798 | && | ||
799 | ((ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
800 | ACPI_TYPE_STRING) | ||
801 | || (ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
802 | ACPI_TYPE_LOCAL_REFERENCE))) { | ||
803 | operand[0] = temp_desc; | ||
804 | acpi_ut_add_reference(temp_desc); | ||
805 | } else { | ||
806 | status = AE_AML_OPERAND_TYPE; | ||
807 | goto cleanup; | ||
808 | } | ||
809 | } else { | ||
782 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | 810 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { |
783 | case ACPI_TYPE_LOCAL_REFERENCE: | 811 | case ACPI_TYPE_LOCAL_REFERENCE: |
784 | /* | 812 | /* |
@@ -827,26 +855,35 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
827 | break; | 855 | break; |
828 | 856 | ||
829 | case ACPI_TYPE_STRING: | 857 | case ACPI_TYPE_STRING: |
858 | break; | ||
830 | 859 | ||
860 | default: | ||
861 | status = AE_AML_OPERAND_TYPE; | ||
862 | goto cleanup; | ||
863 | } | ||
864 | } | ||
865 | |||
866 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | ||
867 | ACPI_DESC_TYPE_NAMED) { | ||
868 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == | ||
869 | ACPI_TYPE_STRING) { | ||
831 | /* | 870 | /* |
832 | * This is a deref_of (String). The string is a reference | 871 | * This is a deref_of (String). The string is a reference |
833 | * to a named ACPI object. | 872 | * to a named ACPI object. |
834 | * | 873 | * |
835 | * 1) Find the owning Node | 874 | * 1) Find the owning Node |
836 | * 2) Dereference the node to an actual object. Could be a | 875 | * 2) Dereference the node to an actual object. Could be a |
837 | * Field, so we need to resolve the node to a value. | 876 | * Field, so we need to resolve the node to a value. |
838 | */ | 877 | */ |
839 | status = | 878 | status = |
840 | acpi_ns_get_node_by_path(operand[0]->string. | 879 | acpi_ns_get_node(walk_state->scope_info-> |
841 | pointer, | 880 | scope.node, |
842 | walk_state-> | 881 | operand[0]->string.pointer, |
843 | scope_info->scope. | 882 | ACPI_NS_SEARCH_PARENT, |
844 | node, | 883 | ACPI_CAST_INDIRECT_PTR |
845 | ACPI_NS_SEARCH_PARENT, | 884 | (struct |
846 | ACPI_CAST_INDIRECT_PTR | 885 | acpi_namespace_node, |
847 | (struct | 886 | &return_desc)); |
848 | acpi_namespace_node, | ||
849 | &return_desc)); | ||
850 | if (ACPI_FAILURE(status)) { | 887 | if (ACPI_FAILURE(status)) { |
851 | goto cleanup; | 888 | goto cleanup; |
852 | } | 889 | } |
@@ -857,11 +894,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
857 | (struct acpi_namespace_node, &return_desc), | 894 | (struct acpi_namespace_node, &return_desc), |
858 | walk_state); | 895 | walk_state); |
859 | goto cleanup; | 896 | goto cleanup; |
860 | |||
861 | default: | ||
862 | |||
863 | status = AE_AML_OPERAND_TYPE; | ||
864 | goto cleanup; | ||
865 | } | 897 | } |
866 | } | 898 | } |
867 | 899 | ||
@@ -937,13 +969,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
937 | acpi_ut_add_reference | 969 | acpi_ut_add_reference |
938 | (return_desc); | 970 | (return_desc); |
939 | } | 971 | } |
940 | |||
941 | break; | 972 | break; |
942 | 973 | ||
943 | default: | 974 | default: |
944 | 975 | ||
945 | ACPI_ERROR((AE_INFO, | 976 | ACPI_ERROR((AE_INFO, |
946 | "Unknown Index target_type %X in obj %p", | 977 | "Unknown Index TargetType %X in obj %p", |
947 | operand[0]->reference. | 978 | operand[0]->reference. |
948 | target_type, operand[0])); | 979 | target_type, operand[0])); |
949 | status = AE_AML_OPERAND_TYPE; | 980 | status = AE_AML_OPERAND_TYPE; |
@@ -957,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
957 | 988 | ||
958 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == | 989 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == |
959 | ACPI_DESC_TYPE_NAMED) { | 990 | ACPI_DESC_TYPE_NAMED) { |
960 | |||
961 | return_desc = | 991 | return_desc = |
962 | acpi_ns_get_attached_object((struct | 992 | acpi_ns_get_attached_object((struct |
963 | acpi_namespace_node | 993 | acpi_namespace_node |
@@ -972,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
972 | 1002 | ||
973 | default: | 1003 | default: |
974 | ACPI_ERROR((AE_INFO, | 1004 | ACPI_ERROR((AE_INFO, |
975 | "Unknown opcode in ref(%p) - %X", | 1005 | "Unknown opcode in reference(%p) - %X", |
976 | operand[0], | 1006 | operand[0], |
977 | operand[0]->reference.opcode)); | 1007 | operand[0]->reference.opcode)); |
978 | 1008 | ||
@@ -998,6 +1028,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
998 | acpi_ut_remove_reference(return_desc); | 1028 | acpi_ut_remove_reference(return_desc); |
999 | } | 1029 | } |
1000 | 1030 | ||
1001 | walk_state->result_obj = return_desc; | 1031 | /* Save return object on success */ |
1032 | |||
1033 | else { | ||
1034 | walk_state->result_obj = return_desc; | ||
1035 | } | ||
1036 | |||
1002 | return_ACPI_STATUS(status); | 1037 | return_ACPI_STATUS(status); |
1003 | } | 1038 | } |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index e263a5ddd405..7d2cbc113160 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -92,7 +92,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
92 | u32 value; | 92 | u32 value; |
93 | acpi_status status = AE_OK; | 93 | acpi_status status = AE_OK; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R", | 95 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_0R, |
96 | acpi_ps_get_opcode_name(walk_state->opcode)); | 96 | acpi_ps_get_opcode_name(walk_state->opcode)); |
97 | 97 | ||
98 | /* Examine the opcode */ | 98 | /* Examine the opcode */ |
@@ -121,7 +121,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
121 | #ifdef ACPI_GPE_NOTIFY_CHECK | 121 | #ifdef ACPI_GPE_NOTIFY_CHECK |
122 | /* | 122 | /* |
123 | * GPE method wake/notify check. Here, we want to ensure that we | 123 | * GPE method wake/notify check. Here, we want to ensure that we |
124 | * don't receive any "device_wake" Notifies from a GPE _Lxx or _Exx | 124 | * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx |
125 | * GPE method during system runtime. If we do, the GPE is marked | 125 | * GPE method during system runtime. If we do, the GPE is marked |
126 | * as "wake-only" and disabled. | 126 | * as "wake-only" and disabled. |
127 | * | 127 | * |
@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
138 | acpi_ev_check_for_wake_only_gpe(walk_state-> | 138 | acpi_ev_check_for_wake_only_gpe(walk_state-> |
139 | gpe_event_info); | 139 | gpe_event_info); |
140 | if (ACPI_FAILURE(status)) { | 140 | if (ACPI_FAILURE(status)) { |
141 | |||
141 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ | 142 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ |
142 | 143 | ||
143 | return_ACPI_STATUS(AE_OK) | 144 | return_ACPI_STATUS(AE_OK) |
@@ -185,7 +186,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
185 | union acpi_operand_object *return_desc2 = NULL; | 186 | union acpi_operand_object *return_desc2 = NULL; |
186 | acpi_status status; | 187 | acpi_status status; |
187 | 188 | ||
188 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R", | 189 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_2T_1R, |
189 | acpi_ps_get_opcode_name(walk_state->opcode)); | 190 | acpi_ps_get_opcode_name(walk_state->opcode)); |
190 | 191 | ||
191 | /* Execute the opcode */ | 192 | /* Execute the opcode */ |
@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
252 | acpi_ut_remove_reference(return_desc2); | 253 | acpi_ut_remove_reference(return_desc2); |
253 | 254 | ||
254 | if (ACPI_FAILURE(status)) { | 255 | if (ACPI_FAILURE(status)) { |
256 | |||
255 | /* Delete the return object */ | 257 | /* Delete the return object */ |
256 | 258 | ||
257 | acpi_ut_remove_reference(return_desc1); | 259 | acpi_ut_remove_reference(return_desc1); |
@@ -281,12 +283,13 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
281 | acpi_status status = AE_OK; | 283 | acpi_status status = AE_OK; |
282 | acpi_size length; | 284 | acpi_size length; |
283 | 285 | ||
284 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R", | 286 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R, |
285 | acpi_ps_get_opcode_name(walk_state->opcode)); | 287 | acpi_ps_get_opcode_name(walk_state->opcode)); |
286 | 288 | ||
287 | /* Execute the opcode */ | 289 | /* Execute the opcode */ |
288 | 290 | ||
289 | if (walk_state->op_info->flags & AML_MATH) { | 291 | if (walk_state->op_info->flags & AML_MATH) { |
292 | |||
290 | /* All simple math opcodes (add, etc.) */ | 293 | /* All simple math opcodes (add, etc.) */ |
291 | 294 | ||
292 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 295 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
383 | goto cleanup; | 386 | goto cleanup; |
384 | } | 387 | } |
385 | 388 | ||
389 | /* Initialize the Index reference object */ | ||
390 | |||
386 | index = operand[1]->integer.value; | 391 | index = operand[1]->integer.value; |
392 | return_desc->reference.offset = (u32) index; | ||
393 | return_desc->reference.opcode = AML_INDEX_OP; | ||
387 | 394 | ||
388 | /* At this point, the Source operand is a Package, Buffer, or String */ | 395 | /* |
396 | * At this point, the Source operand is a String, Buffer, or Package. | ||
397 | * Verify that the index is within range. | ||
398 | */ | ||
399 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | ||
400 | case ACPI_TYPE_STRING: | ||
389 | 401 | ||
390 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { | 402 | if (index >= operand[0]->string.length) { |
391 | /* Object to be indexed is a Package */ | 403 | status = AE_AML_STRING_LIMIT; |
404 | } | ||
405 | |||
406 | return_desc->reference.target_type = | ||
407 | ACPI_TYPE_BUFFER_FIELD; | ||
408 | break; | ||
409 | |||
410 | case ACPI_TYPE_BUFFER: | ||
411 | |||
412 | if (index >= operand[0]->buffer.length) { | ||
413 | status = AE_AML_BUFFER_LIMIT; | ||
414 | } | ||
415 | |||
416 | return_desc->reference.target_type = | ||
417 | ACPI_TYPE_BUFFER_FIELD; | ||
418 | break; | ||
419 | |||
420 | case ACPI_TYPE_PACKAGE: | ||
392 | 421 | ||
393 | if (index >= operand[0]->package.count) { | 422 | if (index >= operand[0]->package.count) { |
394 | ACPI_ERROR((AE_INFO, | ||
395 | "Index value (%X%8.8X) beyond package end (%X)", | ||
396 | ACPI_FORMAT_UINT64(index), | ||
397 | operand[0]->package.count)); | ||
398 | status = AE_AML_PACKAGE_LIMIT; | 423 | status = AE_AML_PACKAGE_LIMIT; |
399 | goto cleanup; | ||
400 | } | 424 | } |
401 | 425 | ||
402 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; | 426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; |
403 | return_desc->reference.object = operand[0]; | ||
404 | return_desc->reference.where = | 427 | return_desc->reference.where = |
405 | &operand[0]->package.elements[index]; | 428 | &operand[0]->package.elements[index]; |
406 | } else { | 429 | break; |
407 | /* Object to be indexed is a Buffer/String */ | ||
408 | 430 | ||
409 | if (index >= operand[0]->buffer.length) { | 431 | default: |
410 | ACPI_ERROR((AE_INFO, | ||
411 | "Index value (%X%8.8X) beyond end of buffer (%X)", | ||
412 | ACPI_FORMAT_UINT64(index), | ||
413 | operand[0]->buffer.length)); | ||
414 | status = AE_AML_BUFFER_LIMIT; | ||
415 | goto cleanup; | ||
416 | } | ||
417 | 432 | ||
418 | return_desc->reference.target_type = | 433 | status = AE_AML_INTERNAL; |
419 | ACPI_TYPE_BUFFER_FIELD; | 434 | goto cleanup; |
420 | return_desc->reference.object = operand[0]; | 435 | } |
436 | |||
437 | /* Failure means that the Index was beyond the end of the object */ | ||
438 | |||
439 | if (ACPI_FAILURE(status)) { | ||
440 | ACPI_EXCEPTION((AE_INFO, status, | ||
441 | "Index (%X%8.8X) is beyond end of object", | ||
442 | ACPI_FORMAT_UINT64(index))); | ||
443 | goto cleanup; | ||
421 | } | 444 | } |
422 | 445 | ||
423 | /* | 446 | /* |
424 | * Add a reference to the target package/buffer/string for the life | 447 | * Save the target object and add a reference to it for the life |
425 | * of the index. | 448 | * of the index |
426 | */ | 449 | */ |
450 | return_desc->reference.object = operand[0]; | ||
427 | acpi_ut_add_reference(operand[0]); | 451 | acpi_ut_add_reference(operand[0]); |
428 | 452 | ||
429 | /* Complete the Index reference object */ | ||
430 | |||
431 | return_desc->reference.opcode = AML_INDEX_OP; | ||
432 | return_desc->reference.offset = (u32) index; | ||
433 | |||
434 | /* Store the reference to the Target */ | 453 | /* Store the reference to the Target */ |
435 | 454 | ||
436 | status = acpi_ex_store(return_desc, operand[2], walk_state); | 455 | status = acpi_ex_store(return_desc, operand[2], walk_state); |
@@ -495,7 +514,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
495 | acpi_status status = AE_OK; | 514 | acpi_status status = AE_OK; |
496 | u8 logical_result = FALSE; | 515 | u8 logical_result = FALSE; |
497 | 516 | ||
498 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R", | 517 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_1R, |
499 | acpi_ps_get_opcode_name(walk_state->opcode)); | 518 | acpi_ps_get_opcode_name(walk_state->opcode)); |
500 | 519 | ||
501 | /* Create the internal return object */ | 520 | /* Create the internal return object */ |
@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
509 | /* Execute the Opcode */ | 528 | /* Execute the Opcode */ |
510 | 529 | ||
511 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { | 530 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { |
531 | |||
512 | /* logical_op (Operand0, Operand1) */ | 532 | /* logical_op (Operand0, Operand1) */ |
513 | 533 | ||
514 | status = acpi_ex_do_logical_numeric_op(walk_state->opcode, | 534 | status = acpi_ex_do_logical_numeric_op(walk_state->opcode, |
@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
518 | value, &logical_result); | 538 | value, &logical_result); |
519 | goto store_logical_result; | 539 | goto store_logical_result; |
520 | } else if (walk_state->op_info->flags & AML_LOGICAL) { | 540 | } else if (walk_state->op_info->flags & AML_LOGICAL) { |
541 | |||
521 | /* logical_op (Operand0, Operand1) */ | 542 | /* logical_op (Operand0, Operand1) */ |
522 | 543 | ||
523 | status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], | 544 | status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 6a3a883cb8a3..e2d945dfd509 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -88,20 +88,19 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
88 | struct acpi_signal_fatal_info *fatal; | 88 | struct acpi_signal_fatal_info *fatal; |
89 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
90 | 90 | ||
91 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", | 91 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R, |
92 | acpi_ps_get_opcode_name(walk_state->opcode)); | 92 | acpi_ps_get_opcode_name(walk_state->opcode)); |
93 | 93 | ||
94 | switch (walk_state->opcode) { | 94 | switch (walk_state->opcode) { |
95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
96 | 96 | ||
97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
98 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 98 | "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
99 | (u32) operand[0]->integer.value, | 99 | (u32) operand[0]->integer.value, |
100 | (u32) operand[1]->integer.value, | 100 | (u32) operand[1]->integer.value, |
101 | (u32) operand[2]->integer.value)); | 101 | (u32) operand[2]->integer.value)); |
102 | 102 | ||
103 | fatal = | 103 | fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); |
104 | ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); | ||
105 | if (fatal) { | 104 | if (fatal) { |
106 | fatal->type = (u32) operand[0]->integer.value; | 105 | fatal->type = (u32) operand[0]->integer.value; |
107 | fatal->code = (u32) operand[1]->integer.value; | 106 | fatal->code = (u32) operand[1]->integer.value; |
@@ -114,7 +113,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
114 | 113 | ||
115 | /* Might return while OS is shutting down, just continue */ | 114 | /* Might return while OS is shutting down, just continue */ |
116 | 115 | ||
117 | ACPI_MEM_FREE(fatal); | 116 | ACPI_FREE(fatal); |
118 | break; | 117 | break; |
119 | 118 | ||
120 | default: | 119 | default: |
@@ -151,7 +150,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
151 | acpi_integer index; | 150 | acpi_integer index; |
152 | acpi_size length; | 151 | acpi_size length; |
153 | 152 | ||
154 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", | 153 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, |
155 | acpi_ps_get_opcode_name(walk_state->opcode)); | 154 | acpi_ps_get_opcode_name(walk_state->opcode)); |
156 | 155 | ||
157 | switch (walk_state->opcode) { | 156 | switch (walk_state->opcode) { |
@@ -196,7 +195,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
196 | 195 | ||
197 | /* Always allocate a new buffer for the String */ | 196 | /* Always allocate a new buffer for the String */ |
198 | 197 | ||
199 | buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); | 198 | buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); |
200 | if (!buffer) { | 199 | if (!buffer) { |
201 | status = AE_NO_MEMORY; | 200 | status = AE_NO_MEMORY; |
202 | goto cleanup; | 201 | goto cleanup; |
@@ -208,9 +207,10 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
208 | /* If the requested length is zero, don't allocate a buffer */ | 207 | /* If the requested length is zero, don't allocate a buffer */ |
209 | 208 | ||
210 | if (length > 0) { | 209 | if (length > 0) { |
210 | |||
211 | /* Allocate a new buffer for the Buffer */ | 211 | /* Allocate a new buffer for the Buffer */ |
212 | 212 | ||
213 | buffer = ACPI_MEM_CALLOCATE(length); | 213 | buffer = ACPI_ALLOCATE_ZEROED(length); |
214 | if (!buffer) { | 214 | if (!buffer) { |
215 | status = AE_NO_MEMORY; | 215 | status = AE_NO_MEMORY; |
216 | goto cleanup; | 216 | goto cleanup; |
@@ -225,6 +225,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | if (buffer) { | 227 | if (buffer) { |
228 | |||
228 | /* We have a buffer, copy the portion requested */ | 229 | /* We have a buffer, copy the portion requested */ |
229 | 230 | ||
230 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, | 231 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index e043d924444f..f0c0ba6eb408 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -220,7 +220,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
220 | acpi_integer index; | 220 | acpi_integer index; |
221 | union acpi_operand_object *this_element; | 221 | union acpi_operand_object *this_element; |
222 | 222 | ||
223 | ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", | 223 | ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, |
224 | acpi_ps_get_opcode_name(walk_state->opcode)); | 224 | acpi_ps_get_opcode_name(walk_state->opcode)); |
225 | 225 | ||
226 | switch (walk_state->opcode) { | 226 | switch (walk_state->opcode) { |
@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
276 | * match was found. | 276 | * match was found. |
277 | */ | 277 | */ |
278 | for (; index < operand[0]->package.count; index++) { | 278 | for (; index < operand[0]->package.count; index++) { |
279 | |||
279 | /* Get the current package element */ | 280 | /* Get the current package element */ |
280 | 281 | ||
281 | this_element = operand[0]->package.elements[index]; | 282 | this_element = operand[0]->package.elements[index]; |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 7719ae5d4f16..44d064f427b9 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -97,7 +97,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
97 | u32 minimum_accesses = 0xFFFFFFFF; | 97 | u32 minimum_accesses = 0xFFFFFFFF; |
98 | u32 accesses; | 98 | u32 accesses; |
99 | 99 | ||
100 | ACPI_FUNCTION_TRACE("ex_generate_access"); | 100 | ACPI_FUNCTION_TRACE(ex_generate_access); |
101 | 101 | ||
102 | /* Round Field start offset and length to "minimal" byte boundaries */ | 102 | /* Round Field start offset and length to "minimal" byte boundaries */ |
103 | 103 | ||
@@ -146,7 +146,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
146 | accesses = field_end_offset - field_start_offset; | 146 | accesses = field_end_offset - field_start_offset; |
147 | 147 | ||
148 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 148 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
149 | "access_width %d end is within region\n", | 149 | "AccessWidth %d end is within region\n", |
150 | access_byte_width)); | 150 | access_byte_width)); |
151 | 151 | ||
152 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 152 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
@@ -173,7 +173,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
173 | } | 173 | } |
174 | } else { | 174 | } else { |
175 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 175 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
176 | "access_width %d end is NOT within region\n", | 176 | "AccessWidth %d end is NOT within region\n", |
177 | access_byte_width)); | 177 | access_byte_width)); |
178 | if (access_byte_width == 1) { | 178 | if (access_byte_width == 1) { |
179 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 179 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
@@ -228,7 +228,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
228 | u32 byte_alignment; | 228 | u32 byte_alignment; |
229 | u32 bit_length; | 229 | u32 bit_length; |
230 | 230 | ||
231 | ACPI_FUNCTION_TRACE("ex_decode_field_access"); | 231 | ACPI_FUNCTION_TRACE(ex_decode_field_access); |
232 | 232 | ||
233 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); | 233 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); |
234 | 234 | ||
@@ -322,7 +322,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
322 | u32 byte_alignment; | 322 | u32 byte_alignment; |
323 | u32 nearest_byte_address; | 323 | u32 nearest_byte_address; |
324 | 324 | ||
325 | ACPI_FUNCTION_TRACE("ex_prep_common_field_object"); | 325 | ACPI_FUNCTION_TRACE(ex_prep_common_field_object); |
326 | 326 | ||
327 | /* | 327 | /* |
328 | * Note: the structure being initialized is the | 328 | * Note: the structure being initialized is the |
@@ -415,13 +415,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
415 | u32 type; | 415 | u32 type; |
416 | acpi_status status; | 416 | acpi_status status; |
417 | 417 | ||
418 | ACPI_FUNCTION_TRACE("ex_prep_field_value"); | 418 | ACPI_FUNCTION_TRACE(ex_prep_field_value); |
419 | 419 | ||
420 | /* Parameter validation */ | 420 | /* Parameter validation */ |
421 | 421 | ||
422 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { | 422 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { |
423 | if (!info->region_node) { | 423 | if (!info->region_node) { |
424 | ACPI_ERROR((AE_INFO, "Null region_node")); | 424 | ACPI_ERROR((AE_INFO, "Null RegionNode")); |
425 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 425 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
426 | } | 426 | } |
427 | 427 | ||
@@ -467,7 +467,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
467 | acpi_ut_add_reference(obj_desc->field.region_obj); | 467 | acpi_ut_add_reference(obj_desc->field.region_obj); |
468 | 468 | ||
469 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 469 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
470 | "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", | 470 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
471 | obj_desc->field.start_field_bit_offset, | 471 | obj_desc->field.start_field_bit_offset, |
472 | obj_desc->field.base_byte_offset, | 472 | obj_desc->field.base_byte_offset, |
473 | obj_desc->field.access_byte_width, | 473 | obj_desc->field.access_byte_width, |
@@ -488,7 +488,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
488 | acpi_ut_add_reference(obj_desc->bank_field.bank_obj); | 488 | acpi_ut_add_reference(obj_desc->bank_field.bank_obj); |
489 | 489 | ||
490 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 490 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
491 | "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", | 491 | "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n", |
492 | obj_desc->bank_field.start_field_bit_offset, | 492 | obj_desc->bank_field.start_field_bit_offset, |
493 | obj_desc->bank_field.base_byte_offset, | 493 | obj_desc->bank_field.base_byte_offset, |
494 | obj_desc->field.access_byte_width, | 494 | obj_desc->field.access_byte_width, |
@@ -519,16 +519,29 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
519 | acpi_ut_add_reference(obj_desc->index_field.index_obj); | 519 | acpi_ut_add_reference(obj_desc->index_field.index_obj); |
520 | 520 | ||
521 | /* | 521 | /* |
522 | * April 2006: Changed to match MS behavior | ||
523 | * | ||
522 | * The value written to the Index register is the byte offset of the | 524 | * The value written to the Index register is the byte offset of the |
523 | * target field | 525 | * target field in units of the granularity of the index_field |
524 | * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position) | 526 | * |
527 | * Previously, the value was calculated as an index in terms of the | ||
528 | * width of the Data register, as below: | ||
529 | * | ||
530 | * obj_desc->index_field.Value = (u32) | ||
531 | * (Info->field_bit_position / ACPI_MUL_8 ( | ||
532 | * obj_desc->Field.access_byte_width)); | ||
533 | * | ||
534 | * February 2006: Tried value as a byte offset: | ||
535 | * obj_desc->index_field.Value = (u32) | ||
536 | * ACPI_DIV_8 (Info->field_bit_position); | ||
525 | */ | 537 | */ |
526 | obj_desc->index_field.value = (u32) | 538 | obj_desc->index_field.value = |
527 | (info->field_bit_position / | 539 | (u32) ACPI_ROUND_DOWN(ACPI_DIV_8(info->field_bit_position), |
528 | ACPI_MUL_8(obj_desc->field.access_byte_width)); | 540 | obj_desc->index_field. |
541 | access_byte_width); | ||
529 | 542 | ||
530 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 543 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
531 | "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", | 544 | "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", |
532 | obj_desc->index_field.start_field_bit_offset, | 545 | obj_desc->index_field.start_field_bit_offset, |
533 | obj_desc->index_field.base_byte_offset, | 546 | obj_desc->index_field.base_byte_offset, |
534 | obj_desc->index_field.value, | 547 | obj_desc->index_field.value, |
@@ -550,7 +563,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
550 | acpi_ns_get_type(info->field_node)); | 563 | acpi_ns_get_type(info->field_node)); |
551 | 564 | ||
552 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 565 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
553 | "Set named_obj %p [%4.4s], obj_desc %p\n", | 566 | "Set NamedObj %p [%4.4s], ObjDesc %p\n", |
554 | info->field_node, | 567 | info->field_node, |
555 | acpi_ut_get_node_name(info->field_node), obj_desc)); | 568 | acpi_ut_get_node_name(info->field_node), obj_desc)); |
556 | 569 | ||
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 6a4cfdff606d..3cc97ba48b36 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -81,7 +81,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
81 | u32 remainder; | 81 | u32 remainder; |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("ex_system_memory_space_handler"); | 84 | ACPI_FUNCTION_TRACE(ex_system_memory_space_handler); |
85 | 85 | ||
86 | /* Validate and translate the bit width */ | 86 | /* Validate and translate the bit width */ |
87 | 87 | ||
@@ -103,7 +103,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
103 | break; | 103 | break; |
104 | 104 | ||
105 | default: | 105 | default: |
106 | ACPI_ERROR((AE_INFO, "Invalid system_memory width %d", | 106 | ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d", |
107 | bit_width)); | 107 | bit_width)); |
108 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 108 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
109 | } | 109 | } |
@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
135 | * Delete the existing mapping and create a new one. | 135 | * Delete the existing mapping and create a new one. |
136 | */ | 136 | */ |
137 | if (mem_info->mapped_length) { | 137 | if (mem_info->mapped_length) { |
138 | |||
138 | /* Valid mapping, delete it */ | 139 | /* Valid mapping, delete it */ |
139 | 140 | ||
140 | acpi_os_unmap_memory(mem_info->mapped_logical_address, | 141 | acpi_os_unmap_memory(mem_info->mapped_logical_address, |
@@ -181,8 +182,8 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
181 | (acpi_integer) mem_info->mapped_physical_address); | 182 | (acpi_integer) mem_info->mapped_physical_address); |
182 | 183 | ||
183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 184 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
184 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", | 185 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", |
185 | function, bit_width, ACPI_FORMAT_UINT64(address))); | 186 | bit_width, function, ACPI_FORMAT_UINT64(address))); |
186 | 187 | ||
187 | /* | 188 | /* |
188 | * Perform the memory read or write | 189 | * Perform the memory read or write |
@@ -283,11 +284,11 @@ acpi_ex_system_io_space_handler(u32 function, | |||
283 | acpi_status status = AE_OK; | 284 | acpi_status status = AE_OK; |
284 | u32 value32; | 285 | u32 value32; |
285 | 286 | ||
286 | ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); | 287 | ACPI_FUNCTION_TRACE(ex_system_io_space_handler); |
287 | 288 | ||
288 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 289 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
289 | "system_iO %d (%d width) Address=%8.8X%8.8X\n", | 290 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", |
290 | function, bit_width, ACPI_FORMAT_UINT64(address))); | 291 | bit_width, function, ACPI_FORMAT_UINT64(address))); |
291 | 292 | ||
292 | /* Decode the function parameter */ | 293 | /* Decode the function parameter */ |
293 | 294 | ||
@@ -342,7 +343,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
342 | struct acpi_pci_id *pci_id; | 343 | struct acpi_pci_id *pci_id; |
343 | u16 pci_register; | 344 | u16 pci_register; |
344 | 345 | ||
345 | ACPI_FUNCTION_TRACE("ex_pci_config_space_handler"); | 346 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); |
346 | 347 | ||
347 | /* | 348 | /* |
348 | * The arguments to acpi_os(Read|Write)pci_configuration are: | 349 | * The arguments to acpi_os(Read|Write)pci_configuration are: |
@@ -360,7 +361,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
360 | pci_register = (u16) (u32) address; | 361 | pci_register = (u16) (u32) address; |
361 | 362 | ||
362 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 363 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
363 | "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", | 364 | "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", |
364 | function, bit_width, pci_id->segment, pci_id->bus, | 365 | function, bit_width, pci_id->segment, pci_id->bus, |
365 | pci_id->device, pci_id->function, pci_register)); | 366 | pci_id->device, pci_id->function, pci_register)); |
366 | 367 | ||
@@ -414,7 +415,7 @@ acpi_ex_cmos_space_handler(u32 function, | |||
414 | { | 415 | { |
415 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
416 | 417 | ||
417 | ACPI_FUNCTION_TRACE("ex_cmos_space_handler"); | 418 | ACPI_FUNCTION_TRACE(ex_cmos_space_handler); |
418 | 419 | ||
419 | return_ACPI_STATUS(status); | 420 | return_ACPI_STATUS(status); |
420 | } | 421 | } |
@@ -446,7 +447,7 @@ acpi_ex_pci_bar_space_handler(u32 function, | |||
446 | { | 447 | { |
447 | acpi_status status = AE_OK; | 448 | acpi_status status = AE_OK; |
448 | 449 | ||
449 | ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler"); | 450 | ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler); |
450 | 451 | ||
451 | return_ACPI_STATUS(status); | 452 | return_ACPI_STATUS(status); |
452 | } | 453 | } |
@@ -476,23 +477,16 @@ acpi_ex_data_table_space_handler(u32 function, | |||
476 | acpi_integer * value, | 477 | acpi_integer * value, |
477 | void *handler_context, void *region_context) | 478 | void *handler_context, void *region_context) |
478 | { | 479 | { |
479 | acpi_status status = AE_OK; | 480 | ACPI_FUNCTION_TRACE(ex_data_table_space_handler); |
480 | u32 byte_width = ACPI_DIV_8(bit_width); | ||
481 | u32 i; | ||
482 | char *logical_addr_ptr; | ||
483 | |||
484 | ACPI_FUNCTION_TRACE("ex_data_table_space_handler"); | ||
485 | |||
486 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address); | ||
487 | 481 | ||
488 | /* Perform the memory read or write */ | 482 | /* Perform the memory read or write */ |
489 | 483 | ||
490 | switch (function) { | 484 | switch (function) { |
491 | case ACPI_READ: | 485 | case ACPI_READ: |
492 | 486 | ||
493 | for (i = 0; i < byte_width; i++) { | 487 | ACPI_MEMCPY(ACPI_CAST_PTR(char, value), |
494 | ((char *)value)[i] = logical_addr_ptr[i]; | 488 | ACPI_PHYSADDR_TO_PTR(address), |
495 | } | 489 | ACPI_DIV_8(bit_width)); |
496 | break; | 490 | break; |
497 | 491 | ||
498 | case ACPI_WRITE: | 492 | case ACPI_WRITE: |
@@ -501,5 +495,5 @@ acpi_ex_data_table_space_handler(u32 function, | |||
501 | return_ACPI_STATUS(AE_SUPPORT); | 495 | return_ACPI_STATUS(AE_SUPPORT); |
502 | } | 496 | } |
503 | 497 | ||
504 | return_ACPI_STATUS(status); | 498 | return_ACPI_STATUS(AE_OK); |
505 | } | 499 | } |
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 01b26c80d22b..3089b05a1368 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -87,7 +87,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
87 | struct acpi_namespace_node *node; | 87 | struct acpi_namespace_node *node; |
88 | acpi_object_type entry_type; | 88 | acpi_object_type entry_type; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_resolve_node_to_value"); | 90 | ACPI_FUNCTION_TRACE(ex_resolve_node_to_value); |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the | 93 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the |
@@ -97,12 +97,13 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
97 | source_desc = acpi_ns_get_attached_object(node); | 97 | source_desc = acpi_ns_get_attached_object(node); |
98 | entry_type = acpi_ns_get_type((acpi_handle) node); | 98 | entry_type = acpi_ns_get_type((acpi_handle) node); |
99 | 99 | ||
100 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", | 100 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", |
101 | node, source_desc, | 101 | node, source_desc, |
102 | acpi_ut_get_type_name(entry_type))); | 102 | acpi_ut_get_type_name(entry_type))); |
103 | 103 | ||
104 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || | 104 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || |
105 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { | 105 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { |
106 | |||
106 | /* There is always exactly one level of indirection */ | 107 | /* There is always exactly one level of indirection */ |
107 | 108 | ||
108 | node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); | 109 | node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); |
@@ -113,10 +114,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
113 | 114 | ||
114 | /* | 115 | /* |
115 | * Several object types require no further processing: | 116 | * Several object types require no further processing: |
116 | * 1) Devices rarely have an attached object, return the Node | 117 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node |
117 | * 2) Method locals and arguments have a pseudo-Node | 118 | * 2) Method locals and arguments have a pseudo-Node |
118 | */ | 119 | */ |
119 | if (entry_type == ACPI_TYPE_DEVICE || | 120 | if ((entry_type == ACPI_TYPE_DEVICE) || |
121 | (entry_type == ACPI_TYPE_THERMAL) || | ||
120 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { | 122 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { |
121 | return_ACPI_STATUS(AE_OK); | 123 | return_ACPI_STATUS(AE_OK); |
122 | } | 124 | } |
@@ -141,6 +143,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
141 | 143 | ||
142 | status = acpi_ds_get_package_arguments(source_desc); | 144 | status = acpi_ds_get_package_arguments(source_desc); |
143 | if (ACPI_SUCCESS(status)) { | 145 | if (ACPI_SUCCESS(status)) { |
146 | |||
144 | /* Return an additional reference to the object */ | 147 | /* Return an additional reference to the object */ |
145 | 148 | ||
146 | obj_desc = source_desc; | 149 | obj_desc = source_desc; |
@@ -158,6 +161,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
158 | 161 | ||
159 | status = acpi_ds_get_buffer_arguments(source_desc); | 162 | status = acpi_ds_get_buffer_arguments(source_desc); |
160 | if (ACPI_SUCCESS(status)) { | 163 | if (ACPI_SUCCESS(status)) { |
164 | |||
161 | /* Return an additional reference to the object */ | 165 | /* Return an additional reference to the object */ |
162 | 166 | ||
163 | obj_desc = source_desc; | 167 | obj_desc = source_desc; |
@@ -199,7 +203,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
199 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 203 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
200 | 204 | ||
201 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
202 | "field_read Node=%p source_desc=%p Type=%X\n", | 206 | "FieldRead Node=%p SourceDesc=%p Type=%X\n", |
203 | node, source_desc, entry_type)); | 207 | node, source_desc, entry_type)); |
204 | 208 | ||
205 | status = | 209 | status = |
@@ -213,7 +217,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
213 | case ACPI_TYPE_METHOD: | 217 | case ACPI_TYPE_METHOD: |
214 | case ACPI_TYPE_POWER: | 218 | case ACPI_TYPE_POWER: |
215 | case ACPI_TYPE_PROCESSOR: | 219 | case ACPI_TYPE_PROCESSOR: |
216 | case ACPI_TYPE_THERMAL: | ||
217 | case ACPI_TYPE_EVENT: | 220 | case ACPI_TYPE_EVENT: |
218 | case ACPI_TYPE_REGION: | 221 | case ACPI_TYPE_REGION: |
219 | 222 | ||
@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
240 | /* This is a ddb_handle */ | 243 | /* This is a ddb_handle */ |
241 | /* Return an additional reference to the object */ | 244 | /* Return an additional reference to the object */ |
242 | 245 | ||
246 | case AML_REF_OF_OP: | ||
247 | |||
243 | obj_desc = source_desc; | 248 | obj_desc = source_desc; |
244 | acpi_ut_add_reference(obj_desc); | 249 | acpi_ut_add_reference(obj_desc); |
245 | break; | 250 | break; |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 1deed492fe88..6499de878017 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -78,7 +78,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, | |||
78 | { | 78 | { |
79 | acpi_status status; | 79 | acpi_status status; |
80 | 80 | ||
81 | ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); | 81 | ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr); |
82 | 82 | ||
83 | if (!stack_ptr || !*stack_ptr) { | 83 | if (!stack_ptr || !*stack_ptr) { |
84 | ACPI_ERROR((AE_INFO, "Internal - null pointer")); | 84 | ACPI_ERROR((AE_INFO, "Internal - null pointer")); |
@@ -144,7 +144,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
144 | union acpi_operand_object *obj_desc; | 144 | union acpi_operand_object *obj_desc; |
145 | u16 opcode; | 145 | u16 opcode; |
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE("ex_resolve_object_to_value"); | 147 | ACPI_FUNCTION_TRACE(ex_resolve_object_to_value); |
148 | 148 | ||
149 | stack_desc = *stack_ptr; | 149 | stack_desc = *stack_ptr; |
150 | 150 | ||
@@ -190,7 +190,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
190 | } | 190 | } |
191 | 191 | ||
192 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 192 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
193 | "[Arg/Local %X] value_obj is %p\n", | 193 | "[Arg/Local %X] ValueObj is %p\n", |
194 | stack_desc->reference.offset, | 194 | stack_desc->reference.offset, |
195 | obj_desc)); | 195 | obj_desc)); |
196 | 196 | ||
@@ -239,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
239 | /* Invalid reference object */ | 239 | /* Invalid reference object */ |
240 | 240 | ||
241 | ACPI_ERROR((AE_INFO, | 241 | ACPI_ERROR((AE_INFO, |
242 | "Unknown target_type %X in Index/Reference obj %p", | 242 | "Unknown TargetType %X in Index/Reference obj %p", |
243 | stack_desc->reference.target_type, | 243 | stack_desc->reference.target_type, |
244 | stack_desc)); | 244 | stack_desc)); |
245 | status = AE_AML_INTERNAL; | 245 | status = AE_AML_INTERNAL; |
@@ -257,10 +257,24 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
257 | 257 | ||
258 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 258 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
259 | 259 | ||
260 | /* Get the object pointed to by the namespace node */ | 260 | /* Dereference the name */ |
261 | |||
262 | if ((stack_desc->reference.node->type == | ||
263 | ACPI_TYPE_DEVICE) | ||
264 | || (stack_desc->reference.node->type == | ||
265 | ACPI_TYPE_THERMAL)) { | ||
266 | |||
267 | /* These node types do not have 'real' subobjects */ | ||
268 | |||
269 | *stack_ptr = (void *)stack_desc->reference.node; | ||
270 | } else { | ||
271 | /* Get the object pointed to by the namespace node */ | ||
272 | |||
273 | *stack_ptr = | ||
274 | (stack_desc->reference.node)->object; | ||
275 | acpi_ut_add_reference(*stack_ptr); | ||
276 | } | ||
261 | 277 | ||
262 | *stack_ptr = (stack_desc->reference.node)->object; | ||
263 | acpi_ut_add_reference(*stack_ptr); | ||
264 | acpi_ut_remove_reference(stack_desc); | 278 | acpi_ut_remove_reference(stack_desc); |
265 | break; | 279 | break; |
266 | 280 | ||
@@ -293,7 +307,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
293 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 307 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
294 | 308 | ||
295 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 309 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
296 | "field_read source_desc=%p Type=%X\n", | 310 | "FieldRead SourceDesc=%p Type=%X\n", |
297 | stack_desc, | 311 | stack_desc, |
298 | ACPI_GET_OBJECT_TYPE(stack_desc))); | 312 | ACPI_GET_OBJECT_TYPE(stack_desc))); |
299 | 313 | ||
@@ -337,7 +351,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
337 | acpi_object_type type; | 351 | acpi_object_type type; |
338 | acpi_status status; | 352 | acpi_status status; |
339 | 353 | ||
340 | ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple"); | 354 | ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple); |
341 | 355 | ||
342 | /* Operand can be either a namespace node or an operand descriptor */ | 356 | /* Operand can be either a namespace node or an operand descriptor */ |
343 | 357 | ||
@@ -382,10 +396,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
382 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 396 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { |
383 | switch (obj_desc->reference.opcode) { | 397 | switch (obj_desc->reference.opcode) { |
384 | case AML_REF_OF_OP: | 398 | case AML_REF_OF_OP: |
399 | case AML_INT_NAMEPATH_OP: | ||
385 | 400 | ||
386 | /* Dereference the reference pointer */ | 401 | /* Dereference the reference pointer */ |
387 | 402 | ||
388 | node = obj_desc->reference.object; | 403 | if (obj_desc->reference.opcode == AML_REF_OF_OP) { |
404 | node = obj_desc->reference.object; | ||
405 | } else { /* AML_INT_NAMEPATH_OP */ | ||
406 | |||
407 | node = obj_desc->reference.node; | ||
408 | } | ||
389 | 409 | ||
390 | /* All "References" point to a NS node */ | 410 | /* All "References" point to a NS node */ |
391 | 411 | ||
@@ -401,6 +421,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
401 | 421 | ||
402 | obj_desc = acpi_ns_get_attached_object(node); | 422 | obj_desc = acpi_ns_get_attached_object(node); |
403 | if (!obj_desc) { | 423 | if (!obj_desc) { |
424 | |||
404 | /* No object, use the NS node type */ | 425 | /* No object, use the NS node type */ |
405 | 426 | ||
406 | type = acpi_ns_get_type(node); | 427 | type = acpi_ns_get_type(node); |
@@ -432,6 +453,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
432 | */ | 453 | */ |
433 | obj_desc = *(obj_desc->reference.where); | 454 | obj_desc = *(obj_desc->reference.where); |
434 | if (!obj_desc) { | 455 | if (!obj_desc) { |
456 | |||
435 | /* NULL package elements are allowed */ | 457 | /* NULL package elements are allowed */ |
436 | 458 | ||
437 | type = 0; /* Uninitialized */ | 459 | type = 0; /* Uninitialized */ |
@@ -439,39 +461,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
439 | } | 461 | } |
440 | break; | 462 | break; |
441 | 463 | ||
442 | case AML_INT_NAMEPATH_OP: | ||
443 | |||
444 | /* Dereference the reference pointer */ | ||
445 | |||
446 | node = obj_desc->reference.node; | ||
447 | |||
448 | /* All "References" point to a NS node */ | ||
449 | |||
450 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != | ||
451 | ACPI_DESC_TYPE_NAMED) { | ||
452 | ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]", | ||
453 | node, | ||
454 | acpi_ut_get_descriptor_name(node))); | ||
455 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
456 | } | ||
457 | |||
458 | /* Get the attached object */ | ||
459 | |||
460 | obj_desc = acpi_ns_get_attached_object(node); | ||
461 | if (!obj_desc) { | ||
462 | /* No object, use the NS node type */ | ||
463 | |||
464 | type = acpi_ns_get_type(node); | ||
465 | goto exit; | ||
466 | } | ||
467 | |||
468 | /* Check for circular references */ | ||
469 | |||
470 | if (obj_desc == operand) { | ||
471 | return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); | ||
472 | } | ||
473 | break; | ||
474 | |||
475 | case AML_LOCAL_OP: | 464 | case AML_LOCAL_OP: |
476 | case AML_ARG_OP: | 465 | case AML_ARG_OP: |
477 | 466 | ||
@@ -513,7 +502,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
513 | 502 | ||
514 | case AML_DEBUG_OP: | 503 | case AML_DEBUG_OP: |
515 | 504 | ||
516 | /* The Debug Object is of type "debug_object" */ | 505 | /* The Debug Object is of type "DebugObject" */ |
517 | 506 | ||
518 | type = ACPI_TYPE_DEBUG_OBJECT; | 507 | type = ACPI_TYPE_DEBUG_OBJECT; |
519 | goto exit; | 508 | goto exit; |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index a1c000f5a415..4c93d0972333 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed, | |||
77 | ACPI_FUNCTION_ENTRY(); | 77 | ACPI_FUNCTION_ENTRY(); |
78 | 78 | ||
79 | if (type_needed == ACPI_TYPE_ANY) { | 79 | if (type_needed == ACPI_TYPE_ANY) { |
80 | |||
80 | /* All types OK, so we don't perform any typechecks */ | 81 | /* All types OK, so we don't perform any typechecks */ |
81 | 82 | ||
82 | return (AE_OK); | 83 | return (AE_OK); |
@@ -143,7 +144,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
143 | acpi_object_type type_needed; | 144 | acpi_object_type type_needed; |
144 | u16 target_op = 0; | 145 | u16 target_op = 0; |
145 | 146 | ||
146 | ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); | 147 | ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode); |
147 | 148 | ||
148 | op_info = acpi_ps_get_opcode_info(opcode); | 149 | op_info = acpi_ps_get_opcode_info(opcode); |
149 | if (op_info->class == AML_CLASS_UNKNOWN) { | 150 | if (op_info->class == AML_CLASS_UNKNOWN) { |
@@ -158,7 +159,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
158 | } | 159 | } |
159 | 160 | ||
160 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
161 | "Opcode %X [%s] required_operand_types=%8.8X\n", | 162 | "Opcode %X [%s] RequiredOperandTypes=%8.8X\n", |
162 | opcode, op_info->name, arg_types)); | 163 | opcode, op_info->name, arg_types)); |
163 | 164 | ||
164 | /* | 165 | /* |
@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
224 | } | 225 | } |
225 | 226 | ||
226 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 227 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
228 | |||
227 | /* Decode the Reference */ | 229 | /* Decode the Reference */ |
228 | 230 | ||
229 | op_info = acpi_ps_get_opcode_info(opcode); | 231 | op_info = acpi_ps_get_opcode_info(opcode); |
@@ -247,7 +249,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
247 | 249 | ||
248 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT | 250 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT |
249 | ((ACPI_DB_EXEC, | 251 | ((ACPI_DB_EXEC, |
250 | "Operand is a Reference, ref_opcode [%s]\n", | 252 | "Operand is a Reference, RefOpcode [%s]\n", |
251 | (acpi_ps_get_opcode_info | 253 | (acpi_ps_get_opcode_info |
252 | (obj_desc-> | 254 | (obj_desc-> |
253 | reference. | 255 | reference. |
@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
332 | } | 334 | } |
333 | 335 | ||
334 | if (obj_desc->reference.opcode == AML_NAME_OP) { | 336 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
337 | |||
335 | /* Convert a named reference to the actual named object */ | 338 | /* Convert a named reference to the actual named object */ |
336 | 339 | ||
337 | temp_node = obj_desc->reference.object; | 340 | temp_node = obj_desc->reference.object; |
@@ -623,7 +626,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
623 | 626 | ||
624 | default: | 627 | default: |
625 | ACPI_ERROR((AE_INFO, | 628 | ACPI_ERROR((AE_INFO, |
626 | "Needed [Region/region_field], found [%s] %p", | 629 | "Needed [Region/RegionField], found [%s] %p", |
627 | acpi_ut_get_object_type_name | 630 | acpi_ut_get_object_type_name |
628 | (obj_desc), obj_desc)); | 631 | (obj_desc), obj_desc)); |
629 | 632 | ||
@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
662 | } | 665 | } |
663 | 666 | ||
664 | if (target_op == AML_DEBUG_OP) { | 667 | if (target_op == AML_DEBUG_OP) { |
668 | |||
665 | /* Allow store of any object to the Debug object */ | 669 | /* Allow store of any object to the Debug object */ |
666 | 670 | ||
667 | break; | 671 | break; |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 3f020c0e2b95..0456405ba019 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -82,7 +82,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
82 | { | 82 | { |
83 | u32 i; | 83 | u32 i; |
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc); | 85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); |
86 | 86 | ||
87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | 87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", |
88 | level, " ")); | 88 | level, " ")); |
@@ -245,7 +245,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
245 | acpi_status status = AE_OK; | 245 | acpi_status status = AE_OK; |
246 | union acpi_operand_object *ref_desc = dest_desc; | 246 | union acpi_operand_object *ref_desc = dest_desc; |
247 | 247 | ||
248 | ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc); | 248 | ACPI_FUNCTION_TRACE_PTR(ex_store, dest_desc); |
249 | 249 | ||
250 | /* Validate parameters */ | 250 | /* Validate parameters */ |
251 | 251 | ||
@@ -297,7 +297,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
297 | 297 | ||
298 | ACPI_DUMP_STACK_ENTRY(source_desc); | 298 | ACPI_DUMP_STACK_ENTRY(source_desc); |
299 | ACPI_DUMP_STACK_ENTRY(dest_desc); | 299 | ACPI_DUMP_STACK_ENTRY(dest_desc); |
300 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", | 300 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore", |
301 | 2, | 301 | 2, |
302 | "Target is not a Reference or Constant object"); | 302 | "Target is not a Reference or Constant object"); |
303 | 303 | ||
@@ -396,7 +396,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
396 | u8 value = 0; | 396 | u8 value = 0; |
397 | u32 i; | 397 | u32 i; |
398 | 398 | ||
399 | ACPI_FUNCTION_TRACE("ex_store_object_to_index"); | 399 | ACPI_FUNCTION_TRACE(ex_store_object_to_index); |
400 | 400 | ||
401 | /* | 401 | /* |
402 | * Destination must be a reference pointer, and | 402 | * Destination must be a reference pointer, and |
@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
423 | } | 423 | } |
424 | 424 | ||
425 | if (obj_desc) { | 425 | if (obj_desc) { |
426 | |||
426 | /* Decrement reference count by the ref count of the parent package */ | 427 | /* Decrement reference count by the ref count of the parent package */ |
427 | 428 | ||
428 | for (i = 0; i < ((union acpi_operand_object *) | 429 | for (i = 0; i < ((union acpi_operand_object *) |
@@ -502,8 +503,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
502 | break; | 503 | break; |
503 | 504 | ||
504 | default: | 505 | default: |
505 | ACPI_ERROR((AE_INFO, | 506 | ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField")); |
506 | "Target is not a Package or buffer_field")); | ||
507 | status = AE_AML_OPERAND_TYPE; | 507 | status = AE_AML_OPERAND_TYPE; |
508 | break; | 508 | break; |
509 | } | 509 | } |
@@ -548,7 +548,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
548 | union acpi_operand_object *new_desc; | 548 | union acpi_operand_object *new_desc; |
549 | acpi_object_type target_type; | 549 | acpi_object_type target_type; |
550 | 550 | ||
551 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc); | 551 | ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_node, source_desc); |
552 | 552 | ||
553 | /* Get current type of the node, and object attached to Node */ | 553 | /* Get current type of the node, and object attached to Node */ |
554 | 554 | ||
@@ -572,6 +572,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
572 | /* If no implicit conversion, drop into the default case below */ | 572 | /* If no implicit conversion, drop into the default case below */ |
573 | 573 | ||
574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { | 574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { |
575 | |||
575 | /* Force execution of default (no implicit conversion) */ | 576 | /* Force execution of default (no implicit conversion) */ |
576 | 577 | ||
577 | target_type = ACPI_TYPE_ANY; | 578 | target_type = ACPI_TYPE_ANY; |
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 42967baf760d..591aaf0e18b3 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -72,7 +72,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
72 | union acpi_operand_object *source_desc = *source_desc_ptr; | 72 | union acpi_operand_object *source_desc = *source_desc_ptr; |
73 | acpi_status status = AE_OK; | 73 | acpi_status status = AE_OK; |
74 | 74 | ||
75 | ACPI_FUNCTION_TRACE("ex_resolve_object"); | 75 | ACPI_FUNCTION_TRACE(ex_resolve_object); |
76 | 76 | ||
77 | /* Ensure we have a Target that can be stored to */ | 77 | /* Ensure we have a Target that can be stored to */ |
78 | 78 | ||
@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
97 | */ | 97 | */ |
98 | if (ACPI_GET_OBJECT_TYPE(source_desc) == | 98 | if (ACPI_GET_OBJECT_TYPE(source_desc) == |
99 | ACPI_TYPE_LOCAL_REFERENCE) { | 99 | ACPI_TYPE_LOCAL_REFERENCE) { |
100 | |||
100 | /* Resolve a reference object first */ | 101 | /* Resolve a reference object first */ |
101 | 102 | ||
102 | status = | 103 | status = |
@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
121 | !((ACPI_GET_OBJECT_TYPE(source_desc) == | 122 | !((ACPI_GET_OBJECT_TYPE(source_desc) == |
122 | ACPI_TYPE_LOCAL_REFERENCE) | 123 | ACPI_TYPE_LOCAL_REFERENCE) |
123 | && (source_desc->reference.opcode == AML_LOAD_OP))) { | 124 | && (source_desc->reference.opcode == AML_LOAD_OP))) { |
125 | |||
124 | /* Conversion successful but still not a valid type */ | 126 | /* Conversion successful but still not a valid type */ |
125 | 127 | ||
126 | ACPI_ERROR((AE_INFO, | 128 | ACPI_ERROR((AE_INFO, |
@@ -199,7 +201,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
199 | union acpi_operand_object *actual_src_desc; | 201 | union acpi_operand_object *actual_src_desc; |
200 | acpi_status status = AE_OK; | 202 | acpi_status status = AE_OK; |
201 | 203 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc); | 204 | ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_object, source_desc); |
203 | 205 | ||
204 | actual_src_desc = source_desc; | 206 | actual_src_desc = source_desc; |
205 | if (!dest_desc) { | 207 | if (!dest_desc) { |
@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
289 | } | 291 | } |
290 | 292 | ||
291 | if (actual_src_desc != source_desc) { | 293 | if (actual_src_desc != source_desc) { |
294 | |||
292 | /* Delete the intermediate (temporary) source object */ | 295 | /* Delete the intermediate (temporary) source object */ |
293 | 296 | ||
294 | acpi_ut_remove_reference(actual_src_desc); | 297 | acpi_ut_remove_reference(actual_src_desc); |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 6ab707087750..99ebe5adfcda 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -67,7 +67,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
67 | u32 length; | 67 | u32 length; |
68 | u8 *buffer; | 68 | u8 *buffer; |
69 | 69 | ||
70 | ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); | 70 | ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc); |
71 | 71 | ||
72 | /* We know that source_desc is a buffer by now */ | 72 | /* We know that source_desc is a buffer by now */ |
73 | 73 | ||
@@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
80 | */ | 80 | */ |
81 | if ((target_desc->buffer.length == 0) || | 81 | if ((target_desc->buffer.length == 0) || |
82 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { | 82 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { |
83 | target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); | 83 | target_desc->buffer.pointer = ACPI_ALLOCATE(length); |
84 | if (!target_desc->buffer.pointer) { | 84 | if (!target_desc->buffer.pointer) { |
85 | return_ACPI_STATUS(AE_NO_MEMORY); | 85 | return_ACPI_STATUS(AE_NO_MEMORY); |
86 | } | 86 | } |
@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
91 | /* Copy source buffer to target buffer */ | 91 | /* Copy source buffer to target buffer */ |
92 | 92 | ||
93 | if (length <= target_desc->buffer.length) { | 93 | if (length <= target_desc->buffer.length) { |
94 | |||
94 | /* Clear existing buffer and copy in the new one */ | 95 | /* Clear existing buffer and copy in the new one */ |
95 | 96 | ||
96 | ACPI_MEMSET(target_desc->buffer.pointer, 0, | 97 | ACPI_MEMSET(target_desc->buffer.pointer, 0, |
@@ -102,7 +103,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
102 | * NOTE: ACPI versions up to 3.0 specified that the buffer must be | 103 | * NOTE: ACPI versions up to 3.0 specified that the buffer must be |
103 | * truncated if the string is smaller than the buffer. However, "other" | 104 | * truncated if the string is smaller than the buffer. However, "other" |
104 | * implementations of ACPI never did this and thus became the defacto | 105 | * implementations of ACPI never did this and thus became the defacto |
105 | * standard. ACPi 3.0_a changes this behavior such that the buffer | 106 | * standard. ACPI 3.0_a changes this behavior such that the buffer |
106 | * is no longer truncated. | 107 | * is no longer truncated. |
107 | */ | 108 | */ |
108 | 109 | ||
@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
113 | * copy must not truncate the original buffer. | 114 | * copy must not truncate the original buffer. |
114 | */ | 115 | */ |
115 | if (original_src_type == ACPI_TYPE_STRING) { | 116 | if (original_src_type == ACPI_TYPE_STRING) { |
117 | |||
116 | /* Set the new length of the target */ | 118 | /* Set the new length of the target */ |
117 | 119 | ||
118 | target_desc->buffer.length = length; | 120 | target_desc->buffer.length = length; |
@@ -156,7 +158,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
156 | u32 length; | 158 | u32 length; |
157 | u8 *buffer; | 159 | u8 *buffer; |
158 | 160 | ||
159 | ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); | 161 | ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc); |
160 | 162 | ||
161 | /* We know that source_desc is a string by now */ | 163 | /* We know that source_desc is a string by now */ |
162 | 164 | ||
@@ -183,13 +185,14 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
183 | */ | 185 | */ |
184 | if (target_desc->string.pointer && | 186 | if (target_desc->string.pointer && |
185 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { | 187 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { |
188 | |||
186 | /* Only free if not a pointer into the DSDT */ | 189 | /* Only free if not a pointer into the DSDT */ |
187 | 190 | ||
188 | ACPI_MEM_FREE(target_desc->string.pointer); | 191 | ACPI_FREE(target_desc->string.pointer); |
189 | } | 192 | } |
190 | 193 | ||
191 | target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) | 194 | target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size) |
192 | length + 1); | 195 | length + 1); |
193 | if (!target_desc->string.pointer) { | 196 | if (!target_desc->string.pointer) { |
194 | return_ACPI_STATUS(AE_NO_MEMORY); | 197 | return_ACPI_STATUS(AE_NO_MEMORY); |
195 | } | 198 | } |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index ea9144f42e1f..52beee3674a0 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -68,7 +68,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
68 | acpi_status status; | 68 | acpi_status status; |
69 | acpi_status status2; | 69 | acpi_status status2; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ex_system_wait_semaphore"); | 71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
72 | 72 | ||
73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); | 73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); |
74 | if (ACPI_SUCCESS(status)) { | 74 | if (ACPI_SUCCESS(status)) { |
@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | if (status == AE_TIME) { | 78 | if (status == AE_TIME) { |
79 | |||
79 | /* We must wait, so unlock the interpreter */ | 80 | /* We must wait, so unlock the interpreter */ |
80 | 81 | ||
81 | acpi_ex_exit_interpreter(); | 82 | acpi_ex_exit_interpreter(); |
@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
90 | 91 | ||
91 | status2 = acpi_ex_enter_interpreter(); | 92 | status2 = acpi_ex_enter_interpreter(); |
92 | if (ACPI_FAILURE(status2)) { | 93 | if (ACPI_FAILURE(status2)) { |
94 | |||
93 | /* Report fatal error, could not acquire interpreter */ | 95 | /* Report fatal error, could not acquire interpreter */ |
94 | 96 | ||
95 | return_ACPI_STATUS(status2); | 97 | return_ACPI_STATUS(status2); |
@@ -191,7 +193,7 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, | |||
191 | { | 193 | { |
192 | acpi_status status = AE_OK; | 194 | acpi_status status = AE_OK; |
193 | 195 | ||
194 | ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ex_system_acquire_mutex, obj_desc); |
195 | 197 | ||
196 | if (!obj_desc) { | 198 | if (!obj_desc) { |
197 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 199 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -229,7 +231,7 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) | |||
229 | { | 231 | { |
230 | acpi_status status = AE_OK; | 232 | acpi_status status = AE_OK; |
231 | 233 | ||
232 | ACPI_FUNCTION_TRACE("ex_system_release_mutex"); | 234 | ACPI_FUNCTION_TRACE(ex_system_release_mutex); |
233 | 235 | ||
234 | if (!obj_desc) { | 236 | if (!obj_desc) { |
235 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 237 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -263,7 +265,7 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) | |||
263 | { | 265 | { |
264 | acpi_status status = AE_OK; | 266 | acpi_status status = AE_OK; |
265 | 267 | ||
266 | ACPI_FUNCTION_TRACE("ex_system_signal_event"); | 268 | ACPI_FUNCTION_TRACE(ex_system_signal_event); |
267 | 269 | ||
268 | if (obj_desc) { | 270 | if (obj_desc) { |
269 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); | 271 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); |
@@ -293,7 +295,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, | |||
293 | { | 295 | { |
294 | acpi_status status = AE_OK; | 296 | acpi_status status = AE_OK; |
295 | 297 | ||
296 | ACPI_FUNCTION_TRACE("ex_system_wait_event"); | 298 | ACPI_FUNCTION_TRACE(ex_system_wait_event); |
297 | 299 | ||
298 | if (obj_desc) { | 300 | if (obj_desc) { |
299 | status = | 301 | status = |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index f73a61aeb7ec..982c8b65876f 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -87,9 +87,9 @@ acpi_status acpi_ex_enter_interpreter(void) | |||
87 | { | 87 | { |
88 | acpi_status status; | 88 | acpi_status status; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_enter_interpreter"); | 90 | ACPI_FUNCTION_TRACE(ex_enter_interpreter); |
91 | 91 | ||
92 | status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); | 92 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); |
93 | if (ACPI_FAILURE(status)) { | 93 | if (ACPI_FAILURE(status)) { |
94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); | 94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); |
95 | } | 95 | } |
@@ -123,9 +123,9 @@ void acpi_ex_exit_interpreter(void) | |||
123 | { | 123 | { |
124 | acpi_status status; | 124 | acpi_status status; |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ex_exit_interpreter"); | 126 | ACPI_FUNCTION_TRACE(ex_exit_interpreter); |
127 | 127 | ||
128 | status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); | 128 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); |
129 | if (ACPI_FAILURE(status)) { | 129 | if (ACPI_FAILURE(status)) { |
130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); | 130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); |
131 | } | 131 | } |
@@ -189,11 +189,12 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) | |||
189 | u8 locked = FALSE; | 189 | u8 locked = FALSE; |
190 | acpi_status status; | 190 | acpi_status status; |
191 | 191 | ||
192 | ACPI_FUNCTION_TRACE("ex_acquire_global_lock"); | 192 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); |
193 | 193 | ||
194 | /* Only attempt lock if the always_lock bit is set */ | 194 | /* Only attempt lock if the always_lock bit is set */ |
195 | 195 | ||
196 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { | 196 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { |
197 | |||
197 | /* We should attempt to get the lock, wait forever */ | 198 | /* We should attempt to get the lock, wait forever */ |
198 | 199 | ||
199 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); | 200 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); |
@@ -225,15 +226,17 @@ void acpi_ex_release_global_lock(u8 locked_by_me) | |||
225 | { | 226 | { |
226 | acpi_status status; | 227 | acpi_status status; |
227 | 228 | ||
228 | ACPI_FUNCTION_TRACE("ex_release_global_lock"); | 229 | ACPI_FUNCTION_TRACE(ex_release_global_lock); |
229 | 230 | ||
230 | /* Only attempt unlock if the caller locked it */ | 231 | /* Only attempt unlock if the caller locked it */ |
231 | 232 | ||
232 | if (locked_by_me) { | 233 | if (locked_by_me) { |
234 | |||
233 | /* OK, now release the lock */ | 235 | /* OK, now release the lock */ |
234 | 236 | ||
235 | status = acpi_ev_release_global_lock(); | 237 | status = acpi_ev_release_global_lock(); |
236 | if (ACPI_FAILURE(status)) { | 238 | if (ACPI_FAILURE(status)) { |
239 | |||
237 | /* Report the error, but there isn't much else we can do */ | 240 | /* Report the error, but there isn't much else we can do */ |
238 | 241 | ||
239 | ACPI_EXCEPTION((AE_INFO, status, | 242 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -263,7 +266,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
263 | u32 num_digits; | 266 | u32 num_digits; |
264 | acpi_integer current_value; | 267 | acpi_integer current_value; |
265 | 268 | ||
266 | ACPI_FUNCTION_TRACE("ex_digits_needed"); | 269 | ACPI_FUNCTION_TRACE(ex_digits_needed); |
267 | 270 | ||
268 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ | 271 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ |
269 | 272 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index e8165c4f162a..1cd25784b7a4 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -48,6 +48,8 @@ MODULE_LICENSE("GPL"); | |||
48 | 48 | ||
49 | static int acpi_fan_add(struct acpi_device *device); | 49 | static int acpi_fan_add(struct acpi_device *device); |
50 | static int acpi_fan_remove(struct acpi_device *device, int type); | 50 | static int acpi_fan_remove(struct acpi_device *device, int type); |
51 | static int acpi_fan_suspend(struct acpi_device *device, int state); | ||
52 | static int acpi_fan_resume(struct acpi_device *device, int state); | ||
51 | 53 | ||
52 | static struct acpi_driver acpi_fan_driver = { | 54 | static struct acpi_driver acpi_fan_driver = { |
53 | .name = ACPI_FAN_DRIVER_NAME, | 55 | .name = ACPI_FAN_DRIVER_NAME, |
@@ -56,6 +58,8 @@ static struct acpi_driver acpi_fan_driver = { | |||
56 | .ops = { | 58 | .ops = { |
57 | .add = acpi_fan_add, | 59 | .add = acpi_fan_add, |
58 | .remove = acpi_fan_remove, | 60 | .remove = acpi_fan_remove, |
61 | .suspend = acpi_fan_suspend, | ||
62 | .resume = acpi_fan_resume, | ||
59 | }, | 63 | }, |
60 | }; | 64 | }; |
61 | 65 | ||
@@ -206,6 +210,10 @@ static int acpi_fan_add(struct acpi_device *device) | |||
206 | goto end; | 210 | goto end; |
207 | } | 211 | } |
208 | 212 | ||
213 | device->flags.force_power_state = 1; | ||
214 | acpi_bus_set_power(device->handle, state); | ||
215 | device->flags.force_power_state = 0; | ||
216 | |||
209 | result = acpi_fan_add_fs(device); | 217 | result = acpi_fan_add_fs(device); |
210 | if (result) | 218 | if (result) |
211 | goto end; | 219 | goto end; |
@@ -239,6 +247,38 @@ static int acpi_fan_remove(struct acpi_device *device, int type) | |||
239 | return_VALUE(0); | 247 | return_VALUE(0); |
240 | } | 248 | } |
241 | 249 | ||
250 | static int acpi_fan_suspend(struct acpi_device *device, int state) | ||
251 | { | ||
252 | if (!device) | ||
253 | return -EINVAL; | ||
254 | |||
255 | acpi_bus_set_power(device->handle, ACPI_STATE_D0); | ||
256 | |||
257 | return AE_OK; | ||
258 | } | ||
259 | |||
260 | static int acpi_fan_resume(struct acpi_device *device, int state) | ||
261 | { | ||
262 | int result = 0; | ||
263 | int power_state = 0; | ||
264 | |||
265 | if (!device) | ||
266 | return -EINVAL; | ||
267 | |||
268 | result = acpi_bus_get_power(device->handle, &power_state); | ||
269 | if (result) { | ||
270 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
271 | "Error reading fan power state\n")); | ||
272 | return result; | ||
273 | } | ||
274 | |||
275 | device->flags.force_power_state = 1; | ||
276 | acpi_bus_set_power(device->handle, power_state); | ||
277 | device->flags.force_power_state = 0; | ||
278 | |||
279 | return result; | ||
280 | } | ||
281 | |||
242 | static int __init acpi_fan_init(void) | 282 | static int __init acpi_fan_init(void) |
243 | { | 283 | { |
244 | int result = 0; | 284 | int result = 0; |
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index ea2f13271ff1..de50fab2a910 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -63,7 +63,7 @@ acpi_status acpi_hw_initialize(void) | |||
63 | { | 63 | { |
64 | acpi_status status; | 64 | acpi_status status; |
65 | 65 | ||
66 | ACPI_FUNCTION_TRACE("hw_initialize"); | 66 | ACPI_FUNCTION_TRACE(hw_initialize); |
67 | 67 | ||
68 | /* We must have the ACPI tables by the time we get here */ | 68 | /* We must have the ACPI tables by the time we get here */ |
69 | 69 | ||
@@ -100,7 +100,7 @@ acpi_status acpi_hw_set_mode(u32 mode) | |||
100 | acpi_status status; | 100 | acpi_status status; |
101 | u32 retry; | 101 | u32 retry; |
102 | 102 | ||
103 | ACPI_FUNCTION_TRACE("hw_set_mode"); | 103 | ACPI_FUNCTION_TRACE(hw_set_mode); |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 106 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
@@ -198,7 +198,7 @@ u32 acpi_hw_get_mode(void) | |||
198 | acpi_status status; | 198 | acpi_status status; |
199 | u32 value; | 199 | u32 value; |
200 | 200 | ||
201 | ACPI_FUNCTION_TRACE("hw_get_mode"); | 201 | ACPI_FUNCTION_TRACE(hw_get_mode); |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 204 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index d84942d22dd5..608a3a60ee11 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
214 | /* Examine each GPE Register within the block */ | 214 | /* Examine each GPE Register within the block */ |
215 | 215 | ||
216 | for (i = 0; i < gpe_block->register_count; i++) { | 216 | for (i = 0; i < gpe_block->register_count; i++) { |
217 | |||
217 | /* Disable all GPEs in this register */ | 218 | /* Disable all GPEs in this register */ |
218 | 219 | ||
219 | status = acpi_hw_low_level_write(8, 0x00, | 220 | status = acpi_hw_low_level_write(8, 0x00, |
@@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
250 | /* Examine each GPE Register within the block */ | 251 | /* Examine each GPE Register within the block */ |
251 | 252 | ||
252 | for (i = 0; i < gpe_block->register_count; i++) { | 253 | for (i = 0; i < gpe_block->register_count; i++) { |
254 | |||
253 | /* Clear status on all GPEs in this register */ | 255 | /* Clear status on all GPEs in this register */ |
254 | 256 | ||
255 | status = acpi_hw_low_level_write(8, 0xFF, | 257 | status = acpi_hw_low_level_write(8, 0xFF, |
@@ -368,7 +370,7 @@ acpi_status acpi_hw_disable_all_gpes(void) | |||
368 | { | 370 | { |
369 | acpi_status status; | 371 | acpi_status status; |
370 | 372 | ||
371 | ACPI_FUNCTION_TRACE("hw_disable_all_gpes"); | 373 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); |
372 | 374 | ||
373 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); | 375 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); |
374 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 376 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
@@ -391,7 +393,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void) | |||
391 | { | 393 | { |
392 | acpi_status status; | 394 | acpi_status status; |
393 | 395 | ||
394 | ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes"); | 396 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); |
395 | 397 | ||
396 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); | 398 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); |
397 | return_ACPI_STATUS(status); | 399 | return_ACPI_STATUS(status); |
@@ -413,7 +415,7 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) | |||
413 | { | 415 | { |
414 | acpi_status status; | 416 | acpi_status status; |
415 | 417 | ||
416 | ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes"); | 418 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); |
417 | 419 | ||
418 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); | 420 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); |
419 | return_ACPI_STATUS(status); | 421 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index e1fe75498415..ae142de19507 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -43,8 +43,6 @@ | |||
43 | * POSSIBILITY OF SUCH DAMAGES. | 43 | * POSSIBILITY OF SUCH DAMAGES. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | #include <linux/module.h> | ||
47 | |||
48 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
49 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acevents.h> | 48 | #include <acpi/acevents.h> |
@@ -63,23 +61,21 @@ ACPI_MODULE_NAME("hwregs") | |||
63 | * DESCRIPTION: Clears all fixed and general purpose status bits | 61 | * DESCRIPTION: Clears all fixed and general purpose status bits |
64 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 62 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
65 | * | 63 | * |
64 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
65 | * | ||
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) | 67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) |
68 | { | 68 | { |
69 | acpi_status status; | 69 | acpi_status status; |
70 | acpi_cpu_flags lock_flags = 0; | ||
70 | 71 | ||
71 | ACPI_FUNCTION_TRACE("hw_clear_acpi_status"); | 72 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); |
72 | 73 | ||
73 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", | 74 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", |
74 | ACPI_BITMASK_ALL_FIXED_STATUS, | 75 | ACPI_BITMASK_ALL_FIXED_STATUS, |
75 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); | 76 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); |
76 | 77 | ||
77 | if (flags & ACPI_MTX_LOCK) { | 78 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
78 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
79 | if (ACPI_FAILURE(status)) { | ||
80 | return_ACPI_STATUS(status); | ||
81 | } | ||
82 | } | ||
83 | 79 | ||
84 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, | 80 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
85 | ACPI_REGISTER_PM1_STATUS, | 81 | ACPI_REGISTER_PM1_STATUS, |
@@ -104,9 +100,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags) | |||
104 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 100 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
105 | 101 | ||
106 | unlock_and_exit: | 102 | unlock_and_exit: |
107 | if (flags & ACPI_MTX_LOCK) { | 103 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
108 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
109 | } | ||
110 | return_ACPI_STATUS(status); | 104 | return_ACPI_STATUS(status); |
111 | } | 105 | } |
112 | 106 | ||
@@ -129,10 +123,9 @@ acpi_status | |||
129 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | 123 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) |
130 | { | 124 | { |
131 | acpi_status status = AE_OK; | 125 | acpi_status status = AE_OK; |
132 | struct acpi_parameter_info info; | 126 | struct acpi_evaluate_info *info; |
133 | char *sleep_state_name; | ||
134 | 127 | ||
135 | ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data"); | 128 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); |
136 | 129 | ||
137 | /* Validate parameters */ | 130 | /* Validate parameters */ |
138 | 131 | ||
@@ -140,34 +133,39 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
140 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 133 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
141 | } | 134 | } |
142 | 135 | ||
143 | /* Evaluate the namespace object containing the values for this state */ | 136 | /* Allocate the evaluation information block */ |
137 | |||
138 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
139 | if (!info) { | ||
140 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
141 | } | ||
144 | 142 | ||
145 | info.parameters = NULL; | 143 | info->pathname = |
146 | info.return_object = NULL; | ||
147 | sleep_state_name = | ||
148 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | 144 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); |
149 | 145 | ||
150 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); | 146 | /* Evaluate the namespace object containing the values for this state */ |
147 | |||
148 | status = acpi_ns_evaluate(info); | ||
151 | if (ACPI_FAILURE(status)) { | 149 | if (ACPI_FAILURE(status)) { |
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 150 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
153 | "%s while evaluating sleep_state [%s]\n", | 151 | "%s while evaluating SleepState [%s]\n", |
154 | acpi_format_exception(status), | 152 | acpi_format_exception(status), |
155 | sleep_state_name)); | 153 | info->pathname)); |
156 | 154 | ||
157 | return_ACPI_STATUS(status); | 155 | goto cleanup; |
158 | } | 156 | } |
159 | 157 | ||
160 | /* Must have a return object */ | 158 | /* Must have a return object */ |
161 | 159 | ||
162 | if (!info.return_object) { | 160 | if (!info->return_object) { |
163 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | 161 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", |
164 | sleep_state_name)); | 162 | info->pathname)); |
165 | status = AE_NOT_EXIST; | 163 | status = AE_NOT_EXIST; |
166 | } | 164 | } |
167 | 165 | ||
168 | /* It must be of type Package */ | 166 | /* It must be of type Package */ |
169 | 167 | ||
170 | else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { | 168 | else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { |
171 | ACPI_ERROR((AE_INFO, | 169 | ACPI_ERROR((AE_INFO, |
172 | "Sleep State return object is not a Package")); | 170 | "Sleep State return object is not a Package")); |
173 | status = AE_AML_OPERAND_TYPE; | 171 | status = AE_AML_OPERAND_TYPE; |
@@ -180,7 +178,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
180 | * by BIOS vendors seems to be to have 2 or more elements, at least | 178 | * by BIOS vendors seems to be to have 2 or more elements, at least |
181 | * one per sleep type (A/B). | 179 | * one per sleep type (A/B). |
182 | */ | 180 | */ |
183 | else if (info.return_object->package.count < 2) { | 181 | else if (info->return_object->package.count < 2) { |
184 | ACPI_ERROR((AE_INFO, | 182 | ACPI_ERROR((AE_INFO, |
185 | "Sleep State return package does not have at least two elements")); | 183 | "Sleep State return package does not have at least two elements")); |
186 | status = AE_AML_NO_OPERAND; | 184 | status = AE_AML_NO_OPERAND; |
@@ -188,39 +186,42 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
188 | 186 | ||
189 | /* The first two elements must both be of type Integer */ | 187 | /* The first two elements must both be of type Integer */ |
190 | 188 | ||
191 | else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0]) | 189 | else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) |
192 | != ACPI_TYPE_INTEGER) || | 190 | != ACPI_TYPE_INTEGER) || |
193 | (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) | 191 | (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) |
194 | != ACPI_TYPE_INTEGER)) { | 192 | != ACPI_TYPE_INTEGER)) { |
195 | ACPI_ERROR((AE_INFO, | 193 | ACPI_ERROR((AE_INFO, |
196 | "Sleep State return package elements are not both Integers (%s, %s)", | 194 | "Sleep State return package elements are not both Integers (%s, %s)", |
197 | acpi_ut_get_object_type_name(info.return_object-> | 195 | acpi_ut_get_object_type_name(info->return_object-> |
198 | package.elements[0]), | 196 | package.elements[0]), |
199 | acpi_ut_get_object_type_name(info.return_object-> | 197 | acpi_ut_get_object_type_name(info->return_object-> |
200 | package.elements[1]))); | 198 | package.elements[1]))); |
201 | status = AE_AML_OPERAND_TYPE; | 199 | status = AE_AML_OPERAND_TYPE; |
202 | } else { | 200 | } else { |
203 | /* Valid _Sx_ package size, type, and value */ | 201 | /* Valid _Sx_ package size, type, and value */ |
204 | 202 | ||
205 | *sleep_type_a = (u8) | 203 | *sleep_type_a = (u8) |
206 | (info.return_object->package.elements[0])->integer.value; | 204 | (info->return_object->package.elements[0])->integer.value; |
207 | *sleep_type_b = (u8) | 205 | *sleep_type_b = (u8) |
208 | (info.return_object->package.elements[1])->integer.value; | 206 | (info->return_object->package.elements[1])->integer.value; |
209 | } | 207 | } |
210 | 208 | ||
211 | if (ACPI_FAILURE(status)) { | 209 | if (ACPI_FAILURE(status)) { |
212 | ACPI_EXCEPTION((AE_INFO, status, | 210 | ACPI_EXCEPTION((AE_INFO, status, |
213 | "While evaluating sleep_state [%s], bad Sleep object %p type %s", | 211 | "While evaluating SleepState [%s], bad Sleep object %p type %s", |
214 | sleep_state_name, info.return_object, | 212 | info->pathname, info->return_object, |
215 | acpi_ut_get_object_type_name(info. | 213 | acpi_ut_get_object_type_name(info-> |
216 | return_object))); | 214 | return_object))); |
217 | } | 215 | } |
218 | 216 | ||
219 | acpi_ut_remove_reference(info.return_object); | 217 | acpi_ut_remove_reference(info->return_object); |
218 | |||
219 | cleanup: | ||
220 | ACPI_FREE(info); | ||
220 | return_ACPI_STATUS(status); | 221 | return_ACPI_STATUS(status); |
221 | } | 222 | } |
222 | 223 | ||
223 | EXPORT_SYMBOL(acpi_get_sleep_type_data); | 224 | ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) |
224 | 225 | ||
225 | /******************************************************************************* | 226 | /******************************************************************************* |
226 | * | 227 | * |
@@ -233,13 +234,12 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); | |||
233 | * DESCRIPTION: Map register_id into a register bitmask. | 234 | * DESCRIPTION: Map register_id into a register bitmask. |
234 | * | 235 | * |
235 | ******************************************************************************/ | 236 | ******************************************************************************/ |
236 | |||
237 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | 237 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) |
238 | { | 238 | { |
239 | ACPI_FUNCTION_ENTRY(); | 239 | ACPI_FUNCTION_ENTRY(); |
240 | 240 | ||
241 | if (register_id > ACPI_BITREG_MAX) { | 241 | if (register_id > ACPI_BITREG_MAX) { |
242 | ACPI_ERROR((AE_INFO, "Invalid bit_register ID: %X", | 242 | ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", |
243 | register_id)); | 243 | register_id)); |
244 | return (NULL); | 244 | return (NULL); |
245 | } | 245 | } |
@@ -260,6 +260,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | |||
260 | * | 260 | * |
261 | * DESCRIPTION: ACPI bit_register read function. | 261 | * DESCRIPTION: ACPI bit_register read function. |
262 | * | 262 | * |
263 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
264 | * | ||
263 | ******************************************************************************/ | 265 | ******************************************************************************/ |
264 | 266 | ||
265 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | 267 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) |
@@ -268,7 +270,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
268 | struct acpi_bit_register_info *bit_reg_info; | 270 | struct acpi_bit_register_info *bit_reg_info; |
269 | acpi_status status; | 271 | acpi_status status; |
270 | 272 | ||
271 | ACPI_FUNCTION_TRACE("acpi_get_register"); | 273 | ACPI_FUNCTION_TRACE(acpi_get_register); |
272 | 274 | ||
273 | /* Get the info structure corresponding to the requested ACPI Register */ | 275 | /* Get the info structure corresponding to the requested ACPI Register */ |
274 | 276 | ||
@@ -277,24 +279,14 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
277 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 279 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
278 | } | 280 | } |
279 | 281 | ||
280 | if (flags & ACPI_MTX_LOCK) { | ||
281 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
282 | if (ACPI_FAILURE(status)) { | ||
283 | return_ACPI_STATUS(status); | ||
284 | } | ||
285 | } | ||
286 | |||
287 | /* Read from the register */ | 282 | /* Read from the register */ |
288 | 283 | ||
289 | status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, | 284 | status = acpi_hw_register_read(ACPI_MTX_LOCK, |
290 | bit_reg_info->parent_register, | 285 | bit_reg_info->parent_register, |
291 | ®ister_value); | 286 | ®ister_value); |
292 | 287 | ||
293 | if (flags & ACPI_MTX_LOCK) { | ||
294 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
295 | } | ||
296 | |||
297 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
289 | |||
298 | /* Normalize the value that was read */ | 290 | /* Normalize the value that was read */ |
299 | 291 | ||
300 | register_value = | 292 | register_value = |
@@ -311,7 +303,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
311 | return_ACPI_STATUS(status); | 303 | return_ACPI_STATUS(status); |
312 | } | 304 | } |
313 | 305 | ||
314 | EXPORT_SYMBOL(acpi_get_register); | 306 | ACPI_EXPORT_SYMBOL(acpi_get_register) |
315 | 307 | ||
316 | /******************************************************************************* | 308 | /******************************************************************************* |
317 | * | 309 | * |
@@ -326,31 +318,28 @@ EXPORT_SYMBOL(acpi_get_register); | |||
326 | * | 318 | * |
327 | * DESCRIPTION: ACPI Bit Register write function. | 319 | * DESCRIPTION: ACPI Bit Register write function. |
328 | * | 320 | * |
321 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
322 | * | ||
329 | ******************************************************************************/ | 323 | ******************************************************************************/ |
330 | |||
331 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | 324 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) |
332 | { | 325 | { |
333 | u32 register_value = 0; | 326 | u32 register_value = 0; |
334 | struct acpi_bit_register_info *bit_reg_info; | 327 | struct acpi_bit_register_info *bit_reg_info; |
335 | acpi_status status; | 328 | acpi_status status; |
329 | acpi_cpu_flags lock_flags; | ||
336 | 330 | ||
337 | ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id); | 331 | ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); |
338 | 332 | ||
339 | /* Get the info structure corresponding to the requested ACPI Register */ | 333 | /* Get the info structure corresponding to the requested ACPI Register */ |
340 | 334 | ||
341 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); | 335 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); |
342 | if (!bit_reg_info) { | 336 | if (!bit_reg_info) { |
343 | ACPI_ERROR((AE_INFO, "Bad ACPI HW register_id: %X", | 337 | ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X", |
344 | register_id)); | 338 | register_id)); |
345 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 339 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
346 | } | 340 | } |
347 | 341 | ||
348 | if (flags & ACPI_MTX_LOCK) { | 342 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
349 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
350 | if (ACPI_FAILURE(status)) { | ||
351 | return_ACPI_STATUS(status); | ||
352 | } | ||
353 | } | ||
354 | 343 | ||
355 | /* Always do a register read first so we can insert the new bits */ | 344 | /* Always do a register read first so we can insert the new bits */ |
356 | 345 | ||
@@ -458,9 +447,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
458 | 447 | ||
459 | unlock_and_exit: | 448 | unlock_and_exit: |
460 | 449 | ||
461 | if (flags & ACPI_MTX_LOCK) { | 450 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
462 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
463 | } | ||
464 | 451 | ||
465 | /* Normalize the value that was read */ | 452 | /* Normalize the value that was read */ |
466 | 453 | ||
@@ -474,7 +461,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
474 | return_ACPI_STATUS(status); | 461 | return_ACPI_STATUS(status); |
475 | } | 462 | } |
476 | 463 | ||
477 | EXPORT_SYMBOL(acpi_set_register); | 464 | ACPI_EXPORT_SYMBOL(acpi_set_register) |
478 | 465 | ||
479 | /****************************************************************************** | 466 | /****************************************************************************** |
480 | * | 467 | * |
@@ -490,21 +477,18 @@ EXPORT_SYMBOL(acpi_set_register); | |||
490 | * given offset. | 477 | * given offset. |
491 | * | 478 | * |
492 | ******************************************************************************/ | 479 | ******************************************************************************/ |
493 | |||
494 | acpi_status | 480 | acpi_status |
495 | acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | 481 | acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) |
496 | { | 482 | { |
497 | u32 value1 = 0; | 483 | u32 value1 = 0; |
498 | u32 value2 = 0; | 484 | u32 value2 = 0; |
499 | acpi_status status; | 485 | acpi_status status; |
486 | acpi_cpu_flags lock_flags = 0; | ||
500 | 487 | ||
501 | ACPI_FUNCTION_TRACE("hw_register_read"); | 488 | ACPI_FUNCTION_TRACE(hw_register_read); |
502 | 489 | ||
503 | if (ACPI_MTX_LOCK == use_lock) { | 490 | if (ACPI_MTX_LOCK == use_lock) { |
504 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 491 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
505 | if (ACPI_FAILURE(status)) { | ||
506 | return_ACPI_STATUS(status); | ||
507 | } | ||
508 | } | 492 | } |
509 | 493 | ||
510 | switch (register_id) { | 494 | switch (register_id) { |
@@ -582,7 +566,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
582 | 566 | ||
583 | unlock_and_exit: | 567 | unlock_and_exit: |
584 | if (ACPI_MTX_LOCK == use_lock) { | 568 | if (ACPI_MTX_LOCK == use_lock) { |
585 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 569 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
586 | } | 570 | } |
587 | 571 | ||
588 | if (ACPI_SUCCESS(status)) { | 572 | if (ACPI_SUCCESS(status)) { |
@@ -610,14 +594,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
610 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | 594 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) |
611 | { | 595 | { |
612 | acpi_status status; | 596 | acpi_status status; |
597 | acpi_cpu_flags lock_flags = 0; | ||
613 | 598 | ||
614 | ACPI_FUNCTION_TRACE("hw_register_write"); | 599 | ACPI_FUNCTION_TRACE(hw_register_write); |
615 | 600 | ||
616 | if (ACPI_MTX_LOCK == use_lock) { | 601 | if (ACPI_MTX_LOCK == use_lock) { |
617 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 602 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
618 | if (ACPI_FAILURE(status)) { | ||
619 | return_ACPI_STATUS(status); | ||
620 | } | ||
621 | } | 603 | } |
622 | 604 | ||
623 | switch (register_id) { | 605 | switch (register_id) { |
@@ -707,7 +689,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | |||
707 | 689 | ||
708 | unlock_and_exit: | 690 | unlock_and_exit: |
709 | if (ACPI_MTX_LOCK == use_lock) { | 691 | if (ACPI_MTX_LOCK == use_lock) { |
710 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 692 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
711 | } | 693 | } |
712 | 694 | ||
713 | return_ACPI_STATUS(status); | 695 | return_ACPI_STATUS(status); |
@@ -733,7 +715,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) | |||
733 | u64 address; | 715 | u64 address; |
734 | acpi_status status; | 716 | acpi_status status; |
735 | 717 | ||
736 | ACPI_FUNCTION_NAME("hw_low_level_read"); | 718 | ACPI_FUNCTION_NAME(hw_low_level_read); |
737 | 719 | ||
738 | /* | 720 | /* |
739 | * Must have a valid pointer to a GAS structure, and | 721 | * Must have a valid pointer to a GAS structure, and |
@@ -805,7 +787,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) | |||
805 | u64 address; | 787 | u64 address; |
806 | acpi_status status; | 788 | acpi_status status; |
807 | 789 | ||
808 | ACPI_FUNCTION_NAME("hw_low_level_write"); | 790 | ACPI_FUNCTION_NAME(hw_low_level_write); |
809 | 791 | ||
810 | /* | 792 | /* |
811 | * Must have a valid pointer to a GAS structure, and | 793 | * Must have a valid pointer to a GAS structure, and |
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 89269272fd62..8bb43cae60c2 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | 46 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 47 | #define _COMPONENT ACPI_HARDWARE |
@@ -64,7 +63,7 @@ acpi_status | |||
64 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | 63 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address) |
65 | { | 64 | { |
66 | 65 | ||
67 | ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector"); | 66 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); |
68 | 67 | ||
69 | /* Set the vector */ | 68 | /* Set the vector */ |
70 | 69 | ||
@@ -79,6 +78,8 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | |||
79 | return_ACPI_STATUS(AE_OK); | 78 | return_ACPI_STATUS(AE_OK); |
80 | } | 79 | } |
81 | 80 | ||
81 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) | ||
82 | |||
82 | /******************************************************************************* | 83 | /******************************************************************************* |
83 | * | 84 | * |
84 | * FUNCTION: acpi_get_firmware_waking_vector | 85 | * FUNCTION: acpi_get_firmware_waking_vector |
@@ -92,13 +93,12 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | |||
92 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS | 93 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS |
93 | * | 94 | * |
94 | ******************************************************************************/ | 95 | ******************************************************************************/ |
95 | |||
96 | #ifdef ACPI_FUTURE_USAGE | 96 | #ifdef ACPI_FUTURE_USAGE |
97 | acpi_status | 97 | acpi_status |
98 | acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | 98 | acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) |
99 | { | 99 | { |
100 | 100 | ||
101 | ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector"); | 101 | ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector); |
102 | 102 | ||
103 | if (!physical_address) { | 103 | if (!physical_address) { |
104 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 104 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -118,6 +118,8 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
118 | 118 | ||
119 | return_ACPI_STATUS(AE_OK); | 119 | return_ACPI_STATUS(AE_OK); |
120 | } | 120 | } |
121 | |||
122 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) | ||
121 | #endif | 123 | #endif |
122 | 124 | ||
123 | /******************************************************************************* | 125 | /******************************************************************************* |
@@ -134,14 +136,13 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
134 | * various OS-specific tasks between the two steps. | 136 | * various OS-specific tasks between the two steps. |
135 | * | 137 | * |
136 | ******************************************************************************/ | 138 | ******************************************************************************/ |
137 | |||
138 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | 139 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) |
139 | { | 140 | { |
140 | acpi_status status; | 141 | acpi_status status; |
141 | struct acpi_object_list arg_list; | 142 | struct acpi_object_list arg_list; |
142 | union acpi_object arg; | 143 | union acpi_object arg; |
143 | 144 | ||
144 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep"); | 145 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); |
145 | 146 | ||
146 | /* | 147 | /* |
147 | * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. | 148 | * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. |
@@ -206,6 +207,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
206 | return_ACPI_STATUS(AE_OK); | 207 | return_ACPI_STATUS(AE_OK); |
207 | } | 208 | } |
208 | 209 | ||
210 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) | ||
211 | |||
209 | /******************************************************************************* | 212 | /******************************************************************************* |
210 | * | 213 | * |
211 | * FUNCTION: acpi_enter_sleep_state | 214 | * FUNCTION: acpi_enter_sleep_state |
@@ -218,7 +221,6 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
218 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 221 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
219 | * | 222 | * |
220 | ******************************************************************************/ | 223 | ******************************************************************************/ |
221 | |||
222 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | 224 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) |
223 | { | 225 | { |
224 | u32 PM1Acontrol; | 226 | u32 PM1Acontrol; |
@@ -228,7 +230,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
228 | u32 in_value; | 230 | u32 in_value; |
229 | acpi_status status; | 231 | acpi_status status; |
230 | 232 | ||
231 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state"); | 233 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); |
232 | 234 | ||
233 | if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || | 235 | if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || |
234 | (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { | 236 | (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { |
@@ -378,7 +380,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
378 | return_ACPI_STATUS(AE_OK); | 380 | return_ACPI_STATUS(AE_OK); |
379 | } | 381 | } |
380 | 382 | ||
381 | EXPORT_SYMBOL(acpi_enter_sleep_state); | 383 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) |
382 | 384 | ||
383 | /******************************************************************************* | 385 | /******************************************************************************* |
384 | * | 386 | * |
@@ -392,13 +394,12 @@ EXPORT_SYMBOL(acpi_enter_sleep_state); | |||
392 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 394 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
393 | * | 395 | * |
394 | ******************************************************************************/ | 396 | ******************************************************************************/ |
395 | |||
396 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) | 397 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) |
397 | { | 398 | { |
398 | u32 in_value; | 399 | u32 in_value; |
399 | acpi_status status; | 400 | acpi_status status; |
400 | 401 | ||
401 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios"); | 402 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); |
402 | 403 | ||
403 | status = | 404 | status = |
404 | acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); | 405 | acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); |
@@ -443,7 +444,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) | |||
443 | return_ACPI_STATUS(AE_OK); | 444 | return_ACPI_STATUS(AE_OK); |
444 | } | 445 | } |
445 | 446 | ||
446 | EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | 447 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) |
447 | 448 | ||
448 | /******************************************************************************* | 449 | /******************************************************************************* |
449 | * | 450 | * |
@@ -457,7 +458,6 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | |||
457 | * Called with interrupts ENABLED. | 458 | * Called with interrupts ENABLED. |
458 | * | 459 | * |
459 | ******************************************************************************/ | 460 | ******************************************************************************/ |
460 | |||
461 | acpi_status acpi_leave_sleep_state(u8 sleep_state) | 461 | acpi_status acpi_leave_sleep_state(u8 sleep_state) |
462 | { | 462 | { |
463 | struct acpi_object_list arg_list; | 463 | struct acpi_object_list arg_list; |
@@ -468,7 +468,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
468 | u32 PM1Acontrol; | 468 | u32 PM1Acontrol; |
469 | u32 PM1Bcontrol; | 469 | u32 PM1Bcontrol; |
470 | 470 | ||
471 | ACPI_FUNCTION_TRACE("acpi_leave_sleep_state"); | 471 | ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); |
472 | 472 | ||
473 | /* | 473 | /* |
474 | * Set SLP_TYPE and SLP_EN to state S0. | 474 | * Set SLP_TYPE and SLP_EN to state S0. |
@@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
490 | ACPI_REGISTER_PM1_CONTROL, | 490 | ACPI_REGISTER_PM1_CONTROL, |
491 | &PM1Acontrol); | 491 | &PM1Acontrol); |
492 | if (ACPI_SUCCESS(status)) { | 492 | if (ACPI_SUCCESS(status)) { |
493 | |||
493 | /* Clear SLP_EN and SLP_TYP fields */ | 494 | /* Clear SLP_EN and SLP_TYP fields */ |
494 | 495 | ||
495 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | | 496 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | |
@@ -583,3 +584,5 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
583 | 584 | ||
584 | return_ACPI_STATUS(status); | 585 | return_ACPI_STATUS(status); |
585 | } | 586 | } |
587 | |||
588 | ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state) | ||
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index fc10b7cb456f..c4ec47c939fd 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | 46 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 47 | #define _COMPONENT ACPI_HARDWARE |
@@ -61,13 +60,13 @@ ACPI_MODULE_NAME("hwtimer") | |||
61 | ******************************************************************************/ | 60 | ******************************************************************************/ |
62 | acpi_status acpi_get_timer_resolution(u32 * resolution) | 61 | acpi_status acpi_get_timer_resolution(u32 * resolution) |
63 | { | 62 | { |
64 | ACPI_FUNCTION_TRACE("acpi_get_timer_resolution"); | 63 | ACPI_FUNCTION_TRACE(acpi_get_timer_resolution); |
65 | 64 | ||
66 | if (!resolution) { | 65 | if (!resolution) { |
67 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 66 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
68 | } | 67 | } |
69 | 68 | ||
70 | if (0 == acpi_gbl_FADT->tmr_val_ext) { | 69 | if (acpi_gbl_FADT->tmr_val_ext == 0) { |
71 | *resolution = 24; | 70 | *resolution = 24; |
72 | } else { | 71 | } else { |
73 | *resolution = 32; | 72 | *resolution = 32; |
@@ -76,6 +75,8 @@ acpi_status acpi_get_timer_resolution(u32 * resolution) | |||
76 | return_ACPI_STATUS(AE_OK); | 75 | return_ACPI_STATUS(AE_OK); |
77 | } | 76 | } |
78 | 77 | ||
78 | ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution) | ||
79 | |||
79 | /****************************************************************************** | 80 | /****************************************************************************** |
80 | * | 81 | * |
81 | * FUNCTION: acpi_get_timer | 82 | * FUNCTION: acpi_get_timer |
@@ -87,12 +88,11 @@ acpi_status acpi_get_timer_resolution(u32 * resolution) | |||
87 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). | 88 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). |
88 | * | 89 | * |
89 | ******************************************************************************/ | 90 | ******************************************************************************/ |
90 | |||
91 | acpi_status acpi_get_timer(u32 * ticks) | 91 | acpi_status acpi_get_timer(u32 * ticks) |
92 | { | 92 | { |
93 | acpi_status status; | 93 | acpi_status status; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE("acpi_get_timer"); | 95 | ACPI_FUNCTION_TRACE(acpi_get_timer); |
96 | 96 | ||
97 | if (!ticks) { | 97 | if (!ticks) { |
98 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 98 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -103,7 +103,7 @@ acpi_status acpi_get_timer(u32 * ticks) | |||
103 | return_ACPI_STATUS(status); | 103 | return_ACPI_STATUS(status); |
104 | } | 104 | } |
105 | 105 | ||
106 | EXPORT_SYMBOL(acpi_get_timer); | 106 | ACPI_EXPORT_SYMBOL(acpi_get_timer) |
107 | 107 | ||
108 | /****************************************************************************** | 108 | /****************************************************************************** |
109 | * | 109 | * |
@@ -133,7 +133,6 @@ EXPORT_SYMBOL(acpi_get_timer); | |||
133 | * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes | 133 | * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes |
134 | * | 134 | * |
135 | ******************************************************************************/ | 135 | ******************************************************************************/ |
136 | |||
137 | acpi_status | 136 | acpi_status |
138 | acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | 137 | acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) |
139 | { | 138 | { |
@@ -141,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
141 | u32 delta_ticks; | 140 | u32 delta_ticks; |
142 | acpi_integer quotient; | 141 | acpi_integer quotient; |
143 | 142 | ||
144 | ACPI_FUNCTION_TRACE("acpi_get_timer_duration"); | 143 | ACPI_FUNCTION_TRACE(acpi_get_timer_duration); |
145 | 144 | ||
146 | if (!time_elapsed) { | 145 | if (!time_elapsed) { |
147 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 146 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -154,7 +153,8 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
154 | if (start_ticks < end_ticks) { | 153 | if (start_ticks < end_ticks) { |
155 | delta_ticks = end_ticks - start_ticks; | 154 | delta_ticks = end_ticks - start_ticks; |
156 | } else if (start_ticks > end_ticks) { | 155 | } else if (start_ticks > end_ticks) { |
157 | if (0 == acpi_gbl_FADT->tmr_val_ext) { | 156 | if (acpi_gbl_FADT->tmr_val_ext == 0) { |
157 | |||
158 | /* 24-bit Timer */ | 158 | /* 24-bit Timer */ |
159 | 159 | ||
160 | delta_ticks = | 160 | delta_ticks = |
@@ -183,4 +183,4 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
183 | return_ACPI_STATUS(status); | 183 | return_ACPI_STATUS(status); |
184 | } | 184 | } |
185 | 185 | ||
186 | EXPORT_SYMBOL(acpi_get_timer_duration); | 186 | ACPI_EXPORT_SYMBOL(acpi_get_timer_duration) |
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index 2e2e4051dfa7..c25b2b92edcf 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c | |||
@@ -723,6 +723,8 @@ get_parms(char *config_record, | |||
723 | goto do_fail; | 723 | goto do_fail; |
724 | count = tmp1 - tmp; | 724 | count = tmp1 - tmp; |
725 | *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); | 725 | *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); |
726 | if (!*action_handle) | ||
727 | goto do_fail; | ||
726 | strncpy(*action_handle, tmp, count); | 728 | strncpy(*action_handle, tmp, count); |
727 | *(*action_handle + count) = 0; | 729 | *(*action_handle + count) = 0; |
728 | 730 | ||
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 262b1f41335a..15fc12482ba0 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -567,6 +567,69 @@ static int bluetooth_write(char *buf) | |||
567 | return 0; | 567 | return 0; |
568 | } | 568 | } |
569 | 569 | ||
570 | static int wan_supported; | ||
571 | |||
572 | static int wan_init(void) | ||
573 | { | ||
574 | wan_supported = hkey_handle && | ||
575 | acpi_evalf(hkey_handle, NULL, "GWAN", "qv"); | ||
576 | |||
577 | return 0; | ||
578 | } | ||
579 | |||
580 | static int wan_status(void) | ||
581 | { | ||
582 | int status; | ||
583 | |||
584 | if (!wan_supported || | ||
585 | !acpi_evalf(hkey_handle, &status, "GWAN", "d")) | ||
586 | status = 0; | ||
587 | |||
588 | return status; | ||
589 | } | ||
590 | |||
591 | static int wan_read(char *p) | ||
592 | { | ||
593 | int len = 0; | ||
594 | int status = wan_status(); | ||
595 | |||
596 | if (!wan_supported) | ||
597 | len += sprintf(p + len, "status:\t\tnot supported\n"); | ||
598 | else if (!(status & 1)) | ||
599 | len += sprintf(p + len, "status:\t\tnot installed\n"); | ||
600 | else { | ||
601 | len += sprintf(p + len, "status:\t\t%s\n", enabled(status, 1)); | ||
602 | len += sprintf(p + len, "commands:\tenable, disable\n"); | ||
603 | } | ||
604 | |||
605 | return len; | ||
606 | } | ||
607 | |||
608 | static int wan_write(char *buf) | ||
609 | { | ||
610 | int status = wan_status(); | ||
611 | char *cmd; | ||
612 | int do_cmd = 0; | ||
613 | |||
614 | if (!wan_supported) | ||
615 | return -ENODEV; | ||
616 | |||
617 | while ((cmd = next_cmd(&buf))) { | ||
618 | if (strlencmp(cmd, "enable") == 0) { | ||
619 | status |= 2; | ||
620 | } else if (strlencmp(cmd, "disable") == 0) { | ||
621 | status &= ~2; | ||
622 | } else | ||
623 | return -EINVAL; | ||
624 | do_cmd = 1; | ||
625 | } | ||
626 | |||
627 | if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) | ||
628 | return -EIO; | ||
629 | |||
630 | return 0; | ||
631 | } | ||
632 | |||
570 | static int video_supported; | 633 | static int video_supported; |
571 | static int video_orig_autosw; | 634 | static int video_orig_autosw; |
572 | 635 | ||
@@ -1563,6 +1626,13 @@ static struct ibm_struct ibms[] = { | |||
1563 | .write = bluetooth_write, | 1626 | .write = bluetooth_write, |
1564 | }, | 1627 | }, |
1565 | { | 1628 | { |
1629 | .name = "wan", | ||
1630 | .init = wan_init, | ||
1631 | .read = wan_read, | ||
1632 | .write = wan_write, | ||
1633 | .experimental = 1, | ||
1634 | }, | ||
1635 | { | ||
1566 | .name = "video", | 1636 | .name = "video", |
1567 | .init = video_init, | 1637 | .init = video_init, |
1568 | .read = video_read, | 1638 | .read = video_read, |
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index 468244147ec1..d51d68f5dd8d 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c | |||
@@ -37,7 +37,7 @@ ACPI_MODULE_NAME("acpi_motherboard") | |||
37 | #define ACPI_MB_HID2 "PNP0C02" | 37 | #define ACPI_MB_HID2 "PNP0C02" |
38 | /** | 38 | /** |
39 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved | 39 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved |
40 | * Doesn't care about the failure of 'request_region', since other may reserve | 40 | * Doesn't care about the failure of 'request_region', since other may reserve |
41 | * the io ports as well | 41 | * the io ports as well |
42 | */ | 42 | */ |
43 | #define IS_RESERVED_ADDR(base, len) \ | 43 | #define IS_RESERVED_ADDR(base, len) \ |
@@ -46,7 +46,7 @@ ACPI_MODULE_NAME("acpi_motherboard") | |||
46 | /* | 46 | /* |
47 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use | 47 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use |
48 | * the io ports if they really know they can use it, while | 48 | * the io ports if they really know they can use it, while |
49 | * still preventing hotplug PCI devices from using it. | 49 | * still preventing hotplug PCI devices from using it. |
50 | */ | 50 | */ |
51 | static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) | 51 | static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) |
52 | { | 52 | { |
@@ -123,49 +123,54 @@ static struct acpi_driver acpi_motherboard_driver2 = { | |||
123 | }, | 123 | }, |
124 | }; | 124 | }; |
125 | 125 | ||
126 | static void __init acpi_request_region (struct acpi_generic_address *addr, | ||
127 | unsigned int length, char *desc) | ||
128 | { | ||
129 | if (!addr->address || !length) | ||
130 | return; | ||
131 | |||
132 | if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO) | ||
133 | request_region(addr->address, length, desc); | ||
134 | else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | ||
135 | request_mem_region(addr->address, length, desc); | ||
136 | } | ||
137 | |||
126 | static void __init acpi_reserve_resources(void) | 138 | static void __init acpi_reserve_resources(void) |
127 | { | 139 | { |
128 | if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 140 | acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk, |
129 | request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, | 141 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK"); |
130 | acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); | ||
131 | 142 | ||
132 | if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 143 | acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk, |
133 | request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, | 144 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK"); |
134 | acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); | ||
135 | 145 | ||
136 | if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 146 | acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk, |
137 | request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, | 147 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK"); |
138 | acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); | ||
139 | 148 | ||
140 | if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 149 | acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk, |
141 | request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, | 150 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK"); |
142 | acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); | ||
143 | 151 | ||
144 | if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) | 152 | if (acpi_gbl_FADT->pm_tm_len == 4) |
145 | request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); | 153 | acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR"); |
146 | 154 | ||
147 | if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) | 155 | acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk, |
148 | request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, | 156 | acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK"); |
149 | acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); | ||
150 | 157 | ||
151 | /* Length of GPE blocks must be a non-negative multiple of 2 */ | 158 | /* Length of GPE blocks must be a non-negative multiple of 2 */ |
152 | 159 | ||
153 | if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && | 160 | if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1)) |
154 | !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) | 161 | acpi_request_region(&acpi_gbl_FADT->xgpe0_blk, |
155 | request_region(acpi_gbl_FADT->xgpe0_blk.address, | 162 | acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK"); |
156 | acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); | ||
157 | 163 | ||
158 | if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && | 164 | if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1)) |
159 | !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) | 165 | acpi_request_region(&acpi_gbl_FADT->xgpe1_blk, |
160 | request_region(acpi_gbl_FADT->xgpe1_blk.address, | 166 | acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK"); |
161 | acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); | ||
162 | } | 167 | } |
163 | 168 | ||
164 | static int __init acpi_motherboard_init(void) | 169 | static int __init acpi_motherboard_init(void) |
165 | { | 170 | { |
166 | acpi_bus_register_driver(&acpi_motherboard_driver1); | 171 | acpi_bus_register_driver(&acpi_motherboard_driver1); |
167 | acpi_bus_register_driver(&acpi_motherboard_driver2); | 172 | acpi_bus_register_driver(&acpi_motherboard_driver2); |
168 | /* | 173 | /* |
169 | * Guarantee motherboard IO reservation first | 174 | * Guarantee motherboard IO reservation first |
170 | * This module must run after scan.c | 175 | * This module must run after scan.c |
171 | */ | 176 | */ |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 1149bc18fb35..48fadade52e2 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
70 | union acpi_operand_object *obj_desc; | 70 | union acpi_operand_object *obj_desc; |
71 | acpi_string val = NULL; | 71 | acpi_string val = NULL; |
72 | 72 | ||
73 | ACPI_FUNCTION_TRACE("ns_root_initialize"); | 73 | ACPI_FUNCTION_TRACE(ns_root_initialize); |
74 | 74 | ||
75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
76 | if (ACPI_FAILURE(status)) { | 76 | if (ACPI_FAILURE(status)) { |
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
98 | "Entering predefined entries into namespace\n")); | 98 | "Entering predefined entries into namespace\n")); |
99 | 99 | ||
100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { | 100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { |
101 | |||
101 | /* _OSI is optional for now, will be permanent later */ | 102 | /* _OSI is optional for now, will be permanent later */ |
102 | 103 | ||
103 | if (!ACPI_STRCMP(init_val->name, "_OSI") | 104 | if (!ACPI_STRCMP(init_val->name, "_OSI") |
@@ -156,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
156 | 157 | ||
157 | #if defined (ACPI_ASL_COMPILER) | 158 | #if defined (ACPI_ASL_COMPILER) |
158 | 159 | ||
159 | /* save the parameter count for the i_aSL compiler */ | 160 | /* Save the parameter count for the i_aSL compiler */ |
160 | 161 | ||
161 | new_node->value = obj_desc->method.param_count; | 162 | new_node->value = obj_desc->method.param_count; |
162 | #else | 163 | #else |
@@ -258,10 +259,8 @@ acpi_status acpi_ns_root_initialize(void) | |||
258 | /* Save a handle to "_GPE", it is always present */ | 259 | /* Save a handle to "_GPE", it is always present */ |
259 | 260 | ||
260 | if (ACPI_SUCCESS(status)) { | 261 | if (ACPI_SUCCESS(status)) { |
261 | status = | 262 | status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, |
262 | acpi_ns_get_node_by_path("\\_GPE", NULL, | 263 | &acpi_gbl_fadt_gpe_device); |
263 | ACPI_NS_NO_UPSEARCH, | ||
264 | &acpi_gbl_fadt_gpe_device); | ||
265 | } | 264 | } |
266 | 265 | ||
267 | return_ACPI_STATUS(status); | 266 | return_ACPI_STATUS(status); |
@@ -310,17 +309,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
310 | acpi_object_type type_to_check_for; | 309 | acpi_object_type type_to_check_for; |
311 | acpi_object_type this_search_type; | 310 | acpi_object_type this_search_type; |
312 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; | 311 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; |
313 | u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | | 312 | u32 local_flags; |
314 | ACPI_NS_SEARCH_PARENT); | ||
315 | 313 | ||
316 | ACPI_FUNCTION_TRACE("ns_lookup"); | 314 | ACPI_FUNCTION_TRACE(ns_lookup); |
317 | 315 | ||
318 | if (!return_node) { | 316 | if (!return_node) { |
319 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 317 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
320 | } | 318 | } |
321 | 319 | ||
322 | acpi_gbl_ns_lookup_count++; | 320 | local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); |
323 | *return_node = ACPI_ENTRY_NOT_FOUND; | 321 | *return_node = ACPI_ENTRY_NOT_FOUND; |
322 | acpi_gbl_ns_lookup_count++; | ||
324 | 323 | ||
325 | if (!acpi_gbl_root_node) { | 324 | if (!acpi_gbl_root_node) { |
326 | return_ACPI_STATUS(AE_NO_NAMESPACE); | 325 | return_ACPI_STATUS(AE_NO_NAMESPACE); |
@@ -346,14 +345,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
346 | return_ACPI_STATUS(AE_AML_INTERNAL); | 345 | return_ACPI_STATUS(AE_AML_INTERNAL); |
347 | } | 346 | } |
348 | 347 | ||
349 | /* | 348 | if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { |
350 | * This node might not be a actual "scope" node (such as a | 349 | /* |
351 | * Device/Method, etc.) It could be a Package or other object node. | 350 | * This node might not be a actual "scope" node (such as a |
352 | * Backup up the tree to find the containing scope node. | 351 | * Device/Method, etc.) It could be a Package or other object node. |
353 | */ | 352 | * Backup up the tree to find the containing scope node. |
354 | while (!acpi_ns_opens_scope(prefix_node->type) && | 353 | */ |
355 | prefix_node->type != ACPI_TYPE_ANY) { | 354 | while (!acpi_ns_opens_scope(prefix_node->type) && |
356 | prefix_node = acpi_ns_get_parent_node(prefix_node); | 355 | prefix_node->type != ACPI_TYPE_ANY) { |
356 | prefix_node = | ||
357 | acpi_ns_get_parent_node(prefix_node); | ||
358 | } | ||
357 | } | 359 | } |
358 | } | 360 | } |
359 | 361 | ||
@@ -365,6 +367,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
365 | * Begin examination of the actual pathname | 367 | * Begin examination of the actual pathname |
366 | */ | 368 | */ |
367 | if (!pathname) { | 369 | if (!pathname) { |
370 | |||
368 | /* A Null name_path is allowed and refers to the root */ | 371 | /* A Null name_path is allowed and refers to the root */ |
369 | 372 | ||
370 | num_segments = 0; | 373 | num_segments = 0; |
@@ -389,6 +392,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
389 | * to the current scope). | 392 | * to the current scope). |
390 | */ | 393 | */ |
391 | if (*path == (u8) AML_ROOT_PREFIX) { | 394 | if (*path == (u8) AML_ROOT_PREFIX) { |
395 | |||
392 | /* Pathname is fully qualified, start from the root */ | 396 | /* Pathname is fully qualified, start from the root */ |
393 | 397 | ||
394 | this_node = acpi_gbl_root_node; | 398 | this_node = acpi_gbl_root_node; |
@@ -416,6 +420,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
416 | this_node = prefix_node; | 420 | this_node = prefix_node; |
417 | num_carats = 0; | 421 | num_carats = 0; |
418 | while (*path == (u8) AML_PARENT_PREFIX) { | 422 | while (*path == (u8) AML_PARENT_PREFIX) { |
423 | |||
419 | /* Name is fully qualified, no search rules apply */ | 424 | /* Name is fully qualified, no search rules apply */ |
420 | 425 | ||
421 | search_parent_flag = ACPI_NS_NO_UPSEARCH; | 426 | search_parent_flag = ACPI_NS_NO_UPSEARCH; |
@@ -430,6 +435,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
430 | num_carats++; | 435 | num_carats++; |
431 | this_node = acpi_ns_get_parent_node(this_node); | 436 | this_node = acpi_ns_get_parent_node(this_node); |
432 | if (!this_node) { | 437 | if (!this_node) { |
438 | |||
433 | /* Current scope has no parent scope */ | 439 | /* Current scope has no parent scope */ |
434 | 440 | ||
435 | ACPI_ERROR((AE_INFO, | 441 | ACPI_ERROR((AE_INFO, |
@@ -569,6 +575,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
569 | &this_node); | 575 | &this_node); |
570 | if (ACPI_FAILURE(status)) { | 576 | if (ACPI_FAILURE(status)) { |
571 | if (status == AE_NOT_FOUND) { | 577 | if (status == AE_NOT_FOUND) { |
578 | |||
572 | /* Name not found in ACPI namespace */ | 579 | /* Name not found in ACPI namespace */ |
573 | 580 | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 581 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
@@ -602,10 +609,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
602 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && | 609 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && |
603 | (this_node->type != ACPI_TYPE_ANY) && | 610 | (this_node->type != ACPI_TYPE_ANY) && |
604 | (this_node->type != type_to_check_for)) { | 611 | (this_node->type != type_to_check_for)) { |
612 | |||
605 | /* Complain about a type mismatch */ | 613 | /* Complain about a type mismatch */ |
606 | 614 | ||
607 | ACPI_WARNING((AE_INFO, | 615 | ACPI_WARNING((AE_INFO, |
608 | "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", | 616 | "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", |
609 | ACPI_CAST_PTR(char, &simple_name), | 617 | ACPI_CAST_PTR(char, &simple_name), |
610 | acpi_ut_get_type_name(this_node->type), | 618 | acpi_ut_get_type_name(this_node->type), |
611 | acpi_ut_get_type_name | 619 | acpi_ut_get_type_name |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 9b871f38b61b..dc3f0739a46b 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_MEM_CALLOCATE(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 | ||
@@ -100,7 +94,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
100 | struct acpi_namespace_node *prev_node; | 94 | struct acpi_namespace_node *prev_node; |
101 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *next_node; |
102 | 96 | ||
103 | ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node); | 97 | ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); |
104 | 98 | ||
105 | parent_node = acpi_ns_get_parent_node(node); | 99 | parent_node = acpi_ns_get_parent_node(node); |
106 | 100 | ||
@@ -115,6 +109,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
115 | } | 109 | } |
116 | 110 | ||
117 | if (prev_node) { | 111 | if (prev_node) { |
112 | |||
118 | /* Node is not first child, unlink it */ | 113 | /* Node is not first child, unlink it */ |
119 | 114 | ||
120 | prev_node->peer = next_node->peer; | 115 | prev_node->peer = next_node->peer; |
@@ -125,6 +120,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
125 | /* Node is first child (has no previous peer) */ | 120 | /* Node is first child (has no previous peer) */ |
126 | 121 | ||
127 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 122 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { |
123 | |||
128 | /* No peers at all */ | 124 | /* No peers at all */ |
129 | 125 | ||
130 | parent_node->child = NULL; | 126 | parent_node->child = NULL; |
@@ -137,10 +133,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
137 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); | 133 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); |
138 | 134 | ||
139 | /* | 135 | /* |
140 | * Detach an object if there is one then delete the node | 136 | * Detach an object if there is one, then delete the node |
141 | */ | 137 | */ |
142 | acpi_ns_detach_object(node); | 138 | acpi_ns_detach_object(node); |
143 | ACPI_MEM_FREE(node); | 139 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); |
144 | return_VOID; | 140 | return_VOID; |
145 | } | 141 | } |
146 | 142 | ||
@@ -171,7 +167,7 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
171 | acpi_owner_id owner_id = 0; | 167 | acpi_owner_id owner_id = 0; |
172 | struct acpi_namespace_node *child_node; | 168 | struct acpi_namespace_node *child_node; |
173 | 169 | ||
174 | ACPI_FUNCTION_TRACE("ns_install_node"); | 170 | ACPI_FUNCTION_TRACE(ns_install_node); |
175 | 171 | ||
176 | /* | 172 | /* |
177 | * Get the owner ID from the Walk state | 173 | * Get the owner ID from the Walk state |
@@ -216,14 +212,6 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
216 | acpi_ut_get_type_name(parent_node->type), | 212 | acpi_ut_get_type_name(parent_node->type), |
217 | parent_node)); | 213 | parent_node)); |
218 | 214 | ||
219 | /* | ||
220 | * Increment the reference count(s) of all parents up to | ||
221 | * the root! | ||
222 | */ | ||
223 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
224 | node->reference_count++; | ||
225 | } | ||
226 | |||
227 | return_VOID; | 215 | return_VOID; |
228 | } | 216 | } |
229 | 217 | ||
@@ -244,10 +232,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
244 | { | 232 | { |
245 | struct acpi_namespace_node *child_node; | 233 | struct acpi_namespace_node *child_node; |
246 | struct acpi_namespace_node *next_node; | 234 | struct acpi_namespace_node *next_node; |
247 | struct acpi_namespace_node *node; | ||
248 | u8 flags; | 235 | u8 flags; |
249 | 236 | ||
250 | ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); | 237 | ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); |
251 | 238 | ||
252 | if (!parent_node) { | 239 | if (!parent_node) { |
253 | return_VOID; | 240 | return_VOID; |
@@ -264,6 +251,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
264 | * Deallocate all children at this level | 251 | * Deallocate all children at this level |
265 | */ | 252 | */ |
266 | do { | 253 | do { |
254 | |||
267 | /* Get the things we need */ | 255 | /* Get the things we need */ |
268 | 256 | ||
269 | next_node = child_node->peer; | 257 | next_node = child_node->peer; |
@@ -289,26 +277,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
289 | */ | 277 | */ |
290 | acpi_ns_detach_object(child_node); | 278 | acpi_ns_detach_object(child_node); |
291 | 279 | ||
292 | /* | ||
293 | * Decrement the reference count(s) of all parents up to | ||
294 | * the root! (counts were incremented when the node was created) | ||
295 | */ | ||
296 | node = child_node; | ||
297 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
298 | node->reference_count--; | ||
299 | } | ||
300 | |||
301 | /* There should be only one reference remaining on this node */ | ||
302 | |||
303 | if (child_node->reference_count != 1) { | ||
304 | ACPI_WARNING((AE_INFO, | ||
305 | "Existing references (%d) on node being deleted (%p)", | ||
306 | child_node->reference_count, child_node)); | ||
307 | } | ||
308 | |||
309 | /* Now we can delete the node */ | 280 | /* Now we can delete the node */ |
310 | 281 | ||
311 | ACPI_MEM_FREE(child_node); | 282 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, |
283 | child_node); | ||
312 | 284 | ||
313 | /* And move on to the next child in the list */ | 285 | /* And move on to the next child in the list */ |
314 | 286 | ||
@@ -341,7 +313,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
341 | struct acpi_namespace_node *child_node = NULL; | 313 | struct acpi_namespace_node *child_node = NULL; |
342 | u32 level = 1; | 314 | u32 level = 1; |
343 | 315 | ||
344 | ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree"); | 316 | ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree); |
345 | 317 | ||
346 | if (!parent_node) { | 318 | if (!parent_node) { |
347 | return_VOID; | 319 | return_VOID; |
@@ -352,11 +324,14 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
352 | * to where we started. | 324 | * to where we started. |
353 | */ | 325 | */ |
354 | while (level > 0) { | 326 | while (level > 0) { |
327 | |||
355 | /* Get the next node in this scope (NULL if none) */ | 328 | /* Get the next node in this scope (NULL if none) */ |
356 | 329 | ||
357 | child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | 330 | child_node = |
358 | child_node); | 331 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, |
332 | child_node); | ||
359 | if (child_node) { | 333 | if (child_node) { |
334 | |||
360 | /* Found a child node - detach any attached object */ | 335 | /* Found a child node - detach any attached object */ |
361 | 336 | ||
362 | acpi_ns_detach_object(child_node); | 337 | acpi_ns_detach_object(child_node); |
@@ -401,55 +376,6 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
401 | 376 | ||
402 | /******************************************************************************* | 377 | /******************************************************************************* |
403 | * | 378 | * |
404 | * FUNCTION: acpi_ns_remove_reference | ||
405 | * | ||
406 | * PARAMETERS: Node - Named node whose reference count is to be | ||
407 | * decremented | ||
408 | * | ||
409 | * RETURN: None. | ||
410 | * | ||
411 | * DESCRIPTION: Remove a Node reference. Decrements the reference count | ||
412 | * of all parent Nodes up to the root. Any node along | ||
413 | * the way that reaches zero references is freed. | ||
414 | * | ||
415 | ******************************************************************************/ | ||
416 | |||
417 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node) | ||
418 | { | ||
419 | struct acpi_namespace_node *parent_node; | ||
420 | struct acpi_namespace_node *this_node; | ||
421 | |||
422 | ACPI_FUNCTION_ENTRY(); | ||
423 | |||
424 | /* | ||
425 | * Decrement the reference count(s) of this node and all | ||
426 | * nodes up to the root, Delete anything with zero remaining references. | ||
427 | */ | ||
428 | this_node = node; | ||
429 | while (this_node) { | ||
430 | /* Prepare to move up to parent */ | ||
431 | |||
432 | parent_node = acpi_ns_get_parent_node(this_node); | ||
433 | |||
434 | /* Decrement the reference count on this node */ | ||
435 | |||
436 | this_node->reference_count--; | ||
437 | |||
438 | /* Delete the node if no more references */ | ||
439 | |||
440 | if (!this_node->reference_count) { | ||
441 | /* Delete all children and delete the node */ | ||
442 | |||
443 | acpi_ns_delete_children(this_node); | ||
444 | acpi_ns_delete_node(this_node); | ||
445 | } | ||
446 | |||
447 | this_node = parent_node; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | /******************************************************************************* | ||
452 | * | ||
453 | * FUNCTION: acpi_ns_delete_namespace_by_owner | 379 | * FUNCTION: acpi_ns_delete_namespace_by_owner |
454 | * | 380 | * |
455 | * PARAMETERS: owner_id - All nodes with this owner will be deleted | 381 | * PARAMETERS: owner_id - All nodes with this owner will be deleted |
@@ -469,15 +395,15 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
469 | u32 level; | 395 | u32 level; |
470 | struct acpi_namespace_node *parent_node; | 396 | struct acpi_namespace_node *parent_node; |
471 | 397 | ||
472 | ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id); | 398 | ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); |
473 | 399 | ||
474 | if (owner_id == 0) { | 400 | if (owner_id == 0) { |
475 | return_VOID; | 401 | return_VOID; |
476 | } | 402 | } |
477 | 403 | ||
404 | deletion_node = NULL; | ||
478 | parent_node = acpi_gbl_root_node; | 405 | parent_node = acpi_gbl_root_node; |
479 | child_node = NULL; | 406 | child_node = NULL; |
480 | deletion_node = NULL; | ||
481 | level = 1; | 407 | level = 1; |
482 | 408 | ||
483 | /* | 409 | /* |
@@ -494,12 +420,14 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
494 | child_node); | 420 | child_node); |
495 | 421 | ||
496 | if (deletion_node) { | 422 | if (deletion_node) { |
497 | acpi_ns_remove_reference(deletion_node); | 423 | acpi_ns_delete_children(deletion_node); |
424 | acpi_ns_delete_node(deletion_node); | ||
498 | deletion_node = NULL; | 425 | deletion_node = NULL; |
499 | } | 426 | } |
500 | 427 | ||
501 | if (child_node) { | 428 | if (child_node) { |
502 | if (child_node->owner_id == owner_id) { | 429 | if (child_node->owner_id == owner_id) { |
430 | |||
503 | /* Found a matching child node - detach any attached object */ | 431 | /* Found a matching child node - detach any attached object */ |
504 | 432 | ||
505 | acpi_ns_detach_object(child_node); | 433 | acpi_ns_detach_object(child_node); |
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index a2807317a84b..d72df66aa965 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -75,7 +75,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname) | |||
75 | { | 75 | { |
76 | acpi_native_uint i; | 76 | acpi_native_uint i; |
77 | 77 | ||
78 | ACPI_FUNCTION_NAME("ns_print_pathname"); | 78 | ACPI_FUNCTION_NAME(ns_print_pathname); |
79 | 79 | ||
80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) | 80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) |
81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { | 81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { |
@@ -123,7 +123,7 @@ void | |||
123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) | 123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) |
124 | { | 124 | { |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ns_dump_pathname"); | 126 | ACPI_FUNCTION_TRACE(ns_dump_pathname); |
127 | 127 | ||
128 | /* Do this only if the requested debug level and component are enabled */ | 128 | /* Do this only if the requested debug level and component are enabled */ |
129 | 129 | ||
@@ -167,7 +167,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
167 | u32 dbg_level; | 167 | u32 dbg_level; |
168 | u32 i; | 168 | u32 i; |
169 | 169 | ||
170 | ACPI_FUNCTION_NAME("ns_dump_one_object"); | 170 | ACPI_FUNCTION_NAME(ns_dump_one_object); |
171 | 171 | ||
172 | /* Is output enabled? */ | 172 | /* Is output enabled? */ |
173 | 173 | ||
@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
191 | } | 191 | } |
192 | 192 | ||
193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { | 193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { |
194 | |||
194 | /* Indent the object according to the level */ | 195 | /* Indent the object according to the level */ |
195 | 196 | ||
196 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); | 197 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); |
@@ -203,6 +204,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
203 | } | 204 | } |
204 | 205 | ||
205 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { | 206 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { |
207 | this_node->name.integer = | ||
208 | acpi_ut_repair_name(this_node->name.integer); | ||
209 | |||
206 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", | 210 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", |
207 | this_node->name.integer)); | 211 | this_node->name.integer)); |
208 | } | 212 | } |
@@ -226,6 +230,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
226 | case ACPI_DISPLAY_SUMMARY: | 230 | case ACPI_DISPLAY_SUMMARY: |
227 | 231 | ||
228 | if (!obj_desc) { | 232 | if (!obj_desc) { |
233 | |||
229 | /* No attached object, we are done */ | 234 | /* No attached object, we are done */ |
230 | 235 | ||
231 | acpi_os_printf("\n"); | 236 | acpi_os_printf("\n"); |
@@ -419,6 +424,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
419 | 424 | ||
420 | acpi_os_printf("O:%p", obj_desc); | 425 | acpi_os_printf("O:%p", obj_desc); |
421 | if (!obj_desc) { | 426 | if (!obj_desc) { |
427 | |||
422 | /* No attached object, we are done */ | 428 | /* No attached object, we are done */ |
423 | 429 | ||
424 | acpi_os_printf("\n"); | 430 | acpi_os_printf("\n"); |
@@ -669,7 +675,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
669 | { | 675 | { |
670 | acpi_handle search_handle = search_base; | 676 | acpi_handle search_handle = search_base; |
671 | 677 | ||
672 | ACPI_FUNCTION_TRACE("ns_dump_tables"); | 678 | ACPI_FUNCTION_TRACE(ns_dump_tables); |
673 | 679 | ||
674 | if (!acpi_gbl_root_node) { | 680 | if (!acpi_gbl_root_node) { |
675 | /* | 681 | /* |
@@ -682,6 +688,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
682 | } | 688 | } |
683 | 689 | ||
684 | if (ACPI_NS_ALL == search_base) { | 690 | if (ACPI_NS_ALL == search_base) { |
691 | |||
685 | /* Entire namespace */ | 692 | /* Entire namespace */ |
686 | 693 | ||
687 | search_handle = acpi_gbl_root_node; | 694 | search_handle = acpi_gbl_root_node; |
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index aff899a935e3..c6bf5d30fca3 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -74,7 +74,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
74 | acpi_status status; | 74 | acpi_status status; |
75 | u32 i; | 75 | u32 i; |
76 | 76 | ||
77 | ACPI_FUNCTION_NAME("ns_dump_one_device"); | 77 | ACPI_FUNCTION_NAME(ns_dump_one_device); |
78 | 78 | ||
79 | status = | 79 | status = |
80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); | 80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); |
@@ -92,7 +92,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
92 | info->hardware_id.value, | 92 | info->hardware_id.value, |
93 | ACPI_FORMAT_UINT64(info->address), | 93 | ACPI_FORMAT_UINT64(info->address), |
94 | info->current_status)); | 94 | info->current_status)); |
95 | ACPI_MEM_FREE(info); | 95 | ACPI_FREE(info); |
96 | } | 96 | } |
97 | 97 | ||
98 | return (status); | 98 | return (status); |
@@ -115,7 +115,7 @@ void acpi_ns_dump_root_devices(void) | |||
115 | acpi_handle sys_bus_handle; | 115 | acpi_handle sys_bus_handle; |
116 | acpi_status status; | 116 | acpi_status status; |
117 | 117 | ||
118 | ACPI_FUNCTION_NAME("ns_dump_root_devices"); | 118 | ACPI_FUNCTION_NAME(ns_dump_root_devices); |
119 | 119 | ||
120 | /* Only dump the table if tracing is enabled */ | 120 | /* Only dump the table if tracing is enabled */ |
121 | 121 | ||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 19d7b94d40c3..4b0a4a8c9843 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | * | 2 | * |
3 | * Module Name: nseval - Object evaluation interfaces -- includes control | 3 | * Module Name: nseval - Object evaluation, includes control method execution |
4 | * method lookup and execution. | ||
5 | * | 4 | * |
6 | ******************************************************************************/ | 5 | ******************************************************************************/ |
7 | 6 | ||
@@ -50,196 +49,14 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nseval") | 50 | ACPI_MODULE_NAME("nseval") |
52 | 51 | ||
53 | /* Local prototypes */ | ||
54 | static acpi_status | ||
55 | acpi_ns_execute_control_method(struct acpi_parameter_info *info); | ||
56 | |||
57 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info); | ||
58 | |||
59 | /******************************************************************************* | ||
60 | * | ||
61 | * FUNCTION: acpi_ns_evaluate_relative | ||
62 | * | ||
63 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the | ||
64 | * handle is the object to execute | ||
65 | * Info - Method info block, contains: | ||
66 | * return_object - Where to put method's return value (if | ||
67 | * any). If NULL, no value is returned. | ||
68 | * Params - List of parameters to pass to the method, | ||
69 | * terminated by NULL. Params itself may be | ||
70 | * NULL if no parameters are being passed. | ||
71 | * | ||
72 | * RETURN: Status | ||
73 | * | ||
74 | * DESCRIPTION: Evaluate the object or find and execute the requested method | ||
75 | * | ||
76 | * MUTEX: Locks Namespace | ||
77 | * | ||
78 | ******************************************************************************/ | ||
79 | |||
80 | acpi_status | ||
81 | acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info) | ||
82 | { | ||
83 | acpi_status status; | ||
84 | struct acpi_namespace_node *node = NULL; | ||
85 | union acpi_generic_state *scope_info; | ||
86 | char *internal_path = NULL; | ||
87 | |||
88 | ACPI_FUNCTION_TRACE("ns_evaluate_relative"); | ||
89 | |||
90 | /* | ||
91 | * Must have a valid object handle | ||
92 | */ | ||
93 | if (!info || !info->node) { | ||
94 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
95 | } | ||
96 | |||
97 | /* Build an internal name string for the method */ | ||
98 | |||
99 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
100 | if (ACPI_FAILURE(status)) { | ||
101 | return_ACPI_STATUS(status); | ||
102 | } | ||
103 | |||
104 | scope_info = acpi_ut_create_generic_state(); | ||
105 | if (!scope_info) { | ||
106 | goto cleanup1; | ||
107 | } | ||
108 | |||
109 | /* Get the prefix handle and Node */ | ||
110 | |||
111 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
112 | if (ACPI_FAILURE(status)) { | ||
113 | goto cleanup; | ||
114 | } | ||
115 | |||
116 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
117 | if (!info->node) { | ||
118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
119 | status = AE_BAD_PARAMETER; | ||
120 | goto cleanup; | ||
121 | } | ||
122 | |||
123 | /* Lookup the name in the namespace */ | ||
124 | |||
125 | scope_info->scope.node = info->node; | ||
126 | status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY, | ||
127 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
128 | &node); | ||
129 | |||
130 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
131 | |||
132 | if (ACPI_FAILURE(status)) { | ||
133 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", | ||
134 | pathname, acpi_format_exception(status))); | ||
135 | goto cleanup; | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
140 | */ | ||
141 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
142 | pathname, node, acpi_ns_get_attached_object(node))); | ||
143 | |||
144 | info->node = node; | ||
145 | status = acpi_ns_evaluate_by_handle(info); | ||
146 | |||
147 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
148 | "*** Completed eval of object %s ***\n", pathname)); | ||
149 | |||
150 | cleanup: | ||
151 | acpi_ut_delete_generic_state(scope_info); | ||
152 | |||
153 | cleanup1: | ||
154 | ACPI_MEM_FREE(internal_path); | ||
155 | return_ACPI_STATUS(status); | ||
156 | } | ||
157 | |||
158 | /******************************************************************************* | 52 | /******************************************************************************* |
159 | * | 53 | * |
160 | * FUNCTION: acpi_ns_evaluate_by_name | 54 | * FUNCTION: acpi_ns_evaluate |
161 | * | 55 | * |
162 | * PARAMETERS: Pathname - Fully qualified pathname to the object | 56 | * PARAMETERS: Info - Evaluation info block, contains: |
163 | * Info - Method info block, contains: | 57 | * prefix_node - Prefix or Method/Object Node to execute |
164 | * return_object - Where to put method's return value (if | 58 | * Pathname - Name of method to execute, If NULL, the |
165 | * any). If NULL, no value is returned. | 59 | * Node is the object to execute |
166 | * Params - List of parameters to pass to the method, | ||
167 | * terminated by NULL. Params itself may be | ||
168 | * NULL if no parameters are being passed. | ||
169 | * | ||
170 | * RETURN: Status | ||
171 | * | ||
172 | * DESCRIPTION: Evaluate the object or rind and execute the requested method | ||
173 | * passing the given parameters | ||
174 | * | ||
175 | * MUTEX: Locks Namespace | ||
176 | * | ||
177 | ******************************************************************************/ | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | ||
181 | { | ||
182 | acpi_status status; | ||
183 | char *internal_path = NULL; | ||
184 | |||
185 | ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); | ||
186 | |||
187 | /* Build an internal name string for the method */ | ||
188 | |||
189 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
190 | if (ACPI_FAILURE(status)) { | ||
191 | return_ACPI_STATUS(status); | ||
192 | } | ||
193 | |||
194 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
195 | if (ACPI_FAILURE(status)) { | ||
196 | goto cleanup; | ||
197 | } | ||
198 | |||
199 | /* Lookup the name in the namespace */ | ||
200 | |||
201 | status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, | ||
202 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
203 | &info->node); | ||
204 | |||
205 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
206 | |||
207 | if (ACPI_FAILURE(status)) { | ||
208 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
209 | "Object at [%s] was not found, status=%.4X\n", | ||
210 | pathname, status)); | ||
211 | goto cleanup; | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
216 | */ | ||
217 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
218 | pathname, info->node, | ||
219 | acpi_ns_get_attached_object(info->node))); | ||
220 | |||
221 | status = acpi_ns_evaluate_by_handle(info); | ||
222 | |||
223 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
224 | "*** Completed eval of object %s ***\n", pathname)); | ||
225 | |||
226 | cleanup: | ||
227 | |||
228 | /* Cleanup */ | ||
229 | |||
230 | if (internal_path) { | ||
231 | ACPI_MEM_FREE(internal_path); | ||
232 | } | ||
233 | |||
234 | return_ACPI_STATUS(status); | ||
235 | } | ||
236 | |||
237 | /******************************************************************************* | ||
238 | * | ||
239 | * FUNCTION: acpi_ns_evaluate_by_handle | ||
240 | * | ||
241 | * PARAMETERS: Info - Method info block, contains: | ||
242 | * Node - Method/Object Node to execute | ||
243 | * Parameters - List of parameters to pass to the method, | 60 | * Parameters - List of parameters to pass to the method, |
244 | * terminated by NULL. Params itself may be | 61 | * terminated by NULL. Params itself may be |
245 | * NULL if no parameters are being passed. | 62 | * NULL if no parameters are being passed. |
@@ -248,29 +65,21 @@ acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | |||
248 | * parameter_type - Type of Parameter list | 65 | * parameter_type - Type of Parameter list |
249 | * return_object - Where to put method's return value (if | 66 | * return_object - Where to put method's return value (if |
250 | * any). If NULL, no value is returned. | 67 | * any). If NULL, no value is returned. |
68 | * Flags - ACPI_IGNORE_RETURN_VALUE to delete return | ||
251 | * | 69 | * |
252 | * RETURN: Status | 70 | * RETURN: Status |
253 | * | 71 | * |
254 | * DESCRIPTION: Evaluate object or execute the requested method passing the | 72 | * DESCRIPTION: Execute a control method or return the current value of an |
255 | * given parameters | 73 | * ACPI namespace object. |
256 | * | 74 | * |
257 | * MUTEX: Locks Namespace | 75 | * MUTEX: Locks interpreter |
258 | * | 76 | * |
259 | ******************************************************************************/ | 77 | ******************************************************************************/ |
260 | 78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |
261 | acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | ||
262 | { | 79 | { |
263 | acpi_status status; | 80 | acpi_status status; |
264 | 81 | ||
265 | ACPI_FUNCTION_TRACE("ns_evaluate_by_handle"); | 82 | ACPI_FUNCTION_TRACE(ns_evaluate); |
266 | |||
267 | /* Check if namespace has been initialized */ | ||
268 | |||
269 | if (!acpi_gbl_root_node) { | ||
270 | return_ACPI_STATUS(AE_NO_NAMESPACE); | ||
271 | } | ||
272 | |||
273 | /* Parameter Validation */ | ||
274 | 83 | ||
275 | if (!info) { | 84 | if (!info) { |
276 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 85 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -280,202 +89,120 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | |||
280 | 89 | ||
281 | info->return_object = NULL; | 90 | info->return_object = NULL; |
282 | 91 | ||
283 | /* Get the prefix handle and Node */ | 92 | /* |
284 | 93 | * Get the actual namespace node for the target object. Handles these cases: | |
285 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 94 | * |
95 | * 1) Null node, Pathname (absolute path) | ||
96 | * 2) Node, Pathname (path relative to Node) | ||
97 | * 3) Node, Null Pathname | ||
98 | */ | ||
99 | status = acpi_ns_get_node(info->prefix_node, info->pathname, | ||
100 | ACPI_NS_NO_UPSEARCH, &info->resolved_node); | ||
286 | if (ACPI_FAILURE(status)) { | 101 | if (ACPI_FAILURE(status)) { |
287 | return_ACPI_STATUS(status); | 102 | return_ACPI_STATUS(status); |
288 | } | 103 | } |
289 | 104 | ||
290 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
291 | if (!info->node) { | ||
292 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
293 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
294 | } | ||
295 | |||
296 | /* | 105 | /* |
297 | * For a method alias, we must grab the actual method node so that proper | 106 | * For a method alias, we must grab the actual method node so that proper |
298 | * scoping context will be established before execution. | 107 | * scoping context will be established before execution. |
299 | */ | 108 | */ |
300 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 109 | if (acpi_ns_get_type(info->resolved_node) == |
301 | info->node = | 110 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
111 | info->resolved_node = | ||
302 | ACPI_CAST_PTR(struct acpi_namespace_node, | 112 | ACPI_CAST_PTR(struct acpi_namespace_node, |
303 | info->node->object); | 113 | info->resolved_node->object); |
304 | } | 114 | } |
305 | 115 | ||
116 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname, | ||
117 | info->resolved_node, | ||
118 | acpi_ns_get_attached_object(info->resolved_node))); | ||
119 | |||
306 | /* | 120 | /* |
307 | * Two major cases here: | 121 | * Two major cases here: |
308 | * 1) The object is an actual control method -- execute it. | ||
309 | * 2) The object is not a method -- just return it's current value | ||
310 | * | 122 | * |
311 | * In both cases, the namespace is unlocked by the acpi_ns* procedure | 123 | * 1) The object is a control method -- execute it |
124 | * 2) The object is not a method -- just return it's current value | ||
312 | */ | 125 | */ |
313 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) { | 126 | if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) { |
314 | /* | ||
315 | * Case 1) We have an actual control method to execute | ||
316 | */ | ||
317 | status = acpi_ns_execute_control_method(info); | ||
318 | } else { | ||
319 | /* | 127 | /* |
320 | * Case 2) Object is NOT a method, just return its current value | 128 | * 1) Object is a control method - execute it |
321 | */ | 129 | */ |
322 | status = acpi_ns_get_object_value(info); | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * Check if there is a return value on the stack that must be dealt with | ||
327 | */ | ||
328 | if (status == AE_CTRL_RETURN_VALUE) { | ||
329 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
330 | |||
331 | status = AE_OK; | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
336 | * just return | ||
337 | */ | ||
338 | return_ACPI_STATUS(status); | ||
339 | } | ||
340 | |||
341 | /******************************************************************************* | ||
342 | * | ||
343 | * FUNCTION: acpi_ns_execute_control_method | ||
344 | * | ||
345 | * PARAMETERS: Info - Method info block, contains: | ||
346 | * Node - Method Node to execute | ||
347 | * obj_desc - Method object | ||
348 | * Parameters - List of parameters to pass to the method, | ||
349 | * terminated by NULL. Params itself may be | ||
350 | * NULL if no parameters are being passed. | ||
351 | * return_object - Where to put method's return value (if | ||
352 | * any). If NULL, no value is returned. | ||
353 | * parameter_type - Type of Parameter list | ||
354 | * return_object - Where to put method's return value (if | ||
355 | * any). If NULL, no value is returned. | ||
356 | * | ||
357 | * RETURN: Status | ||
358 | * | ||
359 | * DESCRIPTION: Execute the requested method passing the given parameters | ||
360 | * | ||
361 | * MUTEX: Assumes namespace is locked | ||
362 | * | ||
363 | ******************************************************************************/ | ||
364 | |||
365 | static acpi_status | ||
366 | acpi_ns_execute_control_method(struct acpi_parameter_info *info) | ||
367 | { | ||
368 | acpi_status status; | ||
369 | |||
370 | ACPI_FUNCTION_TRACE("ns_execute_control_method"); | ||
371 | |||
372 | /* Verify that there is a method associated with this object */ | ||
373 | |||
374 | info->obj_desc = acpi_ns_get_attached_object(info->node); | ||
375 | if (!info->obj_desc) { | ||
376 | ACPI_ERROR((AE_INFO, "No attached method object")); | ||
377 | 130 | ||
378 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 131 | /* Verify that there is a method object associated with this node */ |
379 | return_ACPI_STATUS(AE_NULL_OBJECT); | ||
380 | } | ||
381 | |||
382 | ACPI_DUMP_PATHNAME(info->node, "Execute Method:", | ||
383 | ACPI_LV_INFO, _COMPONENT); | ||
384 | |||
385 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", | ||
386 | info->obj_desc->method.aml_start + 1, | ||
387 | info->obj_desc->method.aml_length - 1)); | ||
388 | |||
389 | /* | ||
390 | * Unlock the namespace before execution. This allows namespace access | ||
391 | * via the external Acpi* interfaces while a method is being executed. | ||
392 | * However, any namespace deletion must acquire both the namespace and | ||
393 | * interpreter locks to ensure that no thread is using the portion of the | ||
394 | * namespace that is being deleted. | ||
395 | */ | ||
396 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
397 | if (ACPI_FAILURE(status)) { | ||
398 | return_ACPI_STATUS(status); | ||
399 | } | ||
400 | 132 | ||
401 | /* | 133 | info->obj_desc = |
402 | * Execute the method via the interpreter. The interpreter is locked | 134 | acpi_ns_get_attached_object(info->resolved_node); |
403 | * here before calling into the AML parser | 135 | if (!info->obj_desc) { |
404 | */ | 136 | ACPI_ERROR((AE_INFO, |
405 | status = acpi_ex_enter_interpreter(); | 137 | "Control method has no attached sub-object")); |
406 | if (ACPI_FAILURE(status)) { | 138 | return_ACPI_STATUS(AE_NULL_OBJECT); |
407 | return_ACPI_STATUS(status); | 139 | } |
408 | } | ||
409 | 140 | ||
410 | status = acpi_ps_execute_method(info); | 141 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", |
411 | acpi_ex_exit_interpreter(); | 142 | ACPI_LV_INFO, _COMPONENT); |
412 | 143 | ||
413 | return_ACPI_STATUS(status); | 144 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
414 | } | 145 | "Method at AML address %p Length %X\n", |
146 | info->obj_desc->method.aml_start + 1, | ||
147 | info->obj_desc->method.aml_length - 1)); | ||
415 | 148 | ||
416 | /******************************************************************************* | 149 | /* |
417 | * | 150 | * Any namespace deletion must acquire both the namespace and |
418 | * FUNCTION: acpi_ns_get_object_value | 151 | * interpreter locks to ensure that no thread is using the portion of |
419 | * | 152 | * the namespace that is being deleted. |
420 | * PARAMETERS: Info - Method info block, contains: | 153 | * |
421 | * Node - Object's NS node | 154 | * Execute the method via the interpreter. The interpreter is locked |
422 | * return_object - Where to put object value (if | 155 | * here before calling into the AML parser |
423 | * any). If NULL, no value is returned. | 156 | */ |
424 | * | 157 | status = acpi_ex_enter_interpreter(); |
425 | * RETURN: Status | 158 | if (ACPI_FAILURE(status)) { |
426 | * | 159 | return_ACPI_STATUS(status); |
427 | * DESCRIPTION: Return the current value of the object | 160 | } |
428 | * | ||
429 | * MUTEX: Assumes namespace is locked, leaves namespace unlocked | ||
430 | * | ||
431 | ******************************************************************************/ | ||
432 | 161 | ||
433 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | 162 | status = acpi_ps_execute_method(info); |
434 | { | 163 | acpi_ex_exit_interpreter(); |
435 | acpi_status status = AE_OK; | 164 | } else { |
436 | struct acpi_namespace_node *resolved_node = info->node; | 165 | /* |
166 | * 2) Object is not a method, return its current value | ||
167 | */ | ||
437 | 168 | ||
438 | ACPI_FUNCTION_TRACE("ns_get_object_value"); | 169 | /* |
170 | * Objects require additional resolution steps (e.g., the Node may be | ||
171 | * a field that must be read, etc.) -- we can't just grab the object | ||
172 | * out of the node. | ||
173 | * | ||
174 | * Use resolve_node_to_value() to get the associated value. | ||
175 | * | ||
176 | * NOTE: we can get away with passing in NULL for a walk state because | ||
177 | * resolved_node is guaranteed to not be a reference to either a method | ||
178 | * local or a method argument (because this interface is never called | ||
179 | * from a running method.) | ||
180 | * | ||
181 | * Even though we do not directly invoke the interpreter for object | ||
182 | * resolution, we must lock it because we could access an opregion. | ||
183 | * The opregion access code assumes that the interpreter is locked. | ||
184 | */ | ||
185 | status = acpi_ex_enter_interpreter(); | ||
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
439 | 189 | ||
440 | /* | 190 | /* Function has a strange interface */ |
441 | * Objects require additional resolution steps (e.g., the Node may be a | ||
442 | * field that must be read, etc.) -- we can't just grab the object out of | ||
443 | * the node. | ||
444 | */ | ||
445 | 191 | ||
446 | /* | 192 | status = |
447 | * Use resolve_node_to_value() to get the associated value. This call always | 193 | acpi_ex_resolve_node_to_value(&info->resolved_node, NULL); |
448 | * deletes obj_desc (allocated above). | 194 | acpi_ex_exit_interpreter(); |
449 | * | ||
450 | * NOTE: we can get away with passing in NULL for a walk state because | ||
451 | * obj_desc is guaranteed to not be a reference to either a method local or | ||
452 | * a method argument (because this interface can only be called from the | ||
453 | * acpi_evaluate external interface, never called from a running method.) | ||
454 | * | ||
455 | * Even though we do not directly invoke the interpreter for this, we must | ||
456 | * enter it because we could access an opregion. The opregion access code | ||
457 | * assumes that the interpreter is locked. | ||
458 | * | ||
459 | * We must release the namespace lock before entering the intepreter. | ||
460 | */ | ||
461 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
462 | if (ACPI_FAILURE(status)) { | ||
463 | return_ACPI_STATUS(status); | ||
464 | } | ||
465 | 195 | ||
466 | status = acpi_ex_enter_interpreter(); | ||
467 | if (ACPI_SUCCESS(status)) { | ||
468 | status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); | ||
469 | /* | 196 | /* |
470 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed | 197 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed |
471 | * in resolved_node. | 198 | * in resolved_node. |
472 | */ | 199 | */ |
473 | acpi_ex_exit_interpreter(); | ||
474 | |||
475 | if (ACPI_SUCCESS(status)) { | 200 | if (ACPI_SUCCESS(status)) { |
476 | status = AE_CTRL_RETURN_VALUE; | 201 | status = AE_CTRL_RETURN_VALUE; |
477 | info->return_object = ACPI_CAST_PTR | 202 | info->return_object = |
478 | (union acpi_operand_object, resolved_node); | 203 | ACPI_CAST_PTR(union acpi_operand_object, |
204 | info->resolved_node); | ||
205 | |||
479 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
480 | "Returning object %p [%s]\n", | 207 | "Returning object %p [%s]\n", |
481 | info->return_object, | 208 | info->return_object, |
@@ -484,7 +211,30 @@ static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | |||
484 | } | 211 | } |
485 | } | 212 | } |
486 | 213 | ||
487 | /* Namespace is unlocked */ | 214 | /* |
215 | * Check if there is a return value that must be dealt with | ||
216 | */ | ||
217 | if (status == AE_CTRL_RETURN_VALUE) { | ||
218 | |||
219 | /* If caller does not want the return value, delete it */ | ||
488 | 220 | ||
221 | if (info->flags & ACPI_IGNORE_RETURN_VALUE) { | ||
222 | acpi_ut_remove_reference(info->return_object); | ||
223 | info->return_object = NULL; | ||
224 | } | ||
225 | |||
226 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
227 | |||
228 | status = AE_OK; | ||
229 | } | ||
230 | |||
231 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
232 | "*** Completed evaluation of object %s ***\n", | ||
233 | info->pathname)); | ||
234 | |||
235 | /* | ||
236 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
237 | * just return | ||
238 | */ | ||
489 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
490 | } | 240 | } |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 9f929e479fd8..aec8488c0019 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -58,6 +58,10 @@ static acpi_status | |||
58 | acpi_ns_init_one_device(acpi_handle obj_handle, | 58 | acpi_ns_init_one_device(acpi_handle obj_handle, |
59 | u32 nesting_level, void *context, void **return_value); | 59 | u32 nesting_level, void *context, void **return_value); |
60 | 60 | ||
61 | static acpi_status | ||
62 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
63 | u32 nesting_level, void *context, void **return_value); | ||
64 | |||
61 | /******************************************************************************* | 65 | /******************************************************************************* |
62 | * | 66 | * |
63 | * FUNCTION: acpi_ns_initialize_objects | 67 | * FUNCTION: acpi_ns_initialize_objects |
@@ -76,7 +80,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
76 | acpi_status status; | 80 | acpi_status status; |
77 | struct acpi_init_walk_info info; | 81 | struct acpi_init_walk_info info; |
78 | 82 | ||
79 | ACPI_FUNCTION_TRACE("ns_initialize_objects"); | 83 | ACPI_FUNCTION_TRACE(ns_initialize_objects); |
80 | 84 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 85 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
82 | "**** Starting initialization of namespace objects ****\n")); | 86 | "**** Starting initialization of namespace objects ****\n")); |
@@ -93,7 +97,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
93 | ACPI_UINT32_MAX, acpi_ns_init_one_object, | 97 | ACPI_UINT32_MAX, acpi_ns_init_one_object, |
94 | &info, NULL); | 98 | &info, NULL); |
95 | if (ACPI_FAILURE(status)) { | 99 | if (ACPI_FAILURE(status)) { |
96 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 100 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
97 | } | 101 | } |
98 | 102 | ||
99 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 103 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
@@ -133,7 +137,7 @@ acpi_status acpi_ns_initialize_devices(void) | |||
133 | acpi_status status; | 137 | acpi_status status; |
134 | struct acpi_device_walk_info info; | 138 | struct acpi_device_walk_info info; |
135 | 139 | ||
136 | ACPI_FUNCTION_TRACE("ns_initialize_devices"); | 140 | ACPI_FUNCTION_TRACE(ns_initialize_devices); |
137 | 141 | ||
138 | /* Init counters */ | 142 | /* Init counters */ |
139 | 143 | ||
@@ -142,30 +146,46 @@ acpi_status acpi_ns_initialize_devices(void) | |||
142 | info.num_INI = 0; | 146 | info.num_INI = 0; |
143 | 147 | ||
144 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 148 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
145 | "Executing all Device _STA and_INI methods:")); | 149 | "Initializing Device/Processor/Thermal objects by executing _INI methods:")); |
150 | |||
151 | /* Tree analysis: find all subtrees that contain _INI methods */ | ||
146 | 152 | ||
147 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 153 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
154 | ACPI_UINT32_MAX, FALSE, | ||
155 | acpi_ns_find_ini_methods, &info, NULL); | ||
148 | if (ACPI_FAILURE(status)) { | 156 | if (ACPI_FAILURE(status)) { |
149 | return_ACPI_STATUS(status); | 157 | goto error_exit; |
150 | } | 158 | } |
151 | 159 | ||
152 | /* Walk namespace for all objects */ | 160 | /* Allocate the evaluation information block */ |
161 | |||
162 | info.evaluate_info = | ||
163 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
164 | if (!info.evaluate_info) { | ||
165 | status = AE_NO_MEMORY; | ||
166 | goto error_exit; | ||
167 | } | ||
168 | |||
169 | /* Walk namespace to execute all _INIs on present devices */ | ||
153 | 170 | ||
154 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, | 171 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
155 | ACPI_UINT32_MAX, TRUE, | 172 | ACPI_UINT32_MAX, FALSE, |
156 | acpi_ns_init_one_device, &info, NULL); | 173 | acpi_ns_init_one_device, &info, NULL); |
157 | 174 | ||
158 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 175 | ACPI_FREE(info.evaluate_info); |
159 | |||
160 | if (ACPI_FAILURE(status)) { | 176 | if (ACPI_FAILURE(status)) { |
161 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 177 | goto error_exit; |
162 | } | 178 | } |
163 | 179 | ||
164 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 180 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
165 | "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n", | 181 | "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n", |
166 | info.device_count, info.num_STA, info.num_INI)); | 182 | info.num_INI, info.num_STA, info.device_count)); |
167 | 183 | ||
168 | return_ACPI_STATUS(status); | 184 | return_ACPI_STATUS(status); |
185 | |||
186 | error_exit: | ||
187 | ACPI_EXCEPTION((AE_INFO, status, "During device initialization")); | ||
188 | return_ACPI_STATUS(status); | ||
169 | } | 189 | } |
170 | 190 | ||
171 | /******************************************************************************* | 191 | /******************************************************************************* |
@@ -200,7 +220,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
200 | (struct acpi_namespace_node *)obj_handle; | 220 | (struct acpi_namespace_node *)obj_handle; |
201 | union acpi_operand_object *obj_desc; | 221 | union acpi_operand_object *obj_desc; |
202 | 222 | ||
203 | ACPI_FUNCTION_NAME("ns_init_one_object"); | 223 | ACPI_FUNCTION_NAME(ns_init_one_object); |
204 | 224 | ||
205 | info->object_count++; | 225 | info->object_count++; |
206 | 226 | ||
@@ -311,6 +331,72 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
311 | 331 | ||
312 | /******************************************************************************* | 332 | /******************************************************************************* |
313 | * | 333 | * |
334 | * FUNCTION: acpi_ns_find_ini_methods | ||
335 | * | ||
336 | * PARAMETERS: acpi_walk_callback | ||
337 | * | ||
338 | * RETURN: acpi_status | ||
339 | * | ||
340 | * DESCRIPTION: Called during namespace walk. Finds objects named _INI under | ||
341 | * device/processor/thermal objects, and marks the entire subtree | ||
342 | * with a SUBTREE_HAS_INI flag. This flag is used during the | ||
343 | * subsequent device initialization walk to avoid entire subtrees | ||
344 | * that do not contain an _INI. | ||
345 | * | ||
346 | ******************************************************************************/ | ||
347 | |||
348 | static acpi_status | ||
349 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
350 | u32 nesting_level, void *context, void **return_value) | ||
351 | { | ||
352 | struct acpi_device_walk_info *info = | ||
353 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); | ||
354 | struct acpi_namespace_node *node; | ||
355 | struct acpi_namespace_node *parent_node; | ||
356 | |||
357 | /* Keep count of device/processor/thermal objects */ | ||
358 | |||
359 | node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); | ||
360 | if ((node->type == ACPI_TYPE_DEVICE) || | ||
361 | (node->type == ACPI_TYPE_PROCESSOR) || | ||
362 | (node->type == ACPI_TYPE_THERMAL)) { | ||
363 | info->device_count++; | ||
364 | return (AE_OK); | ||
365 | } | ||
366 | |||
367 | /* We are only looking for methods named _INI */ | ||
368 | |||
369 | if (!ACPI_COMPARE_NAME(node->name.ascii, METHOD_NAME__INI)) { | ||
370 | return (AE_OK); | ||
371 | } | ||
372 | |||
373 | /* | ||
374 | * The only _INI methods that we care about are those that are | ||
375 | * present under Device, Processor, and Thermal objects. | ||
376 | */ | ||
377 | parent_node = acpi_ns_get_parent_node(node); | ||
378 | switch (parent_node->type) { | ||
379 | case ACPI_TYPE_DEVICE: | ||
380 | case ACPI_TYPE_PROCESSOR: | ||
381 | case ACPI_TYPE_THERMAL: | ||
382 | |||
383 | /* Mark parent and bubble up the INI present flag to the root */ | ||
384 | |||
385 | while (parent_node) { | ||
386 | parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; | ||
387 | parent_node = acpi_ns_get_parent_node(parent_node); | ||
388 | } | ||
389 | break; | ||
390 | |||
391 | default: | ||
392 | break; | ||
393 | } | ||
394 | |||
395 | return (AE_OK); | ||
396 | } | ||
397 | |||
398 | /******************************************************************************* | ||
399 | * | ||
314 | * FUNCTION: acpi_ns_init_one_device | 400 | * FUNCTION: acpi_ns_init_one_device |
315 | * | 401 | * |
316 | * PARAMETERS: acpi_walk_callback | 402 | * PARAMETERS: acpi_walk_callback |
@@ -327,119 +413,165 @@ static acpi_status | |||
327 | acpi_ns_init_one_device(acpi_handle obj_handle, | 413 | acpi_ns_init_one_device(acpi_handle obj_handle, |
328 | u32 nesting_level, void *context, void **return_value) | 414 | u32 nesting_level, void *context, void **return_value) |
329 | { | 415 | { |
330 | struct acpi_device_walk_info *info = | 416 | struct acpi_device_walk_info *walk_info = |
331 | (struct acpi_device_walk_info *)context; | 417 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); |
332 | struct acpi_parameter_info pinfo; | 418 | struct acpi_evaluate_info *info = walk_info->evaluate_info; |
333 | u32 flags; | 419 | u32 flags; |
334 | acpi_status status; | 420 | acpi_status status; |
335 | struct acpi_namespace_node *ini_node; | ||
336 | struct acpi_namespace_node *device_node; | 421 | struct acpi_namespace_node *device_node; |
337 | 422 | ||
338 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | 423 | ACPI_FUNCTION_TRACE(ns_init_one_device); |
339 | 424 | ||
340 | device_node = acpi_ns_map_handle_to_node(obj_handle); | 425 | /* We are interested in Devices, Processors and thermal_zones only */ |
341 | if (!device_node) { | ||
342 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
343 | } | ||
344 | 426 | ||
345 | /* | 427 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); |
346 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | ||
347 | */ | ||
348 | if ((device_node->type != ACPI_TYPE_DEVICE) && | 428 | if ((device_node->type != ACPI_TYPE_DEVICE) && |
349 | (device_node->type != ACPI_TYPE_PROCESSOR) && | 429 | (device_node->type != ACPI_TYPE_PROCESSOR) && |
350 | (device_node->type != ACPI_TYPE_THERMAL)) { | 430 | (device_node->type != ACPI_TYPE_THERMAL)) { |
351 | return_ACPI_STATUS(AE_OK); | 431 | return_ACPI_STATUS(AE_OK); |
352 | } | 432 | } |
353 | 433 | ||
354 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
355 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
356 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
357 | } | ||
358 | |||
359 | info->device_count++; | ||
360 | |||
361 | /* | 434 | /* |
362 | * Check if the _INI method exists for this device - | 435 | * Because of an earlier namespace analysis, all subtrees that contain an |
363 | * if _INI does not exist, there is no need to run _STA | 436 | * _INI method are tagged. |
364 | * No _INI means device requires no initialization | 437 | * |
438 | * If this device subtree does not contain any _INI methods, we | ||
439 | * can exit now and stop traversing this entire subtree. | ||
365 | */ | 440 | */ |
366 | status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), | 441 | if (!(device_node->flags & ANOBJ_SUBTREE_HAS_INI)) { |
367 | device_node, ACPI_TYPE_METHOD, &ini_node); | 442 | return_ACPI_STATUS(AE_CTRL_DEPTH); |
368 | if (ACPI_FAILURE(status)) { | ||
369 | /* No _INI method found - move on to next device */ | ||
370 | |||
371 | return_ACPI_STATUS(AE_OK); | ||
372 | } | 443 | } |
373 | 444 | ||
374 | /* | 445 | /* |
375 | * Run _STA to determine if we can run _INI on the device - | 446 | * Run _STA to determine if this device is present and functioning. We |
376 | * the device must be present before _INI can be run. | 447 | * must know this information for two important reasons (from ACPI spec): |
377 | * However, _STA is not required - assume device present if no _STA | 448 | * |
449 | * 1) We can only run _INI if the device is present. | ||
450 | * 2) We must abort the device tree walk on this subtree if the device is | ||
451 | * not present and is not functional (we will not examine the children) | ||
452 | * | ||
453 | * The _STA method is not required to be present under the device, we | ||
454 | * assume the device is present if _STA does not exist. | ||
378 | */ | 455 | */ |
379 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 456 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
380 | device_node, | 457 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__STA)); |
381 | METHOD_NAME__STA)); | ||
382 | |||
383 | pinfo.node = device_node; | ||
384 | pinfo.parameters = NULL; | ||
385 | pinfo.parameter_type = ACPI_PARAM_ARGS; | ||
386 | 458 | ||
387 | status = acpi_ut_execute_STA(pinfo.node, &flags); | 459 | status = acpi_ut_execute_STA(device_node, &flags); |
388 | if (ACPI_FAILURE(status)) { | 460 | if (ACPI_FAILURE(status)) { |
461 | |||
389 | /* Ignore error and move on to next device */ | 462 | /* Ignore error and move on to next device */ |
390 | 463 | ||
391 | return_ACPI_STATUS(AE_OK); | 464 | return_ACPI_STATUS(AE_OK); |
392 | } | 465 | } |
393 | 466 | ||
467 | /* | ||
468 | * Flags == -1 means that _STA was not found. In this case, we assume that | ||
469 | * the device is both present and functional. | ||
470 | * | ||
471 | * From the ACPI spec, description of _STA: | ||
472 | * | ||
473 | * "If a device object (including the processor object) does not have an | ||
474 | * _STA object, then OSPM assumes that all of the above bits are set (in | ||
475 | * other words, the device is present, ..., and functioning)" | ||
476 | */ | ||
394 | if (flags != ACPI_UINT32_MAX) { | 477 | if (flags != ACPI_UINT32_MAX) { |
395 | info->num_STA++; | 478 | walk_info->num_STA++; |
396 | } | 479 | } |
397 | 480 | ||
481 | /* | ||
482 | * Examine the PRESENT and FUNCTIONING status bits | ||
483 | * | ||
484 | * Note: ACPI spec does not seem to specify behavior for the present but | ||
485 | * not functioning case, so we assume functioning if present. | ||
486 | */ | ||
398 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 487 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
399 | /* Don't look at children of a not present device */ | ||
400 | 488 | ||
401 | return_ACPI_STATUS(AE_CTRL_DEPTH); | 489 | /* Device is not present, we must examine the Functioning bit */ |
490 | |||
491 | if (flags & ACPI_STA_DEVICE_FUNCTIONING) { | ||
492 | /* | ||
493 | * Device is not present but is "functioning". In this case, | ||
494 | * we will not run _INI, but we continue to examine the children | ||
495 | * of this device. | ||
496 | * | ||
497 | * From the ACPI spec, description of _STA: (Note - no mention | ||
498 | * of whether to run _INI or not on the device in question) | ||
499 | * | ||
500 | * "_STA may return bit 0 clear (not present) with bit 3 set | ||
501 | * (device is functional). This case is used to indicate a valid | ||
502 | * device for which no device driver should be loaded (for example, | ||
503 | * a bridge device.) Children of this device may be present and | ||
504 | * valid. OSPM should continue enumeration below a device whose | ||
505 | * _STA returns this bit combination" | ||
506 | */ | ||
507 | return_ACPI_STATUS(AE_OK); | ||
508 | } else { | ||
509 | /* | ||
510 | * Device is not present and is not functioning. We must abort the | ||
511 | * walk of this subtree immediately -- don't look at the children | ||
512 | * of such a device. | ||
513 | * | ||
514 | * From the ACPI spec, description of _INI: | ||
515 | * | ||
516 | * "If the _STA method indicates that the device is not present, | ||
517 | * OSPM will not run the _INI and will not examine the children | ||
518 | * of the device for _INI methods" | ||
519 | */ | ||
520 | return_ACPI_STATUS(AE_CTRL_DEPTH); | ||
521 | } | ||
402 | } | 522 | } |
403 | 523 | ||
404 | /* | 524 | /* |
405 | * The device is present and _INI exists. Run the _INI method. | 525 | * The device is present or is assumed present if no _STA exists. |
406 | * (We already have the _INI node from above) | 526 | * Run the _INI if it exists (not required to exist) |
527 | * | ||
528 | * Note: We know there is an _INI within this subtree, but it may not be | ||
529 | * under this particular device, it may be lower in the branch. | ||
407 | */ | 530 | */ |
408 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 531 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
409 | pinfo.node, | 532 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); |
410 | METHOD_NAME__INI)); | 533 | |
534 | info->prefix_node = device_node; | ||
535 | info->pathname = METHOD_NAME__INI; | ||
536 | info->parameters = NULL; | ||
537 | info->parameter_type = ACPI_PARAM_ARGS; | ||
538 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
539 | |||
540 | status = acpi_ns_evaluate(info); | ||
541 | if (ACPI_SUCCESS(status)) { | ||
542 | walk_info->num_INI++; | ||
543 | |||
544 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
545 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
546 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
547 | } | ||
548 | } | ||
549 | #ifdef ACPI_DEBUG_OUTPUT | ||
550 | else if (status != AE_NOT_FOUND) { | ||
411 | 551 | ||
412 | pinfo.node = ini_node; | ||
413 | status = acpi_ns_evaluate_by_handle(&pinfo); | ||
414 | if (ACPI_FAILURE(status)) { | ||
415 | /* Ignore error and move on to next device */ | 552 | /* Ignore error and move on to next device */ |
416 | 553 | ||
417 | #ifdef ACPI_DEBUG_OUTPUT | 554 | char *scope_name = |
418 | char *scope_name = acpi_ns_get_external_pathname(ini_node); | 555 | acpi_ns_get_external_pathname(info->resolved_node); |
419 | |||
420 | ACPI_WARNING((AE_INFO, "%s._INI failed: %s", | ||
421 | scope_name, acpi_format_exception(status))); | ||
422 | 556 | ||
423 | ACPI_MEM_FREE(scope_name); | 557 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", |
558 | scope_name)); | ||
559 | ACPI_FREE(scope_name); | ||
560 | } | ||
424 | #endif | 561 | #endif |
425 | } else { | ||
426 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
427 | 562 | ||
428 | if (pinfo.return_object) { | 563 | /* Ignore errors from above */ |
429 | acpi_ut_remove_reference(pinfo.return_object); | ||
430 | } | ||
431 | 564 | ||
432 | /* Count of successful INIs */ | 565 | status = AE_OK; |
433 | |||
434 | info->num_INI++; | ||
435 | } | ||
436 | 566 | ||
567 | /* | ||
568 | * The _INI method has been run if present; call the Global Initialization | ||
569 | * Handler for this device. | ||
570 | */ | ||
437 | if (acpi_gbl_init_handler) { | 571 | if (acpi_gbl_init_handler) { |
438 | /* External initialization handler is present, call it */ | ||
439 | |||
440 | status = | 572 | status = |
441 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 573 | acpi_gbl_init_handler(device_node, ACPI_INIT_DEVICE_INI); |
442 | } | 574 | } |
443 | 575 | ||
444 | return_ACPI_STATUS(AE_OK); | 576 | return_ACPI_STATUS(status); |
445 | } | 577 | } |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 4e0b0524c188..fe75d888e183 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -77,13 +77,14 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, | |||
77 | { | 77 | { |
78 | acpi_status status; | 78 | acpi_status status; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ns_load_table"); | 80 | ACPI_FUNCTION_TRACE(ns_load_table); |
81 | 81 | ||
82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ | 82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ |
83 | 83 | ||
84 | if (! | 84 | if (! |
85 | (acpi_gbl_table_data[table_desc->type]. | 85 | (acpi_gbl_table_data[table_desc->type]. |
86 | flags & ACPI_TABLE_EXECUTABLE)) { | 86 | flags & ACPI_TABLE_EXECUTABLE)) { |
87 | |||
87 | /* Just ignore this table */ | 88 | /* Just ignore this table */ |
88 | 89 | ||
89 | return_ACPI_STATUS(AE_OK); | 90 | return_ACPI_STATUS(AE_OK); |
@@ -168,7 +169,7 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
168 | acpi_status status; | 169 | acpi_status status; |
169 | struct acpi_table_desc *table_desc; | 170 | struct acpi_table_desc *table_desc; |
170 | 171 | ||
171 | ACPI_FUNCTION_TRACE("ns_load_table_by_type"); | 172 | ACPI_FUNCTION_TRACE(ns_load_table_by_type); |
172 | 173 | ||
173 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 174 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
174 | if (ACPI_FAILURE(status)) { | 175 | if (ACPI_FAILURE(status)) { |
@@ -180,11 +181,11 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
180 | * DSDT (one), SSDT/PSDT (multiple) | 181 | * DSDT (one), SSDT/PSDT (multiple) |
181 | */ | 182 | */ |
182 | switch (table_type) { | 183 | switch (table_type) { |
183 | case ACPI_TABLE_DSDT: | 184 | case ACPI_TABLE_ID_DSDT: |
184 | 185 | ||
185 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); | 186 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); |
186 | 187 | ||
187 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; | 188 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next; |
188 | 189 | ||
189 | /* If table already loaded into namespace, just return */ | 190 | /* If table already loaded into namespace, just return */ |
190 | 191 | ||
@@ -200,8 +201,8 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
200 | } | 201 | } |
201 | break; | 202 | break; |
202 | 203 | ||
203 | case ACPI_TABLE_SSDT: | 204 | case ACPI_TABLE_ID_SSDT: |
204 | case ACPI_TABLE_PSDT: | 205 | case ACPI_TABLE_ID_PSDT: |
205 | 206 | ||
206 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 207 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
207 | "Namespace load: %d SSDT or PSDTs\n", | 208 | "Namespace load: %d SSDT or PSDTs\n", |
@@ -258,7 +259,7 @@ acpi_status acpi_ns_load_namespace(void) | |||
258 | { | 259 | { |
259 | acpi_status status; | 260 | acpi_status status; |
260 | 261 | ||
261 | ACPI_FUNCTION_TRACE("acpi_load_name_space"); | 262 | ACPI_FUNCTION_TRACE(acpi_load_name_space); |
262 | 263 | ||
263 | /* There must be at least a DSDT installed */ | 264 | /* There must be at least a DSDT installed */ |
264 | 265 | ||
@@ -271,15 +272,15 @@ acpi_status acpi_ns_load_namespace(void) | |||
271 | * Load the namespace. The DSDT is required, | 272 | * Load the namespace. The DSDT is required, |
272 | * but the SSDT and PSDT tables are optional. | 273 | * but the SSDT and PSDT tables are optional. |
273 | */ | 274 | */ |
274 | status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT); | 275 | status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT); |
275 | if (ACPI_FAILURE(status)) { | 276 | if (ACPI_FAILURE(status)) { |
276 | return_ACPI_STATUS(status); | 277 | return_ACPI_STATUS(status); |
277 | } | 278 | } |
278 | 279 | ||
279 | /* Ignore exceptions from these */ | 280 | /* Ignore exceptions from these */ |
280 | 281 | ||
281 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT); | 282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT); |
282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT); | 283 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT); |
283 | 284 | ||
284 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 285 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
285 | "ACPI Namespace successfully loaded at root %p\n", | 286 | "ACPI Namespace successfully loaded at root %p\n", |
@@ -314,7 +315,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
314 | acpi_handle dummy; | 315 | acpi_handle dummy; |
315 | u32 level; | 316 | u32 level; |
316 | 317 | ||
317 | ACPI_FUNCTION_TRACE("ns_delete_subtree"); | 318 | ACPI_FUNCTION_TRACE(ns_delete_subtree); |
318 | 319 | ||
319 | parent_handle = start_handle; | 320 | parent_handle = start_handle; |
320 | child_handle = NULL; | 321 | child_handle = NULL; |
@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
325 | * to where we started. | 326 | * to where we started. |
326 | */ | 327 | */ |
327 | while (level > 0) { | 328 | while (level > 0) { |
329 | |||
328 | /* Attempt to get the next object in this scope */ | 330 | /* Attempt to get the next object in this scope */ |
329 | 331 | ||
330 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, | 332 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, |
@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
335 | /* Did we get a new object? */ | 337 | /* Did we get a new object? */ |
336 | 338 | ||
337 | if (ACPI_SUCCESS(status)) { | 339 | if (ACPI_SUCCESS(status)) { |
340 | |||
338 | /* Check if this object has any children */ | 341 | /* Check if this object has any children */ |
339 | 342 | ||
340 | if (ACPI_SUCCESS | 343 | if (ACPI_SUCCESS |
@@ -392,7 +395,7 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle) | |||
392 | { | 395 | { |
393 | acpi_status status; | 396 | acpi_status status; |
394 | 397 | ||
395 | ACPI_FUNCTION_TRACE("ns_unload_name_space"); | 398 | ACPI_FUNCTION_TRACE(ns_unload_name_space); |
396 | 399 | ||
397 | /* Parameter validation */ | 400 | /* Parameter validation */ |
398 | 401 | ||
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 639f653b4b6b..97b8332c9746 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsnames") | 49 | ACPI_MODULE_NAME("nsnames") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | static void | ||
53 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | ||
54 | acpi_size size, char *name_buffer); | ||
55 | |||
56 | /******************************************************************************* | 51 | /******************************************************************************* |
57 | * | 52 | * |
58 | * FUNCTION: acpi_ns_build_external_path | 53 | * FUNCTION: acpi_ns_build_external_path |
@@ -67,8 +62,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
67 | * DESCRIPTION: Generate a full pathaname | 62 | * DESCRIPTION: Generate a full pathaname |
68 | * | 63 | * |
69 | ******************************************************************************/ | 64 | ******************************************************************************/ |
70 | 65 | void | |
71 | static void | ||
72 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | 66 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
73 | acpi_size size, char *name_buffer) | 67 | acpi_size size, char *name_buffer) |
74 | { | 68 | { |
@@ -138,7 +132,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
138 | char *name_buffer; | 132 | char *name_buffer; |
139 | acpi_size size; | 133 | acpi_size size; |
140 | 134 | ||
141 | ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node); | 135 | ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); |
142 | 136 | ||
143 | /* Calculate required buffer size based on depth below root */ | 137 | /* Calculate required buffer size based on depth below root */ |
144 | 138 | ||
@@ -146,7 +140,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
146 | 140 | ||
147 | /* Allocate a buffer to be returned to caller */ | 141 | /* Allocate a buffer to be returned to caller */ |
148 | 142 | ||
149 | name_buffer = ACPI_MEM_CALLOCATE(size); | 143 | name_buffer = ACPI_ALLOCATE_ZEROED(size); |
150 | if (!name_buffer) { | 144 | if (!name_buffer) { |
151 | ACPI_ERROR((AE_INFO, "Allocation failure")); | 145 | ACPI_ERROR((AE_INFO, "Allocation failure")); |
152 | return_PTR(NULL); | 146 | return_PTR(NULL); |
@@ -219,7 +213,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
219 | struct acpi_namespace_node *node; | 213 | struct acpi_namespace_node *node; |
220 | acpi_size required_size; | 214 | acpi_size required_size; |
221 | 215 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle); | 216 | ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle); |
223 | 217 | ||
224 | node = acpi_ns_map_handle_to_node(target_handle); | 218 | node = acpi_ns_map_handle_to_node(target_handle); |
225 | if (!node) { | 219 | if (!node) { |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 10ae6292bca4..aabe8794b908 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -76,19 +76,21 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
76 | union acpi_operand_object *last_obj_desc; | 76 | union acpi_operand_object *last_obj_desc; |
77 | acpi_object_type object_type = ACPI_TYPE_ANY; | 77 | acpi_object_type object_type = ACPI_TYPE_ANY; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE("ns_attach_object"); | 79 | ACPI_FUNCTION_TRACE(ns_attach_object); |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Parameter validation | 82 | * Parameter validation |
83 | */ | 83 | */ |
84 | if (!node) { | 84 | if (!node) { |
85 | |||
85 | /* Invalid handle */ | 86 | /* Invalid handle */ |
86 | 87 | ||
87 | ACPI_ERROR((AE_INFO, "Null named_obj handle")); | 88 | ACPI_ERROR((AE_INFO, "Null NamedObj handle")); |
88 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 89 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
89 | } | 90 | } |
90 | 91 | ||
91 | if (!object && (ACPI_TYPE_ANY != type)) { | 92 | if (!object && (ACPI_TYPE_ANY != type)) { |
93 | |||
92 | /* Null object */ | 94 | /* Null object */ |
93 | 95 | ||
94 | ACPI_ERROR((AE_INFO, | 96 | ACPI_ERROR((AE_INFO, |
@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
97 | } | 99 | } |
98 | 100 | ||
99 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { | 101 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
102 | |||
100 | /* Not a name handle */ | 103 | /* Not a name handle */ |
101 | 104 | ||
102 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", | 105 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", |
@@ -108,7 +111,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
108 | 111 | ||
109 | if (node->object == object) { | 112 | if (node->object == object) { |
110 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
111 | "Obj %p already installed in name_obj %p\n", | 114 | "Obj %p already installed in NameObj %p\n", |
112 | object, node)); | 115 | object, node)); |
113 | 116 | ||
114 | return_ACPI_STATUS(AE_OK); | 117 | return_ACPI_STATUS(AE_OK); |
@@ -201,7 +204,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
201 | { | 204 | { |
202 | union acpi_operand_object *obj_desc; | 205 | union acpi_operand_object *obj_desc; |
203 | 206 | ||
204 | ACPI_FUNCTION_TRACE("ns_detach_object"); | 207 | ACPI_FUNCTION_TRACE(ns_detach_object); |
205 | 208 | ||
206 | obj_desc = node->object; | 209 | obj_desc = node->object; |
207 | 210 | ||
@@ -252,7 +255,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct | |||
252 | acpi_namespace_node | 255 | acpi_namespace_node |
253 | *node) | 256 | *node) |
254 | { | 257 | { |
255 | ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); | 258 | ACPI_FUNCTION_TRACE_PTR(ns_get_attached_object, node); |
256 | 259 | ||
257 | if (!node) { | 260 | if (!node) { |
258 | ACPI_WARNING((AE_INFO, "Null Node ptr")); | 261 | ACPI_WARNING((AE_INFO, "Null Node ptr")); |
@@ -287,7 +290,7 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union | |||
287 | acpi_operand_object | 290 | acpi_operand_object |
288 | *obj_desc) | 291 | *obj_desc) |
289 | { | 292 | { |
290 | ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc); | 293 | ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc); |
291 | 294 | ||
292 | if ((!obj_desc) || | 295 | if ((!obj_desc) || |
293 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || | 296 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || |
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 232be4303653..155505a4ef69 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -62,13 +62,13 @@ ACPI_MODULE_NAME("nsparse") | |||
62 | * | 62 | * |
63 | ******************************************************************************/ | 63 | ******************************************************************************/ |
64 | acpi_status | 64 | acpi_status |
65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) | 65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) |
66 | { | 66 | { |
67 | union acpi_parse_object *parse_root; | 67 | union acpi_parse_object *parse_root; |
68 | acpi_status status; | 68 | acpi_status status; |
69 | struct acpi_walk_state *walk_state; | 69 | struct acpi_walk_state *walk_state; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ns_one_complete_parse"); | 71 | ACPI_FUNCTION_TRACE(ns_one_complete_parse); |
72 | 72 | ||
73 | /* Create and init a Root Node */ | 73 | /* Create and init a Root Node */ |
74 | 74 | ||
@@ -124,7 +124,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc, | |||
124 | { | 124 | { |
125 | acpi_status status; | 125 | acpi_status status; |
126 | 126 | ||
127 | ACPI_FUNCTION_TRACE("ns_parse_table"); | 127 | ACPI_FUNCTION_TRACE(ns_parse_table); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * AML Parse, pass 1 | 130 | * AML Parse, pass 1 |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index d64b78952f24..500e2bbcfaf7 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -56,16 +56,16 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
56 | 56 | ||
57 | /******************************************************************************* | 57 | /******************************************************************************* |
58 | * | 58 | * |
59 | * FUNCTION: acpi_ns_search_node | 59 | * FUNCTION: acpi_ns_search_one_scope |
60 | * | 60 | * |
61 | * PARAMETERS: target_name - Ascii ACPI name to search for | 61 | * PARAMETERS: target_name - Ascii ACPI name to search for |
62 | * Node - Starting node where search will begin | 62 | * parent_node - Starting node where search will begin |
63 | * Type - Object type to match | 63 | * Type - Object type to match |
64 | * return_node - Where the matched Named obj is returned | 64 | * return_node - Where the matched Named obj is returned |
65 | * | 65 | * |
66 | * RETURN: Status | 66 | * RETURN: Status |
67 | * | 67 | * |
68 | * DESCRIPTION: Search a single level of the namespace. Performs a | 68 | * DESCRIPTION: Search a single level of the namespace. Performs a |
69 | * simple search of the specified level, and does not add | 69 | * simple search of the specified level, and does not add |
70 | * entries or search parents. | 70 | * entries or search parents. |
71 | * | 71 | * |
@@ -75,35 +75,40 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
75 | * | 75 | * |
76 | * All namespace searching is linear in this implementation, but | 76 | * All namespace searching is linear in this implementation, but |
77 | * could be easily modified to support any improved search | 77 | * could be easily modified to support any improved search |
78 | * algorithm. However, the linear search was chosen for simplicity | 78 | * algorithm. However, the linear search was chosen for simplicity |
79 | * and because the trees are small and the other interpreter | 79 | * and because the trees are small and the other interpreter |
80 | * execution overhead is relatively high. | 80 | * execution overhead is relatively high. |
81 | * | 81 | * |
82 | * Note: CPU execution analysis has shown that the AML interpreter spends | ||
83 | * a very small percentage of its time searching the namespace. Therefore, | ||
84 | * the linear search seems to be sufficient, as there would seem to be | ||
85 | * little value in improving the search. | ||
86 | * | ||
82 | ******************************************************************************/ | 87 | ******************************************************************************/ |
83 | 88 | ||
84 | acpi_status | 89 | acpi_status |
85 | acpi_ns_search_node(u32 target_name, | 90 | acpi_ns_search_one_scope(u32 target_name, |
86 | struct acpi_namespace_node *node, | 91 | struct acpi_namespace_node *parent_node, |
87 | acpi_object_type type, | 92 | acpi_object_type type, |
88 | struct acpi_namespace_node **return_node) | 93 | struct acpi_namespace_node **return_node) |
89 | { | 94 | { |
90 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *node; |
91 | 96 | ||
92 | ACPI_FUNCTION_TRACE("ns_search_node"); | 97 | ACPI_FUNCTION_TRACE(ns_search_one_scope); |
93 | 98 | ||
94 | #ifdef ACPI_DEBUG_OUTPUT | 99 | #ifdef ACPI_DEBUG_OUTPUT |
95 | if (ACPI_LV_NAMES & acpi_dbg_level) { | 100 | if (ACPI_LV_NAMES & acpi_dbg_level) { |
96 | char *scope_name; | 101 | char *scope_name; |
97 | 102 | ||
98 | scope_name = acpi_ns_get_external_pathname(node); | 103 | scope_name = acpi_ns_get_external_pathname(parent_node); |
99 | if (scope_name) { | 104 | if (scope_name) { |
100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 105 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
101 | "Searching %s (%p) For [%4.4s] (%s)\n", | 106 | "Searching %s (%p) For [%4.4s] (%s)\n", |
102 | scope_name, node, ACPI_CAST_PTR(char, | 107 | scope_name, parent_node, |
103 | &target_name), | 108 | ACPI_CAST_PTR(char, &target_name), |
104 | acpi_ut_get_type_name(type))); | 109 | acpi_ut_get_type_name(type))); |
105 | 110 | ||
106 | ACPI_MEM_FREE(scope_name); | 111 | ACPI_FREE(scope_name); |
107 | } | 112 | } |
108 | } | 113 | } |
109 | #endif | 114 | #endif |
@@ -112,32 +117,33 @@ acpi_ns_search_node(u32 target_name, | |||
112 | * Search for name at this namespace level, which is to say that we | 117 | * Search for name at this namespace level, which is to say that we |
113 | * must search for the name among the children of this object | 118 | * must search for the name among the children of this object |
114 | */ | 119 | */ |
115 | next_node = node->child; | 120 | node = parent_node->child; |
116 | while (next_node) { | 121 | while (node) { |
122 | |||
117 | /* Check for match against the name */ | 123 | /* Check for match against the name */ |
118 | 124 | ||
119 | if (next_node->name.integer == target_name) { | 125 | if (node->name.integer == target_name) { |
126 | |||
120 | /* Resolve a control method alias if any */ | 127 | /* Resolve a control method alias if any */ |
121 | 128 | ||
122 | if (acpi_ns_get_type(next_node) == | 129 | if (acpi_ns_get_type(node) == |
123 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 130 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
124 | next_node = | 131 | node = |
125 | ACPI_CAST_PTR(struct acpi_namespace_node, | 132 | ACPI_CAST_PTR(struct acpi_namespace_node, |
126 | next_node->object); | 133 | node->object); |
127 | } | 134 | } |
128 | 135 | ||
129 | /* | 136 | /* Found matching entry */ |
130 | * Found matching entry. | 137 | |
131 | */ | ||
132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 138 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 139 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
134 | ACPI_CAST_PTR(char, &target_name), | 140 | ACPI_CAST_PTR(char, &target_name), |
135 | acpi_ut_get_type_name(next_node-> | 141 | acpi_ut_get_type_name(node->type), |
136 | type), | 142 | node, |
137 | next_node, | 143 | acpi_ut_get_node_name(parent_node), |
138 | acpi_ut_get_node_name(node), node)); | 144 | parent_node)); |
139 | 145 | ||
140 | *return_node = next_node; | 146 | *return_node = node; |
141 | return_ACPI_STATUS(AE_OK); | 147 | return_ACPI_STATUS(AE_OK); |
142 | } | 148 | } |
143 | 149 | ||
@@ -145,7 +151,8 @@ acpi_ns_search_node(u32 target_name, | |||
145 | * The last entry in the list points back to the parent, | 151 | * The last entry in the list points back to the parent, |
146 | * so a flag is used to indicate the end-of-list | 152 | * so a flag is used to indicate the end-of-list |
147 | */ | 153 | */ |
148 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 154 | if (node->flags & ANOBJ_END_OF_PEER_LIST) { |
155 | |||
149 | /* Searched entire list, we are done */ | 156 | /* Searched entire list, we are done */ |
150 | 157 | ||
151 | break; | 158 | break; |
@@ -153,7 +160,7 @@ acpi_ns_search_node(u32 target_name, | |||
153 | 160 | ||
154 | /* Didn't match name, move on to the next peer object */ | 161 | /* Didn't match name, move on to the next peer object */ |
155 | 162 | ||
156 | next_node = next_node->peer; | 163 | node = node->peer; |
157 | } | 164 | } |
158 | 165 | ||
159 | /* Searched entire namespace level, not found */ | 166 | /* Searched entire namespace level, not found */ |
@@ -162,7 +169,8 @@ acpi_ns_search_node(u32 target_name, | |||
162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 169 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
163 | ACPI_CAST_PTR(char, &target_name), | 170 | ACPI_CAST_PTR(char, &target_name), |
164 | acpi_ut_get_type_name(type), | 171 | acpi_ut_get_type_name(type), |
165 | acpi_ut_get_node_name(node), node, node->child)); | 172 | acpi_ut_get_node_name(parent_node), parent_node, |
173 | parent_node->child)); | ||
166 | 174 | ||
167 | return_ACPI_STATUS(AE_NOT_FOUND); | 175 | return_ACPI_STATUS(AE_NOT_FOUND); |
168 | } | 176 | } |
@@ -179,14 +187,14 @@ acpi_ns_search_node(u32 target_name, | |||
179 | * RETURN: Status | 187 | * RETURN: Status |
180 | * | 188 | * |
181 | * DESCRIPTION: Called when a name has not been found in the current namespace | 189 | * DESCRIPTION: Called when a name has not been found in the current namespace |
182 | * level. Before adding it or giving up, ACPI scope rules require | 190 | * level. Before adding it or giving up, ACPI scope rules require |
183 | * searching enclosing scopes in cases identified by acpi_ns_local(). | 191 | * searching enclosing scopes in cases identified by acpi_ns_local(). |
184 | * | 192 | * |
185 | * "A name is located by finding the matching name in the current | 193 | * "A name is located by finding the matching name in the current |
186 | * name space, and then in the parent name space. If the parent | 194 | * name space, and then in the parent name space. If the parent |
187 | * name space does not contain the name, the search continues | 195 | * name space does not contain the name, the search continues |
188 | * recursively until either the name is found or the name space | 196 | * recursively until either the name is found or the name space |
189 | * does not have a parent (the root of the name space). This | 197 | * does not have a parent (the root of the name space). This |
190 | * indicates that the name is not found" (From ACPI Specification, | 198 | * indicates that the name is not found" (From ACPI Specification, |
191 | * section 5.3) | 199 | * section 5.3) |
192 | * | 200 | * |
@@ -201,7 +209,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
201 | acpi_status status; | 209 | acpi_status status; |
202 | struct acpi_namespace_node *parent_node; | 210 | struct acpi_namespace_node *parent_node; |
203 | 211 | ||
204 | ACPI_FUNCTION_TRACE("ns_search_parent_tree"); | 212 | ACPI_FUNCTION_TRACE(ns_search_parent_tree); |
205 | 213 | ||
206 | parent_node = acpi_ns_get_parent_node(node); | 214 | parent_node = acpi_ns_get_parent_node(node); |
207 | 215 | ||
@@ -235,20 +243,19 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
235 | */ | 243 | */ |
236 | while (parent_node) { | 244 | while (parent_node) { |
237 | /* | 245 | /* |
238 | * Search parent scope. Use TYPE_ANY because we don't care about the | 246 | * Search parent scope. Use TYPE_ANY because we don't care about the |
239 | * object type at this point, we only care about the existence of | 247 | * object type at this point, we only care about the existence of |
240 | * the actual name we are searching for. Typechecking comes later. | 248 | * the actual name we are searching for. Typechecking comes later. |
241 | */ | 249 | */ |
242 | status = acpi_ns_search_node(target_name, parent_node, | 250 | status = |
251 | acpi_ns_search_one_scope(target_name, parent_node, | ||
243 | ACPI_TYPE_ANY, return_node); | 252 | ACPI_TYPE_ANY, return_node); |
244 | if (ACPI_SUCCESS(status)) { | 253 | if (ACPI_SUCCESS(status)) { |
245 | return_ACPI_STATUS(status); | 254 | return_ACPI_STATUS(status); |
246 | } | 255 | } |
247 | 256 | ||
248 | /* | 257 | /* Not found here, go up another level (until we reach the root) */ |
249 | * Not found here, go up another level | 258 | |
250 | * (until we reach the root) | ||
251 | */ | ||
252 | parent_node = acpi_ns_get_parent_node(parent_node); | 259 | parent_node = acpi_ns_get_parent_node(parent_node); |
253 | } | 260 | } |
254 | 261 | ||
@@ -273,7 +280,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
273 | * RETURN: Status | 280 | * RETURN: Status |
274 | * | 281 | * |
275 | * DESCRIPTION: Search for a name segment in a single namespace level, | 282 | * DESCRIPTION: Search for a name segment in a single namespace level, |
276 | * optionally adding it if it is not found. If the passed | 283 | * optionally adding it if it is not found. If the passed |
277 | * Type is not Any and the type previously stored in the | 284 | * Type is not Any and the type previously stored in the |
278 | * entry was Any (i.e. unknown), update the stored type. | 285 | * entry was Any (i.e. unknown), update the stored type. |
279 | * | 286 | * |
@@ -293,29 +300,46 @@ acpi_ns_search_and_enter(u32 target_name, | |||
293 | acpi_status status; | 300 | acpi_status status; |
294 | struct acpi_namespace_node *new_node; | 301 | struct acpi_namespace_node *new_node; |
295 | 302 | ||
296 | ACPI_FUNCTION_TRACE("ns_search_and_enter"); | 303 | ACPI_FUNCTION_TRACE(ns_search_and_enter); |
297 | 304 | ||
298 | /* Parameter validation */ | 305 | /* Parameter validation */ |
299 | 306 | ||
300 | if (!node || !target_name || !return_node) { | 307 | if (!node || !target_name || !return_node) { |
301 | ACPI_ERROR((AE_INFO, | 308 | ACPI_ERROR((AE_INFO, |
302 | "Null param: Node %p Name %X return_node %p", | 309 | "Null parameter: Node %p Name %X ReturnNode %p", |
303 | node, target_name, return_node)); | 310 | node, target_name, return_node)); |
304 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 311 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
305 | } | 312 | } |
306 | 313 | ||
307 | /* Name must consist of printable characters */ | 314 | /* |
308 | 315 | * Name must consist of valid ACPI characters. We will repair the name if | |
316 | * necessary because we don't want to abort because of this, but we want | ||
317 | * all namespace names to be printable. A warning message is appropriate. | ||
318 | * | ||
319 | * This issue came up because there are in fact machines that exhibit | ||
320 | * this problem, and we want to be able to enable ACPI support for them, | ||
321 | * even though there are a few bad names. | ||
322 | */ | ||
309 | if (!acpi_ut_valid_acpi_name(target_name)) { | 323 | if (!acpi_ut_valid_acpi_name(target_name)) { |
310 | ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X", | 324 | target_name = acpi_ut_repair_name(target_name); |
311 | target_name)); | 325 | |
312 | return_ACPI_STATUS(AE_BAD_CHARACTER); | 326 | /* Report warning only if in strict mode or debug mode */ |
327 | |||
328 | if (!acpi_gbl_enable_interpreter_slack) { | ||
329 | ACPI_WARNING((AE_INFO, | ||
330 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
331 | ACPI_CAST_PTR(char, &target_name))); | ||
332 | } else { | ||
333 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
334 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
335 | ACPI_CAST_PTR(char, &target_name))); | ||
336 | } | ||
313 | } | 337 | } |
314 | 338 | ||
315 | /* Try to find the name in the namespace level specified by the caller */ | 339 | /* Try to find the name in the namespace level specified by the caller */ |
316 | 340 | ||
317 | *return_node = ACPI_ENTRY_NOT_FOUND; | 341 | *return_node = ACPI_ENTRY_NOT_FOUND; |
318 | status = acpi_ns_search_node(target_name, node, type, return_node); | 342 | status = acpi_ns_search_one_scope(target_name, node, type, return_node); |
319 | if (status != AE_NOT_FOUND) { | 343 | if (status != AE_NOT_FOUND) { |
320 | /* | 344 | /* |
321 | * If we found it AND the request specifies that a find is an error, | 345 | * If we found it AND the request specifies that a find is an error, |
@@ -325,18 +349,16 @@ acpi_ns_search_and_enter(u32 target_name, | |||
325 | status = AE_ALREADY_EXISTS; | 349 | status = AE_ALREADY_EXISTS; |
326 | } | 350 | } |
327 | 351 | ||
328 | /* | 352 | /* Either found it or there was an error: finished either way */ |
329 | * Either found it or there was an error | 353 | |
330 | * -- finished either way | ||
331 | */ | ||
332 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
333 | } | 355 | } |
334 | 356 | ||
335 | /* | 357 | /* |
336 | * The name was not found. If we are NOT performing the first pass | 358 | * The name was not found. If we are NOT performing the first pass |
337 | * (name entry) of loading the namespace, search the parent tree (all the | 359 | * (name entry) of loading the namespace, search the parent tree (all the |
338 | * way to the root if necessary.) We don't want to perform the parent | 360 | * way to the root if necessary.) We don't want to perform the parent |
339 | * search when the namespace is actually being loaded. We want to perform | 361 | * search when the namespace is actually being loaded. We want to perform |
340 | * the search when namespace references are being resolved (load pass 2) | 362 | * the search when namespace references are being resolved (load pass 2) |
341 | * and during the execution phase. | 363 | * and during the execution phase. |
342 | */ | 364 | */ |
@@ -354,9 +376,8 @@ acpi_ns_search_and_enter(u32 target_name, | |||
354 | } | 376 | } |
355 | } | 377 | } |
356 | 378 | ||
357 | /* | 379 | /* In execute mode, just search, never add names. Exit now */ |
358 | * In execute mode, just search, never add names. Exit now. | 380 | |
359 | */ | ||
360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 381 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 382 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
362 | "%4.4s Not found in %p [Not adding]\n", | 383 | "%4.4s Not found in %p [Not adding]\n", |
@@ -371,11 +392,18 @@ acpi_ns_search_and_enter(u32 target_name, | |||
371 | if (!new_node) { | 392 | if (!new_node) { |
372 | return_ACPI_STATUS(AE_NO_MEMORY); | 393 | return_ACPI_STATUS(AE_NO_MEMORY); |
373 | } | 394 | } |
395 | #ifdef ACPI_ASL_COMPILER | ||
396 | /* | ||
397 | * Node is an object defined by an External() statement | ||
398 | */ | ||
399 | if (flags & ACPI_NS_EXTERNAL) { | ||
400 | new_node->flags |= ANOBJ_IS_EXTERNAL; | ||
401 | } | ||
402 | #endif | ||
374 | 403 | ||
375 | /* Install the new object into the parent's list of children */ | 404 | /* Install the new object into the parent's list of children */ |
376 | 405 | ||
377 | acpi_ns_install_node(walk_state, node, new_node, type); | 406 | acpi_ns_install_node(walk_state, node, new_node, type); |
378 | *return_node = new_node; | 407 | *return_node = new_node; |
379 | |||
380 | return_ACPI_STATUS(AE_OK); | 408 | return_ACPI_STATUS(AE_OK); |
381 | } | 409 | } |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 3e7cad549a38..aa4e799d9a8c 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -78,15 +78,17 @@ acpi_ns_report_error(char *module_name, | |||
78 | char *internal_name, acpi_status lookup_status) | 78 | char *internal_name, acpi_status lookup_status) |
79 | { | 79 | { |
80 | acpi_status status; | 80 | acpi_status status; |
81 | u32 bad_name; | ||
81 | char *name = NULL; | 82 | char *name = NULL; |
82 | 83 | ||
83 | acpi_ut_report_error(module_name, line_number); | 84 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
84 | 85 | ||
85 | if (lookup_status == AE_BAD_CHARACTER) { | 86 | if (lookup_status == AE_BAD_CHARACTER) { |
87 | |||
86 | /* There is a non-ascii character in the name */ | 88 | /* There is a non-ascii character in the name */ |
87 | 89 | ||
88 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", | 90 | ACPI_MOVE_32_TO_32(&bad_name, internal_name); |
89 | *(ACPI_CAST_PTR(u32, internal_name))); | 91 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); |
90 | } else { | 92 | } else { |
91 | /* Convert path to external format */ | 93 | /* Convert path to external format */ |
92 | 94 | ||
@@ -102,7 +104,7 @@ acpi_ns_report_error(char *module_name, | |||
102 | } | 104 | } |
103 | 105 | ||
104 | if (name) { | 106 | if (name) { |
105 | ACPI_MEM_FREE(name); | 107 | ACPI_FREE(name); |
106 | } | 108 | } |
107 | } | 109 | } |
108 | 110 | ||
@@ -137,11 +139,12 @@ acpi_ns_report_method_error(char *module_name, | |||
137 | acpi_status status; | 139 | acpi_status status; |
138 | struct acpi_namespace_node *node = prefix_node; | 140 | struct acpi_namespace_node *node = prefix_node; |
139 | 141 | ||
140 | acpi_ut_report_error(module_name, line_number); | 142 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
141 | 143 | ||
142 | if (path) { | 144 | if (path) { |
143 | status = acpi_ns_get_node_by_path(path, prefix_node, | 145 | status = |
144 | ACPI_NS_NO_UPSEARCH, &node); | 146 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, |
147 | &node); | ||
145 | if (ACPI_FAILURE(status)) { | 148 | if (ACPI_FAILURE(status)) { |
146 | acpi_os_printf("[Could not get node by pathname]"); | 149 | acpi_os_printf("[Could not get node by pathname]"); |
147 | } | 150 | } |
@@ -185,7 +188,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) | |||
185 | } | 188 | } |
186 | 189 | ||
187 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); | 190 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); |
188 | ACPI_MEM_FREE(buffer.pointer); | 191 | ACPI_FREE(buffer.pointer); |
189 | } | 192 | } |
190 | } | 193 | } |
191 | 194 | ||
@@ -239,7 +242,7 @@ static u8 acpi_ns_valid_path_separator(char sep) | |||
239 | 242 | ||
240 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | 243 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) |
241 | { | 244 | { |
242 | ACPI_FUNCTION_TRACE("ns_get_type"); | 245 | ACPI_FUNCTION_TRACE(ns_get_type); |
243 | 246 | ||
244 | if (!node) { | 247 | if (!node) { |
245 | ACPI_WARNING((AE_INFO, "Null Node parameter")); | 248 | ACPI_WARNING((AE_INFO, "Null Node parameter")); |
@@ -264,9 +267,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | |||
264 | 267 | ||
265 | u32 acpi_ns_local(acpi_object_type type) | 268 | u32 acpi_ns_local(acpi_object_type type) |
266 | { | 269 | { |
267 | ACPI_FUNCTION_TRACE("ns_local"); | 270 | ACPI_FUNCTION_TRACE(ns_local); |
268 | 271 | ||
269 | if (!acpi_ut_valid_object_type(type)) { | 272 | if (!acpi_ut_valid_object_type(type)) { |
273 | |||
270 | /* Type code out of range */ | 274 | /* Type code out of range */ |
271 | 275 | ||
272 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 276 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -363,7 +367,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
363 | char *result = NULL; | 367 | char *result = NULL; |
364 | acpi_native_uint i; | 368 | acpi_native_uint i; |
365 | 369 | ||
366 | ACPI_FUNCTION_TRACE("ns_build_internal_name"); | 370 | ACPI_FUNCTION_TRACE(ns_build_internal_name); |
367 | 371 | ||
368 | /* Setup the correct prefixes, counts, and pointers */ | 372 | /* Setup the correct prefixes, counts, and pointers */ |
369 | 373 | ||
@@ -411,6 +415,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
411 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 415 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
412 | if (acpi_ns_valid_path_separator(*external_name) || | 416 | if (acpi_ns_valid_path_separator(*external_name) || |
413 | (*external_name == 0)) { | 417 | (*external_name == 0)) { |
418 | |||
414 | /* Pad the segment with underscore(s) if segment is short */ | 419 | /* Pad the segment with underscore(s) if segment is short */ |
415 | 420 | ||
416 | result[i] = '_'; | 421 | result[i] = '_'; |
@@ -473,7 +478,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
473 | struct acpi_namestring_info info; | 478 | struct acpi_namestring_info info; |
474 | acpi_status status; | 479 | acpi_status status; |
475 | 480 | ||
476 | ACPI_FUNCTION_TRACE("ns_internalize_name"); | 481 | ACPI_FUNCTION_TRACE(ns_internalize_name); |
477 | 482 | ||
478 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { | 483 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { |
479 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 484 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -486,7 +491,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
486 | 491 | ||
487 | /* We need a segment to store the internal name */ | 492 | /* We need a segment to store the internal name */ |
488 | 493 | ||
489 | internal_name = ACPI_MEM_CALLOCATE(info.length); | 494 | internal_name = ACPI_ALLOCATE_ZEROED(info.length); |
490 | if (!internal_name) { | 495 | if (!internal_name) { |
491 | return_ACPI_STATUS(AE_NO_MEMORY); | 496 | return_ACPI_STATUS(AE_NO_MEMORY); |
492 | } | 497 | } |
@@ -496,7 +501,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
496 | info.internal_name = internal_name; | 501 | info.internal_name = internal_name; |
497 | status = acpi_ns_build_internal_name(&info); | 502 | status = acpi_ns_build_internal_name(&info); |
498 | if (ACPI_FAILURE(status)) { | 503 | if (ACPI_FAILURE(status)) { |
499 | ACPI_MEM_FREE(internal_name); | 504 | ACPI_FREE(internal_name); |
500 | return_ACPI_STATUS(status); | 505 | return_ACPI_STATUS(status); |
501 | } | 506 | } |
502 | 507 | ||
@@ -533,7 +538,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
533 | acpi_native_uint i = 0; | 538 | acpi_native_uint i = 0; |
534 | acpi_native_uint j = 0; | 539 | acpi_native_uint j = 0; |
535 | 540 | ||
536 | ACPI_FUNCTION_TRACE("ns_externalize_name"); | 541 | ACPI_FUNCTION_TRACE(ns_externalize_name); |
537 | 542 | ||
538 | if (!internal_name_length || !internal_name || !converted_name) { | 543 | if (!internal_name_length || !internal_name || !converted_name) { |
539 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 544 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -628,7 +633,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
628 | /* | 633 | /* |
629 | * Build converted_name | 634 | * Build converted_name |
630 | */ | 635 | */ |
631 | *converted_name = ACPI_MEM_CALLOCATE(required_length); | 636 | *converted_name = ACPI_ALLOCATE_ZEROED(required_length); |
632 | if (!(*converted_name)) { | 637 | if (!(*converted_name)) { |
633 | return_ACPI_STATUS(AE_NO_MEMORY); | 638 | return_ACPI_STATUS(AE_NO_MEMORY); |
634 | } | 639 | } |
@@ -681,13 +686,9 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
681 | ACPI_FUNCTION_ENTRY(); | 686 | ACPI_FUNCTION_ENTRY(); |
682 | 687 | ||
683 | /* | 688 | /* |
684 | * Simple implementation. | 689 | * Simple implementation |
685 | */ | 690 | */ |
686 | if (!handle) { | 691 | if ((!handle) || (handle == ACPI_ROOT_OBJECT)) { |
687 | return (NULL); | ||
688 | } | ||
689 | |||
690 | if (handle == ACPI_ROOT_OBJECT) { | ||
691 | return (acpi_gbl_root_node); | 692 | return (acpi_gbl_root_node); |
692 | } | 693 | } |
693 | 694 | ||
@@ -697,7 +698,7 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
697 | return (NULL); | 698 | return (NULL); |
698 | } | 699 | } |
699 | 700 | ||
700 | return ((struct acpi_namespace_node *)handle); | 701 | return (ACPI_CAST_PTR(struct acpi_namespace_node, handle)); |
701 | } | 702 | } |
702 | 703 | ||
703 | /******************************************************************************* | 704 | /******************************************************************************* |
@@ -752,7 +753,7 @@ void acpi_ns_terminate(void) | |||
752 | { | 753 | { |
753 | union acpi_operand_object *obj_desc; | 754 | union acpi_operand_object *obj_desc; |
754 | 755 | ||
755 | ACPI_FUNCTION_TRACE("ns_terminate"); | 756 | ACPI_FUNCTION_TRACE(ns_terminate); |
756 | 757 | ||
757 | /* | 758 | /* |
758 | * 1) Free the entire namespace -- all nodes and objects | 759 | * 1) Free the entire namespace -- all nodes and objects |
@@ -792,9 +793,10 @@ void acpi_ns_terminate(void) | |||
792 | 793 | ||
793 | u32 acpi_ns_opens_scope(acpi_object_type type) | 794 | u32 acpi_ns_opens_scope(acpi_object_type type) |
794 | { | 795 | { |
795 | ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); | 796 | ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type)); |
796 | 797 | ||
797 | if (!acpi_ut_valid_object_type(type)) { | 798 | if (!acpi_ut_valid_object_type(type)) { |
799 | |||
798 | /* type code out of range */ | 800 | /* type code out of range */ |
799 | 801 | ||
800 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 802 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -806,12 +808,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
806 | 808 | ||
807 | /******************************************************************************* | 809 | /******************************************************************************* |
808 | * | 810 | * |
809 | * FUNCTION: acpi_ns_get_node_by_path | 811 | * FUNCTION: acpi_ns_get_node |
810 | * | 812 | * |
811 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The | 813 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The |
812 | * \ (backslash) and ^ (carat) prefixes, and the | 814 | * \ (backslash) and ^ (carat) prefixes, and the |
813 | * . (period) to separate segments are supported. | 815 | * . (period) to separate segments are supported. |
814 | * start_node - Root of subtree to be searched, or NS_ALL for the | 816 | * prefix_node - Root of subtree to be searched, or NS_ALL for the |
815 | * root of the name space. If Name is fully | 817 | * root of the name space. If Name is fully |
816 | * qualified (first s8 is '\'), the passed value | 818 | * qualified (first s8 is '\'), the passed value |
817 | * of Scope will not be accessed. | 819 | * of Scope will not be accessed. |
@@ -827,23 +829,29 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
827 | ******************************************************************************/ | 829 | ******************************************************************************/ |
828 | 830 | ||
829 | acpi_status | 831 | acpi_status |
830 | acpi_ns_get_node_by_path(char *pathname, | 832 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
831 | struct acpi_namespace_node *start_node, | 833 | char *pathname, |
832 | u32 flags, struct acpi_namespace_node **return_node) | 834 | u32 flags, struct acpi_namespace_node **return_node) |
833 | { | 835 | { |
834 | union acpi_generic_state scope_info; | 836 | union acpi_generic_state scope_info; |
835 | acpi_status status; | 837 | acpi_status status; |
836 | char *internal_path = NULL; | 838 | char *internal_path; |
837 | |||
838 | ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); | ||
839 | 839 | ||
840 | if (pathname) { | 840 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); |
841 | /* Convert path to internal representation */ | ||
842 | 841 | ||
843 | status = acpi_ns_internalize_name(pathname, &internal_path); | 842 | if (!pathname) { |
844 | if (ACPI_FAILURE(status)) { | 843 | *return_node = prefix_node; |
845 | return_ACPI_STATUS(status); | 844 | if (!prefix_node) { |
845 | *return_node = acpi_gbl_root_node; | ||
846 | } | 846 | } |
847 | return_ACPI_STATUS(AE_OK); | ||
848 | } | ||
849 | |||
850 | /* Convert path to internal representation */ | ||
851 | |||
852 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
853 | if (ACPI_FAILURE(status)) { | ||
854 | return_ACPI_STATUS(status); | ||
847 | } | 855 | } |
848 | 856 | ||
849 | /* Must lock namespace during lookup */ | 857 | /* Must lock namespace during lookup */ |
@@ -855,26 +863,23 @@ acpi_ns_get_node_by_path(char *pathname, | |||
855 | 863 | ||
856 | /* Setup lookup scope (search starting point) */ | 864 | /* Setup lookup scope (search starting point) */ |
857 | 865 | ||
858 | scope_info.scope.node = start_node; | 866 | scope_info.scope.node = prefix_node; |
859 | 867 | ||
860 | /* Lookup the name in the namespace */ | 868 | /* Lookup the name in the namespace */ |
861 | 869 | ||
862 | status = acpi_ns_lookup(&scope_info, internal_path, | 870 | status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY, |
863 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 871 | ACPI_IMODE_EXECUTE, |
864 | (flags | ACPI_NS_DONT_OPEN_SCOPE), | 872 | (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, |
865 | NULL, return_node); | 873 | return_node); |
866 | if (ACPI_FAILURE(status)) { | 874 | if (ACPI_FAILURE(status)) { |
867 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", | 875 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", |
868 | internal_path, | 876 | pathname, acpi_format_exception(status))); |
869 | acpi_format_exception(status))); | ||
870 | } | 877 | } |
871 | 878 | ||
872 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 879 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
873 | 880 | ||
874 | cleanup: | 881 | cleanup: |
875 | if (internal_path) { | 882 | ACPI_FREE(internal_path); |
876 | ACPI_MEM_FREE(internal_path); | ||
877 | } | ||
878 | return_ACPI_STATUS(status); | 883 | return_ACPI_STATUS(status); |
879 | } | 884 | } |
880 | 885 | ||
@@ -960,9 +965,10 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) | |||
960 | { | 965 | { |
961 | struct acpi_namespace_node *parent_node; | 966 | struct acpi_namespace_node *parent_node; |
962 | 967 | ||
963 | ACPI_FUNCTION_TRACE("ns_find_parent_name"); | 968 | ACPI_FUNCTION_TRACE(ns_find_parent_name); |
964 | 969 | ||
965 | if (child_node) { | 970 | if (child_node) { |
971 | |||
966 | /* Valid entry. Get the parent Node */ | 972 | /* Valid entry. Get the parent Node */ |
967 | 973 | ||
968 | parent_node = acpi_ns_get_parent_node(child_node); | 974 | parent_node = acpi_ns_get_parent_node(child_node); |
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index fcab1e784b81..c8f6bef16ed0 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
76 | ACPI_FUNCTION_ENTRY(); | 76 | ACPI_FUNCTION_ENTRY(); |
77 | 77 | ||
78 | if (!child_node) { | 78 | if (!child_node) { |
79 | |||
79 | /* It's really the parent's _scope_ that we want */ | 80 | /* It's really the parent's _scope_ that we want */ |
80 | 81 | ||
81 | if (parent_node->child) { | 82 | if (parent_node->child) { |
@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
92 | /* If any type is OK, we are done */ | 93 | /* If any type is OK, we are done */ |
93 | 94 | ||
94 | if (type == ACPI_TYPE_ANY) { | 95 | if (type == ACPI_TYPE_ANY) { |
96 | |||
95 | /* next_node is NULL if we are at the end-of-list */ | 97 | /* next_node is NULL if we are at the end-of-list */ |
96 | 98 | ||
97 | return (next_node); | 99 | return (next_node); |
@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
100 | /* Must search for the node -- but within this scope only */ | 102 | /* Must search for the node -- but within this scope only */ |
101 | 103 | ||
102 | while (next_node) { | 104 | while (next_node) { |
105 | |||
103 | /* If type matches, we are done */ | 106 | /* If type matches, we are done */ |
104 | 107 | ||
105 | if (next_node->type == type) { | 108 | if (next_node->type == type) { |
@@ -161,7 +164,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
161 | acpi_object_type child_type; | 164 | acpi_object_type child_type; |
162 | u32 level; | 165 | u32 level; |
163 | 166 | ||
164 | ACPI_FUNCTION_TRACE("ns_walk_namespace"); | 167 | ACPI_FUNCTION_TRACE(ns_walk_namespace); |
165 | 168 | ||
166 | /* Special case for the namespace Root Node */ | 169 | /* Special case for the namespace Root Node */ |
167 | 170 | ||
@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
182 | * bubbled up to (and passed) the original parent handle (start_entry) | 185 | * bubbled up to (and passed) the original parent handle (start_entry) |
183 | */ | 186 | */ |
184 | while (level > 0) { | 187 | while (level > 0) { |
188 | |||
185 | /* Get the next node in this scope. Null if not found */ | 189 | /* Get the next node in this scope. Null if not found */ |
186 | 190 | ||
187 | status = AE_OK; | 191 | status = AE_OK; |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index a95f636dc35d..6d9bd45af30a 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -51,6 +49,7 @@ | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME("nsxfeval") | 50 | ACPI_MODULE_NAME("nsxfeval") |
53 | 51 | ||
52 | #ifdef ACPI_FUTURE_USAGE | ||
54 | /******************************************************************************* | 53 | /******************************************************************************* |
55 | * | 54 | * |
56 | * FUNCTION: acpi_evaluate_object_typed | 55 | * FUNCTION: acpi_evaluate_object_typed |
@@ -71,18 +70,17 @@ ACPI_MODULE_NAME("nsxfeval") | |||
71 | * be valid (non-null) | 70 | * be valid (non-null) |
72 | * | 71 | * |
73 | ******************************************************************************/ | 72 | ******************************************************************************/ |
74 | #ifdef ACPI_FUTURE_USAGE | ||
75 | acpi_status | 73 | acpi_status |
76 | acpi_evaluate_object_typed(acpi_handle handle, | 74 | acpi_evaluate_object_typed(acpi_handle handle, |
77 | acpi_string pathname, | 75 | acpi_string pathname, |
78 | struct acpi_object_list *external_params, | 76 | struct acpi_object_list * external_params, |
79 | struct acpi_buffer *return_buffer, | 77 | struct acpi_buffer * return_buffer, |
80 | acpi_object_type return_type) | 78 | acpi_object_type return_type) |
81 | { | 79 | { |
82 | acpi_status status; | 80 | acpi_status status; |
83 | u8 must_free = FALSE; | 81 | u8 must_free = FALSE; |
84 | 82 | ||
85 | ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed"); | 83 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); |
86 | 84 | ||
87 | /* Return buffer must be valid */ | 85 | /* Return buffer must be valid */ |
88 | 86 | ||
@@ -110,6 +108,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
110 | } | 108 | } |
111 | 109 | ||
112 | if (return_buffer->length == 0) { | 110 | if (return_buffer->length == 0) { |
111 | |||
113 | /* Error because caller specifically asked for a return value */ | 112 | /* Error because caller specifically asked for a return value */ |
114 | 113 | ||
115 | ACPI_ERROR((AE_INFO, "No return value")); | 114 | ACPI_ERROR((AE_INFO, "No return value")); |
@@ -131,6 +130,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
131 | acpi_ut_get_type_name(return_type))); | 130 | acpi_ut_get_type_name(return_type))); |
132 | 131 | ||
133 | if (must_free) { | 132 | if (must_free) { |
133 | |||
134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ | 134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ |
135 | 135 | ||
136 | acpi_os_free(return_buffer->pointer); | 136 | acpi_os_free(return_buffer->pointer); |
@@ -140,6 +140,8 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
140 | return_buffer->length = 0; | 140 | return_buffer->length = 0; |
141 | return_ACPI_STATUS(AE_TYPE); | 141 | return_ACPI_STATUS(AE_TYPE); |
142 | } | 142 | } |
143 | |||
144 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) | ||
143 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
144 | 146 | ||
145 | /******************************************************************************* | 147 | /******************************************************************************* |
@@ -161,7 +163,6 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
161 | * be valid (non-null) | 163 | * be valid (non-null) |
162 | * | 164 | * |
163 | ******************************************************************************/ | 165 | ******************************************************************************/ |
164 | |||
165 | acpi_status | 166 | acpi_status |
166 | acpi_evaluate_object(acpi_handle handle, | 167 | acpi_evaluate_object(acpi_handle handle, |
167 | acpi_string pathname, | 168 | acpi_string pathname, |
@@ -170,51 +171,61 @@ acpi_evaluate_object(acpi_handle handle, | |||
170 | { | 171 | { |
171 | acpi_status status; | 172 | acpi_status status; |
172 | acpi_status status2; | 173 | acpi_status status2; |
173 | struct acpi_parameter_info info; | 174 | struct acpi_evaluate_info *info; |
174 | acpi_size buffer_space_needed; | 175 | acpi_size buffer_space_needed; |
175 | u32 i; | 176 | u32 i; |
176 | 177 | ||
177 | ACPI_FUNCTION_TRACE("acpi_evaluate_object"); | 178 | ACPI_FUNCTION_TRACE(acpi_evaluate_object); |
178 | 179 | ||
179 | info.node = handle; | 180 | /* Allocate and initialize the evaluation information block */ |
180 | info.parameters = NULL; | 181 | |
181 | info.return_object = NULL; | 182 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
182 | info.parameter_type = ACPI_PARAM_ARGS; | 183 | if (!info) { |
184 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
185 | } | ||
186 | |||
187 | info->pathname = pathname; | ||
188 | info->parameter_type = ACPI_PARAM_ARGS; | ||
189 | |||
190 | /* Convert and validate the device handle */ | ||
191 | |||
192 | info->prefix_node = acpi_ns_map_handle_to_node(handle); | ||
193 | if (!info->prefix_node) { | ||
194 | status = AE_BAD_PARAMETER; | ||
195 | goto cleanup; | ||
196 | } | ||
183 | 197 | ||
184 | /* | 198 | /* |
185 | * If there are parameters to be passed to the object | 199 | * If there are parameters to be passed to a control method, the external |
186 | * (which must be a control method), the external objects | 200 | * objects must all be converted to internal objects |
187 | * must be converted to internal objects | ||
188 | */ | 201 | */ |
189 | if (external_params && external_params->count) { | 202 | if (external_params && external_params->count) { |
190 | /* | 203 | /* |
191 | * Allocate a new parameter block for the internal objects | 204 | * Allocate a new parameter block for the internal objects |
192 | * Add 1 to count to allow for null terminated internal list | 205 | * Add 1 to count to allow for null terminated internal list |
193 | */ | 206 | */ |
194 | info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) | 207 | info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) |
195 | external_params->count + | 208 | external_params-> |
196 | 1) * sizeof(void *)); | 209 | count + |
197 | if (!info.parameters) { | 210 | 1) * sizeof(void *)); |
198 | return_ACPI_STATUS(AE_NO_MEMORY); | 211 | if (!info->parameters) { |
212 | status = AE_NO_MEMORY; | ||
213 | goto cleanup; | ||
199 | } | 214 | } |
200 | 215 | ||
201 | /* | 216 | /* Convert each external object in the list to an internal object */ |
202 | * Convert each external object in the list to an | 217 | |
203 | * internal object | ||
204 | */ | ||
205 | for (i = 0; i < external_params->count; i++) { | 218 | for (i = 0; i < external_params->count; i++) { |
206 | status = | 219 | status = |
207 | acpi_ut_copy_eobject_to_iobject(&external_params-> | 220 | acpi_ut_copy_eobject_to_iobject(&external_params-> |
208 | pointer[i], | 221 | pointer[i], |
209 | &info. | 222 | &info-> |
210 | parameters[i]); | 223 | parameters[i]); |
211 | if (ACPI_FAILURE(status)) { | 224 | if (ACPI_FAILURE(status)) { |
212 | acpi_ut_delete_internal_object_list(info. | 225 | goto cleanup; |
213 | parameters); | ||
214 | return_ACPI_STATUS(status); | ||
215 | } | 226 | } |
216 | } | 227 | } |
217 | info.parameters[external_params->count] = NULL; | 228 | info->parameters[external_params->count] = NULL; |
218 | } | 229 | } |
219 | 230 | ||
220 | /* | 231 | /* |
@@ -224,43 +235,31 @@ acpi_evaluate_object(acpi_handle handle, | |||
224 | * 3) Valid handle | 235 | * 3) Valid handle |
225 | */ | 236 | */ |
226 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { | 237 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { |
227 | /* | 238 | |
228 | * The path is fully qualified, just evaluate by name | 239 | /* The path is fully qualified, just evaluate by name */ |
229 | */ | 240 | |
230 | status = acpi_ns_evaluate_by_name(pathname, &info); | 241 | info->prefix_node = NULL; |
242 | status = acpi_ns_evaluate(info); | ||
231 | } else if (!handle) { | 243 | } else if (!handle) { |
232 | /* | 244 | /* |
233 | * A handle is optional iff a fully qualified pathname | 245 | * A handle is optional iff a fully qualified pathname is specified. |
234 | * is specified. Since we've already handled fully | 246 | * Since we've already handled fully qualified names above, this is |
235 | * qualified names above, this is an error | 247 | * an error |
236 | */ | 248 | */ |
237 | if (!pathname) { | 249 | if (!pathname) { |
238 | ACPI_ERROR((AE_INFO, | 250 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
239 | "Both Handle and Pathname are NULL")); | 251 | "Both Handle and Pathname are NULL")); |
240 | } else { | 252 | } else { |
241 | ACPI_ERROR((AE_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
242 | "Handle is NULL and Pathname is relative")); | 254 | "Null Handle with relative pathname [%s]", |
255 | pathname)); | ||
243 | } | 256 | } |
244 | 257 | ||
245 | status = AE_BAD_PARAMETER; | 258 | status = AE_BAD_PARAMETER; |
246 | } else { | 259 | } else { |
247 | /* | 260 | /* We have a namespace a node and a possible relative path */ |
248 | * We get here if we have a handle -- and if we have a | 261 | |
249 | * pathname it is relative. The handle will be validated | 262 | status = acpi_ns_evaluate(info); |
250 | * in the lower procedures | ||
251 | */ | ||
252 | if (!pathname) { | ||
253 | /* | ||
254 | * The null pathname case means the handle is for | ||
255 | * the actual object to be evaluated | ||
256 | */ | ||
257 | status = acpi_ns_evaluate_by_handle(&info); | ||
258 | } else { | ||
259 | /* | ||
260 | * Both a Handle and a relative Pathname | ||
261 | */ | ||
262 | status = acpi_ns_evaluate_relative(pathname, &info); | ||
263 | } | ||
264 | } | 263 | } |
265 | 264 | ||
266 | /* | 265 | /* |
@@ -268,10 +267,10 @@ acpi_evaluate_object(acpi_handle handle, | |||
268 | * copy the return value to an external object. | 267 | * copy the return value to an external object. |
269 | */ | 268 | */ |
270 | if (return_buffer) { | 269 | if (return_buffer) { |
271 | if (!info.return_object) { | 270 | if (!info->return_object) { |
272 | return_buffer->length = 0; | 271 | return_buffer->length = 0; |
273 | } else { | 272 | } else { |
274 | if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) == | 273 | if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) == |
275 | ACPI_DESC_TYPE_NAMED) { | 274 | ACPI_DESC_TYPE_NAMED) { |
276 | /* | 275 | /* |
277 | * If we received a NS Node as a return object, this means that | 276 | * If we received a NS Node as a return object, this means that |
@@ -282,19 +281,19 @@ acpi_evaluate_object(acpi_handle handle, | |||
282 | * support for various types at a later date if necessary. | 281 | * support for various types at a later date if necessary. |
283 | */ | 282 | */ |
284 | status = AE_TYPE; | 283 | status = AE_TYPE; |
285 | info.return_object = NULL; /* No need to delete a NS Node */ | 284 | info->return_object = NULL; /* No need to delete a NS Node */ |
286 | return_buffer->length = 0; | 285 | return_buffer->length = 0; |
287 | } | 286 | } |
288 | 287 | ||
289 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
290 | /* | 289 | |
291 | * Find out how large a buffer is needed | 290 | /* Get the size of the returned object */ |
292 | * to contain the returned object | 291 | |
293 | */ | ||
294 | status = | 292 | status = |
295 | acpi_ut_get_object_size(info.return_object, | 293 | acpi_ut_get_object_size(info->return_object, |
296 | &buffer_space_needed); | 294 | &buffer_space_needed); |
297 | if (ACPI_SUCCESS(status)) { | 295 | if (ACPI_SUCCESS(status)) { |
296 | |||
298 | /* Validate/Allocate/Clear caller buffer */ | 297 | /* Validate/Allocate/Clear caller buffer */ |
299 | 298 | ||
300 | status = | 299 | status = |
@@ -303,7 +302,8 @@ acpi_evaluate_object(acpi_handle handle, | |||
303 | buffer_space_needed); | 302 | buffer_space_needed); |
304 | if (ACPI_FAILURE(status)) { | 303 | if (ACPI_FAILURE(status)) { |
305 | /* | 304 | /* |
306 | * Caller's buffer is too small or a new one can't be allocated | 305 | * Caller's buffer is too small or a new one can't |
306 | * be allocated | ||
307 | */ | 307 | */ |
308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
309 | "Needed buffer size %X, %s\n", | 309 | "Needed buffer size %X, %s\n", |
@@ -312,12 +312,11 @@ acpi_evaluate_object(acpi_handle handle, | |||
312 | acpi_format_exception | 312 | acpi_format_exception |
313 | (status))); | 313 | (status))); |
314 | } else { | 314 | } else { |
315 | /* | 315 | /* We have enough space for the object, build it */ |
316 | * We have enough space for the object, build it | 316 | |
317 | */ | ||
318 | status = | 317 | status = |
319 | acpi_ut_copy_iobject_to_eobject | 318 | acpi_ut_copy_iobject_to_eobject |
320 | (info.return_object, | 319 | (info->return_object, |
321 | return_buffer); | 320 | return_buffer); |
322 | } | 321 | } |
323 | } | 322 | } |
@@ -325,35 +324,37 @@ acpi_evaluate_object(acpi_handle handle, | |||
325 | } | 324 | } |
326 | } | 325 | } |
327 | 326 | ||
328 | if (info.return_object) { | 327 | if (info->return_object) { |
329 | /* | 328 | /* |
330 | * Delete the internal return object. NOTE: Interpreter | 329 | * Delete the internal return object. NOTE: Interpreter must be |
331 | * must be locked to avoid race condition. | 330 | * locked to avoid race condition. |
332 | */ | 331 | */ |
333 | status2 = acpi_ex_enter_interpreter(); | 332 | status2 = acpi_ex_enter_interpreter(); |
334 | if (ACPI_SUCCESS(status2)) { | 333 | if (ACPI_SUCCESS(status2)) { |
335 | /* | 334 | |
336 | * Delete the internal return object. (Or at least | 335 | /* Remove one reference on the return object (should delete it) */ |
337 | * decrement the reference count by one) | 336 | |
338 | */ | 337 | acpi_ut_remove_reference(info->return_object); |
339 | acpi_ut_remove_reference(info.return_object); | ||
340 | acpi_ex_exit_interpreter(); | 338 | acpi_ex_exit_interpreter(); |
341 | } | 339 | } |
342 | } | 340 | } |
343 | 341 | ||
344 | /* | 342 | cleanup: |
345 | * Free the input parameter list (if we created one), | 343 | |
346 | */ | 344 | /* Free the input parameter list (if we created one) */ |
347 | if (info.parameters) { | 345 | |
346 | if (info->parameters) { | ||
347 | |||
348 | /* Free the allocated parameter block */ | 348 | /* Free the allocated parameter block */ |
349 | 349 | ||
350 | acpi_ut_delete_internal_object_list(info.parameters); | 350 | acpi_ut_delete_internal_object_list(info->parameters); |
351 | } | 351 | } |
352 | 352 | ||
353 | ACPI_FREE(info); | ||
353 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
354 | } | 355 | } |
355 | 356 | ||
356 | EXPORT_SYMBOL(acpi_evaluate_object); | 357 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object) |
357 | 358 | ||
358 | /******************************************************************************* | 359 | /******************************************************************************* |
359 | * | 360 | * |
@@ -384,7 +385,6 @@ EXPORT_SYMBOL(acpi_evaluate_object); | |||
384 | * function, etc. | 385 | * function, etc. |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status | 388 | acpi_status |
389 | acpi_walk_namespace(acpi_object_type type, | 389 | acpi_walk_namespace(acpi_object_type type, |
390 | acpi_handle start_object, | 390 | acpi_handle start_object, |
@@ -394,7 +394,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
394 | { | 394 | { |
395 | acpi_status status; | 395 | acpi_status status; |
396 | 396 | ||
397 | ACPI_FUNCTION_TRACE("acpi_walk_namespace"); | 397 | ACPI_FUNCTION_TRACE(acpi_walk_namespace); |
398 | 398 | ||
399 | /* Parameter validation */ | 399 | /* Parameter validation */ |
400 | 400 | ||
@@ -421,7 +421,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
421 | return_ACPI_STATUS(status); | 421 | return_ACPI_STATUS(status); |
422 | } | 422 | } |
423 | 423 | ||
424 | EXPORT_SYMBOL(acpi_walk_namespace); | 424 | ACPI_EXPORT_SYMBOL(acpi_walk_namespace) |
425 | 425 | ||
426 | /******************************************************************************* | 426 | /******************************************************************************* |
427 | * | 427 | * |
@@ -436,7 +436,6 @@ EXPORT_SYMBOL(acpi_walk_namespace); | |||
436 | * on that. | 436 | * on that. |
437 | * | 437 | * |
438 | ******************************************************************************/ | 438 | ******************************************************************************/ |
439 | |||
440 | static acpi_status | 439 | static acpi_status |
441 | acpi_ns_get_device_callback(acpi_handle obj_handle, | 440 | acpi_ns_get_device_callback(acpi_handle obj_handle, |
442 | u32 nesting_level, | 441 | u32 nesting_level, |
@@ -473,6 +472,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
473 | } | 472 | } |
474 | 473 | ||
475 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 474 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
475 | |||
476 | /* Don't examine children of the device if not present */ | 476 | /* Don't examine children of the device if not present */ |
477 | 477 | ||
478 | return (AE_CTRL_DEPTH); | 478 | return (AE_CTRL_DEPTH); |
@@ -489,6 +489,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
489 | } | 489 | } |
490 | 490 | ||
491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { | 491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { |
492 | |||
492 | /* Get the list of Compatible IDs */ | 493 | /* Get the list of Compatible IDs */ |
493 | 494 | ||
494 | status = acpi_ut_execute_CID(node, &cid); | 495 | status = acpi_ut_execute_CID(node, &cid); |
@@ -505,11 +506,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
505 | sizeof(struct | 506 | sizeof(struct |
506 | acpi_compatible_id)) != | 507 | acpi_compatible_id)) != |
507 | 0) { | 508 | 0) { |
508 | ACPI_MEM_FREE(cid); | 509 | ACPI_FREE(cid); |
509 | return (AE_OK); | 510 | return (AE_OK); |
510 | } | 511 | } |
511 | } | 512 | } |
512 | ACPI_MEM_FREE(cid); | 513 | ACPI_FREE(cid); |
513 | } | 514 | } |
514 | } | 515 | } |
515 | 516 | ||
@@ -551,7 +552,7 @@ acpi_get_devices(char *HID, | |||
551 | acpi_status status; | 552 | acpi_status status; |
552 | struct acpi_get_devices_info info; | 553 | struct acpi_get_devices_info info; |
553 | 554 | ||
554 | ACPI_FUNCTION_TRACE("acpi_get_devices"); | 555 | ACPI_FUNCTION_TRACE(acpi_get_devices); |
555 | 556 | ||
556 | /* Parameter validation */ | 557 | /* Parameter validation */ |
557 | 558 | ||
@@ -563,9 +564,9 @@ acpi_get_devices(char *HID, | |||
563 | * We're going to call their callback from OUR callback, so we need | 564 | * We're going to call their callback from OUR callback, so we need |
564 | * to know what it is, and their context parameter. | 565 | * to know what it is, and their context parameter. |
565 | */ | 566 | */ |
567 | info.hid = HID; | ||
566 | info.context = context; | 568 | info.context = context; |
567 | info.user_function = user_function; | 569 | info.user_function = user_function; |
568 | info.hid = HID; | ||
569 | 570 | ||
570 | /* | 571 | /* |
571 | * Lock the namespace around the walk. | 572 | * Lock the namespace around the walk. |
@@ -578,9 +579,8 @@ acpi_get_devices(char *HID, | |||
578 | return_ACPI_STATUS(status); | 579 | return_ACPI_STATUS(status); |
579 | } | 580 | } |
580 | 581 | ||
581 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, | 582 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
582 | ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | 583 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
583 | ACPI_NS_WALK_UNLOCK, | ||
584 | acpi_ns_get_device_callback, &info, | 584 | acpi_ns_get_device_callback, &info, |
585 | return_value); | 585 | return_value); |
586 | 586 | ||
@@ -588,7 +588,7 @@ acpi_get_devices(char *HID, | |||
588 | return_ACPI_STATUS(status); | 588 | return_ACPI_STATUS(status); |
589 | } | 589 | } |
590 | 590 | ||
591 | EXPORT_SYMBOL(acpi_get_devices); | 591 | ACPI_EXPORT_SYMBOL(acpi_get_devices) |
592 | 592 | ||
593 | /******************************************************************************* | 593 | /******************************************************************************* |
594 | * | 594 | * |
@@ -603,7 +603,6 @@ EXPORT_SYMBOL(acpi_get_devices); | |||
603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. | 603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. |
604 | * | 604 | * |
605 | ******************************************************************************/ | 605 | ******************************************************************************/ |
606 | |||
607 | acpi_status | 606 | acpi_status |
608 | acpi_attach_data(acpi_handle obj_handle, | 607 | acpi_attach_data(acpi_handle obj_handle, |
609 | acpi_object_handler handler, void *data) | 608 | acpi_object_handler handler, void *data) |
@@ -637,6 +636,8 @@ acpi_attach_data(acpi_handle obj_handle, | |||
637 | return (status); | 636 | return (status); |
638 | } | 637 | } |
639 | 638 | ||
639 | ACPI_EXPORT_SYMBOL(acpi_attach_data) | ||
640 | |||
640 | /******************************************************************************* | 641 | /******************************************************************************* |
641 | * | 642 | * |
642 | * FUNCTION: acpi_detach_data | 643 | * FUNCTION: acpi_detach_data |
@@ -649,7 +650,6 @@ acpi_attach_data(acpi_handle obj_handle, | |||
649 | * DESCRIPTION: Remove data that was previously attached to a node. | 650 | * DESCRIPTION: Remove data that was previously attached to a node. |
650 | * | 651 | * |
651 | ******************************************************************************/ | 652 | ******************************************************************************/ |
652 | |||
653 | acpi_status | 653 | acpi_status |
654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | 654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) |
655 | { | 655 | { |
@@ -682,6 +682,8 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
682 | return (status); | 682 | return (status); |
683 | } | 683 | } |
684 | 684 | ||
685 | ACPI_EXPORT_SYMBOL(acpi_detach_data) | ||
686 | |||
685 | /******************************************************************************* | 687 | /******************************************************************************* |
686 | * | 688 | * |
687 | * FUNCTION: acpi_get_data | 689 | * FUNCTION: acpi_get_data |
@@ -695,7 +697,6 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
695 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. | 697 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. |
696 | * | 698 | * |
697 | ******************************************************************************/ | 699 | ******************************************************************************/ |
698 | |||
699 | acpi_status | 700 | acpi_status |
700 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | 701 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) |
701 | { | 702 | { |
@@ -727,3 +728,5 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | |||
727 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 728 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
728 | return (status); | 729 | return (status); |
729 | } | 730 | } |
731 | |||
732 | ACPI_EXPORT_SYMBOL(acpi_get_data) | ||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 8cd8675a47c0..978213a6c19f 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -114,9 +112,8 @@ acpi_get_handle(acpi_handle parent, | |||
114 | /* | 112 | /* |
115 | * Find the Node and convert to a handle | 113 | * Find the Node and convert to a handle |
116 | */ | 114 | */ |
117 | status = | 115 | status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, |
118 | acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, | 116 | &node); |
119 | &node); | ||
120 | 117 | ||
121 | *ret_handle = NULL; | 118 | *ret_handle = NULL; |
122 | if (ACPI_SUCCESS(status)) { | 119 | if (ACPI_SUCCESS(status)) { |
@@ -126,7 +123,7 @@ acpi_get_handle(acpi_handle parent, | |||
126 | return (status); | 123 | return (status); |
127 | } | 124 | } |
128 | 125 | ||
129 | EXPORT_SYMBOL(acpi_get_handle); | 126 | ACPI_EXPORT_SYMBOL(acpi_get_handle) |
130 | 127 | ||
131 | /****************************************************************************** | 128 | /****************************************************************************** |
132 | * | 129 | * |
@@ -143,7 +140,6 @@ EXPORT_SYMBOL(acpi_get_handle); | |||
143 | * complementary functions. | 140 | * complementary functions. |
144 | * | 141 | * |
145 | ******************************************************************************/ | 142 | ******************************************************************************/ |
146 | |||
147 | acpi_status | 143 | acpi_status |
148 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | 144 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) |
149 | { | 145 | { |
@@ -162,6 +158,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
162 | } | 158 | } |
163 | 159 | ||
164 | if (name_type == ACPI_FULL_PATHNAME) { | 160 | if (name_type == ACPI_FULL_PATHNAME) { |
161 | |||
165 | /* Get the full pathname (From the namespace root) */ | 162 | /* Get the full pathname (From the namespace root) */ |
166 | 163 | ||
167 | status = acpi_ns_handle_to_pathname(handle, buffer); | 164 | status = acpi_ns_handle_to_pathname(handle, buffer); |
@@ -203,7 +200,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
203 | return (status); | 200 | return (status); |
204 | } | 201 | } |
205 | 202 | ||
206 | EXPORT_SYMBOL(acpi_get_name); | 203 | ACPI_EXPORT_SYMBOL(acpi_get_name) |
207 | 204 | ||
208 | /****************************************************************************** | 205 | /****************************************************************************** |
209 | * | 206 | * |
@@ -219,7 +216,6 @@ EXPORT_SYMBOL(acpi_get_name); | |||
219 | * control methods (Such as in the case of a device.) | 216 | * control methods (Such as in the case of a device.) |
220 | * | 217 | * |
221 | ******************************************************************************/ | 218 | ******************************************************************************/ |
222 | |||
223 | acpi_status | 219 | acpi_status |
224 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | 220 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) |
225 | { | 221 | { |
@@ -241,7 +237,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
241 | return (status); | 237 | return (status); |
242 | } | 238 | } |
243 | 239 | ||
244 | info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); | 240 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); |
245 | if (!info) { | 241 | if (!info) { |
246 | return (AE_NO_MEMORY); | 242 | return (AE_NO_MEMORY); |
247 | } | 243 | } |
@@ -345,11 +341,11 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
345 | } | 341 | } |
346 | 342 | ||
347 | cleanup: | 343 | cleanup: |
348 | ACPI_MEM_FREE(info); | 344 | ACPI_FREE(info); |
349 | if (cid_list) { | 345 | if (cid_list) { |
350 | ACPI_MEM_FREE(cid_list); | 346 | ACPI_FREE(cid_list); |
351 | } | 347 | } |
352 | return (status); | 348 | return (status); |
353 | } | 349 | } |
354 | 350 | ||
355 | EXPORT_SYMBOL(acpi_get_object_info); | 351 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index a0332595677a..a163e1d3708d 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -101,7 +99,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) | |||
101 | return (status); | 99 | return (status); |
102 | } | 100 | } |
103 | 101 | ||
104 | EXPORT_SYMBOL(acpi_get_type); | 102 | ACPI_EXPORT_SYMBOL(acpi_get_type) |
105 | 103 | ||
106 | /******************************************************************************* | 104 | /******************************************************************************* |
107 | * | 105 | * |
@@ -116,7 +114,6 @@ EXPORT_SYMBOL(acpi_get_type); | |||
116 | * Handle. | 114 | * Handle. |
117 | * | 115 | * |
118 | ******************************************************************************/ | 116 | ******************************************************************************/ |
119 | |||
120 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | 117 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) |
121 | { | 118 | { |
122 | struct acpi_namespace_node *node; | 119 | struct acpi_namespace_node *node; |
@@ -162,7 +159,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | |||
162 | return (status); | 159 | return (status); |
163 | } | 160 | } |
164 | 161 | ||
165 | EXPORT_SYMBOL(acpi_get_parent); | 162 | ACPI_EXPORT_SYMBOL(acpi_get_parent) |
166 | 163 | ||
167 | /******************************************************************************* | 164 | /******************************************************************************* |
168 | * | 165 | * |
@@ -181,7 +178,6 @@ EXPORT_SYMBOL(acpi_get_parent); | |||
181 | * Scope is returned. | 178 | * Scope is returned. |
182 | * | 179 | * |
183 | ******************************************************************************/ | 180 | ******************************************************************************/ |
184 | |||
185 | acpi_status | 181 | acpi_status |
186 | acpi_get_next_object(acpi_object_type type, | 182 | acpi_get_next_object(acpi_object_type type, |
187 | acpi_handle parent, | 183 | acpi_handle parent, |
@@ -206,6 +202,7 @@ acpi_get_next_object(acpi_object_type type, | |||
206 | /* If null handle, use the parent */ | 202 | /* If null handle, use the parent */ |
207 | 203 | ||
208 | if (!child) { | 204 | if (!child) { |
205 | |||
209 | /* Start search at the beginning of the specified scope */ | 206 | /* Start search at the beginning of the specified scope */ |
210 | 207 | ||
211 | parent_node = acpi_ns_map_handle_to_node(parent); | 208 | parent_node = acpi_ns_map_handle_to_node(parent); |
@@ -242,4 +239,4 @@ acpi_get_next_object(acpi_object_type type, | |||
242 | return (status); | 239 | return (status); |
243 | } | 240 | } |
244 | 241 | ||
245 | EXPORT_SYMBOL(acpi_get_next_object); | 242 | ACPI_EXPORT_SYMBOL(acpi_get_next_object) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 13b5fd5854a8..1bb558adee66 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
39 | #include <linux/nmi.h> | 39 | #include <linux/nmi.h> |
40 | #include <linux/kthread.h> | ||
40 | #include <acpi/acpi.h> | 41 | #include <acpi/acpi.h> |
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
42 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
@@ -600,23 +601,41 @@ static void acpi_os_execute_deferred(void *context) | |||
600 | return_VOID; | 601 | return_VOID; |
601 | } | 602 | } |
602 | 603 | ||
603 | acpi_status | 604 | static int acpi_os_execute_thread(void *context) |
604 | acpi_os_queue_for_execution(u32 priority, | 605 | { |
606 | struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; | ||
607 | if (dpc) { | ||
608 | dpc->function(dpc->context); | ||
609 | kfree(dpc); | ||
610 | } | ||
611 | do_exit(0); | ||
612 | } | ||
613 | |||
614 | /******************************************************************************* | ||
615 | * | ||
616 | * FUNCTION: acpi_os_execute | ||
617 | * | ||
618 | * PARAMETERS: Type - Type of the callback | ||
619 | * Function - Function to be executed | ||
620 | * Context - Function parameters | ||
621 | * | ||
622 | * RETURN: Status | ||
623 | * | ||
624 | * DESCRIPTION: Depending on type, either queues function for deferred execution or | ||
625 | * immediately executes function on a separate thread. | ||
626 | * | ||
627 | ******************************************************************************/ | ||
628 | |||
629 | acpi_status acpi_os_execute(acpi_execute_type type, | ||
605 | acpi_osd_exec_callback function, void *context) | 630 | acpi_osd_exec_callback function, void *context) |
606 | { | 631 | { |
607 | acpi_status status = AE_OK; | 632 | acpi_status status = AE_OK; |
608 | struct acpi_os_dpc *dpc; | 633 | struct acpi_os_dpc *dpc; |
609 | struct work_struct *task; | 634 | struct work_struct *task; |
610 | 635 | struct task_struct *p; | |
611 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
612 | |||
613 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
614 | "Scheduling function [%p(%p)] for deferred execution.\n", | ||
615 | function, context)); | ||
616 | 636 | ||
617 | if (!function) | 637 | if (!function) |
618 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 638 | return AE_BAD_PARAMETER; |
619 | |||
620 | /* | 639 | /* |
621 | * Allocate/initialize DPC structure. Note that this memory will be | 640 | * Allocate/initialize DPC structure. Note that this memory will be |
622 | * freed by the callee. The kernel handles the tq_struct list in a | 641 | * freed by the callee. The kernel handles the tq_struct list in a |
@@ -627,30 +646,37 @@ acpi_os_queue_for_execution(u32 priority, | |||
627 | * We can save time and code by allocating the DPC and tq_structs | 646 | * We can save time and code by allocating the DPC and tq_structs |
628 | * from the same memory. | 647 | * from the same memory. |
629 | */ | 648 | */ |
630 | 649 | if (type == OSL_NOTIFY_HANDLER) { | |
631 | dpc = | 650 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL); |
632 | kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), | 651 | } else { |
633 | GFP_ATOMIC); | 652 | dpc = kmalloc(sizeof(struct acpi_os_dpc) + |
653 | sizeof(struct work_struct), GFP_ATOMIC); | ||
654 | } | ||
634 | if (!dpc) | 655 | if (!dpc) |
635 | return_ACPI_STATUS(AE_NO_MEMORY); | 656 | return AE_NO_MEMORY; |
636 | |||
637 | dpc->function = function; | 657 | dpc->function = function; |
638 | dpc->context = context; | 658 | dpc->context = context; |
639 | 659 | ||
640 | task = (void *)(dpc + 1); | 660 | if (type == OSL_NOTIFY_HANDLER) { |
641 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | 661 | p = kthread_create(acpi_os_execute_thread, dpc, "kacpid_notify"); |
642 | 662 | if (!IS_ERR(p)) { | |
643 | if (!queue_work(kacpid_wq, task)) { | 663 | wake_up_process(p); |
644 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 664 | } else { |
645 | "Call to queue_work() failed.\n")); | 665 | status = AE_NO_MEMORY; |
646 | kfree(dpc); | 666 | kfree(dpc); |
647 | status = AE_ERROR; | 667 | } |
668 | } else { | ||
669 | task = (void *)(dpc + 1); | ||
670 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | ||
671 | if (!queue_work(kacpid_wq, task)) { | ||
672 | status = AE_ERROR; | ||
673 | kfree(dpc); | ||
674 | } | ||
648 | } | 675 | } |
649 | 676 | return status; | |
650 | return_ACPI_STATUS(status); | ||
651 | } | 677 | } |
652 | 678 | ||
653 | EXPORT_SYMBOL(acpi_os_queue_for_execution); | 679 | EXPORT_SYMBOL(acpi_os_execute); |
654 | 680 | ||
655 | void acpi_os_wait_events_complete(void *context) | 681 | void acpi_os_wait_events_complete(void *context) |
656 | { | 682 | { |
@@ -769,9 +795,6 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
769 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", | 795 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", |
770 | handle, units, timeout)); | 796 | handle, units, timeout)); |
771 | 797 | ||
772 | if (in_atomic()) | ||
773 | timeout = 0; | ||
774 | |||
775 | switch (timeout) { | 798 | switch (timeout) { |
776 | /* | 799 | /* |
777 | * No Wait: | 800 | * No Wait: |
@@ -896,14 +919,6 @@ u8 acpi_os_writable(void *ptr, acpi_size len) | |||
896 | } | 919 | } |
897 | #endif | 920 | #endif |
898 | 921 | ||
899 | u32 acpi_os_get_thread_id(void) | ||
900 | { | ||
901 | if (!in_atomic()) | ||
902 | return current->pid; | ||
903 | |||
904 | return 0; | ||
905 | } | ||
906 | |||
907 | acpi_status acpi_os_signal(u32 function, void *info) | 922 | acpi_status acpi_os_signal(u32 function, void *info) |
908 | { | 923 | { |
909 | switch (function) { | 924 | switch (function) { |
@@ -1050,12 +1065,12 @@ void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) | |||
1050 | * | 1065 | * |
1051 | * FUNCTION: acpi_os_create_cache | 1066 | * FUNCTION: acpi_os_create_cache |
1052 | * | 1067 | * |
1053 | * PARAMETERS: CacheName - Ascii name for the cache | 1068 | * PARAMETERS: name - Ascii name for the cache |
1054 | * ObjectSize - Size of each cached object | 1069 | * size - Size of each cached object |
1055 | * MaxDepth - Maximum depth of the cache (in objects) | 1070 | * depth - Maximum depth of the cache (in objects) <ignored> |
1056 | * ReturnCache - Where the new cache object is returned | 1071 | * cache - Where the new cache object is returned |
1057 | * | 1072 | * |
1058 | * RETURN: Status | 1073 | * RETURN: status |
1059 | * | 1074 | * |
1060 | * DESCRIPTION: Create a cache object | 1075 | * DESCRIPTION: Create a cache object |
1061 | * | 1076 | * |
@@ -1065,7 +1080,10 @@ acpi_status | |||
1065 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) | 1080 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) |
1066 | { | 1081 | { |
1067 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); | 1082 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); |
1068 | return AE_OK; | 1083 | if (cache == NULL) |
1084 | return AE_ERROR; | ||
1085 | else | ||
1086 | return AE_OK; | ||
1069 | } | 1087 | } |
1070 | 1088 | ||
1071 | /******************************************************************************* | 1089 | /******************************************************************************* |
@@ -1134,16 +1152,63 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1134 | * | 1152 | * |
1135 | * RETURN: Status | 1153 | * RETURN: Status |
1136 | * | 1154 | * |
1137 | * DESCRIPTION: Get an object from the specified cache. If cache is empty, | 1155 | * DESCRIPTION: Return a zero-filled object. |
1138 | * the object is allocated. | ||
1139 | * | 1156 | * |
1140 | ******************************************************************************/ | 1157 | ******************************************************************************/ |
1141 | 1158 | ||
1142 | void *acpi_os_acquire_object(acpi_cache_t * cache) | 1159 | void *acpi_os_acquire_object(acpi_cache_t * cache) |
1143 | { | 1160 | { |
1144 | void *object = kmem_cache_alloc(cache, GFP_KERNEL); | 1161 | void *object = kmem_cache_zalloc(cache, GFP_KERNEL); |
1145 | WARN_ON(!object); | 1162 | WARN_ON(!object); |
1146 | return object; | 1163 | return object; |
1147 | } | 1164 | } |
1148 | 1165 | ||
1166 | /****************************************************************************** | ||
1167 | * | ||
1168 | * FUNCTION: acpi_os_validate_interface | ||
1169 | * | ||
1170 | * PARAMETERS: interface - Requested interface to be validated | ||
1171 | * | ||
1172 | * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise | ||
1173 | * | ||
1174 | * DESCRIPTION: Match an interface string to the interfaces supported by the | ||
1175 | * host. Strings originate from an AML call to the _OSI method. | ||
1176 | * | ||
1177 | *****************************************************************************/ | ||
1178 | |||
1179 | acpi_status | ||
1180 | acpi_os_validate_interface (char *interface) | ||
1181 | { | ||
1182 | |||
1183 | return AE_SUPPORT; | ||
1184 | } | ||
1185 | |||
1186 | |||
1187 | /****************************************************************************** | ||
1188 | * | ||
1189 | * FUNCTION: acpi_os_validate_address | ||
1190 | * | ||
1191 | * PARAMETERS: space_id - ACPI space ID | ||
1192 | * address - Physical address | ||
1193 | * length - Address length | ||
1194 | * | ||
1195 | * RETURN: AE_OK if address/length is valid for the space_id. Otherwise, | ||
1196 | * should return AE_AML_ILLEGAL_ADDRESS. | ||
1197 | * | ||
1198 | * DESCRIPTION: Validate a system address via the host OS. Used to validate | ||
1199 | * the addresses accessed by AML operation regions. | ||
1200 | * | ||
1201 | *****************************************************************************/ | ||
1202 | |||
1203 | acpi_status | ||
1204 | acpi_os_validate_address ( | ||
1205 | u8 space_id, | ||
1206 | acpi_physical_address address, | ||
1207 | acpi_size length) | ||
1208 | { | ||
1209 | |||
1210 | return AE_OK; | ||
1211 | } | ||
1212 | |||
1213 | |||
1149 | #endif | 1214 | #endif |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index de573be52718..bf88e076c3e9 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -79,7 +79,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | |||
79 | acpi_native_uint byte_count; | 79 | acpi_native_uint byte_count; |
80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ | 80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ |
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE("ps_get_next_package_length"); | 82 | ACPI_FUNCTION_TRACE(ps_get_next_package_length); |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * Byte 0 bits [6:7] contain the number of additional bytes | 85 | * Byte 0 bits [6:7] contain the number of additional bytes |
@@ -128,7 +128,7 @@ u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) | |||
128 | u8 *start = parser_state->aml; | 128 | u8 *start = parser_state->aml; |
129 | u32 package_length; | 129 | u32 package_length; |
130 | 130 | ||
131 | ACPI_FUNCTION_TRACE("ps_get_next_package_end"); | 131 | ACPI_FUNCTION_TRACE(ps_get_next_package_end); |
132 | 132 | ||
133 | /* Function below updates parser_state->Aml */ | 133 | /* Function below updates parser_state->Aml */ |
134 | 134 | ||
@@ -157,7 +157,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
157 | u8 *start = parser_state->aml; | 157 | u8 *start = parser_state->aml; |
158 | u8 *end = parser_state->aml; | 158 | u8 *end = parser_state->aml; |
159 | 159 | ||
160 | ACPI_FUNCTION_TRACE("ps_get_next_namestring"); | 160 | ACPI_FUNCTION_TRACE(ps_get_next_namestring); |
161 | 161 | ||
162 | /* Point past any namestring prefix characters (backslash or carat) */ | 162 | /* Point past any namestring prefix characters (backslash or carat) */ |
163 | 163 | ||
@@ -237,7 +237,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
237 | struct acpi_namespace_node *node; | 237 | struct acpi_namespace_node *node; |
238 | union acpi_generic_state scope_info; | 238 | union acpi_generic_state scope_info; |
239 | 239 | ||
240 | ACPI_FUNCTION_TRACE("ps_get_next_namepath"); | 240 | ACPI_FUNCTION_TRACE(ps_get_next_namepath); |
241 | 241 | ||
242 | path = acpi_ps_get_next_namestring(parser_state); | 242 | path = acpi_ps_get_next_namestring(parser_state); |
243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | 243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); |
@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
275 | */ | 275 | */ |
276 | if (ACPI_SUCCESS(status) && | 276 | if (ACPI_SUCCESS(status) && |
277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { | 277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { |
278 | |||
278 | /* This name is actually a control method invocation */ | 279 | /* This name is actually a control method invocation */ |
279 | 280 | ||
280 | method_desc = acpi_ns_get_attached_object(node); | 281 | method_desc = acpi_ns_get_attached_object(node); |
@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
319 | * some not_found cases are allowed | 320 | * some not_found cases are allowed |
320 | */ | 321 | */ |
321 | if (status == AE_NOT_FOUND) { | 322 | if (status == AE_NOT_FOUND) { |
323 | |||
322 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ | 324 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ |
323 | 325 | ||
324 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != | 326 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != |
@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
354 | 356 | ||
355 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 357 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
356 | ACPI_PARSE_EXECUTE) { | 358 | ACPI_PARSE_EXECUTE) { |
359 | |||
357 | /* Report a control method execution error */ | 360 | /* Report a control method execution error */ |
358 | 361 | ||
359 | status = acpi_ds_method_error(status, walk_state); | 362 | status = acpi_ds_method_error(status, walk_state); |
@@ -388,7 +391,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
388 | u16 opcode; | 391 | u16 opcode; |
389 | u8 *aml = parser_state->aml; | 392 | u8 *aml = parser_state->aml; |
390 | 393 | ||
391 | ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); | 394 | ACPI_FUNCTION_TRACE_U32(ps_get_next_simple_arg, arg_type); |
392 | 395 | ||
393 | switch (arg_type) { | 396 | switch (arg_type) { |
394 | case ARGP_BYTEDATA: | 397 | case ARGP_BYTEDATA: |
@@ -453,7 +456,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
453 | 456 | ||
454 | default: | 457 | default: |
455 | 458 | ||
456 | ACPI_ERROR((AE_INFO, "Invalid arg_type %X", arg_type)); | 459 | ACPI_ERROR((AE_INFO, "Invalid ArgType %X", arg_type)); |
457 | return_VOID; | 460 | return_VOID; |
458 | } | 461 | } |
459 | 462 | ||
@@ -484,7 +487,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state | |||
484 | u16 opcode; | 487 | u16 opcode; |
485 | u32 name; | 488 | u32 name; |
486 | 489 | ||
487 | ACPI_FUNCTION_TRACE("ps_get_next_field"); | 490 | ACPI_FUNCTION_TRACE(ps_get_next_field); |
488 | 491 | ||
489 | /* Determine field type */ | 492 | /* Determine field type */ |
490 | 493 | ||
@@ -590,7 +593,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
590 | u32 subop; | 593 | u32 subop; |
591 | acpi_status status = AE_OK; | 594 | acpi_status status = AE_OK; |
592 | 595 | ||
593 | ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state); | 596 | ACPI_FUNCTION_TRACE_PTR(ps_get_next_arg, parser_state); |
594 | 597 | ||
595 | switch (arg_type) { | 598 | switch (arg_type) { |
596 | case ARGP_BYTEDATA: | 599 | case ARGP_BYTEDATA: |
@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
620 | case ARGP_FIELDLIST: | 623 | case ARGP_FIELDLIST: |
621 | 624 | ||
622 | if (parser_state->aml < parser_state->pkg_end) { | 625 | if (parser_state->aml < parser_state->pkg_end) { |
626 | |||
623 | /* Non-empty list */ | 627 | /* Non-empty list */ |
624 | 628 | ||
625 | while (parser_state->aml < parser_state->pkg_end) { | 629 | while (parser_state->aml < parser_state->pkg_end) { |
@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
645 | case ARGP_BYTELIST: | 649 | case ARGP_BYTELIST: |
646 | 650 | ||
647 | if (parser_state->aml < parser_state->pkg_end) { | 651 | if (parser_state->aml < parser_state->pkg_end) { |
652 | |||
648 | /* Non-empty list */ | 653 | /* Non-empty list */ |
649 | 654 | ||
650 | arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); | 655 | arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); |
@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
673 | if (subop == 0 || | 678 | if (subop == 0 || |
674 | acpi_ps_is_leading_char(subop) || | 679 | acpi_ps_is_leading_char(subop) || |
675 | acpi_ps_is_prefix_char(subop)) { | 680 | acpi_ps_is_prefix_char(subop)) { |
681 | |||
676 | /* null_name or name_string */ | 682 | /* null_name or name_string */ |
677 | 683 | ||
678 | arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); | 684 | arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); |
@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
703 | case ARGP_OBJLIST: | 709 | case ARGP_OBJLIST: |
704 | 710 | ||
705 | if (parser_state->aml < parser_state->pkg_end) { | 711 | if (parser_state->aml < parser_state->pkg_end) { |
712 | |||
706 | /* Non-empty list of variable arguments, nothing returned */ | 713 | /* Non-empty list of variable arguments, nothing returned */ |
707 | 714 | ||
708 | walk_state->arg_count = ACPI_VAR_ARGS; | 715 | walk_state->arg_count = ACPI_VAR_ARGS; |
@@ -711,7 +718,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
711 | 718 | ||
712 | default: | 719 | default: |
713 | 720 | ||
714 | ACPI_ERROR((AE_INFO, "Invalid arg_type: %X", arg_type)); | 721 | ACPI_ERROR((AE_INFO, "Invalid ArgType: %X", arg_type)); |
715 | status = AE_AML_OPERAND_TYPE; | 722 | status = AE_AML_OPERAND_TYPE; |
716 | break; | 723 | break; |
717 | } | 724 | } |
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 00b072e15d19..e1541db3753a 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -83,7 +83,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
83 | struct acpi_parse_state *parser_state; | 83 | struct acpi_parse_state *parser_state; |
84 | u8 *aml_op_start = NULL; | 84 | u8 *aml_op_start = NULL; |
85 | 85 | ||
86 | ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state); | 86 | ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state); |
87 | 87 | ||
88 | if (walk_state->descending_callback == NULL) { | 88 | if (walk_state->descending_callback == NULL) { |
89 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 89 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
95 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) | 95 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) |
96 | 96 | ||
97 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { | 97 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { |
98 | |||
98 | /* We are restarting a preempted control method */ | 99 | /* We are restarting a preempted control method */ |
99 | 100 | ||
100 | if (acpi_ps_has_completed_scope(parser_state)) { | 101 | if (acpi_ps_has_completed_scope(parser_state)) { |
@@ -128,7 +129,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
128 | 129 | ||
129 | } | 130 | } |
130 | ACPI_EXCEPTION((AE_INFO, status, | 131 | ACPI_EXCEPTION((AE_INFO, status, |
131 | "get_predicate Failed")); | 132 | "GetPredicate Failed")); |
132 | return_ACPI_STATUS(status); | 133 | return_ACPI_STATUS(status); |
133 | } | 134 | } |
134 | 135 | ||
@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
143 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 144 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
144 | "Popped scope, Op=%p\n", op)); | 145 | "Popped scope, Op=%p\n", op)); |
145 | } else if (walk_state->prev_op) { | 146 | } else if (walk_state->prev_op) { |
147 | |||
146 | /* We were in the middle of an op */ | 148 | /* We were in the middle of an op */ |
147 | 149 | ||
148 | op = walk_state->prev_op; | 150 | op = walk_state->prev_op; |
@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
156 | while ((parser_state->aml < parser_state->aml_end) || (op)) { | 158 | while ((parser_state->aml < parser_state->aml_end) || (op)) { |
157 | aml_op_start = parser_state->aml; | 159 | aml_op_start = parser_state->aml; |
158 | if (!op) { | 160 | if (!op) { |
161 | |||
159 | /* Get the next opcode from the AML stream */ | 162 | /* Get the next opcode from the AML stream */ |
160 | 163 | ||
161 | walk_state->aml_offset = | 164 | walk_state->aml_offset = |
@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
213 | /* Create Op structure and append to parent's argument list */ | 216 | /* Create Op structure and append to parent's argument list */ |
214 | 217 | ||
215 | if (walk_state->op_info->flags & AML_NAMED) { | 218 | if (walk_state->op_info->flags & AML_NAMED) { |
219 | |||
216 | /* Allocate a new pre_op if necessary */ | 220 | /* Allocate a new pre_op if necessary */ |
217 | 221 | ||
218 | if (!pre_op) { | 222 | if (!pre_op) { |
@@ -371,7 +375,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
371 | 375 | ||
372 | if (walk_state->op_info) { | 376 | if (walk_state->op_info) { |
373 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
374 | "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", | 378 | "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", |
375 | (u32) op->common.aml_opcode, | 379 | (u32) op->common.aml_opcode, |
376 | walk_state->op_info->name, op, | 380 | walk_state->op_info->name, op, |
377 | parser_state->aml, | 381 | parser_state->aml, |
@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
388 | /* Are there any arguments that must be processed? */ | 392 | /* Are there any arguments that must be processed? */ |
389 | 393 | ||
390 | if (walk_state->arg_types) { | 394 | if (walk_state->arg_types) { |
395 | |||
391 | /* Get arguments */ | 396 | /* Get arguments */ |
392 | 397 | ||
393 | switch (op->common.aml_opcode) { | 398 | switch (op->common.aml_opcode) { |
@@ -742,7 +747,19 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
742 | if (ACPI_FAILURE(status2)) { | 747 | if (ACPI_FAILURE(status2)) { |
743 | return_ACPI_STATUS(status2); | 748 | return_ACPI_STATUS(status2); |
744 | } | 749 | } |
750 | |||
751 | status2 = | ||
752 | acpi_ds_result_stack_pop | ||
753 | (walk_state); | ||
754 | if (ACPI_FAILURE(status2)) { | ||
755 | return_ACPI_STATUS(status2); | ||
756 | } | ||
757 | |||
758 | acpi_ut_delete_generic_state | ||
759 | (acpi_ut_pop_generic_state | ||
760 | (&walk_state->control_state)); | ||
745 | } | 761 | } |
762 | |||
746 | acpi_ps_pop_scope(parser_state, &op, | 763 | acpi_ps_pop_scope(parser_state, &op, |
747 | &walk_state->arg_types, | 764 | &walk_state->arg_types, |
748 | &walk_state->arg_count); | 765 | &walk_state->arg_count); |
@@ -762,6 +779,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
762 | return_ACPI_STATUS(status2); | 779 | return_ACPI_STATUS(status2); |
763 | } | 780 | } |
764 | } | 781 | } |
782 | |||
765 | acpi_ps_pop_scope(parser_state, &op, | 783 | acpi_ps_pop_scope(parser_state, &op, |
766 | &walk_state->arg_types, | 784 | &walk_state->arg_types, |
767 | &walk_state->arg_count); | 785 | &walk_state->arg_count); |
@@ -853,6 +871,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
853 | } | 871 | } |
854 | 872 | ||
855 | else if (ACPI_FAILURE(status)) { | 873 | else if (ACPI_FAILURE(status)) { |
874 | |||
856 | /* First error is most important */ | 875 | /* First error is most important */ |
857 | 876 | ||
858 | (void) | 877 | (void) |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 11d6351ab8b2..4bd25e32769f 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c | |||
@@ -725,12 +725,13 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { | |||
725 | 725 | ||
726 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | 726 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) |
727 | { | 727 | { |
728 | ACPI_FUNCTION_NAME("ps_get_opcode_info"); | 728 | ACPI_FUNCTION_NAME(ps_get_opcode_info); |
729 | 729 | ||
730 | /* | 730 | /* |
731 | * Detect normal 8-bit opcode or extended 16-bit opcode | 731 | * Detect normal 8-bit opcode or extended 16-bit opcode |
732 | */ | 732 | */ |
733 | if (!(opcode & 0xFF00)) { | 733 | if (!(opcode & 0xFF00)) { |
734 | |||
734 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ | 735 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ |
735 | 736 | ||
736 | return (&acpi_gbl_aml_op_info | 737 | return (&acpi_gbl_aml_op_info |
@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | |||
739 | 740 | ||
740 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && | 741 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && |
741 | (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { | 742 | (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { |
743 | |||
742 | /* Valid extended (16-bit) opcode */ | 744 | /* Valid extended (16-bit) opcode */ |
743 | 745 | ||
744 | return (&acpi_gbl_aml_op_info | 746 | return (&acpi_gbl_aml_op_info |
@@ -779,7 +781,7 @@ char *acpi_ps_get_opcode_name(u16 opcode) | |||
779 | return (op->name); | 781 | return (op->name); |
780 | 782 | ||
781 | #else | 783 | #else |
782 | return ("AE_NOT_CONFIGURED"); | 784 | return ("OpcodeName unavailable"); |
783 | 785 | ||
784 | #endif | 786 | #endif |
785 | } | 787 | } |
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index a9f3229f4106..7ee2f2e77525 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state) | |||
106 | opcode = (u16) ACPI_GET8(aml); | 106 | opcode = (u16) ACPI_GET8(aml); |
107 | 107 | ||
108 | if (opcode == AML_EXTENDED_OP_PREFIX) { | 108 | if (opcode == AML_EXTENDED_OP_PREFIX) { |
109 | |||
109 | /* Extended opcode, get the second opcode byte */ | 110 | /* Extended opcode, get the second opcode byte */ |
110 | 111 | ||
111 | aml++; | 112 | aml++; |
@@ -137,7 +138,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
137 | const struct acpi_opcode_info *parent_info; | 138 | const struct acpi_opcode_info *parent_info; |
138 | union acpi_parse_object *replacement_op = NULL; | 139 | union acpi_parse_object *replacement_op = NULL; |
139 | 140 | ||
140 | ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op); | 141 | ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op); |
141 | 142 | ||
142 | /* Check for null Op, can happen if AML code is corrupt */ | 143 | /* Check for null Op, can happen if AML code is corrupt */ |
143 | 144 | ||
@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
158 | if (op->common.parent) { | 159 | if (op->common.parent) { |
159 | prev = op->common.parent->common.value.arg; | 160 | prev = op->common.parent->common.value.arg; |
160 | if (!prev) { | 161 | if (!prev) { |
162 | |||
161 | /* Nothing more to do */ | 163 | /* Nothing more to do */ |
162 | 164 | ||
163 | goto cleanup; | 165 | goto cleanup; |
@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
245 | /* We must unlink this op from the parent tree */ | 247 | /* We must unlink this op from the parent tree */ |
246 | 248 | ||
247 | if (prev == op) { | 249 | if (prev == op) { |
250 | |||
248 | /* This op is the first in the list */ | 251 | /* This op is the first in the list */ |
249 | 252 | ||
250 | if (replacement_op) { | 253 | if (replacement_op) { |
@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
265 | 268 | ||
266 | else | 269 | else |
267 | while (prev) { | 270 | while (prev) { |
271 | |||
268 | /* Traverse all siblings in the parent's argument list */ | 272 | /* Traverse all siblings in the parent's argument list */ |
269 | 273 | ||
270 | next = prev->common.next; | 274 | next = prev->common.next; |
@@ -329,7 +333,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
329 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 333 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
330 | acpi_status status = AE_CTRL_PENDING; | 334 | acpi_status status = AE_CTRL_PENDING; |
331 | 335 | ||
332 | ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op); | 336 | ACPI_FUNCTION_TRACE_PTR(ps_next_parse_state, op); |
333 | 337 | ||
334 | switch (callback_status) { | 338 | switch (callback_status) { |
335 | case AE_CTRL_TERMINATE: | 339 | case AE_CTRL_TERMINATE: |
@@ -449,10 +453,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
449 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; | 453 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; |
450 | struct acpi_walk_state *previous_walk_state; | 454 | struct acpi_walk_state *previous_walk_state; |
451 | 455 | ||
452 | ACPI_FUNCTION_TRACE("ps_parse_aml"); | 456 | ACPI_FUNCTION_TRACE(ps_parse_aml); |
453 | 457 | ||
454 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 458 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
455 | "Entered with walk_state=%p Aml=%p size=%X\n", | 459 | "Entered with WalkState=%p Aml=%p size=%X\n", |
456 | walk_state, walk_state->parser_state.aml, | 460 | walk_state, walk_state->parser_state.aml, |
457 | walk_state->parser_state.aml_size)); | 461 | walk_state->parser_state.aml_size)); |
458 | 462 | ||
@@ -460,6 +464,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
460 | 464 | ||
461 | thread = acpi_ut_create_thread_state(); | 465 | thread = acpi_ut_create_thread_state(); |
462 | if (!thread) { | 466 | if (!thread) { |
467 | acpi_ds_delete_walk_state(walk_state); | ||
463 | return_ACPI_STATUS(AE_NO_MEMORY); | 468 | return_ACPI_STATUS(AE_NO_MEMORY); |
464 | } | 469 | } |
465 | 470 | ||
@@ -510,6 +515,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
510 | } else if (status == AE_CTRL_TERMINATE) { | 515 | } else if (status == AE_CTRL_TERMINATE) { |
511 | status = AE_OK; | 516 | status = AE_OK; |
512 | } else if ((status != AE_OK) && (walk_state->method_desc)) { | 517 | } else if ((status != AE_OK) && (walk_state->method_desc)) { |
518 | |||
513 | /* Either the method parse or actual execution failed */ | 519 | /* Either the method parse or actual execution failed */ |
514 | 520 | ||
515 | ACPI_ERROR_METHOD("Method parse/execution failed", | 521 | ACPI_ERROR_METHOD("Method parse/execution failed", |
@@ -550,20 +556,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
550 | */ | 556 | */ |
551 | if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 557 | if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
552 | ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { | 558 | ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { |
553 | if (walk_state->method_desc) { | 559 | acpi_ds_terminate_control_method(walk_state-> |
554 | /* Decrement the thread count on the method parse tree */ | 560 | method_desc, |
555 | 561 | walk_state); | |
556 | if (walk_state->method_desc->method. | ||
557 | thread_count) { | ||
558 | walk_state->method_desc->method. | ||
559 | thread_count--; | ||
560 | } else { | ||
561 | ACPI_ERROR((AE_INFO, | ||
562 | "Invalid zero thread count in method")); | ||
563 | } | ||
564 | } | ||
565 | |||
566 | acpi_ds_terminate_control_method(walk_state); | ||
567 | } | 562 | } |
568 | 563 | ||
569 | /* Delete this walk state and all linked control states */ | 564 | /* Delete this walk state and all linked control states */ |
@@ -572,7 +567,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
572 | previous_walk_state = walk_state; | 567 | previous_walk_state = walk_state; |
573 | 568 | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 569 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
575 | "return_value=%p, implicit_value=%p State=%p\n", | 570 | "ReturnValue=%p, ImplicitValue=%p State=%p\n", |
576 | walk_state->return_desc, | 571 | walk_state->return_desc, |
577 | walk_state->implicit_return_obj, walk_state)); | 572 | walk_state->implicit_return_obj, walk_state)); |
578 | 573 | ||
@@ -633,12 +628,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
633 | } | 628 | } |
634 | } else { | 629 | } else { |
635 | if (previous_walk_state->return_desc) { | 630 | if (previous_walk_state->return_desc) { |
631 | |||
636 | /* Caller doesn't want it, must delete it */ | 632 | /* Caller doesn't want it, must delete it */ |
637 | 633 | ||
638 | acpi_ut_remove_reference(previous_walk_state-> | 634 | acpi_ut_remove_reference(previous_walk_state-> |
639 | return_desc); | 635 | return_desc); |
640 | } | 636 | } |
641 | if (previous_walk_state->implicit_return_obj) { | 637 | if (previous_walk_state->implicit_return_obj) { |
638 | |||
642 | /* Caller doesn't want it, must delete it */ | 639 | /* Caller doesn't want it, must delete it */ |
643 | 640 | ||
644 | acpi_ut_remove_reference(previous_walk_state-> | 641 | acpi_ut_remove_reference(previous_walk_state-> |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index bc6047caccd9..a3e0314de24d 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -106,14 +106,14 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state, | |||
106 | { | 106 | { |
107 | union acpi_generic_state *scope; | 107 | union acpi_generic_state *scope; |
108 | 108 | ||
109 | ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op); | 109 | ACPI_FUNCTION_TRACE_PTR(ps_init_scope, root_op); |
110 | 110 | ||
111 | scope = acpi_ut_create_generic_state(); | 111 | scope = acpi_ut_create_generic_state(); |
112 | if (!scope) { | 112 | if (!scope) { |
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; |
@@ -147,14 +147,14 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
147 | { | 147 | { |
148 | union acpi_generic_state *scope; | 148 | union acpi_generic_state *scope; |
149 | 149 | ||
150 | ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op); | 150 | ACPI_FUNCTION_TRACE_PTR(ps_push_scope, op); |
151 | 151 | ||
152 | scope = acpi_ut_create_generic_state(); | 152 | scope = acpi_ut_create_generic_state(); |
153 | if (!scope) { | 153 | if (!scope) { |
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; |
@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
165 | acpi_ut_push_generic_state(&parser_state->scope, scope); | 165 | acpi_ut_push_generic_state(&parser_state->scope, scope); |
166 | 166 | ||
167 | if (arg_count == ACPI_VAR_ARGS) { | 167 | if (arg_count == ACPI_VAR_ARGS) { |
168 | |||
168 | /* Multiple arguments */ | 169 | /* Multiple arguments */ |
169 | 170 | ||
170 | scope->parse_scope.arg_end = parser_state->pkg_end; | 171 | scope->parse_scope.arg_end = parser_state->pkg_end; |
@@ -199,14 +200,14 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
199 | { | 200 | { |
200 | union acpi_generic_state *scope = parser_state->scope; | 201 | union acpi_generic_state *scope = parser_state->scope; |
201 | 202 | ||
202 | ACPI_FUNCTION_TRACE("ps_pop_scope"); | 203 | ACPI_FUNCTION_TRACE(ps_pop_scope); |
203 | 204 | ||
204 | /* Only pop the scope if there is in fact a next scope */ | 205 | /* Only pop the scope if there is in fact a next scope */ |
205 | 206 | ||
206 | if (scope->common.next) { | 207 | if (scope->common.next) { |
207 | scope = acpi_ut_pop_generic_state(&parser_state->scope); | 208 | scope = acpi_ut_pop_generic_state(&parser_state->scope); |
208 | 209 | ||
209 | /* return to parsing previous op */ | 210 | /* Return to parsing previous op */ |
210 | 211 | ||
211 | *op = scope->parse_scope.op; | 212 | *op = scope->parse_scope.op; |
212 | *arg_list = scope->parse_scope.arg_list; | 213 | *arg_list = scope->parse_scope.arg_list; |
@@ -217,7 +218,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
217 | 218 | ||
218 | acpi_ut_delete_generic_state(scope); | 219 | acpi_ut_delete_generic_state(scope); |
219 | } else { | 220 | } else { |
220 | /* empty parse stack, prepare to fetch next opcode */ | 221 | /* Empty parse stack, prepare to fetch next opcode */ |
221 | 222 | ||
222 | *op = NULL; | 223 | *op = NULL; |
223 | *arg_list = 0; | 224 | *arg_list = 0; |
@@ -246,7 +247,7 @@ void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state) | |||
246 | { | 247 | { |
247 | union acpi_generic_state *scope; | 248 | union acpi_generic_state *scope; |
248 | 249 | ||
249 | ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state); | 250 | ACPI_FUNCTION_TRACE_PTR(ps_cleanup_scope, parser_state); |
250 | 251 | ||
251 | if (!parser_state) { | 252 | if (!parser_state) { |
252 | return_VOID; | 253 | return_VOID; |
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index dd6f16726fc4..0015717ef096 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c | |||
@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) | |||
77 | 77 | ||
78 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); | 78 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); |
79 | if (op_info->class == AML_CLASS_UNKNOWN) { | 79 | if (op_info->class == AML_CLASS_UNKNOWN) { |
80 | |||
80 | /* Invalid opcode or ASCII character */ | 81 | /* Invalid opcode or ASCII character */ |
81 | 82 | ||
82 | return (NULL); | 83 | return (NULL); |
@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) | |||
85 | /* Check if this opcode requires argument sub-objects */ | 86 | /* Check if this opcode requires argument sub-objects */ |
86 | 87 | ||
87 | if (!(op_info->flags & AML_HAS_ARGS)) { | 88 | if (!(op_info->flags & AML_HAS_ARGS)) { |
89 | |||
88 | /* Has no linked argument objects */ | 90 | /* Has no linked argument objects */ |
89 | 91 | ||
90 | return (NULL); | 92 | return (NULL); |
@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
130 | 132 | ||
131 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); | 133 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); |
132 | if (op_info->class == AML_CLASS_UNKNOWN) { | 134 | if (op_info->class == AML_CLASS_UNKNOWN) { |
135 | |||
133 | /* Invalid opcode */ | 136 | /* Invalid opcode */ |
134 | 137 | ||
135 | ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", | 138 | ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", |
@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
140 | /* Check if this opcode requires argument sub-objects */ | 143 | /* Check if this opcode requires argument sub-objects */ |
141 | 144 | ||
142 | if (!(op_info->flags & AML_HAS_ARGS)) { | 145 | if (!(op_info->flags & AML_HAS_ARGS)) { |
146 | |||
143 | /* Has no linked argument objects */ | 147 | /* Has no linked argument objects */ |
144 | 148 | ||
145 | return; | 149 | return; |
@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
148 | /* Append the argument to the linked argument list */ | 152 | /* Append the argument to the linked argument list */ |
149 | 153 | ||
150 | if (op->common.value.arg) { | 154 | if (op->common.value.arg) { |
155 | |||
151 | /* Append to existing argument list */ | 156 | /* Append to existing argument list */ |
152 | 157 | ||
153 | prev_arg = op->common.value.arg; | 158 | prev_arg = op->common.value.arg; |
@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, | |||
222 | } | 227 | } |
223 | 228 | ||
224 | if (arg == origin) { | 229 | if (arg == origin) { |
230 | |||
225 | /* Reached parent of origin, end search */ | 231 | /* Reached parent of origin, end search */ |
226 | 232 | ||
227 | return (NULL); | 233 | return (NULL); |
228 | } | 234 | } |
229 | 235 | ||
230 | if (parent->common.next) { | 236 | if (parent->common.next) { |
237 | |||
231 | /* Found sibling of parent */ | 238 | /* Found sibling of parent */ |
232 | 239 | ||
233 | return (parent->common.next); | 240 | return (parent->common.next); |
@@ -299,5 +306,4 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op) | |||
299 | return (child); | 306 | return (child); |
300 | } | 307 | } |
301 | #endif | 308 | #endif |
302 | |||
303 | #endif /* ACPI_FUTURE_USAGE */ | 309 | #endif /* ACPI_FUTURE_USAGE */ |
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 3e07cb9cb748..182474ae8ce9 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, |
@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) | |||
135 | /* Allocate the minimum required size object */ | 135 | /* Allocate the minimum required size object */ |
136 | 136 | ||
137 | if (flags == ACPI_PARSEOP_GENERIC) { | 137 | if (flags == ACPI_PARSEOP_GENERIC) { |
138 | |||
138 | /* The generic op (default) is by far the most common (16 to 1) */ | 139 | /* The generic op (default) is by far the most common (16 to 1) */ |
139 | 140 | ||
140 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); | 141 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); |
@@ -171,7 +172,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) | |||
171 | 172 | ||
172 | void acpi_ps_free_op(union acpi_parse_object *op) | 173 | void acpi_ps_free_op(union acpi_parse_object *op) |
173 | { | 174 | { |
174 | ACPI_FUNCTION_NAME("ps_free_op"); | 175 | ACPI_FUNCTION_NAME(ps_free_op); |
175 | 176 | ||
176 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 177 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
177 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", | 178 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", |
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 06f05bfd7612..a84a547a0f1b 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c | |||
@@ -64,18 +64,21 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) | |||
64 | union acpi_parse_object *next = NULL; | 64 | union acpi_parse_object *next = NULL; |
65 | union acpi_parse_object *parent = NULL; | 65 | union acpi_parse_object *parent = NULL; |
66 | 66 | ||
67 | ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root); | 67 | ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); |
68 | 68 | ||
69 | /* Visit all nodes in the subtree */ | 69 | /* Visit all nodes in the subtree */ |
70 | 70 | ||
71 | while (op) { | 71 | while (op) { |
72 | |||
72 | /* Check if we are not ascending */ | 73 | /* Check if we are not ascending */ |
73 | 74 | ||
74 | if (op != parent) { | 75 | if (op != parent) { |
76 | |||
75 | /* Look for an argument or child of the current op */ | 77 | /* Look for an argument or child of the current op */ |
76 | 78 | ||
77 | next = acpi_ps_get_arg(op, 0); | 79 | next = acpi_ps_get_arg(op, 0); |
78 | if (next) { | 80 | if (next) { |
81 | |||
79 | /* Still going downward in tree (Op is not completed yet) */ | 82 | /* Still going downward in tree (Op is not completed yet) */ |
80 | 83 | ||
81 | op = next; | 84 | op = next; |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 2dd48cbb7c02..5d996c1140af 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -50,14 +50,14 @@ | |||
50 | ACPI_MODULE_NAME("psxface") | 50 | ACPI_MODULE_NAME("psxface") |
51 | 51 | ||
52 | /* Local Prototypes */ | 52 | /* Local Prototypes */ |
53 | static void acpi_ps_start_trace(struct acpi_parameter_info *info); | 53 | static void acpi_ps_start_trace(struct acpi_evaluate_info *info); |
54 | 54 | ||
55 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info); | 55 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info); |
56 | 56 | ||
57 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); | 57 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info); |
58 | 58 | ||
59 | static void | 59 | static void |
60 | acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); | 60 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action); |
61 | 61 | ||
62 | /******************************************************************************* | 62 | /******************************************************************************* |
63 | * | 63 | * |
@@ -113,7 +113,7 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) | |||
113 | * | 113 | * |
114 | ******************************************************************************/ | 114 | ******************************************************************************/ |
115 | 115 | ||
116 | static void acpi_ps_start_trace(struct acpi_parameter_info *info) | 116 | static void acpi_ps_start_trace(struct acpi_evaluate_info *info) |
117 | { | 117 | { |
118 | acpi_status status; | 118 | acpi_status status; |
119 | 119 | ||
@@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info) | |||
125 | } | 125 | } |
126 | 126 | ||
127 | if ((!acpi_gbl_trace_method_name) || | 127 | if ((!acpi_gbl_trace_method_name) || |
128 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | 128 | (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { |
129 | goto exit; | 129 | goto exit; |
130 | } | 130 | } |
131 | 131 | ||
@@ -158,7 +158,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info) | |||
158 | * | 158 | * |
159 | ******************************************************************************/ | 159 | ******************************************************************************/ |
160 | 160 | ||
161 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | 161 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) |
162 | { | 162 | { |
163 | acpi_status status; | 163 | acpi_status status; |
164 | 164 | ||
@@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | if ((!acpi_gbl_trace_method_name) || | 172 | if ((!acpi_gbl_trace_method_name) || |
173 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | 173 | (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { |
174 | goto exit; | 174 | goto exit; |
175 | } | 175 | } |
176 | 176 | ||
@@ -212,22 +212,23 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | |||
212 | * | 212 | * |
213 | ******************************************************************************/ | 213 | ******************************************************************************/ |
214 | 214 | ||
215 | acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | 215 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) |
216 | { | 216 | { |
217 | acpi_status status; | 217 | acpi_status status; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE("ps_execute_method"); | 219 | ACPI_FUNCTION_TRACE(ps_execute_method); |
220 | 220 | ||
221 | /* Validate the Info and method Node */ | 221 | /* Validate the Info and method Node */ |
222 | 222 | ||
223 | if (!info || !info->node) { | 223 | if (!info || !info->resolved_node) { |
224 | return_ACPI_STATUS(AE_NULL_ENTRY); | 224 | return_ACPI_STATUS(AE_NULL_ENTRY); |
225 | } | 225 | } |
226 | 226 | ||
227 | /* Init for new method, wait on concurrency semaphore */ | 227 | /* Init for new method, wait on concurrency semaphore */ |
228 | 228 | ||
229 | status = | 229 | status = |
230 | acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL); | 230 | acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc, |
231 | NULL); | ||
231 | if (ACPI_FAILURE(status)) { | 232 | if (ACPI_FAILURE(status)) { |
232 | return_ACPI_STATUS(status); | 233 | return_ACPI_STATUS(status); |
233 | } | 234 | } |
@@ -248,7 +249,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
248 | */ | 249 | */ |
249 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 250 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
250 | "**** Begin Method Parse **** Entry=%p obj=%p\n", | 251 | "**** Begin Method Parse **** Entry=%p obj=%p\n", |
251 | info->node, info->obj_desc)); | 252 | info->resolved_node, info->obj_desc)); |
252 | 253 | ||
253 | info->pass_number = 1; | 254 | info->pass_number = 1; |
254 | status = acpi_ps_execute_pass(info); | 255 | status = acpi_ps_execute_pass(info); |
@@ -261,7 +262,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
261 | */ | 262 | */ |
262 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 263 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
263 | "**** Begin Method Execution **** Entry=%p obj=%p\n", | 264 | "**** Begin Method Execution **** Entry=%p obj=%p\n", |
264 | info->node, info->obj_desc)); | 265 | info->resolved_node, info->obj_desc)); |
265 | 266 | ||
266 | info->pass_number = 3; | 267 | info->pass_number = 3; |
267 | status = acpi_ps_execute_pass(info); | 268 | status = acpi_ps_execute_pass(info); |
@@ -286,8 +287,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
286 | * a control exception code | 287 | * a control exception code |
287 | */ | 288 | */ |
288 | if (info->return_object) { | 289 | if (info->return_object) { |
289 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 290 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", |
290 | "Method returned obj_desc=%p\n", | ||
291 | info->return_object)); | 291 | info->return_object)); |
292 | ACPI_DUMP_STACK_ENTRY(info->return_object); | 292 | ACPI_DUMP_STACK_ENTRY(info->return_object); |
293 | 293 | ||
@@ -301,7 +301,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
301 | * | 301 | * |
302 | * FUNCTION: acpi_ps_update_parameter_list | 302 | * FUNCTION: acpi_ps_update_parameter_list |
303 | * | 303 | * |
304 | * PARAMETERS: Info - See struct acpi_parameter_info | 304 | * PARAMETERS: Info - See struct acpi_evaluate_info |
305 | * (Used: parameter_type and Parameters) | 305 | * (Used: parameter_type and Parameters) |
306 | * Action - Add or Remove reference | 306 | * Action - Add or Remove reference |
307 | * | 307 | * |
@@ -312,14 +312,16 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
312 | ******************************************************************************/ | 312 | ******************************************************************************/ |
313 | 313 | ||
314 | static void | 314 | static void |
315 | acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | 315 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) |
316 | { | 316 | { |
317 | acpi_native_uint i; | 317 | acpi_native_uint i; |
318 | 318 | ||
319 | if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { | 319 | if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { |
320 | |||
320 | /* Update reference count for each parameter */ | 321 | /* Update reference count for each parameter */ |
321 | 322 | ||
322 | for (i = 0; info->parameters[i]; i++) { | 323 | for (i = 0; info->parameters[i]; i++) { |
324 | |||
323 | /* Ignore errors, just do them all */ | 325 | /* Ignore errors, just do them all */ |
324 | 326 | ||
325 | (void)acpi_ut_update_object_reference(info-> | 327 | (void)acpi_ut_update_object_reference(info-> |
@@ -333,7 +335,7 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | |||
333 | * | 335 | * |
334 | * FUNCTION: acpi_ps_execute_pass | 336 | * FUNCTION: acpi_ps_execute_pass |
335 | * | 337 | * |
336 | * PARAMETERS: Info - See struct acpi_parameter_info | 338 | * PARAMETERS: Info - See struct acpi_evaluate_info |
337 | * (Used: pass_number, Node, and obj_desc) | 339 | * (Used: pass_number, Node, and obj_desc) |
338 | * | 340 | * |
339 | * RETURN: Status | 341 | * RETURN: Status |
@@ -342,13 +344,13 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | |||
342 | * | 344 | * |
343 | ******************************************************************************/ | 345 | ******************************************************************************/ |
344 | 346 | ||
345 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) | 347 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info) |
346 | { | 348 | { |
347 | acpi_status status; | 349 | acpi_status status; |
348 | union acpi_parse_object *op; | 350 | union acpi_parse_object *op; |
349 | struct acpi_walk_state *walk_state; | 351 | struct acpi_walk_state *walk_state; |
350 | 352 | ||
351 | ACPI_FUNCTION_TRACE("ps_execute_pass"); | 353 | ACPI_FUNCTION_TRACE(ps_execute_pass); |
352 | 354 | ||
353 | /* Create and init a Root Node */ | 355 | /* Create and init a Root Node */ |
354 | 356 | ||
@@ -367,7 +369,7 @@ static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) | |||
367 | goto cleanup; | 369 | goto cleanup; |
368 | } | 370 | } |
369 | 371 | ||
370 | status = acpi_ds_init_aml_walk(walk_state, op, info->node, | 372 | status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, |
371 | info->obj_desc->method.aml_start, | 373 | info->obj_desc->method.aml_start, |
372 | info->obj_desc->method.aml_length, | 374 | info->obj_desc->method.aml_length, |
373 | info->pass_number == 1 ? NULL : info, | 375 | info->pass_number == 1 ? NULL : info, |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 8920e8c6e246..228bdb626502 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
39 | #include <linux/pm.h> | 39 | #include <linux/pm.h> |
40 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
41 | #include <linux/mutex.h> | ||
41 | 42 | ||
42 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
43 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
@@ -91,7 +92,7 @@ static struct { | |||
91 | int count; | 92 | int count; |
92 | struct list_head entries; | 93 | struct list_head entries; |
93 | } acpi_link; | 94 | } acpi_link; |
94 | DECLARE_MUTEX(acpi_link_lock); | 95 | DEFINE_MUTEX(acpi_link_lock); |
95 | 96 | ||
96 | /* -------------------------------------------------------------------------- | 97 | /* -------------------------------------------------------------------------- |
97 | PCI Link Device Management | 98 | PCI Link Device Management |
@@ -641,19 +642,19 @@ acpi_pci_link_allocate_irq(acpi_handle handle, | |||
641 | return_VALUE(-1); | 642 | return_VALUE(-1); |
642 | } | 643 | } |
643 | 644 | ||
644 | down(&acpi_link_lock); | 645 | mutex_lock(&acpi_link_lock); |
645 | if (acpi_pci_link_allocate(link)) { | 646 | if (acpi_pci_link_allocate(link)) { |
646 | up(&acpi_link_lock); | 647 | mutex_unlock(&acpi_link_lock); |
647 | return_VALUE(-1); | 648 | return_VALUE(-1); |
648 | } | 649 | } |
649 | 650 | ||
650 | if (!link->irq.active) { | 651 | if (!link->irq.active) { |
651 | up(&acpi_link_lock); | 652 | mutex_unlock(&acpi_link_lock); |
652 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); | 653 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); |
653 | return_VALUE(-1); | 654 | return_VALUE(-1); |
654 | } | 655 | } |
655 | link->refcnt++; | 656 | link->refcnt++; |
656 | up(&acpi_link_lock); | 657 | mutex_unlock(&acpi_link_lock); |
657 | 658 | ||
658 | if (triggering) | 659 | if (triggering) |
659 | *triggering = link->irq.triggering; | 660 | *triggering = link->irq.triggering; |
@@ -691,9 +692,9 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
691 | return_VALUE(-1); | 692 | return_VALUE(-1); |
692 | } | 693 | } |
693 | 694 | ||
694 | down(&acpi_link_lock); | 695 | mutex_lock(&acpi_link_lock); |
695 | if (!link->irq.initialized) { | 696 | if (!link->irq.initialized) { |
696 | up(&acpi_link_lock); | 697 | mutex_unlock(&acpi_link_lock); |
697 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); | 698 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); |
698 | return_VALUE(-1); | 699 | return_VALUE(-1); |
699 | } | 700 | } |
@@ -716,7 +717,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
716 | if (link->refcnt == 0) { | 717 | if (link->refcnt == 0) { |
717 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 718 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
718 | } | 719 | } |
719 | up(&acpi_link_lock); | 720 | mutex_unlock(&acpi_link_lock); |
720 | return_VALUE(link->irq.active); | 721 | return_VALUE(link->irq.active); |
721 | } | 722 | } |
722 | 723 | ||
@@ -747,7 +748,7 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
747 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); | 748 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); |
748 | acpi_driver_data(device) = link; | 749 | acpi_driver_data(device) = link; |
749 | 750 | ||
750 | down(&acpi_link_lock); | 751 | mutex_lock(&acpi_link_lock); |
751 | result = acpi_pci_link_get_possible(link); | 752 | result = acpi_pci_link_get_possible(link); |
752 | if (result) | 753 | if (result) |
753 | goto end; | 754 | goto end; |
@@ -782,7 +783,7 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
782 | end: | 783 | end: |
783 | /* disable all links -- to be activated on use */ | 784 | /* disable all links -- to be activated on use */ |
784 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 785 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
785 | up(&acpi_link_lock); | 786 | mutex_unlock(&acpi_link_lock); |
786 | 787 | ||
787 | if (result) | 788 | if (result) |
788 | kfree(link); | 789 | kfree(link); |
@@ -840,9 +841,9 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) | |||
840 | 841 | ||
841 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 842 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
842 | 843 | ||
843 | down(&acpi_link_lock); | 844 | mutex_lock(&acpi_link_lock); |
844 | list_del(&link->node); | 845 | list_del(&link->node); |
845 | up(&acpi_link_lock); | 846 | mutex_unlock(&acpi_link_lock); |
846 | 847 | ||
847 | kfree(link); | 848 | kfree(link); |
848 | 849 | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index ab00afec26f7..decaebb4cbe9 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -388,7 +388,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
388 | 388 | ||
389 | /* Use the acpiid in MADT to map cpus in case of SMP */ | 389 | /* Use the acpiid in MADT to map cpus in case of SMP */ |
390 | #ifndef CONFIG_SMP | 390 | #ifndef CONFIG_SMP |
391 | #define convert_acpiid_to_cpu(acpi_id) (0xff) | 391 | #define convert_acpiid_to_cpu(acpi_id) (-1) |
392 | #else | 392 | #else |
393 | 393 | ||
394 | #ifdef CONFIG_IA64 | 394 | #ifdef CONFIG_IA64 |
@@ -401,7 +401,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
401 | #define ARCH_BAD_APICID (0xff) | 401 | #define ARCH_BAD_APICID (0xff) |
402 | #endif | 402 | #endif |
403 | 403 | ||
404 | static u8 convert_acpiid_to_cpu(u8 acpi_id) | 404 | static int convert_acpiid_to_cpu(u8 acpi_id) |
405 | { | 405 | { |
406 | u16 apic_id; | 406 | u16 apic_id; |
407 | int i; | 407 | int i; |
@@ -427,7 +427,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
427 | acpi_status status = 0; | 427 | acpi_status status = 0; |
428 | union acpi_object object = { 0 }; | 428 | union acpi_object object = { 0 }; |
429 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 429 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
430 | u8 cpu_index; | 430 | int cpu_index; |
431 | static int cpu0_initialized; | 431 | static int cpu0_initialized; |
432 | 432 | ||
433 | ACPI_FUNCTION_TRACE("acpi_processor_get_info"); | 433 | ACPI_FUNCTION_TRACE("acpi_processor_get_info"); |
@@ -473,7 +473,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
473 | cpu_index = convert_acpiid_to_cpu(pr->acpi_id); | 473 | cpu_index = convert_acpiid_to_cpu(pr->acpi_id); |
474 | 474 | ||
475 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | 475 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ |
476 | if (!cpu0_initialized && (cpu_index == 0xff) && | 476 | if (!cpu0_initialized && (cpu_index == -1) && |
477 | (num_online_cpus() == 1)) { | 477 | (num_online_cpus() == 1)) { |
478 | cpu_index = 0; | 478 | cpu_index = 0; |
479 | } | 479 | } |
@@ -487,7 +487,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
487 | * less than the max # of CPUs. They should be ignored _iff | 487 | * less than the max # of CPUs. They should be ignored _iff |
488 | * they are physically not present. | 488 | * they are physically not present. |
489 | */ | 489 | */ |
490 | if (cpu_index >= NR_CPUS) { | 490 | if (cpu_index == -1) { |
491 | if (ACPI_FAILURE | 491 | if (ACPI_FAILURE |
492 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { | 492 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { |
493 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 493 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -558,8 +558,8 @@ static int acpi_processor_start(struct acpi_device *device) | |||
558 | */ | 558 | */ |
559 | if (processor_device_array[pr->id] != NULL && | 559 | if (processor_device_array[pr->id] != NULL && |
560 | processor_device_array[pr->id] != (void *)device) { | 560 | processor_device_array[pr->id] != (void *)device) { |
561 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id" | 561 | printk(KERN_WARNING "BIOS reported wrong ACPI id" |
562 | "for the processor\n")); | 562 | "for the processor\n"); |
563 | return_VALUE(-ENODEV); | 563 | return_VALUE(-ENODEV); |
564 | } | 564 | } |
565 | processor_device_array[pr->id] = (void *)device; | 565 | processor_device_array[pr->id] = (void *)device; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 80fa43471f48..3b97a5eae9e8 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -54,10 +54,10 @@ ACPI_MODULE_NAME("acpi_processor") | |||
54 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) | 54 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) |
55 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 55 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
56 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 56 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
57 | static void (*pm_idle_save) (void); | 57 | static void (*pm_idle_save) (void) __read_mostly; |
58 | module_param(max_cstate, uint, 0644); | 58 | module_param(max_cstate, uint, 0644); |
59 | 59 | ||
60 | static unsigned int nocst = 0; | 60 | static unsigned int nocst __read_mostly; |
61 | module_param(nocst, uint, 0000); | 61 | module_param(nocst, uint, 0000); |
62 | 62 | ||
63 | /* | 63 | /* |
@@ -67,7 +67,7 @@ module_param(nocst, uint, 0000); | |||
67 | * 100 HZ: 0x0000000F: 4 jiffies = 40ms | 67 | * 100 HZ: 0x0000000F: 4 jiffies = 40ms |
68 | * reduce history for more aggressive entry into C3 | 68 | * reduce history for more aggressive entry into C3 |
69 | */ | 69 | */ |
70 | static unsigned int bm_history = | 70 | static unsigned int bm_history __read_mostly = |
71 | (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); | 71 | (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); |
72 | module_param(bm_history, uint, 0644); | 72 | module_param(bm_history, uint, 0644); |
73 | /* -------------------------------------------------------------------------- | 73 | /* -------------------------------------------------------------------------- |
@@ -1081,7 +1081,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, | |||
1081 | struct acpi_device *device) | 1081 | struct acpi_device *device) |
1082 | { | 1082 | { |
1083 | acpi_status status = 0; | 1083 | acpi_status status = 0; |
1084 | static int first_run = 0; | 1084 | static int first_run; |
1085 | struct proc_dir_entry *entry = NULL; | 1085 | struct proc_dir_entry *entry = NULL; |
1086 | unsigned int i; | 1086 | unsigned int i; |
1087 | 1087 | ||
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index f36db22ce1ae..41aaaba74b19 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF | 34 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF |
35 | #include <linux/proc_fs.h> | 35 | #include <linux/proc_fs.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <linux/mutex.h> | ||
37 | 38 | ||
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
39 | #endif | 40 | #endif |
@@ -48,7 +49,7 @@ | |||
48 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 49 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
49 | ACPI_MODULE_NAME("acpi_processor") | 50 | ACPI_MODULE_NAME("acpi_processor") |
50 | 51 | ||
51 | static DECLARE_MUTEX(performance_sem); | 52 | static DEFINE_MUTEX(performance_mutex); |
52 | 53 | ||
53 | /* | 54 | /* |
54 | * _PPC support is implemented as a CPUfreq policy notifier: | 55 | * _PPC support is implemented as a CPUfreq policy notifier: |
@@ -72,7 +73,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
72 | struct acpi_processor *pr; | 73 | struct acpi_processor *pr; |
73 | unsigned int ppc = 0; | 74 | unsigned int ppc = 0; |
74 | 75 | ||
75 | down(&performance_sem); | 76 | mutex_lock(&performance_mutex); |
76 | 77 | ||
77 | if (event != CPUFREQ_INCOMPATIBLE) | 78 | if (event != CPUFREQ_INCOMPATIBLE) |
78 | goto out; | 79 | goto out; |
@@ -93,7 +94,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
93 | core_frequency * 1000); | 94 | core_frequency * 1000); |
94 | 95 | ||
95 | out: | 96 | out: |
96 | up(&performance_sem); | 97 | mutex_unlock(&performance_mutex); |
97 | 98 | ||
98 | return 0; | 99 | return 0; |
99 | } | 100 | } |
@@ -553,6 +554,230 @@ static void acpi_cpufreq_remove_file(struct acpi_processor *pr) | |||
553 | } | 554 | } |
554 | #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ | 555 | #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ |
555 | 556 | ||
557 | static int acpi_processor_get_psd(struct acpi_processor *pr) | ||
558 | { | ||
559 | int result = 0; | ||
560 | acpi_status status = AE_OK; | ||
561 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
562 | struct acpi_buffer format = {sizeof("NNNNN"), "NNNNN"}; | ||
563 | struct acpi_buffer state = {0, NULL}; | ||
564 | union acpi_object *psd = NULL; | ||
565 | struct acpi_psd_package *pdomain; | ||
566 | |||
567 | status = acpi_evaluate_object(pr->handle, "_PSD", NULL, &buffer); | ||
568 | if (ACPI_FAILURE(status)) { | ||
569 | return -ENODEV; | ||
570 | } | ||
571 | |||
572 | psd = (union acpi_object *) buffer.pointer; | ||
573 | if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) { | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | ||
575 | result = -EFAULT; | ||
576 | goto end; | ||
577 | } | ||
578 | |||
579 | if (psd->package.count != 1) { | ||
580 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | ||
581 | result = -EFAULT; | ||
582 | goto end; | ||
583 | } | ||
584 | |||
585 | pdomain = &(pr->performance->domain_info); | ||
586 | |||
587 | state.length = sizeof(struct acpi_psd_package); | ||
588 | state.pointer = pdomain; | ||
589 | |||
590 | status = acpi_extract_package(&(psd->package.elements[0]), | ||
591 | &format, &state); | ||
592 | if (ACPI_FAILURE(status)) { | ||
593 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | ||
594 | result = -EFAULT; | ||
595 | goto end; | ||
596 | } | ||
597 | |||
598 | if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) { | ||
599 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:num_entries\n")); | ||
600 | result = -EFAULT; | ||
601 | goto end; | ||
602 | } | ||
603 | |||
604 | if (pdomain->revision != ACPI_PSD_REV0_REVISION) { | ||
605 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:revision\n")); | ||
606 | result = -EFAULT; | ||
607 | goto end; | ||
608 | } | ||
609 | |||
610 | end: | ||
611 | acpi_os_free(buffer.pointer); | ||
612 | return result; | ||
613 | } | ||
614 | |||
615 | int acpi_processor_preregister_performance( | ||
616 | struct acpi_processor_performance **performance) | ||
617 | { | ||
618 | int count, count_target; | ||
619 | int retval = 0; | ||
620 | unsigned int i, j; | ||
621 | cpumask_t covered_cpus; | ||
622 | struct acpi_processor *pr; | ||
623 | struct acpi_psd_package *pdomain; | ||
624 | struct acpi_processor *match_pr; | ||
625 | struct acpi_psd_package *match_pdomain; | ||
626 | |||
627 | mutex_lock(&performance_mutex); | ||
628 | |||
629 | retval = 0; | ||
630 | |||
631 | /* Call _PSD for all CPUs */ | ||
632 | for_each_possible_cpu(i) { | ||
633 | pr = processors[i]; | ||
634 | if (!pr) { | ||
635 | /* Look only at processors in ACPI namespace */ | ||
636 | continue; | ||
637 | } | ||
638 | |||
639 | if (pr->performance) { | ||
640 | retval = -EBUSY; | ||
641 | continue; | ||
642 | } | ||
643 | |||
644 | if (!performance || !performance[i]) { | ||
645 | retval = -EINVAL; | ||
646 | continue; | ||
647 | } | ||
648 | |||
649 | pr->performance = performance[i]; | ||
650 | cpu_set(i, pr->performance->shared_cpu_map); | ||
651 | if (acpi_processor_get_psd(pr)) { | ||
652 | retval = -EINVAL; | ||
653 | continue; | ||
654 | } | ||
655 | } | ||
656 | if (retval) | ||
657 | goto err_ret; | ||
658 | |||
659 | /* | ||
660 | * Now that we have _PSD data from all CPUs, lets setup P-state | ||
661 | * domain info. | ||
662 | */ | ||
663 | for_each_possible_cpu(i) { | ||
664 | pr = processors[i]; | ||
665 | if (!pr) | ||
666 | continue; | ||
667 | |||
668 | /* Basic validity check for domain info */ | ||
669 | pdomain = &(pr->performance->domain_info); | ||
670 | if ((pdomain->revision != ACPI_PSD_REV0_REVISION) || | ||
671 | (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES)) { | ||
672 | retval = -EINVAL; | ||
673 | goto err_ret; | ||
674 | } | ||
675 | if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL && | ||
676 | pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY && | ||
677 | pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) { | ||
678 | retval = -EINVAL; | ||
679 | goto err_ret; | ||
680 | } | ||
681 | } | ||
682 | |||
683 | cpus_clear(covered_cpus); | ||
684 | for_each_possible_cpu(i) { | ||
685 | pr = processors[i]; | ||
686 | if (!pr) | ||
687 | continue; | ||
688 | |||
689 | if (cpu_isset(i, covered_cpus)) | ||
690 | continue; | ||
691 | |||
692 | pdomain = &(pr->performance->domain_info); | ||
693 | cpu_set(i, pr->performance->shared_cpu_map); | ||
694 | cpu_set(i, covered_cpus); | ||
695 | if (pdomain->num_processors <= 1) | ||
696 | continue; | ||
697 | |||
698 | /* Validate the Domain info */ | ||
699 | count_target = pdomain->num_processors; | ||
700 | count = 1; | ||
701 | if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL || | ||
702 | pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) { | ||
703 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; | ||
704 | } else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) { | ||
705 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ANY; | ||
706 | } | ||
707 | |||
708 | for_each_possible_cpu(j) { | ||
709 | if (i == j) | ||
710 | continue; | ||
711 | |||
712 | match_pr = processors[j]; | ||
713 | if (!match_pr) | ||
714 | continue; | ||
715 | |||
716 | match_pdomain = &(match_pr->performance->domain_info); | ||
717 | if (match_pdomain->domain != pdomain->domain) | ||
718 | continue; | ||
719 | |||
720 | /* Here i and j are in the same domain */ | ||
721 | |||
722 | if (match_pdomain->num_processors != count_target) { | ||
723 | retval = -EINVAL; | ||
724 | goto err_ret; | ||
725 | } | ||
726 | |||
727 | if (pdomain->coord_type != match_pdomain->coord_type) { | ||
728 | retval = -EINVAL; | ||
729 | goto err_ret; | ||
730 | } | ||
731 | |||
732 | cpu_set(j, covered_cpus); | ||
733 | cpu_set(j, pr->performance->shared_cpu_map); | ||
734 | count++; | ||
735 | } | ||
736 | |||
737 | for_each_possible_cpu(j) { | ||
738 | if (i == j) | ||
739 | continue; | ||
740 | |||
741 | match_pr = processors[j]; | ||
742 | if (!match_pr) | ||
743 | continue; | ||
744 | |||
745 | match_pdomain = &(match_pr->performance->domain_info); | ||
746 | if (match_pdomain->domain != pdomain->domain) | ||
747 | continue; | ||
748 | |||
749 | match_pr->performance->shared_type = | ||
750 | pr->performance->shared_type; | ||
751 | match_pr->performance->shared_cpu_map = | ||
752 | pr->performance->shared_cpu_map; | ||
753 | } | ||
754 | } | ||
755 | |||
756 | err_ret: | ||
757 | if (retval) { | ||
758 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error while parsing _PSD domain information. Assuming no coordination\n")); | ||
759 | } | ||
760 | |||
761 | for_each_possible_cpu(i) { | ||
762 | pr = processors[i]; | ||
763 | if (!pr || !pr->performance) | ||
764 | continue; | ||
765 | |||
766 | /* Assume no coordination on any error parsing domain info */ | ||
767 | if (retval) { | ||
768 | cpus_clear(pr->performance->shared_cpu_map); | ||
769 | cpu_set(i, pr->performance->shared_cpu_map); | ||
770 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; | ||
771 | } | ||
772 | pr->performance = NULL; /* Will be set for real in register */ | ||
773 | } | ||
774 | |||
775 | mutex_unlock(&performance_mutex); | ||
776 | return retval; | ||
777 | } | ||
778 | EXPORT_SYMBOL(acpi_processor_preregister_performance); | ||
779 | |||
780 | |||
556 | int | 781 | int |
557 | acpi_processor_register_performance(struct acpi_processor_performance | 782 | acpi_processor_register_performance(struct acpi_processor_performance |
558 | *performance, unsigned int cpu) | 783 | *performance, unsigned int cpu) |
@@ -564,16 +789,16 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
564 | if (!(acpi_processor_ppc_status & PPC_REGISTERED)) | 789 | if (!(acpi_processor_ppc_status & PPC_REGISTERED)) |
565 | return_VALUE(-EINVAL); | 790 | return_VALUE(-EINVAL); |
566 | 791 | ||
567 | down(&performance_sem); | 792 | mutex_lock(&performance_mutex); |
568 | 793 | ||
569 | pr = processors[cpu]; | 794 | pr = processors[cpu]; |
570 | if (!pr) { | 795 | if (!pr) { |
571 | up(&performance_sem); | 796 | mutex_unlock(&performance_mutex); |
572 | return_VALUE(-ENODEV); | 797 | return_VALUE(-ENODEV); |
573 | } | 798 | } |
574 | 799 | ||
575 | if (pr->performance) { | 800 | if (pr->performance) { |
576 | up(&performance_sem); | 801 | mutex_unlock(&performance_mutex); |
577 | return_VALUE(-EBUSY); | 802 | return_VALUE(-EBUSY); |
578 | } | 803 | } |
579 | 804 | ||
@@ -583,13 +808,13 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
583 | 808 | ||
584 | if (acpi_processor_get_performance_info(pr)) { | 809 | if (acpi_processor_get_performance_info(pr)) { |
585 | pr->performance = NULL; | 810 | pr->performance = NULL; |
586 | up(&performance_sem); | 811 | mutex_unlock(&performance_mutex); |
587 | return_VALUE(-EIO); | 812 | return_VALUE(-EIO); |
588 | } | 813 | } |
589 | 814 | ||
590 | acpi_cpufreq_add_file(pr); | 815 | acpi_cpufreq_add_file(pr); |
591 | 816 | ||
592 | up(&performance_sem); | 817 | mutex_unlock(&performance_mutex); |
593 | return_VALUE(0); | 818 | return_VALUE(0); |
594 | } | 819 | } |
595 | 820 | ||
@@ -603,11 +828,11 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
603 | 828 | ||
604 | ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); | 829 | ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); |
605 | 830 | ||
606 | down(&performance_sem); | 831 | mutex_lock(&performance_mutex); |
607 | 832 | ||
608 | pr = processors[cpu]; | 833 | pr = processors[cpu]; |
609 | if (!pr) { | 834 | if (!pr) { |
610 | up(&performance_sem); | 835 | mutex_unlock(&performance_mutex); |
611 | return_VOID; | 836 | return_VOID; |
612 | } | 837 | } |
613 | 838 | ||
@@ -617,7 +842,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
617 | 842 | ||
618 | acpi_cpufreq_remove_file(pr); | 843 | acpi_cpufreq_remove_file(pr); |
619 | 844 | ||
620 | up(&performance_sem); | 845 | mutex_unlock(&performance_mutex); |
621 | 846 | ||
622 | return_VOID; | 847 | return_VOID; |
623 | } | 848 | } |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 4038dbfa63a0..cf87b0230026 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) | |||
78 | ACPI_FUNCTION_ENTRY(); | 78 | ACPI_FUNCTION_ENTRY(); |
79 | 79 | ||
80 | for (bits_set = 0; bit_field; bits_set++) { | 80 | for (bits_set = 0; bit_field; bits_set++) { |
81 | |||
81 | /* Zero the least significant bit that is set */ | 82 | /* Zero the least significant bit that is set */ |
82 | 83 | ||
83 | bit_field &= (bit_field - 1); | 84 | bit_field &= (bit_field - 1); |
@@ -154,15 +155,18 @@ acpi_rs_stream_option_length(u32 resource_length, | |||
154 | * length, minus one byte for the resource_source_index itself. | 155 | * length, minus one byte for the resource_source_index itself. |
155 | */ | 156 | */ |
156 | if (resource_length > minimum_aml_resource_length) { | 157 | if (resource_length > minimum_aml_resource_length) { |
158 | |||
157 | /* Compute the length of the optional string */ | 159 | /* Compute the length of the optional string */ |
158 | 160 | ||
159 | string_length = | 161 | string_length = |
160 | resource_length - minimum_aml_resource_length - 1; | 162 | resource_length - minimum_aml_resource_length - 1; |
161 | } | 163 | } |
162 | 164 | ||
163 | /* Round up length to 32 bits for internal structure alignment */ | 165 | /* |
164 | 166 | * Round the length up to a multiple of the native word in order to | |
165 | return (ACPI_ROUND_UP_to_32_bITS(string_length)); | 167 | * guarantee that the entire resource descriptor is native word aligned |
168 | */ | ||
169 | return ((u32) ACPI_ROUND_UP_TO_NATIVE_WORD(string_length)); | ||
166 | } | 170 | } |
167 | 171 | ||
168 | /******************************************************************************* | 172 | /******************************************************************************* |
@@ -186,11 +190,12 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
186 | acpi_size aml_size_needed = 0; | 190 | acpi_size aml_size_needed = 0; |
187 | acpi_rs_length total_size; | 191 | acpi_rs_length total_size; |
188 | 192 | ||
189 | ACPI_FUNCTION_TRACE("rs_get_aml_length"); | 193 | ACPI_FUNCTION_TRACE(rs_get_aml_length); |
190 | 194 | ||
191 | /* Traverse entire list of internal resource descriptors */ | 195 | /* Traverse entire list of internal resource descriptors */ |
192 | 196 | ||
193 | while (resource) { | 197 | while (resource) { |
198 | |||
194 | /* Validate the descriptor type */ | 199 | /* Validate the descriptor type */ |
195 | 200 | ||
196 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 201 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
@@ -214,6 +219,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
214 | * is a Large Resource data type. | 219 | * is a Large Resource data type. |
215 | */ | 220 | */ |
216 | if (resource->data.vendor.byte_length > 7) { | 221 | if (resource->data.vendor.byte_length > 7) { |
222 | |||
217 | /* Base size of a Large resource descriptor */ | 223 | /* Base size of a Large resource descriptor */ |
218 | 224 | ||
219 | total_size = | 225 | total_size = |
@@ -332,20 +338,22 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
332 | acpi_status status; | 338 | acpi_status status; |
333 | u8 *end_aml; | 339 | u8 *end_aml; |
334 | u8 *buffer; | 340 | u8 *buffer; |
335 | u32 buffer_size = 0; | 341 | u32 buffer_size; |
336 | u16 temp16; | 342 | u16 temp16; |
337 | u16 resource_length; | 343 | u16 resource_length; |
338 | u32 extra_struct_bytes; | 344 | u32 extra_struct_bytes; |
339 | u8 resource_index; | 345 | u8 resource_index; |
340 | u8 minimum_aml_resource_length; | 346 | u8 minimum_aml_resource_length; |
341 | 347 | ||
342 | ACPI_FUNCTION_TRACE("rs_get_list_length"); | 348 | ACPI_FUNCTION_TRACE(rs_get_list_length); |
343 | 349 | ||
350 | *size_needed = 0; | ||
344 | end_aml = aml_buffer + aml_buffer_length; | 351 | end_aml = aml_buffer + aml_buffer_length; |
345 | 352 | ||
346 | /* Walk the list of AML resource descriptors */ | 353 | /* Walk the list of AML resource descriptors */ |
347 | 354 | ||
348 | while (aml_buffer < end_aml) { | 355 | while (aml_buffer < end_aml) { |
356 | |||
349 | /* Validate the Resource Type and Resource Length */ | 357 | /* Validate the Resource Type and Resource Length */ |
350 | 358 | ||
351 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); | 359 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); |
@@ -386,35 +394,28 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
386 | break; | 394 | break; |
387 | 395 | ||
388 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: | 396 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: |
397 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: | ||
389 | /* | 398 | /* |
390 | * Vendor Resource: | 399 | * Vendor Resource: |
391 | * Ensure a 32-bit boundary for the structure | 400 | * Get the number of vendor data bytes |
392 | */ | 401 | */ |
393 | extra_struct_bytes = | 402 | extra_struct_bytes = resource_length; |
394 | ACPI_ROUND_UP_to_32_bITS(resource_length); | ||
395 | break; | 403 | break; |
396 | 404 | ||
397 | case ACPI_RESOURCE_NAME_END_TAG: | 405 | case ACPI_RESOURCE_NAME_END_TAG: |
398 | /* | 406 | /* |
399 | * End Tag: This is the normal exit, add size of end_tag | 407 | * End Tag: |
408 | * This is the normal exit, add size of end_tag | ||
400 | */ | 409 | */ |
401 | *size_needed = buffer_size + ACPI_RS_SIZE_MIN; | 410 | *size_needed += ACPI_RS_SIZE_MIN; |
402 | return_ACPI_STATUS(AE_OK); | 411 | return_ACPI_STATUS(AE_OK); |
403 | 412 | ||
404 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: | ||
405 | /* | ||
406 | * Vendor Resource: | ||
407 | * Add vendor data and ensure a 32-bit boundary for the structure | ||
408 | */ | ||
409 | extra_struct_bytes = | ||
410 | ACPI_ROUND_UP_to_32_bITS(resource_length); | ||
411 | break; | ||
412 | |||
413 | case ACPI_RESOURCE_NAME_ADDRESS32: | 413 | case ACPI_RESOURCE_NAME_ADDRESS32: |
414 | case ACPI_RESOURCE_NAME_ADDRESS16: | 414 | case ACPI_RESOURCE_NAME_ADDRESS16: |
415 | case ACPI_RESOURCE_NAME_ADDRESS64: | ||
415 | /* | 416 | /* |
416 | * 32-Bit or 16-bit Address Resource: | 417 | * Address Resource: |
417 | * Add the size of any optional data (resource_source) | 418 | * Add the size of the optional resource_source |
418 | */ | 419 | */ |
419 | extra_struct_bytes = | 420 | extra_struct_bytes = |
420 | acpi_rs_stream_option_length(resource_length, | 421 | acpi_rs_stream_option_length(resource_length, |
@@ -423,50 +424,46 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
423 | 424 | ||
424 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: | 425 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: |
425 | /* | 426 | /* |
426 | * Extended IRQ: | 427 | * Extended IRQ Resource: |
427 | * Point past the interrupt_vector_flags to get the | 428 | * Using the interrupt_table_length, add 4 bytes for each additional |
428 | * interrupt_table_length. | 429 | * interrupt. Note: at least one interrupt is required and is |
430 | * included in the minimum descriptor size (reason for the -1) | ||
429 | */ | 431 | */ |
430 | buffer++; | 432 | extra_struct_bytes = (buffer[1] - 1) * sizeof(u32); |
431 | 433 | ||
432 | extra_struct_bytes = | 434 | /* Add the size of the optional resource_source */ |
433 | /* | 435 | |
434 | * Add 4 bytes for each additional interrupt. Note: at | 436 | extra_struct_bytes += |
435 | * least one interrupt is required and is included in | ||
436 | * the minimum descriptor size | ||
437 | */ | ||
438 | ((*buffer - 1) * sizeof(u32)) + | ||
439 | /* Add the size of any optional data (resource_source) */ | ||
440 | acpi_rs_stream_option_length(resource_length - | 437 | acpi_rs_stream_option_length(resource_length - |
441 | extra_struct_bytes, | 438 | extra_struct_bytes, |
442 | minimum_aml_resource_length); | 439 | minimum_aml_resource_length); |
443 | break; | 440 | break; |
444 | 441 | ||
445 | case ACPI_RESOURCE_NAME_ADDRESS64: | ||
446 | /* | ||
447 | * 64-Bit Address Resource: | ||
448 | * Add the size of any optional data (resource_source) | ||
449 | * Ensure a 64-bit boundary for the structure | ||
450 | */ | ||
451 | extra_struct_bytes = | ||
452 | ACPI_ROUND_UP_to_64_bITS | ||
453 | (acpi_rs_stream_option_length | ||
454 | (resource_length, minimum_aml_resource_length)); | ||
455 | break; | ||
456 | |||
457 | default: | 442 | default: |
458 | break; | 443 | break; |
459 | } | 444 | } |
460 | 445 | ||
461 | /* Update the required buffer size for the internal descriptor structs */ | 446 | /* |
447 | * Update the required buffer size for the internal descriptor structs | ||
448 | * | ||
449 | * Important: Round the size up for the appropriate alignment. This | ||
450 | * is a requirement on IA64. | ||
451 | */ | ||
452 | buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + | ||
453 | extra_struct_bytes; | ||
454 | buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); | ||
462 | 455 | ||
463 | temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + | 456 | *size_needed += buffer_size; |
464 | extra_struct_bytes); | 457 | |
465 | buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); | 458 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
459 | "Type %.2X, AmlLength %.2X InternalLength %.2X\n", | ||
460 | acpi_ut_get_resource_type(aml_buffer), | ||
461 | acpi_ut_get_descriptor_length(aml_buffer), | ||
462 | buffer_size)); | ||
466 | 463 | ||
467 | /* | 464 | /* |
468 | * Point to the next resource within the stream | 465 | * Point to the next resource within the AML stream using the length |
469 | * using the size of the header plus the length contained in the header | 466 | * contained in the resource descriptor header |
470 | */ | 467 | */ |
471 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); | 468 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); |
472 | } | 469 | } |
@@ -506,7 +503,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
506 | u8 name_found; | 503 | u8 name_found; |
507 | u32 table_index; | 504 | u32 table_index; |
508 | 505 | ||
509 | ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length"); | 506 | ACPI_FUNCTION_TRACE(rs_get_pci_routing_table_length); |
510 | 507 | ||
511 | number_of_elements = package_object->package.count; | 508 | number_of_elements = package_object->package.count; |
512 | 509 | ||
@@ -523,6 +520,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
523 | top_object_list = package_object->package.elements; | 520 | top_object_list = package_object->package.elements; |
524 | 521 | ||
525 | for (index = 0; index < number_of_elements; index++) { | 522 | for (index = 0; index < number_of_elements; index++) { |
523 | |||
526 | /* Dereference the sub-package */ | 524 | /* Dereference the sub-package */ |
527 | 525 | ||
528 | package_element = *top_object_list; | 526 | package_element = *top_object_list; |
@@ -581,7 +579,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
581 | 579 | ||
582 | /* Round up the size since each element must be aligned */ | 580 | /* Round up the size since each element must be aligned */ |
583 | 581 | ||
584 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); | 582 | temp_size_needed = ACPI_ROUND_UP_TO_64BIT(temp_size_needed); |
585 | 583 | ||
586 | /* Point to the next union acpi_operand_object */ | 584 | /* Point to the next union acpi_operand_object */ |
587 | 585 | ||
@@ -589,7 +587,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
589 | } | 587 | } |
590 | 588 | ||
591 | /* | 589 | /* |
592 | * Adding an extra element to the end of the list, essentially a | 590 | * Add an extra element to the end of the list, essentially a |
593 | * NULL terminator | 591 | * NULL terminator |
594 | */ | 592 | */ |
595 | *buffer_size_needed = | 593 | *buffer_size_needed = |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 8c128dea3252..008058acdd39 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -75,10 +75,11 @@ 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 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer)); | 82 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlBuffer = %p\n", aml_buffer)); |
82 | 83 | ||
83 | /* Params already validated, so we don't re-validate here */ | 84 | /* Params already validated, so we don't re-validate here */ |
84 | 85 | ||
@@ -92,7 +93,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
92 | status = acpi_rs_get_list_length(aml_start, aml_buffer_length, | 93 | status = acpi_rs_get_list_length(aml_start, aml_buffer_length, |
93 | &list_size_needed); | 94 | &list_size_needed); |
94 | 95 | ||
95 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", | 96 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", |
96 | status, (u32) list_size_needed)); | 97 | status, (u32) list_size_needed)); |
97 | if (ACPI_FAILURE(status)) { | 98 | if (ACPI_FAILURE(status)) { |
98 | return_ACPI_STATUS(status); | 99 | return_ACPI_STATUS(status); |
@@ -107,13 +108,15 @@ 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 | } |
115 | 118 | ||
116 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 119 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
117 | output_buffer->pointer, (u32) output_buffer->length)); | 120 | output_buffer->pointer, (u32) output_buffer->length)); |
118 | return_ACPI_STATUS(AE_OK); | 121 | return_ACPI_STATUS(AE_OK); |
119 | } | 122 | } |
@@ -155,7 +158,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
155 | acpi_status status; | 158 | acpi_status status; |
156 | struct acpi_buffer path_buffer; | 159 | struct acpi_buffer path_buffer; |
157 | 160 | ||
158 | ACPI_FUNCTION_TRACE("rs_create_pci_routing_table"); | 161 | ACPI_FUNCTION_TRACE(rs_create_pci_routing_table); |
159 | 162 | ||
160 | /* Params already validated, so we don't re-validate here */ | 163 | /* Params already validated, so we don't re-validate here */ |
161 | 164 | ||
@@ -167,7 +170,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
167 | return_ACPI_STATUS(status); | 170 | return_ACPI_STATUS(status); |
168 | } | 171 | } |
169 | 172 | ||
170 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n", | 173 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", |
171 | (u32) buffer_size_needed)); | 174 | (u32) buffer_size_needed)); |
172 | 175 | ||
173 | /* Validate/Allocate/Clear caller buffer */ | 176 | /* Validate/Allocate/Clear caller buffer */ |
@@ -332,7 +335,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
332 | /* Now align the current length */ | 335 | /* Now align the current length */ |
333 | 336 | ||
334 | user_prt->length = | 337 | user_prt->length = |
335 | (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); | 338 | (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length); |
336 | 339 | ||
337 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 340 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
338 | 341 | ||
@@ -341,7 +344,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
341 | user_prt->source_index = (u32) obj_desc->integer.value; | 344 | user_prt->source_index = (u32) obj_desc->integer.value; |
342 | } else { | 345 | } else { |
343 | ACPI_ERROR((AE_INFO, | 346 | ACPI_ERROR((AE_INFO, |
344 | "(PRT[%X].source_index) Need Integer, found %s", | 347 | "(PRT[%X].SourceIndex) Need Integer, found %s", |
345 | index, | 348 | index, |
346 | acpi_ut_get_object_type_name(obj_desc))); | 349 | acpi_ut_get_object_type_name(obj_desc))); |
347 | return_ACPI_STATUS(AE_BAD_DATA); | 350 | return_ACPI_STATUS(AE_BAD_DATA); |
@@ -352,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
352 | top_object_list++; | 355 | top_object_list++; |
353 | } | 356 | } |
354 | 357 | ||
355 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 358 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
356 | output_buffer->pointer, (u32) output_buffer->length)); | 359 | output_buffer->pointer, (u32) output_buffer->length)); |
357 | return_ACPI_STATUS(AE_OK); | 360 | return_ACPI_STATUS(AE_OK); |
358 | } | 361 | } |
@@ -382,9 +385,9 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
382 | acpi_status status; | 385 | acpi_status status; |
383 | acpi_size aml_size_needed = 0; | 386 | acpi_size aml_size_needed = 0; |
384 | 387 | ||
385 | ACPI_FUNCTION_TRACE("rs_create_aml_resources"); | 388 | ACPI_FUNCTION_TRACE(rs_create_aml_resources); |
386 | 389 | ||
387 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", | 390 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n", |
388 | linked_list_buffer)); | 391 | linked_list_buffer)); |
389 | 392 | ||
390 | /* | 393 | /* |
@@ -395,7 +398,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
395 | */ | 398 | */ |
396 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); | 399 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); |
397 | 400 | ||
398 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", | 401 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", |
399 | (u32) aml_size_needed, | 402 | (u32) aml_size_needed, |
400 | acpi_format_exception(status))); | 403 | acpi_format_exception(status))); |
401 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
@@ -419,7 +422,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
419 | return_ACPI_STATUS(status); | 422 | return_ACPI_STATUS(status); |
420 | } | 423 | } |
421 | 424 | ||
422 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 425 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
423 | output_buffer->pointer, (u32) output_buffer->length)); | 426 | output_buffer->pointer, (u32) output_buffer->length)); |
424 | return_ACPI_STATUS(AE_OK); | 427 | return_ACPI_STATUS(AE_OK); |
425 | } | 428 | } |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index e7de061cf883..9c99a723a860 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -91,11 +91,11 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); | |||
91 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { | 91 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { |
92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, | 92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, |
93 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", | 93 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", |
94 | acpi_gbl_HEdecode}, | 94 | acpi_gbl_he_decode}, |
95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", | 95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", |
96 | acpi_gbl_LLdecode}, | 96 | acpi_gbl_ll_decode}, |
97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", | 97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", |
98 | acpi_gbl_SHRdecode}, | 98 | acpi_gbl_shr_decode}, |
99 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), | 99 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), |
100 | "Interrupt Count", NULL}, | 100 | "Interrupt Count", NULL}, |
101 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), | 101 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), |
@@ -105,11 +105,11 @@ struct acpi_rsdump_info acpi_rs_dump_irq[6] = { | |||
105 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { | 105 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { |
106 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, | 106 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, |
107 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", | 107 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", |
108 | acpi_gbl_TYPdecode}, | 108 | acpi_gbl_typ_decode}, |
109 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", | 109 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", |
110 | acpi_gbl_BMdecode}, | 110 | acpi_gbl_bm_decode}, |
111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", | 111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", |
112 | acpi_gbl_SIZdecode}, | 112 | acpi_gbl_siz_decode}, |
113 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", | 113 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", |
114 | NULL}, | 114 | NULL}, |
115 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", | 115 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", |
@@ -158,7 +158,7 @@ struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { | 160 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { |
161 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", | 161 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag", |
162 | NULL} | 162 | NULL} |
163 | }; | 163 | }; |
164 | 164 | ||
@@ -166,7 +166,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { | |||
166 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), | 166 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), |
167 | "24-Bit Memory Range", NULL}, | 167 | "24-Bit Memory Range", NULL}, |
168 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), | 168 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), |
169 | "Write Protect", acpi_gbl_RWdecode}, | 169 | "Write Protect", acpi_gbl_rw_decode}, |
170 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", | 170 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", |
171 | NULL}, | 171 | NULL}, |
172 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", | 172 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", |
@@ -181,7 +181,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { | |||
181 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), | 181 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), |
182 | "32-Bit Memory Range", NULL}, | 182 | "32-Bit Memory Range", NULL}, |
183 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), | 183 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), |
184 | "Write Protect", acpi_gbl_RWdecode}, | 184 | "Write Protect", acpi_gbl_rw_decode}, |
185 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", | 185 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", |
186 | NULL}, | 186 | NULL}, |
187 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", | 187 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", |
@@ -196,7 +196,7 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { | |||
196 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), | 196 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), |
197 | "32-Bit Fixed Memory Range", NULL}, | 197 | "32-Bit Fixed Memory Range", NULL}, |
198 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), | 198 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), |
199 | "Write Protect", acpi_gbl_RWdecode}, | 199 | "Write Protect", acpi_gbl_rw_decode}, |
200 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", | 200 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", |
201 | NULL}, | 201 | NULL}, |
202 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), | 202 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), |
@@ -278,11 +278,11 @@ struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { | |||
278 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), | 278 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), |
279 | "Type", acpi_gbl_consume_decode}, | 279 | "Type", acpi_gbl_consume_decode}, |
280 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), | 280 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), |
281 | "Triggering", acpi_gbl_HEdecode}, | 281 | "Triggering", acpi_gbl_he_decode}, |
282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", | 282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", |
283 | acpi_gbl_LLdecode}, | 283 | acpi_gbl_ll_decode}, |
284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", | 284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", |
285 | acpi_gbl_SHRdecode}, | 285 | acpi_gbl_shr_decode}, |
286 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, | 286 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, |
287 | NULL}, | 287 | NULL}, |
288 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), | 288 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), |
@@ -314,7 +314,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { | |||
314 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), | 314 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), |
315 | "Consumer/Producer", acpi_gbl_consume_decode}, | 315 | "Consumer/Producer", acpi_gbl_consume_decode}, |
316 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", | 316 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", |
317 | acpi_gbl_DECdecode}, | 317 | acpi_gbl_dec_decode}, |
318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), | 318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), |
319 | "Min Relocatability", acpi_gbl_min_decode}, | 319 | "Min Relocatability", acpi_gbl_min_decode}, |
320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), | 320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), |
@@ -325,24 +325,24 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { | |||
325 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), | 325 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), |
326 | "Resource Type", (void *)"Memory Range"}, | 326 | "Resource Type", (void *)"Memory Range"}, |
327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), | 327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), |
328 | "Write Protect", acpi_gbl_RWdecode}, | 328 | "Write Protect", acpi_gbl_rw_decode}, |
329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), | 329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), |
330 | "Caching", acpi_gbl_MEMdecode}, | 330 | "Caching", acpi_gbl_mem_decode}, |
331 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), | 331 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), |
332 | "Range Type", acpi_gbl_MTPdecode}, | 332 | "Range Type", acpi_gbl_mtp_decode}, |
333 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), | 333 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), |
334 | "Translation", acpi_gbl_TTPdecode} | 334 | "Translation", acpi_gbl_ttp_decode} |
335 | }; | 335 | }; |
336 | 336 | ||
337 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { | 337 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { |
338 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), | 338 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), |
339 | "Resource Type", (void *)"I/O Range"}, | 339 | "Resource Type", (void *)"I/O Range"}, |
340 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), | 340 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), |
341 | "Range Type", acpi_gbl_RNGdecode}, | 341 | "Range Type", acpi_gbl_rng_decode}, |
342 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), | 342 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), |
343 | "Translation", acpi_gbl_TTPdecode}, | 343 | "Translation", acpi_gbl_ttp_decode}, |
344 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), | 344 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), |
345 | "Translation Type", acpi_gbl_TRSdecode} | 345 | "Translation Type", acpi_gbl_trs_decode} |
346 | }; | 346 | }; |
347 | 347 | ||
348 | /* | 348 | /* |
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index d9ae64b77bd9..9e7ae2f8a1d3 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c | |||
@@ -141,6 +141,7 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { | |||
141 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | 141 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ |
142 | }; | 142 | }; |
143 | #endif | 143 | #endif |
144 | |||
144 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
145 | /* | 146 | /* |
146 | * Base sizes for external AML resource descriptors, indexed by internal type. | 147 | * Base sizes for external AML resource descriptors, indexed by internal type. |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 1434e786477e..29423ce030ca 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -51,76 +51,62 @@ 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, u8 resource_index, void **context) | ||
67 | { | 68 | { |
68 | struct acpi_resource *resource = (void *)output_buffer; | 69 | struct acpi_resource **resource_ptr = |
70 | ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context); | ||
71 | struct acpi_resource *resource; | ||
69 | acpi_status status; | 72 | acpi_status status; |
70 | u8 resource_index; | ||
71 | u8 *end_aml; | ||
72 | |||
73 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); | ||
74 | |||
75 | end_aml = aml + aml_length; | ||
76 | |||
77 | /* Loop until end-of-buffer or an end_tag is found */ | ||
78 | |||
79 | while (aml < end_aml) { | ||
80 | /* Validate the Resource Type and Resource Length */ | ||
81 | |||
82 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
83 | if (ACPI_FAILURE(status)) { | ||
84 | return_ACPI_STATUS(status); | ||
85 | } | ||
86 | 73 | ||
87 | /* Convert the AML byte stream resource to a local resource struct */ | 74 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources); |
88 | |||
89 | status = | ||
90 | acpi_rs_convert_aml_to_resource(resource, | ||
91 | ACPI_CAST_PTR(union | ||
92 | aml_resource, | ||
93 | aml), | ||
94 | acpi_gbl_get_resource_dispatch | ||
95 | [resource_index]); | ||
96 | if (ACPI_FAILURE(status)) { | ||
97 | ACPI_EXCEPTION((AE_INFO, status, | ||
98 | "Could not convert AML resource (Type %X)", | ||
99 | *aml)); | ||
100 | return_ACPI_STATUS(status); | ||
101 | } | ||
102 | 75 | ||
103 | /* Normal exit on completion of an end_tag resource descriptor */ | 76 | /* |
104 | 77 | * Check that the input buffer and all subsequent pointers into it | |
105 | if (acpi_ut_get_resource_type(aml) == | 78 | * are aligned on a native word boundary. Most important on IA64 |
106 | ACPI_RESOURCE_NAME_END_TAG) { | 79 | */ |
107 | return_ACPI_STATUS(AE_OK); | 80 | resource = *resource_ptr; |
108 | } | 81 | if (ACPI_IS_MISALIGNED(resource)) { |
109 | 82 | ACPI_WARNING((AE_INFO, | |
110 | /* Point to the next input AML resource */ | 83 | "Misaligned resource pointer %p", resource)); |
111 | 84 | } | |
112 | aml += acpi_ut_get_descriptor_length(aml); | ||
113 | |||
114 | /* Point to the next structure in the output buffer */ | ||
115 | 85 | ||
116 | resource = | 86 | /* Convert the AML byte stream resource to a local resource struct */ |
117 | ACPI_ADD_PTR(struct acpi_resource, resource, | 87 | |
118 | resource->length); | 88 | status = |
89 | acpi_rs_convert_aml_to_resource(resource, | ||
90 | ACPI_CAST_PTR(union aml_resource, | ||
91 | aml), | ||
92 | acpi_gbl_get_resource_dispatch | ||
93 | [resource_index]); | ||
94 | if (ACPI_FAILURE(status)) { | ||
95 | ACPI_EXCEPTION((AE_INFO, status, | ||
96 | "Could not convert AML resource (Type %X)", | ||
97 | *aml)); | ||
98 | return_ACPI_STATUS(status); | ||
119 | } | 99 | } |
120 | 100 | ||
121 | /* Did not find an end_tag resource descriptor */ | 101 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
102 | "Type %.2X, AmlLength %.2X InternalLength %.2X\n", | ||
103 | acpi_ut_get_resource_type(aml), length, | ||
104 | resource->length)); | ||
122 | 105 | ||
123 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 106 | /* Point to the next structure in the output buffer */ |
107 | |||
108 | *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); | ||
109 | return_ACPI_STATUS(AE_OK); | ||
124 | } | 110 | } |
125 | 111 | ||
126 | /******************************************************************************* | 112 | /******************************************************************************* |
@@ -150,11 +136,12 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
150 | u8 *end_aml = output_buffer + aml_size_needed; | 136 | u8 *end_aml = output_buffer + aml_size_needed; |
151 | acpi_status status; | 137 | acpi_status status; |
152 | 138 | ||
153 | ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); | 139 | ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml); |
154 | 140 | ||
155 | /* Walk the resource descriptor list, convert each descriptor */ | 141 | /* Walk the resource descriptor list, convert each descriptor */ |
156 | 142 | ||
157 | while (aml < end_aml) { | 143 | while (aml < end_aml) { |
144 | |||
158 | /* Validate the (internal) Resource Type */ | 145 | /* Validate the (internal) Resource Type */ |
159 | 146 | ||
160 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 147 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
@@ -191,6 +178,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
191 | /* Check for end-of-list, normal exit */ | 178 | /* Check for end-of-list, normal exit */ |
192 | 179 | ||
193 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | 180 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { |
181 | |||
194 | /* An End Tag indicates the end of the input Resource Template */ | 182 | /* An End Tag indicates the end of the input Resource Template */ |
195 | 183 | ||
196 | return_ACPI_STATUS(AE_OK); | 184 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index ed866cf1c6d2..faf6e106b785 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -81,9 +81,10 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
81 | u16 item_count = 0; | 81 | u16 item_count = 0; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("rs_get_resource"); | 84 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); |
85 | 85 | ||
86 | if (((acpi_native_uint) resource) & 0x3) { | 86 | if (((acpi_native_uint) resource) & 0x3) { |
87 | |||
87 | /* Each internal resource struct is expected to be 32-bit aligned */ | 88 | /* Each internal resource struct is expected to be 32-bit aligned */ |
88 | 89 | ||
89 | ACPI_WARNING((AE_INFO, | 90 | ACPI_WARNING((AE_INFO, |
@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
295 | 296 | ||
296 | exit: | 297 | exit: |
297 | if (!flags_mode) { | 298 | if (!flags_mode) { |
298 | /* Round the resource struct length up to the next 32-bit boundary */ | ||
299 | 299 | ||
300 | resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); | 300 | /* Round the resource struct length up to the next boundary (32 or 64) */ |
301 | |||
302 | resource->length = | ||
303 | (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); | ||
301 | } | 304 | } |
302 | return_ACPI_STATUS(AE_OK); | 305 | return_ACPI_STATUS(AE_OK); |
303 | } | 306 | } |
@@ -329,7 +332,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
329 | u16 temp16 = 0; | 332 | u16 temp16 = 0; |
330 | u16 item_count = 0; | 333 | u16 item_count = 0; |
331 | 334 | ||
332 | ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); | 335 | ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml); |
333 | 336 | ||
334 | /* | 337 | /* |
335 | * First table entry must be ACPI_RSC_INITxxx and must contain the | 338 | * First table entry must be ACPI_RSC_INITxxx and must contain the |
@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { | |||
535 | 538 | ||
536 | resource->data.extended_irq.interrupt_count = temp8; | 539 | resource->data.extended_irq.interrupt_count = temp8; |
537 | if (temp8 < 1) { | 540 | if (temp8 < 1) { |
541 | |||
538 | /* Must have at least one IRQ */ | 542 | /* Must have at least one IRQ */ |
539 | 543 | ||
540 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | 544 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 25b5aedd6612..a9cbee8e8b44 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, | |||
205 | /* Length is stored differently for large and small descriptors */ | 205 | /* Length is stored differently for large and small descriptors */ |
206 | 206 | ||
207 | if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { | 207 | if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { |
208 | |||
208 | /* Large descriptor -- bytes 1-2 contain the 16-bit length */ | 209 | /* Large descriptor -- bytes 1-2 contain the 16-bit length */ |
209 | 210 | ||
210 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, | 211 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, |
@@ -298,7 +299,8 @@ static u16 acpi_rs_strcpy(char *destination, char *source) | |||
298 | * string_ptr - (optional) where to store the actual | 299 | * string_ptr - (optional) where to store the actual |
299 | * resource_source string | 300 | * resource_source string |
300 | * | 301 | * |
301 | * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit | 302 | * RETURN: Length of the string plus NULL terminator, rounded up to native |
303 | * word boundary | ||
302 | * | 304 | * |
303 | * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor | 305 | * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor |
304 | * to an internal resource descriptor | 306 | * to an internal resource descriptor |
@@ -328,6 +330,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
328 | * we add 1 to the minimum length. | 330 | * we add 1 to the minimum length. |
329 | */ | 331 | */ |
330 | if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { | 332 | if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { |
333 | |||
331 | /* Get the resource_source_index */ | 334 | /* Get the resource_source_index */ |
332 | 335 | ||
333 | resource_source->index = aml_resource_source[0]; | 336 | resource_source->index = aml_resource_source[0]; |
@@ -344,23 +347,26 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
344 | } | 347 | } |
345 | 348 | ||
346 | /* | 349 | /* |
347 | * In order for the struct_size to fall on a 32-bit boundary, calculate | 350 | * In order for the Resource length to be a multiple of the native |
348 | * the length of the string (+1 for the NULL terminator) and expand the | 351 | * word, calculate the length of the string (+1 for NULL terminator) |
349 | * struct_size to the next 32-bit boundary. | 352 | * and expand to the next word multiple. |
350 | * | 353 | * |
351 | * Zero the entire area of the buffer. | 354 | * Zero the entire area of the buffer. |
352 | */ | 355 | */ |
353 | total_length = | 356 | total_length = |
354 | ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN | 357 | (u32) |
355 | ((char *)&aml_resource_source[1]) + | 358 | ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + |
356 | 1); | 359 | 1; |
360 | total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); | ||
361 | |||
357 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); | 362 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); |
358 | 363 | ||
359 | /* Copy the resource_source string to the destination */ | 364 | /* Copy the resource_source string to the destination */ |
360 | 365 | ||
361 | resource_source->string_length = | 366 | resource_source->string_length = |
362 | acpi_rs_strcpy(resource_source->string_ptr, | 367 | acpi_rs_strcpy(resource_source->string_ptr, |
363 | (char *)&aml_resource_source[1]); | 368 | ACPI_CAST_PTR(char, |
369 | &aml_resource_source[1])); | ||
364 | 370 | ||
365 | return ((acpi_rs_length) total_length); | 371 | return ((acpi_rs_length) total_length); |
366 | } | 372 | } |
@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
405 | /* Non-zero string length indicates presence of a resource_source */ | 411 | /* Non-zero string length indicates presence of a resource_source */ |
406 | 412 | ||
407 | if (resource_source->string_length) { | 413 | if (resource_source->string_length) { |
414 | |||
408 | /* Point to the end of the AML descriptor */ | 415 | /* Point to the end of the AML descriptor */ |
409 | 416 | ||
410 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); | 417 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); |
@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
415 | 422 | ||
416 | /* Copy the resource_source string */ | 423 | /* Copy the resource_source string */ |
417 | 424 | ||
418 | ACPI_STRCPY((char *)&aml_resource_source[1], | 425 | ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]), |
419 | resource_source->string_ptr); | 426 | resource_source->string_ptr); |
420 | 427 | ||
421 | /* | 428 | /* |
@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
435 | * | 442 | * |
436 | * FUNCTION: acpi_rs_get_prt_method_data | 443 | * FUNCTION: acpi_rs_get_prt_method_data |
437 | * | 444 | * |
438 | * PARAMETERS: Handle - a handle to the containing object | 445 | * PARAMETERS: Node - Device node |
439 | * ret_buffer - a pointer to a buffer structure for the | 446 | * ret_buffer - Pointer to a buffer structure for the |
440 | * results | 447 | * results |
441 | * | 448 | * |
442 | * RETURN: Status | 449 | * RETURN: Status |
443 | * | 450 | * |
@@ -450,18 +457,19 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
450 | ******************************************************************************/ | 457 | ******************************************************************************/ |
451 | 458 | ||
452 | acpi_status | 459 | acpi_status |
453 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | 460 | acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, |
461 | struct acpi_buffer * ret_buffer) | ||
454 | { | 462 | { |
455 | union acpi_operand_object *obj_desc; | 463 | union acpi_operand_object *obj_desc; |
456 | acpi_status status; | 464 | acpi_status status; |
457 | 465 | ||
458 | ACPI_FUNCTION_TRACE("rs_get_prt_method_data"); | 466 | ACPI_FUNCTION_TRACE(rs_get_prt_method_data); |
459 | 467 | ||
460 | /* Parameters guaranteed valid by caller */ | 468 | /* Parameters guaranteed valid by caller */ |
461 | 469 | ||
462 | /* Execute the method, no parameters */ | 470 | /* Execute the method, no parameters */ |
463 | 471 | ||
464 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT, | 472 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT, |
465 | ACPI_BTYPE_PACKAGE, &obj_desc); | 473 | ACPI_BTYPE_PACKAGE, &obj_desc); |
466 | if (ACPI_FAILURE(status)) { | 474 | if (ACPI_FAILURE(status)) { |
467 | return_ACPI_STATUS(status); | 475 | return_ACPI_STATUS(status); |
@@ -483,9 +491,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
483 | * | 491 | * |
484 | * FUNCTION: acpi_rs_get_crs_method_data | 492 | * FUNCTION: acpi_rs_get_crs_method_data |
485 | * | 493 | * |
486 | * PARAMETERS: Handle - a handle to the containing object | 494 | * PARAMETERS: Node - Device node |
487 | * ret_buffer - a pointer to a buffer structure for the | 495 | * ret_buffer - Pointer to a buffer structure for the |
488 | * results | 496 | * results |
489 | * | 497 | * |
490 | * RETURN: Status | 498 | * RETURN: Status |
491 | * | 499 | * |
@@ -498,18 +506,19 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
498 | ******************************************************************************/ | 506 | ******************************************************************************/ |
499 | 507 | ||
500 | acpi_status | 508 | acpi_status |
501 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 509 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, |
510 | struct acpi_buffer *ret_buffer) | ||
502 | { | 511 | { |
503 | union acpi_operand_object *obj_desc; | 512 | union acpi_operand_object *obj_desc; |
504 | acpi_status status; | 513 | acpi_status status; |
505 | 514 | ||
506 | ACPI_FUNCTION_TRACE("rs_get_crs_method_data"); | 515 | ACPI_FUNCTION_TRACE(rs_get_crs_method_data); |
507 | 516 | ||
508 | /* Parameters guaranteed valid by caller */ | 517 | /* Parameters guaranteed valid by caller */ |
509 | 518 | ||
510 | /* Execute the method, no parameters */ | 519 | /* Execute the method, no parameters */ |
511 | 520 | ||
512 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS, | 521 | status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS, |
513 | ACPI_BTYPE_BUFFER, &obj_desc); | 522 | ACPI_BTYPE_BUFFER, &obj_desc); |
514 | if (ACPI_FAILURE(status)) { | 523 | if (ACPI_FAILURE(status)) { |
515 | return_ACPI_STATUS(status); | 524 | return_ACPI_STATUS(status); |
@@ -522,7 +531,7 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
522 | */ | 531 | */ |
523 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); | 532 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); |
524 | 533 | ||
525 | /* on exit, we must delete the object returned by evaluate_object */ | 534 | /* On exit, we must delete the object returned by evaluate_object */ |
526 | 535 | ||
527 | acpi_ut_remove_reference(obj_desc); | 536 | acpi_ut_remove_reference(obj_desc); |
528 | return_ACPI_STATUS(status); | 537 | return_ACPI_STATUS(status); |
@@ -532,9 +541,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
532 | * | 541 | * |
533 | * FUNCTION: acpi_rs_get_prs_method_data | 542 | * FUNCTION: acpi_rs_get_prs_method_data |
534 | * | 543 | * |
535 | * PARAMETERS: Handle - a handle to the containing object | 544 | * PARAMETERS: Node - Device node |
536 | * ret_buffer - a pointer to a buffer structure for the | 545 | * ret_buffer - Pointer to a buffer structure for the |
537 | * results | 546 | * results |
538 | * | 547 | * |
539 | * RETURN: Status | 548 | * RETURN: Status |
540 | * | 549 | * |
@@ -548,18 +557,19 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
548 | 557 | ||
549 | #ifdef ACPI_FUTURE_USAGE | 558 | #ifdef ACPI_FUTURE_USAGE |
550 | acpi_status | 559 | acpi_status |
551 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 560 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, |
561 | struct acpi_buffer *ret_buffer) | ||
552 | { | 562 | { |
553 | union acpi_operand_object *obj_desc; | 563 | union acpi_operand_object *obj_desc; |
554 | acpi_status status; | 564 | acpi_status status; |
555 | 565 | ||
556 | ACPI_FUNCTION_TRACE("rs_get_prs_method_data"); | 566 | ACPI_FUNCTION_TRACE(rs_get_prs_method_data); |
557 | 567 | ||
558 | /* Parameters guaranteed valid by caller */ | 568 | /* Parameters guaranteed valid by caller */ |
559 | 569 | ||
560 | /* Execute the method, no parameters */ | 570 | /* Execute the method, no parameters */ |
561 | 571 | ||
562 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS, | 572 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS, |
563 | ACPI_BTYPE_BUFFER, &obj_desc); | 573 | ACPI_BTYPE_BUFFER, &obj_desc); |
564 | if (ACPI_FAILURE(status)) { | 574 | if (ACPI_FAILURE(status)) { |
565 | return_ACPI_STATUS(status); | 575 | return_ACPI_STATUS(status); |
@@ -572,7 +582,7 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
572 | */ | 582 | */ |
573 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); | 583 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); |
574 | 584 | ||
575 | /* on exit, we must delete the object returned by evaluate_object */ | 585 | /* On exit, we must delete the object returned by evaluate_object */ |
576 | 586 | ||
577 | acpi_ut_remove_reference(obj_desc); | 587 | acpi_ut_remove_reference(obj_desc); |
578 | return_ACPI_STATUS(status); | 588 | return_ACPI_STATUS(status); |
@@ -583,10 +593,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
583 | * | 593 | * |
584 | * FUNCTION: acpi_rs_get_method_data | 594 | * FUNCTION: acpi_rs_get_method_data |
585 | * | 595 | * |
586 | * PARAMETERS: Handle - a handle to the containing object | 596 | * PARAMETERS: Handle - Handle to the containing object |
587 | * Path - Path to method, relative to Handle | 597 | * Path - Path to method, relative to Handle |
588 | * ret_buffer - a pointer to a buffer structure for the | 598 | * ret_buffer - Pointer to a buffer structure for the |
589 | * results | 599 | * results |
590 | * | 600 | * |
591 | * RETURN: Status | 601 | * RETURN: Status |
592 | * | 602 | * |
@@ -605,7 +615,7 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
605 | union acpi_operand_object *obj_desc; | 615 | union acpi_operand_object *obj_desc; |
606 | acpi_status status; | 616 | acpi_status status; |
607 | 617 | ||
608 | ACPI_FUNCTION_TRACE("rs_get_method_data"); | 618 | ACPI_FUNCTION_TRACE(rs_get_method_data); |
609 | 619 | ||
610 | /* Parameters guaranteed valid by caller */ | 620 | /* Parameters guaranteed valid by caller */ |
611 | 621 | ||
@@ -634,9 +644,9 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
634 | * | 644 | * |
635 | * FUNCTION: acpi_rs_set_srs_method_data | 645 | * FUNCTION: acpi_rs_set_srs_method_data |
636 | * | 646 | * |
637 | * PARAMETERS: Handle - a handle to the containing object | 647 | * PARAMETERS: Node - Device node |
638 | * in_buffer - a pointer to a buffer structure of the | 648 | * in_buffer - Pointer to a buffer structure of the |
639 | * parameter | 649 | * parameter |
640 | * | 650 | * |
641 | * RETURN: Status | 651 | * RETURN: Status |
642 | * | 652 | * |
@@ -646,23 +656,37 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
646 | * If the function fails an appropriate status will be returned | 656 | * If the function fails an appropriate status will be returned |
647 | * and the contents of the callers buffer is undefined. | 657 | * and the contents of the callers buffer is undefined. |
648 | * | 658 | * |
659 | * Note: Parameters guaranteed valid by caller | ||
660 | * | ||
649 | ******************************************************************************/ | 661 | ******************************************************************************/ |
650 | 662 | ||
651 | acpi_status | 663 | acpi_status |
652 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | 664 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, |
665 | struct acpi_buffer *in_buffer) | ||
653 | { | 666 | { |
654 | struct acpi_parameter_info info; | 667 | struct acpi_evaluate_info *info; |
655 | union acpi_operand_object *params[2]; | 668 | union acpi_operand_object *args[2]; |
656 | acpi_status status; | 669 | acpi_status status; |
657 | struct acpi_buffer buffer; | 670 | struct acpi_buffer buffer; |
658 | 671 | ||
659 | ACPI_FUNCTION_TRACE("rs_set_srs_method_data"); | 672 | ACPI_FUNCTION_TRACE(rs_set_srs_method_data); |
660 | 673 | ||
661 | /* Parameters guaranteed valid by caller */ | 674 | /* Allocate and initialize the evaluation information block */ |
675 | |||
676 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
677 | if (!info) { | ||
678 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
679 | } | ||
680 | |||
681 | info->prefix_node = node; | ||
682 | info->pathname = METHOD_NAME__SRS; | ||
683 | info->parameters = args; | ||
684 | info->parameter_type = ACPI_PARAM_ARGS; | ||
685 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
662 | 686 | ||
663 | /* | 687 | /* |
664 | * The in_buffer parameter will point to a linked list of | 688 | * The in_buffer parameter will point to a linked list of |
665 | * resource parameters. It needs to be formatted into a | 689 | * resource parameters. It needs to be formatted into a |
666 | * byte stream to be sent in as an input parameter to _SRS | 690 | * byte stream to be sent in as an input parameter to _SRS |
667 | * | 691 | * |
668 | * Convert the linked list into a byte stream | 692 | * Convert the linked list into a byte stream |
@@ -670,41 +694,36 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | |||
670 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 694 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
671 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); | 695 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); |
672 | if (ACPI_FAILURE(status)) { | 696 | if (ACPI_FAILURE(status)) { |
673 | return_ACPI_STATUS(status); | 697 | goto cleanup; |
674 | } | 698 | } |
675 | 699 | ||
676 | /* Init the param object */ | 700 | /* Create and initialize the method parameter object */ |
677 | 701 | ||
678 | params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 702 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
679 | if (!params[0]) { | 703 | if (!args[0]) { |
680 | acpi_os_free(buffer.pointer); | 704 | /* |
681 | return_ACPI_STATUS(AE_NO_MEMORY); | 705 | * Must free the buffer allocated above (otherwise it is freed |
706 | * later) | ||
707 | */ | ||
708 | ACPI_FREE(buffer.pointer); | ||
709 | status = AE_NO_MEMORY; | ||
710 | goto cleanup; | ||
682 | } | 711 | } |
683 | 712 | ||
684 | /* Set up the parameter object */ | 713 | args[0]->buffer.length = (u32) buffer.length; |
685 | 714 | args[0]->buffer.pointer = buffer.pointer; | |
686 | params[0]->buffer.length = (u32) buffer.length; | 715 | args[0]->common.flags = AOPOBJ_DATA_VALID; |
687 | params[0]->buffer.pointer = buffer.pointer; | 716 | args[1] = NULL; |
688 | params[0]->common.flags = AOPOBJ_DATA_VALID; | ||
689 | params[1] = NULL; | ||
690 | |||
691 | info.node = handle; | ||
692 | info.parameters = params; | ||
693 | info.parameter_type = ACPI_PARAM_ARGS; | ||
694 | 717 | ||
695 | /* Execute the method, no return value */ | 718 | /* Execute the method, no return value is expected */ |
696 | 719 | ||
697 | status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); | 720 | status = acpi_ns_evaluate(info); |
698 | if (ACPI_SUCCESS(status)) { | ||
699 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
700 | 721 | ||
701 | if (info.return_object) { | 722 | /* Clean up and return the status from acpi_ns_evaluate */ |
702 | acpi_ut_remove_reference(info.return_object); | ||
703 | } | ||
704 | } | ||
705 | 723 | ||
706 | /* Clean up and return the status from acpi_ns_evaluate_relative */ | 724 | acpi_ut_remove_reference(args[0]); |
707 | 725 | ||
708 | acpi_ut_remove_reference(params[0]); | 726 | cleanup: |
727 | ACPI_FREE(info); | ||
709 | return_ACPI_STATUS(status); | 728 | return_ACPI_STATUS(status); |
710 | } | 729 | } |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 88b67077aeeb..1999e2ab7daa 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -41,10 +41,9 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acresrc.h> | 45 | #include <acpi/acresrc.h> |
46 | #include <acpi/acnamesp.h> | ||
48 | 47 | ||
49 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
50 | ACPI_MODULE_NAME("rsxface") | 49 | ACPI_MODULE_NAME("rsxface") |
@@ -68,312 +67,262 @@ ACPI_MODULE_NAME("rsxface") | |||
68 | static acpi_status | 67 | static acpi_status |
69 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); | 68 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); |
70 | 69 | ||
70 | static acpi_status | ||
71 | acpi_rs_validate_parameters(acpi_handle device_handle, | ||
72 | struct acpi_buffer *buffer, | ||
73 | struct acpi_namespace_node **return_node); | ||
74 | |||
71 | /******************************************************************************* | 75 | /******************************************************************************* |
72 | * | 76 | * |
73 | * FUNCTION: acpi_get_irq_routing_table | 77 | * FUNCTION: acpi_rs_validate_parameters |
74 | * | 78 | * |
75 | * PARAMETERS: device_handle - a handle to the Bus device we are querying | 79 | * PARAMETERS: device_handle - Handle to a device |
76 | * ret_buffer - a pointer to a buffer to receive the | 80 | * Buffer - Pointer to a data buffer |
77 | * current resources for the device | 81 | * return_node - Pointer to where the device node is returned |
78 | * | 82 | * |
79 | * RETURN: Status | 83 | * RETURN: Status |
80 | * | 84 | * |
81 | * DESCRIPTION: This function is called to get the IRQ routing table for a | 85 | * DESCRIPTION: Common parameter validation for resource interfaces |
82 | * specific bus. The caller must first acquire a handle for the | ||
83 | * desired bus. The routine table is placed in the buffer pointed | ||
84 | * to by the ret_buffer variable parameter. | ||
85 | * | ||
86 | * If the function fails an appropriate status will be returned | ||
87 | * and the value of ret_buffer is undefined. | ||
88 | * | ||
89 | * This function attempts to execute the _PRT method contained in | ||
90 | * the object indicated by the passed device_handle. | ||
91 | * | 86 | * |
92 | ******************************************************************************/ | 87 | ******************************************************************************/ |
93 | 88 | ||
94 | acpi_status | 89 | static acpi_status |
95 | acpi_get_irq_routing_table(acpi_handle device_handle, | 90 | acpi_rs_validate_parameters(acpi_handle device_handle, |
96 | struct acpi_buffer *ret_buffer) | 91 | struct acpi_buffer *buffer, |
92 | struct acpi_namespace_node **return_node) | ||
97 | { | 93 | { |
98 | acpi_status status; | 94 | acpi_status status; |
95 | struct acpi_namespace_node *node; | ||
99 | 96 | ||
100 | ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table "); | 97 | ACPI_FUNCTION_TRACE(rs_validate_parameters); |
101 | 98 | ||
102 | /* | 99 | /* |
103 | * Must have a valid handle and buffer, So we have to have a handle | 100 | * Must have a valid handle to an ACPI device |
104 | * and a return buffer structure, and if there is a non-zero buffer length | ||
105 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
106 | * we'll be returning the needed buffer size, so keep going. | ||
107 | */ | 101 | */ |
108 | if (!device_handle) { | 102 | if (!device_handle) { |
109 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 103 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
110 | } | 104 | } |
111 | 105 | ||
112 | status = acpi_ut_validate_buffer(ret_buffer); | 106 | node = acpi_ns_map_handle_to_node(device_handle); |
107 | if (!node) { | ||
108 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
109 | } | ||
110 | |||
111 | if (node->type != ACPI_TYPE_DEVICE) { | ||
112 | return_ACPI_STATUS(AE_TYPE); | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * Validate the user buffer object | ||
117 | * | ||
118 | * if there is a non-zero buffer length we also need a valid pointer in | ||
119 | * the buffer. If it's a zero buffer length, we'll be returning the | ||
120 | * needed buffer size (later), so keep going. | ||
121 | */ | ||
122 | status = acpi_ut_validate_buffer(buffer); | ||
113 | if (ACPI_FAILURE(status)) { | 123 | if (ACPI_FAILURE(status)) { |
114 | return_ACPI_STATUS(status); | 124 | return_ACPI_STATUS(status); |
115 | } | 125 | } |
116 | 126 | ||
117 | status = acpi_rs_get_prt_method_data(device_handle, ret_buffer); | 127 | *return_node = node; |
118 | return_ACPI_STATUS(status); | 128 | return_ACPI_STATUS(AE_OK); |
119 | } | 129 | } |
120 | 130 | ||
121 | /******************************************************************************* | 131 | /******************************************************************************* |
122 | * | 132 | * |
123 | * FUNCTION: acpi_get_current_resources | 133 | * FUNCTION: acpi_get_irq_routing_table |
124 | * | 134 | * |
125 | * PARAMETERS: device_handle - a handle to the device object for the | 135 | * PARAMETERS: device_handle - Handle to the Bus device we are querying |
126 | * device we are querying | 136 | * ret_buffer - Pointer to a buffer to receive the |
127 | * ret_buffer - a pointer to a buffer to receive the | ||
128 | * current resources for the device | 137 | * current resources for the device |
129 | * | 138 | * |
130 | * RETURN: Status | 139 | * RETURN: Status |
131 | * | 140 | * |
132 | * DESCRIPTION: This function is called to get the current resources for a | 141 | * DESCRIPTION: This function is called to get the IRQ routing table for a |
133 | * specific device. The caller must first acquire a handle for | 142 | * specific bus. The caller must first acquire a handle for the |
134 | * the desired device. The resource data is placed in the buffer | 143 | * desired bus. The routine table is placed in the buffer pointed |
135 | * pointed to by the ret_buffer variable parameter. | 144 | * to by the ret_buffer variable parameter. |
136 | * | 145 | * |
137 | * If the function fails an appropriate status will be returned | 146 | * If the function fails an appropriate status will be returned |
138 | * and the value of ret_buffer is undefined. | 147 | * and the value of ret_buffer is undefined. |
139 | * | 148 | * |
140 | * This function attempts to execute the _CRS method contained in | 149 | * This function attempts to execute the _PRT method contained in |
141 | * the object indicated by the passed device_handle. | 150 | * the object indicated by the passed device_handle. |
142 | * | 151 | * |
143 | ******************************************************************************/ | 152 | ******************************************************************************/ |
144 | 153 | ||
145 | acpi_status | 154 | acpi_status |
146 | acpi_get_current_resources(acpi_handle device_handle, | 155 | acpi_get_irq_routing_table(acpi_handle device_handle, |
147 | struct acpi_buffer *ret_buffer) | 156 | struct acpi_buffer *ret_buffer) |
148 | { | 157 | { |
149 | acpi_status status; | 158 | acpi_status status; |
159 | struct acpi_namespace_node *node; | ||
150 | 160 | ||
151 | ACPI_FUNCTION_TRACE("acpi_get_current_resources"); | 161 | ACPI_FUNCTION_TRACE(acpi_get_irq_routing_table); |
152 | 162 | ||
153 | /* | 163 | /* Validate parameters then dispatch to internal routine */ |
154 | * Must have a valid handle and buffer, So we have to have a handle | ||
155 | * and a return buffer structure, and if there is a non-zero buffer length | ||
156 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
157 | * we'll be returning the needed buffer size, so keep going. | ||
158 | */ | ||
159 | if (!device_handle) { | ||
160 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
161 | } | ||
162 | 164 | ||
163 | status = acpi_ut_validate_buffer(ret_buffer); | 165 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
164 | if (ACPI_FAILURE(status)) { | 166 | if (ACPI_FAILURE(status)) { |
165 | return_ACPI_STATUS(status); | 167 | return_ACPI_STATUS(status); |
166 | } | 168 | } |
167 | 169 | ||
168 | status = acpi_rs_get_crs_method_data(device_handle, ret_buffer); | 170 | status = acpi_rs_get_prt_method_data(node, ret_buffer); |
169 | return_ACPI_STATUS(status); | 171 | return_ACPI_STATUS(status); |
170 | } | 172 | } |
171 | 173 | ||
172 | EXPORT_SYMBOL(acpi_get_current_resources); | 174 | ACPI_EXPORT_SYMBOL(acpi_get_irq_routing_table) |
173 | 175 | ||
174 | /******************************************************************************* | 176 | /******************************************************************************* |
175 | * | 177 | * |
176 | * FUNCTION: acpi_get_possible_resources | 178 | * FUNCTION: acpi_get_current_resources |
177 | * | 179 | * |
178 | * PARAMETERS: device_handle - a handle to the device object for the | 180 | * PARAMETERS: device_handle - Handle to the device object for the |
179 | * device we are querying | 181 | * device we are querying |
180 | * ret_buffer - a pointer to a buffer to receive the | 182 | * ret_buffer - Pointer to a buffer to receive the |
181 | * resources for the device | 183 | * current resources for the device |
182 | * | 184 | * |
183 | * RETURN: Status | 185 | * RETURN: Status |
184 | * | 186 | * |
185 | * DESCRIPTION: This function is called to get a list of the possible resources | 187 | * DESCRIPTION: This function is called to get the current resources for a |
186 | * for a specific device. The caller must first acquire a handle | 188 | * specific device. The caller must first acquire a handle for |
187 | * for the desired device. The resource data is placed in the | 189 | * the desired device. The resource data is placed in the buffer |
188 | * buffer pointed to by the ret_buffer variable. | 190 | * pointed to by the ret_buffer variable parameter. |
189 | * | 191 | * |
190 | * If the function fails an appropriate status will be returned | 192 | * If the function fails an appropriate status will be returned |
191 | * and the value of ret_buffer is undefined. | 193 | * and the value of ret_buffer is undefined. |
192 | * | 194 | * |
195 | * This function attempts to execute the _CRS method contained in | ||
196 | * the object indicated by the passed device_handle. | ||
197 | * | ||
193 | ******************************************************************************/ | 198 | ******************************************************************************/ |
194 | |||
195 | #ifdef ACPI_FUTURE_USAGE | ||
196 | acpi_status | 199 | acpi_status |
197 | acpi_get_possible_resources(acpi_handle device_handle, | 200 | acpi_get_current_resources(acpi_handle device_handle, |
198 | struct acpi_buffer *ret_buffer) | 201 | struct acpi_buffer *ret_buffer) |
199 | { | 202 | { |
200 | acpi_status status; | 203 | acpi_status status; |
204 | struct acpi_namespace_node *node; | ||
201 | 205 | ||
202 | ACPI_FUNCTION_TRACE("acpi_get_possible_resources"); | 206 | ACPI_FUNCTION_TRACE(acpi_get_current_resources); |
203 | 207 | ||
204 | /* | 208 | /* Validate parameters then dispatch to internal routine */ |
205 | * Must have a valid handle and buffer, So we have to have a handle | ||
206 | * and a return buffer structure, and if there is a non-zero buffer length | ||
207 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
208 | * we'll be returning the needed buffer size, so keep going. | ||
209 | */ | ||
210 | if (!device_handle) { | ||
211 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
212 | } | ||
213 | 209 | ||
214 | status = acpi_ut_validate_buffer(ret_buffer); | 210 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
215 | if (ACPI_FAILURE(status)) { | 211 | if (ACPI_FAILURE(status)) { |
216 | return_ACPI_STATUS(status); | 212 | return_ACPI_STATUS(status); |
217 | } | 213 | } |
218 | 214 | ||
219 | status = acpi_rs_get_prs_method_data(device_handle, ret_buffer); | 215 | status = acpi_rs_get_crs_method_data(node, ret_buffer); |
220 | return_ACPI_STATUS(status); | 216 | return_ACPI_STATUS(status); |
221 | } | 217 | } |
222 | 218 | ||
223 | EXPORT_SYMBOL(acpi_get_possible_resources); | 219 | ACPI_EXPORT_SYMBOL(acpi_get_current_resources) |
224 | #endif /* ACPI_FUTURE_USAGE */ | ||
225 | 220 | ||
221 | #ifdef ACPI_FUTURE_USAGE | ||
226 | /******************************************************************************* | 222 | /******************************************************************************* |
227 | * | 223 | * |
228 | * FUNCTION: acpi_walk_resources | 224 | * FUNCTION: acpi_get_possible_resources |
229 | * | 225 | * |
230 | * PARAMETERS: device_handle - Handle to the device object for the | 226 | * PARAMETERS: device_handle - Handle to the device object for the |
231 | * device we are querying | 227 | * device we are querying |
232 | * Name - Method name of the resources we want | 228 | * ret_buffer - Pointer to a buffer to receive the |
233 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | 229 | * resources for the device |
234 | * user_function - Called for each resource | ||
235 | * Context - Passed to user_function | ||
236 | * | 230 | * |
237 | * RETURN: Status | 231 | * RETURN: Status |
238 | * | 232 | * |
239 | * DESCRIPTION: Retrieves the current or possible resource list for the | 233 | * DESCRIPTION: This function is called to get a list of the possible resources |
240 | * specified device. The user_function is called once for | 234 | * for a specific device. The caller must first acquire a handle |
241 | * each resource in the list. | 235 | * for the desired device. The resource data is placed in the |
236 | * buffer pointed to by the ret_buffer variable. | ||
237 | * | ||
238 | * If the function fails an appropriate status will be returned | ||
239 | * and the value of ret_buffer is undefined. | ||
242 | * | 240 | * |
243 | ******************************************************************************/ | 241 | ******************************************************************************/ |
244 | |||
245 | acpi_status | 242 | acpi_status |
246 | acpi_walk_resources(acpi_handle device_handle, | 243 | acpi_get_possible_resources(acpi_handle device_handle, |
247 | char *name, | 244 | struct acpi_buffer *ret_buffer) |
248 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) | ||
249 | { | 245 | { |
250 | acpi_status status; | 246 | acpi_status status; |
251 | struct acpi_buffer buffer; | 247 | struct acpi_namespace_node *node; |
252 | struct acpi_resource *resource; | ||
253 | struct acpi_resource *resource_end; | ||
254 | |||
255 | ACPI_FUNCTION_TRACE("acpi_walk_resources"); | ||
256 | |||
257 | /* Parameter validation */ | ||
258 | 248 | ||
259 | if (!device_handle || !user_function || !name || | 249 | ACPI_FUNCTION_TRACE(acpi_get_possible_resources); |
260 | (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && | ||
261 | ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { | ||
262 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
263 | } | ||
264 | 250 | ||
265 | /* Get the _CRS or _PRS resource list */ | 251 | /* Validate parameters then dispatch to internal routine */ |
266 | 252 | ||
267 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 253 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
268 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
269 | if (ACPI_FAILURE(status)) { | 254 | if (ACPI_FAILURE(status)) { |
270 | return_ACPI_STATUS(status); | 255 | return_ACPI_STATUS(status); |
271 | } | 256 | } |
272 | 257 | ||
273 | /* Buffer now contains the resource list */ | 258 | status = acpi_rs_get_prs_method_data(node, ret_buffer); |
274 | |||
275 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); | ||
276 | resource_end = | ||
277 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); | ||
278 | |||
279 | /* Walk the resource list until the end_tag is found (or buffer end) */ | ||
280 | |||
281 | while (resource < resource_end) { | ||
282 | /* Sanity check the resource */ | ||
283 | |||
284 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | ||
285 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
286 | break; | ||
287 | } | ||
288 | |||
289 | /* Invoke the user function, abort on any error returned */ | ||
290 | |||
291 | status = user_function(resource, context); | ||
292 | if (ACPI_FAILURE(status)) { | ||
293 | if (status == AE_CTRL_TERMINATE) { | ||
294 | /* This is an OK termination by the user function */ | ||
295 | |||
296 | status = AE_OK; | ||
297 | } | ||
298 | break; | ||
299 | } | ||
300 | |||
301 | /* end_tag indicates end-of-list */ | ||
302 | |||
303 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | ||
304 | break; | ||
305 | } | ||
306 | |||
307 | /* Get the next resource descriptor */ | ||
308 | |||
309 | resource = | ||
310 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
311 | resource->length); | ||
312 | } | ||
313 | |||
314 | ACPI_MEM_FREE(buffer.pointer); | ||
315 | return_ACPI_STATUS(status); | 259 | return_ACPI_STATUS(status); |
316 | } | 260 | } |
317 | 261 | ||
318 | EXPORT_SYMBOL(acpi_walk_resources); | 262 | ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) |
263 | #endif /* ACPI_FUTURE_USAGE */ | ||
319 | 264 | ||
320 | /******************************************************************************* | 265 | /******************************************************************************* |
321 | * | 266 | * |
322 | * FUNCTION: acpi_set_current_resources | 267 | * FUNCTION: acpi_set_current_resources |
323 | * | 268 | * |
324 | * PARAMETERS: device_handle - a handle to the device object for the | 269 | * PARAMETERS: device_handle - Handle to the device object for the |
325 | * device we are changing the resources of | 270 | * device we are setting resources |
326 | * in_buffer - a pointer to a buffer containing the | 271 | * in_buffer - Pointer to a buffer containing the |
327 | * resources to be set for the device | 272 | * resources to be set for the device |
328 | * | 273 | * |
329 | * RETURN: Status | 274 | * RETURN: Status |
330 | * | 275 | * |
331 | * DESCRIPTION: This function is called to set the current resources for a | 276 | * DESCRIPTION: This function is called to set the current resources for a |
332 | * specific device. The caller must first acquire a handle for | 277 | * specific device. The caller must first acquire a handle for |
333 | * the desired device. The resource data is passed to the routine | 278 | * the desired device. The resource data is passed to the routine |
334 | * the buffer pointed to by the in_buffer variable. | 279 | * the buffer pointed to by the in_buffer variable. |
335 | * | 280 | * |
336 | ******************************************************************************/ | 281 | ******************************************************************************/ |
337 | |||
338 | acpi_status | 282 | acpi_status |
339 | acpi_set_current_resources(acpi_handle device_handle, | 283 | acpi_set_current_resources(acpi_handle device_handle, |
340 | struct acpi_buffer *in_buffer) | 284 | struct acpi_buffer *in_buffer) |
341 | { | 285 | { |
342 | acpi_status status; | 286 | acpi_status status; |
287 | struct acpi_namespace_node *node; | ||
343 | 288 | ||
344 | ACPI_FUNCTION_TRACE("acpi_set_current_resources"); | 289 | ACPI_FUNCTION_TRACE(acpi_set_current_resources); |
345 | 290 | ||
346 | /* Must have a valid handle and buffer */ | 291 | /* Validate the buffer, don't allow zero length */ |
347 | 292 | ||
348 | if ((!device_handle) || | 293 | if ((!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { |
349 | (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { | ||
350 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 294 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
351 | } | 295 | } |
352 | 296 | ||
353 | status = acpi_rs_set_srs_method_data(device_handle, in_buffer); | 297 | /* Validate parameters then dispatch to internal routine */ |
298 | |||
299 | status = acpi_rs_validate_parameters(device_handle, in_buffer, &node); | ||
300 | if (ACPI_FAILURE(status)) { | ||
301 | return_ACPI_STATUS(status); | ||
302 | } | ||
303 | |||
304 | status = acpi_rs_set_srs_method_data(node, in_buffer); | ||
354 | return_ACPI_STATUS(status); | 305 | return_ACPI_STATUS(status); |
355 | } | 306 | } |
356 | 307 | ||
357 | EXPORT_SYMBOL(acpi_set_current_resources); | 308 | ACPI_EXPORT_SYMBOL(acpi_set_current_resources) |
358 | 309 | ||
359 | /****************************************************************************** | 310 | /****************************************************************************** |
360 | * | 311 | * |
361 | * FUNCTION: acpi_resource_to_address64 | 312 | * FUNCTION: acpi_resource_to_address64 |
362 | * | 313 | * |
363 | * PARAMETERS: Resource - Pointer to a resource | 314 | * PARAMETERS: Resource - Pointer to a resource |
364 | * Out - Pointer to the users's return | 315 | * Out - Pointer to the users's return buffer |
365 | * buffer (a struct | 316 | * (a struct acpi_resource_address64) |
366 | * struct acpi_resource_address64) | ||
367 | * | 317 | * |
368 | * RETURN: Status | 318 | * RETURN: Status |
369 | * | 319 | * |
370 | * DESCRIPTION: If the resource is an address16, address32, or address64, | 320 | * DESCRIPTION: If the resource is an address16, address32, or address64, |
371 | * copy it to the address64 return buffer. This saves the | 321 | * copy it to the address64 return buffer. This saves the |
372 | * caller from having to duplicate code for different-sized | 322 | * caller from having to duplicate code for different-sized |
373 | * addresses. | 323 | * addresses. |
374 | * | 324 | * |
375 | ******************************************************************************/ | 325 | ******************************************************************************/ |
376 | |||
377 | acpi_status | 326 | acpi_status |
378 | acpi_resource_to_address64(struct acpi_resource *resource, | 327 | acpi_resource_to_address64(struct acpi_resource *resource, |
379 | struct acpi_resource_address64 *out) | 328 | struct acpi_resource_address64 *out) |
@@ -415,18 +364,18 @@ acpi_resource_to_address64(struct acpi_resource *resource, | |||
415 | return (AE_OK); | 364 | return (AE_OK); |
416 | } | 365 | } |
417 | 366 | ||
418 | EXPORT_SYMBOL(acpi_resource_to_address64); | 367 | ACPI_EXPORT_SYMBOL(acpi_resource_to_address64) |
419 | 368 | ||
420 | /******************************************************************************* | 369 | /******************************************************************************* |
421 | * | 370 | * |
422 | * FUNCTION: acpi_get_vendor_resource | 371 | * FUNCTION: acpi_get_vendor_resource |
423 | * | 372 | * |
424 | * PARAMETERS: device_handle - Handle for the parent device object | 373 | * PARAMETERS: device_handle - Handle for the parent device object |
425 | * Name - Method name for the parent resource | 374 | * Name - Method name for the parent resource |
426 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | 375 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) |
427 | * Uuid - Pointer to the UUID to be matched. | 376 | * Uuid - Pointer to the UUID to be matched. |
428 | * includes both subtype and 16-byte UUID | 377 | * includes both subtype and 16-byte UUID |
429 | * ret_buffer - Where the vendor resource is returned | 378 | * ret_buffer - Where the vendor resource is returned |
430 | * | 379 | * |
431 | * RETURN: Status | 380 | * RETURN: Status |
432 | * | 381 | * |
@@ -435,7 +384,6 @@ EXPORT_SYMBOL(acpi_resource_to_address64); | |||
435 | * UUID subtype. Returns a struct acpi_resource of type Vendor. | 384 | * UUID subtype. Returns a struct acpi_resource of type Vendor. |
436 | * | 385 | * |
437 | ******************************************************************************/ | 386 | ******************************************************************************/ |
438 | |||
439 | acpi_status | 387 | acpi_status |
440 | acpi_get_vendor_resource(acpi_handle device_handle, | 388 | acpi_get_vendor_resource(acpi_handle device_handle, |
441 | char *name, | 389 | char *name, |
@@ -467,18 +415,19 @@ acpi_get_vendor_resource(acpi_handle device_handle, | |||
467 | return (info.status); | 415 | return (info.status); |
468 | } | 416 | } |
469 | 417 | ||
418 | ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource) | ||
419 | |||
470 | /******************************************************************************* | 420 | /******************************************************************************* |
471 | * | 421 | * |
472 | * FUNCTION: acpi_rs_match_vendor_resource | 422 | * FUNCTION: acpi_rs_match_vendor_resource |
473 | * | 423 | * |
474 | * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK | 424 | * PARAMETERS: acpi_walk_resource_callback |
475 | * | 425 | * |
476 | * RETURN: Status | 426 | * RETURN: Status |
477 | * | 427 | * |
478 | * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID | 428 | * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID |
479 | * | 429 | * |
480 | ******************************************************************************/ | 430 | ******************************************************************************/ |
481 | |||
482 | static acpi_status | 431 | static acpi_status |
483 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | 432 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) |
484 | { | 433 | { |
@@ -526,3 +475,101 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | |||
526 | info->status = AE_OK; | 475 | info->status = AE_OK; |
527 | return (AE_CTRL_TERMINATE); | 476 | return (AE_CTRL_TERMINATE); |
528 | } | 477 | } |
478 | |||
479 | ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource) | ||
480 | |||
481 | /******************************************************************************* | ||
482 | * | ||
483 | * FUNCTION: acpi_walk_resources | ||
484 | * | ||
485 | * PARAMETERS: device_handle - Handle to the device object for the | ||
486 | * device we are querying | ||
487 | * Name - Method name of the resources we want | ||
488 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | ||
489 | * user_function - Called for each resource | ||
490 | * Context - Passed to user_function | ||
491 | * | ||
492 | * RETURN: Status | ||
493 | * | ||
494 | * DESCRIPTION: Retrieves the current or possible resource list for the | ||
495 | * specified device. The user_function is called once for | ||
496 | * each resource in the list. | ||
497 | * | ||
498 | ******************************************************************************/ | ||
499 | |||
500 | acpi_status | ||
501 | acpi_walk_resources(acpi_handle device_handle, | ||
502 | char *name, | ||
503 | acpi_walk_resource_callback user_function, void *context) | ||
504 | { | ||
505 | acpi_status status; | ||
506 | struct acpi_buffer buffer; | ||
507 | struct acpi_resource *resource; | ||
508 | struct acpi_resource *resource_end; | ||
509 | |||
510 | ACPI_FUNCTION_TRACE(acpi_walk_resources); | ||
511 | |||
512 | /* Parameter validation */ | ||
513 | |||
514 | if (!device_handle || !user_function || !name || | ||
515 | (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && | ||
516 | !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS))) { | ||
517 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
518 | } | ||
519 | |||
520 | /* Get the _CRS or _PRS resource list */ | ||
521 | |||
522 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
523 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
524 | if (ACPI_FAILURE(status)) { | ||
525 | return_ACPI_STATUS(status); | ||
526 | } | ||
527 | |||
528 | /* Buffer now contains the resource list */ | ||
529 | |||
530 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); | ||
531 | resource_end = | ||
532 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); | ||
533 | |||
534 | /* Walk the resource list until the end_tag is found (or buffer end) */ | ||
535 | |||
536 | while (resource < resource_end) { | ||
537 | |||
538 | /* Sanity check the resource */ | ||
539 | |||
540 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | ||
541 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
542 | break; | ||
543 | } | ||
544 | |||
545 | /* Invoke the user function, abort on any error returned */ | ||
546 | |||
547 | status = user_function(resource, context); | ||
548 | if (ACPI_FAILURE(status)) { | ||
549 | if (status == AE_CTRL_TERMINATE) { | ||
550 | |||
551 | /* This is an OK termination by the user function */ | ||
552 | |||
553 | status = AE_OK; | ||
554 | } | ||
555 | break; | ||
556 | } | ||
557 | |||
558 | /* end_tag indicates end-of-list */ | ||
559 | |||
560 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | ||
561 | break; | ||
562 | } | ||
563 | |||
564 | /* Get the next resource descriptor */ | ||
565 | |||
566 | resource = | ||
567 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
568 | resource->length); | ||
569 | } | ||
570 | |||
571 | ACPI_FREE(buffer.pointer); | ||
572 | return_ACPI_STATUS(status); | ||
573 | } | ||
574 | |||
575 | ACPI_EXPORT_SYMBOL(acpi_walk_resources) | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index a0ab828b2cc5..f8316a05ede7 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -142,7 +142,7 @@ static void acpi_device_register(struct acpi_device *device, | |||
142 | create_sysfs_device_files(device); | 142 | create_sysfs_device_files(device); |
143 | } | 143 | } |
144 | 144 | ||
145 | static int acpi_device_unregister(struct acpi_device *device, int type) | 145 | static void acpi_device_unregister(struct acpi_device *device, int type) |
146 | { | 146 | { |
147 | spin_lock(&acpi_device_lock); | 147 | spin_lock(&acpi_device_lock); |
148 | if (device->parent) { | 148 | if (device->parent) { |
@@ -158,7 +158,6 @@ static int acpi_device_unregister(struct acpi_device *device, int type) | |||
158 | acpi_detach_data(device->handle, acpi_bus_data_handler); | 158 | acpi_detach_data(device->handle, acpi_bus_data_handler); |
159 | remove_sysfs_device_files(device); | 159 | remove_sysfs_device_files(device); |
160 | kobject_unregister(&device->kobj); | 160 | kobject_unregister(&device->kobj); |
161 | return 0; | ||
162 | } | 161 | } |
163 | 162 | ||
164 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) | 163 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) |
@@ -234,12 +233,9 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
234 | 233 | ||
235 | int acpi_match_ids(struct acpi_device *device, char *ids) | 234 | int acpi_match_ids(struct acpi_device *device, char *ids) |
236 | { | 235 | { |
237 | int error = 0; | ||
238 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
239 | |||
240 | if (device->flags.hardware_id) | 236 | if (device->flags.hardware_id) |
241 | if (strstr(ids, device->pnp.hardware_id)) | 237 | if (strstr(ids, device->pnp.hardware_id)) |
242 | goto Done; | 238 | return 0; |
243 | 239 | ||
244 | if (device->flags.compatible_ids) { | 240 | if (device->flags.compatible_ids) { |
245 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; | 241 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; |
@@ -248,15 +244,10 @@ int acpi_match_ids(struct acpi_device *device, char *ids) | |||
248 | /* compare multiple _CID entries against driver ids */ | 244 | /* compare multiple _CID entries against driver ids */ |
249 | for (i = 0; i < cid_list->count; i++) { | 245 | for (i = 0; i < cid_list->count; i++) { |
250 | if (strstr(ids, cid_list->id[i].value)) | 246 | if (strstr(ids, cid_list->id[i].value)) |
251 | goto Done; | 247 | return 0; |
252 | } | 248 | } |
253 | } | 249 | } |
254 | error = -ENOENT; | 250 | return -ENOENT; |
255 | |||
256 | Done: | ||
257 | if (buffer.pointer) | ||
258 | acpi_os_free(buffer.pointer); | ||
259 | return error; | ||
260 | } | 251 | } |
261 | 252 | ||
262 | static acpi_status | 253 | static acpi_status |
@@ -441,10 +432,7 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) | |||
441 | islockable = device->flags.lockable; | 432 | islockable = device->flags.lockable; |
442 | handle = device->handle; | 433 | handle = device->handle; |
443 | 434 | ||
444 | if (type == ACPI_TYPE_PROCESSOR) | 435 | result = acpi_bus_trim(device, 1); |
445 | result = acpi_bus_trim(device, 0); | ||
446 | else | ||
447 | result = acpi_bus_trim(device, 1); | ||
448 | 436 | ||
449 | if (!result) | 437 | if (!result) |
450 | result = acpi_eject_operation(handle, islockable); | 438 | result = acpi_eject_operation(handle, islockable); |
@@ -471,7 +459,6 @@ static int acpi_bus_get_perf_flags(struct acpi_device *device) | |||
471 | -------------------------------------------------------------------------- */ | 459 | -------------------------------------------------------------------------- */ |
472 | 460 | ||
473 | static LIST_HEAD(acpi_bus_drivers); | 461 | static LIST_HEAD(acpi_bus_drivers); |
474 | static DECLARE_MUTEX(acpi_bus_drivers_lock); | ||
475 | 462 | ||
476 | /** | 463 | /** |
477 | * acpi_bus_match - match device IDs to driver's supported IDs | 464 | * acpi_bus_match - match device IDs to driver's supported IDs |
@@ -548,10 +535,9 @@ static int acpi_start_single_object(struct acpi_device *device) | |||
548 | return_VALUE(result); | 535 | return_VALUE(result); |
549 | } | 536 | } |
550 | 537 | ||
551 | static int acpi_driver_attach(struct acpi_driver *drv) | 538 | static void acpi_driver_attach(struct acpi_driver *drv) |
552 | { | 539 | { |
553 | struct list_head *node, *next; | 540 | struct list_head *node, *next; |
554 | int count = 0; | ||
555 | 541 | ||
556 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); | 542 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); |
557 | 543 | ||
@@ -568,7 +554,6 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
568 | if (!acpi_bus_driver_init(dev, drv)) { | 554 | if (!acpi_bus_driver_init(dev, drv)) { |
569 | acpi_start_single_object(dev); | 555 | acpi_start_single_object(dev); |
570 | atomic_inc(&drv->references); | 556 | atomic_inc(&drv->references); |
571 | count++; | ||
572 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 557 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
573 | "Found driver [%s] for device [%s]\n", | 558 | "Found driver [%s] for device [%s]\n", |
574 | drv->name, dev->pnp.bus_id)); | 559 | drv->name, dev->pnp.bus_id)); |
@@ -577,10 +562,9 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
577 | spin_lock(&acpi_device_lock); | 562 | spin_lock(&acpi_device_lock); |
578 | } | 563 | } |
579 | spin_unlock(&acpi_device_lock); | 564 | spin_unlock(&acpi_device_lock); |
580 | return_VALUE(count); | ||
581 | } | 565 | } |
582 | 566 | ||
583 | static int acpi_driver_detach(struct acpi_driver *drv) | 567 | static void acpi_driver_detach(struct acpi_driver *drv) |
584 | { | 568 | { |
585 | struct list_head *node, *next; | 569 | struct list_head *node, *next; |
586 | 570 | ||
@@ -602,7 +586,6 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
602 | } | 586 | } |
603 | } | 587 | } |
604 | spin_unlock(&acpi_device_lock); | 588 | spin_unlock(&acpi_device_lock); |
605 | return_VALUE(0); | ||
606 | } | 589 | } |
607 | 590 | ||
608 | /** | 591 | /** |
@@ -610,28 +593,22 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
610 | * @driver: driver being registered | 593 | * @driver: driver being registered |
611 | * | 594 | * |
612 | * Registers a driver with the ACPI bus. Searches the namespace for all | 595 | * Registers a driver with the ACPI bus. Searches the namespace for all |
613 | * devices that match the driver's criteria and binds. Returns the | 596 | * devices that match the driver's criteria and binds. Returns zero for |
614 | * number of devices that were claimed by the driver, or a negative | 597 | * success or a negative error status for failure. |
615 | * error status for failure. | ||
616 | */ | 598 | */ |
617 | int acpi_bus_register_driver(struct acpi_driver *driver) | 599 | int acpi_bus_register_driver(struct acpi_driver *driver) |
618 | { | 600 | { |
619 | int count; | ||
620 | |||
621 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); | 601 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); |
622 | 602 | ||
623 | if (acpi_disabled) | 603 | if (acpi_disabled) |
624 | return_VALUE(-ENODEV); | 604 | return_VALUE(-ENODEV); |
625 | 605 | ||
626 | if (!driver) | ||
627 | return_VALUE(-EINVAL); | ||
628 | |||
629 | spin_lock(&acpi_device_lock); | 606 | spin_lock(&acpi_device_lock); |
630 | list_add_tail(&driver->node, &acpi_bus_drivers); | 607 | list_add_tail(&driver->node, &acpi_bus_drivers); |
631 | spin_unlock(&acpi_device_lock); | 608 | spin_unlock(&acpi_device_lock); |
632 | count = acpi_driver_attach(driver); | 609 | acpi_driver_attach(driver); |
633 | 610 | ||
634 | return_VALUE(count); | 611 | return_VALUE(0); |
635 | } | 612 | } |
636 | 613 | ||
637 | EXPORT_SYMBOL(acpi_bus_register_driver); | 614 | EXPORT_SYMBOL(acpi_bus_register_driver); |
@@ -643,23 +620,16 @@ EXPORT_SYMBOL(acpi_bus_register_driver); | |||
643 | * Unregisters a driver with the ACPI bus. Searches the namespace for all | 620 | * Unregisters a driver with the ACPI bus. Searches the namespace for all |
644 | * devices that match the driver's criteria and unbinds. | 621 | * devices that match the driver's criteria and unbinds. |
645 | */ | 622 | */ |
646 | int acpi_bus_unregister_driver(struct acpi_driver *driver) | 623 | void acpi_bus_unregister_driver(struct acpi_driver *driver) |
647 | { | 624 | { |
648 | int error = 0; | 625 | acpi_driver_detach(driver); |
649 | 626 | ||
650 | ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver"); | 627 | if (!atomic_read(&driver->references)) { |
651 | 628 | spin_lock(&acpi_device_lock); | |
652 | if (driver) { | 629 | list_del_init(&driver->node); |
653 | acpi_driver_detach(driver); | 630 | spin_unlock(&acpi_device_lock); |
654 | 631 | } | |
655 | if (!atomic_read(&driver->references)) { | 632 | return; |
656 | spin_lock(&acpi_device_lock); | ||
657 | list_del_init(&driver->node); | ||
658 | spin_unlock(&acpi_device_lock); | ||
659 | } | ||
660 | } else | ||
661 | error = -EINVAL; | ||
662 | return_VALUE(error); | ||
663 | } | 633 | } |
664 | 634 | ||
665 | EXPORT_SYMBOL(acpi_bus_unregister_driver); | 635 | EXPORT_SYMBOL(acpi_bus_unregister_driver); |
@@ -1371,6 +1341,100 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) | |||
1371 | return_VALUE(result); | 1341 | return_VALUE(result); |
1372 | } | 1342 | } |
1373 | 1343 | ||
1344 | |||
1345 | static inline struct acpi_device * to_acpi_dev(struct device * dev) | ||
1346 | { | ||
1347 | return container_of(dev, struct acpi_device, dev); | ||
1348 | } | ||
1349 | |||
1350 | |||
1351 | static int root_suspend(struct acpi_device * acpi_dev, pm_message_t state) | ||
1352 | { | ||
1353 | struct acpi_device * dev, * next; | ||
1354 | int result; | ||
1355 | |||
1356 | spin_lock(&acpi_device_lock); | ||
1357 | list_for_each_entry_safe_reverse(dev, next, &acpi_device_list, g_list) { | ||
1358 | if (dev->driver && dev->driver->ops.suspend) { | ||
1359 | spin_unlock(&acpi_device_lock); | ||
1360 | result = dev->driver->ops.suspend(dev, 0); | ||
1361 | if (result) { | ||
1362 | printk(KERN_ERR PREFIX "[%s - %s] Suspend failed: %d\n", | ||
1363 | acpi_device_name(dev), | ||
1364 | acpi_device_bid(dev), result); | ||
1365 | } | ||
1366 | spin_lock(&acpi_device_lock); | ||
1367 | } | ||
1368 | } | ||
1369 | spin_unlock(&acpi_device_lock); | ||
1370 | return 0; | ||
1371 | } | ||
1372 | |||
1373 | |||
1374 | static int acpi_device_suspend(struct device * dev, pm_message_t state) | ||
1375 | { | ||
1376 | struct acpi_device * acpi_dev = to_acpi_dev(dev); | ||
1377 | |||
1378 | /* | ||
1379 | * For now, we should only register 1 generic device - | ||
1380 | * the ACPI root device - and from there, we walk the | ||
1381 | * tree of ACPI devices to suspend each one using the | ||
1382 | * ACPI driver methods. | ||
1383 | */ | ||
1384 | if (acpi_dev->handle == ACPI_ROOT_OBJECT) | ||
1385 | root_suspend(acpi_dev, state); | ||
1386 | return 0; | ||
1387 | } | ||
1388 | |||
1389 | |||
1390 | |||
1391 | static int root_resume(struct acpi_device * acpi_dev) | ||
1392 | { | ||
1393 | struct acpi_device * dev, * next; | ||
1394 | int result; | ||
1395 | |||
1396 | spin_lock(&acpi_device_lock); | ||
1397 | list_for_each_entry_safe(dev, next, &acpi_device_list, g_list) { | ||
1398 | if (dev->driver && dev->driver->ops.resume) { | ||
1399 | spin_unlock(&acpi_device_lock); | ||
1400 | result = dev->driver->ops.resume(dev, 0); | ||
1401 | if (result) { | ||
1402 | printk(KERN_ERR PREFIX "[%s - %s] resume failed: %d\n", | ||
1403 | acpi_device_name(dev), | ||
1404 | acpi_device_bid(dev), result); | ||
1405 | } | ||
1406 | spin_lock(&acpi_device_lock); | ||
1407 | } | ||
1408 | } | ||
1409 | spin_unlock(&acpi_device_lock); | ||
1410 | return 0; | ||
1411 | } | ||
1412 | |||
1413 | |||
1414 | static int acpi_device_resume(struct device * dev) | ||
1415 | { | ||
1416 | struct acpi_device * acpi_dev = to_acpi_dev(dev); | ||
1417 | |||
1418 | /* | ||
1419 | * For now, we should only register 1 generic device - | ||
1420 | * the ACPI root device - and from there, we walk the | ||
1421 | * tree of ACPI devices to resume each one using the | ||
1422 | * ACPI driver methods. | ||
1423 | */ | ||
1424 | if (acpi_dev->handle == ACPI_ROOT_OBJECT) | ||
1425 | root_resume(acpi_dev); | ||
1426 | return 0; | ||
1427 | } | ||
1428 | |||
1429 | |||
1430 | struct bus_type acpi_bus_type = { | ||
1431 | .name = "acpi", | ||
1432 | .suspend = acpi_device_suspend, | ||
1433 | .resume = acpi_device_resume, | ||
1434 | }; | ||
1435 | |||
1436 | |||
1437 | |||
1374 | static int __init acpi_scan_init(void) | 1438 | static int __init acpi_scan_init(void) |
1375 | { | 1439 | { |
1376 | int result; | 1440 | int result; |
@@ -1383,6 +1447,12 @@ static int __init acpi_scan_init(void) | |||
1383 | 1447 | ||
1384 | kset_register(&acpi_namespace_kset); | 1448 | kset_register(&acpi_namespace_kset); |
1385 | 1449 | ||
1450 | result = bus_register(&acpi_bus_type); | ||
1451 | if (result) { | ||
1452 | /* We don't want to quit even if we failed to add suspend/resume */ | ||
1453 | printk(KERN_ERR PREFIX "Could not register bus type\n"); | ||
1454 | } | ||
1455 | |||
1386 | /* | 1456 | /* |
1387 | * Create the root device in the bus's device tree | 1457 | * Create the root device in the bus's device tree |
1388 | */ | 1458 | */ |
@@ -1392,6 +1462,16 @@ static int __init acpi_scan_init(void) | |||
1392 | goto Done; | 1462 | goto Done; |
1393 | 1463 | ||
1394 | result = acpi_start_single_object(acpi_root); | 1464 | result = acpi_start_single_object(acpi_root); |
1465 | if (result) | ||
1466 | goto Done; | ||
1467 | |||
1468 | acpi_root->dev.bus = &acpi_bus_type; | ||
1469 | snprintf(acpi_root->dev.bus_id, BUS_ID_SIZE, "%s", acpi_bus_type.name); | ||
1470 | result = device_register(&acpi_root->dev); | ||
1471 | if (result) { | ||
1472 | /* We don't want to quit even if we failed to add suspend/resume */ | ||
1473 | printk(KERN_ERR PREFIX "Could not register device\n"); | ||
1474 | } | ||
1395 | 1475 | ||
1396 | /* | 1476 | /* |
1397 | * Enumerate devices in the ACPI namespace. | 1477 | * Enumerate devices in the ACPI namespace. |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 930427fc0c4b..62ce87d71651 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -105,6 +105,14 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
105 | default: | 105 | default: |
106 | return -EINVAL; | 106 | return -EINVAL; |
107 | } | 107 | } |
108 | |||
109 | /* ACPI 3.0 specs (P62) says that it's the responsabilty | ||
110 | * of the OSPM to clear the status bit [ implying that the | ||
111 | * POWER_BUTTON event should not reach userspace ] | ||
112 | */ | ||
113 | if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) | ||
114 | acpi_clear_event(ACPI_EVENT_POWER_BUTTON); | ||
115 | |||
108 | local_irq_restore(flags); | 116 | local_irq_restore(flags); |
109 | printk(KERN_DEBUG "Back to C!\n"); | 117 | printk(KERN_DEBUG "Back to C!\n"); |
110 | 118 | ||
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 85df0ceda2a9..af1dbabaf0b1 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -155,7 +155,6 @@ static int __init acpi_wakeup_device_init(void) | |||
155 | 155 | ||
156 | if (acpi_disabled) | 156 | if (acpi_disabled) |
157 | return 0; | 157 | return 0; |
158 | printk("ACPI wakeup devices: \n"); | ||
159 | 158 | ||
160 | spin_lock(&acpi_device_lock); | 159 | spin_lock(&acpi_device_lock); |
161 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 160 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
@@ -174,10 +173,8 @@ static int __init acpi_wakeup_device_init(void) | |||
174 | dev->wakeup.state.enabled = 1; | 173 | dev->wakeup.state.enabled = 1; |
175 | spin_lock(&acpi_device_lock); | 174 | spin_lock(&acpi_device_lock); |
176 | } | 175 | } |
177 | printk("%4s ", dev->pnp.bus_id); | ||
178 | } | 176 | } |
179 | spin_unlock(&acpi_device_lock); | 177 | spin_unlock(&acpi_device_lock); |
180 | printk("\n"); | ||
181 | 178 | ||
182 | return 0; | 179 | return 0; |
183 | } | 180 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index e4308c7a6743..a934ac42178d 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -39,7 +39,7 @@ ACPI_MODULE_NAME("acpi_system") | |||
39 | #define ACPI_SYSTEM_FILE_EVENT "event" | 39 | #define ACPI_SYSTEM_FILE_EVENT "event" |
40 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" | 40 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" |
41 | #define ACPI_SYSTEM_FILE_FADT "fadt" | 41 | #define ACPI_SYSTEM_FILE_FADT "fadt" |
42 | extern FADT_DESCRIPTOR acpi_fadt; | 42 | extern struct fadt_descriptor acpi_fadt; |
43 | 43 | ||
44 | /* -------------------------------------------------------------------------- | 44 | /* -------------------------------------------------------------------------- |
45 | FS Interface (/proc) | 45 | FS Interface (/proc) |
@@ -82,7 +82,7 @@ acpi_system_read_dsdt(struct file *file, | |||
82 | 82 | ||
83 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); | 83 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); |
84 | 84 | ||
85 | status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); | 85 | status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); |
86 | if (ACPI_FAILURE(status)) | 86 | if (ACPI_FAILURE(status)) |
87 | return_VALUE(-ENODEV); | 87 | return_VALUE(-ENODEV); |
88 | 88 | ||
@@ -110,7 +110,7 @@ acpi_system_read_fadt(struct file *file, | |||
110 | 110 | ||
111 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); | 111 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); |
112 | 112 | ||
113 | status = acpi_get_table(ACPI_TABLE_FADT, 1, &fadt); | 113 | status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); |
114 | if (ACPI_FAILURE(status)) | 114 | if (ACPI_FAILURE(status)) |
115 | return_VALUE(-ENODEV); | 115 | return_VALUE(-ENODEV); |
116 | 116 | ||
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 7f37c7cc5ef1..ed5e8816d83d 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -282,8 +282,8 @@ acpi_get_table_header_early(enum acpi_table_id id, | |||
282 | 282 | ||
283 | /* Map the DSDT header via the pointer in the FADT */ | 283 | /* Map the DSDT header via the pointer in the FADT */ |
284 | if (id == ACPI_DSDT) { | 284 | if (id == ACPI_DSDT) { |
285 | struct fadt_descriptor_rev2 *fadt = | 285 | struct fadt_descriptor *fadt = |
286 | (struct fadt_descriptor_rev2 *)*header; | 286 | (struct fadt_descriptor *)*header; |
287 | 287 | ||
288 | if (fadt->revision == 3 && fadt->Xdsdt) { | 288 | if (fadt->revision == 3 && fadt->Xdsdt) { |
289 | *header = (void *)__acpi_map_table(fadt->Xdsdt, | 289 | *header = (void *)__acpi_map_table(fadt->Xdsdt, |
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 03b37d2223bc..d697fcb35d52 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
48 | 46 | ||
@@ -56,15 +54,15 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | |||
56 | acpi_physical_address address); | 54 | acpi_physical_address address); |
57 | 55 | ||
58 | static void | 56 | static void |
59 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | 57 | acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, |
60 | struct fadt_descriptor_rev1 *original_fadt); | 58 | struct fadt_descriptor_rev1 *original_fadt); |
61 | 59 | ||
62 | static void | 60 | static void |
63 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | 61 | acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, |
64 | struct fadt_descriptor_rev2 *original_fadt); | 62 | struct fadt_descriptor *original_fadt); |
65 | 63 | ||
66 | u8 acpi_fadt_is_v1; | 64 | u8 acpi_fadt_is_v1; |
67 | EXPORT_SYMBOL(acpi_fadt_is_v1); | 65 | ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1) |
68 | 66 | ||
69 | /******************************************************************************* | 67 | /******************************************************************************* |
70 | * | 68 | * |
@@ -122,7 +120,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
122 | { | 120 | { |
123 | acpi_size table_size; | 121 | acpi_size table_size; |
124 | u32 i; | 122 | u32 i; |
125 | XSDT_DESCRIPTOR *new_table; | 123 | struct xsdt_descriptor *new_table; |
126 | 124 | ||
127 | ACPI_FUNCTION_ENTRY(); | 125 | ACPI_FUNCTION_ENTRY(); |
128 | 126 | ||
@@ -133,7 +131,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
133 | 131 | ||
134 | /* Allocate an XSDT */ | 132 | /* Allocate an XSDT */ |
135 | 133 | ||
136 | new_table = ACPI_MEM_CALLOCATE(table_size); | 134 | new_table = ACPI_ALLOCATE_ZEROED(table_size); |
137 | if (!new_table) { | 135 | if (!new_table) { |
138 | return (AE_NO_MEMORY); | 136 | return (AE_NO_MEMORY); |
139 | } | 137 | } |
@@ -147,17 +145,18 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
147 | /* Copy the table pointers */ | 145 | /* Copy the table pointers */ |
148 | 146 | ||
149 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 147 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
148 | |||
150 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ | 149 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ |
151 | 150 | ||
152 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 151 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
153 | ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], | 152 | ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], |
154 | (ACPI_CAST_PTR | 153 | (ACPI_CAST_PTR |
155 | (struct rsdt_descriptor_rev1, | 154 | (struct rsdt_descriptor, |
156 | table_info->pointer))-> | 155 | table_info->pointer))-> |
157 | table_offset_entry[i]); | 156 | table_offset_entry[i]); |
158 | } else { | 157 | } else { |
159 | new_table->table_offset_entry[i] = | 158 | new_table->table_offset_entry[i] = |
160 | (ACPI_CAST_PTR(XSDT_DESCRIPTOR, | 159 | (ACPI_CAST_PTR(struct xsdt_descriptor, |
161 | table_info->pointer))-> | 160 | table_info->pointer))-> |
162 | table_offset_entry[i]; | 161 | table_offset_entry[i]; |
163 | } | 162 | } |
@@ -219,7 +218,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | |||
219 | ******************************************************************************/ | 218 | ******************************************************************************/ |
220 | 219 | ||
221 | static void | 220 | static void |
222 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | 221 | acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, |
223 | struct fadt_descriptor_rev1 *original_fadt) | 222 | struct fadt_descriptor_rev1 *original_fadt) |
224 | { | 223 | { |
225 | 224 | ||
@@ -365,14 +364,13 @@ acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | |||
365 | ******************************************************************************/ | 364 | ******************************************************************************/ |
366 | 365 | ||
367 | static void | 366 | static void |
368 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | 367 | acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, |
369 | struct fadt_descriptor_rev2 *original_fadt) | 368 | struct fadt_descriptor *original_fadt) |
370 | { | 369 | { |
371 | 370 | ||
372 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ | 371 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ |
373 | 372 | ||
374 | ACPI_MEMCPY(local_fadt, original_fadt, | 373 | ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor)); |
375 | sizeof(struct fadt_descriptor_rev2)); | ||
376 | 374 | ||
377 | /* | 375 | /* |
378 | * "X" fields are optional extensions to the original V1.0 fields, so | 376 | * "X" fields are optional extensions to the original V1.0 fields, so |
@@ -491,10 +489,10 @@ acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | |||
491 | 489 | ||
492 | acpi_status acpi_tb_convert_table_fadt(void) | 490 | acpi_status acpi_tb_convert_table_fadt(void) |
493 | { | 491 | { |
494 | struct fadt_descriptor_rev2 *local_fadt; | 492 | struct fadt_descriptor *local_fadt; |
495 | struct acpi_table_desc *table_desc; | 493 | struct acpi_table_desc *table_desc; |
496 | 494 | ||
497 | ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); | 495 | ACPI_FUNCTION_TRACE(tb_convert_table_fadt); |
498 | 496 | ||
499 | /* | 497 | /* |
500 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be | 498 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be |
@@ -508,13 +506,14 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
508 | 506 | ||
509 | /* Allocate buffer for the ACPI 2.0(+) FADT */ | 507 | /* Allocate buffer for the ACPI 2.0(+) FADT */ |
510 | 508 | ||
511 | local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); | 509 | local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor)); |
512 | if (!local_fadt) { | 510 | if (!local_fadt) { |
513 | return_ACPI_STATUS(AE_NO_MEMORY); | 511 | return_ACPI_STATUS(AE_NO_MEMORY); |
514 | } | 512 | } |
515 | 513 | ||
516 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { | 514 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { |
517 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { | 515 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor)) { |
516 | |||
518 | /* Length is too short to be a V2.0 table */ | 517 | /* Length is too short to be a V2.0 table */ |
519 | 518 | ||
520 | ACPI_WARNING((AE_INFO, | 519 | ACPI_WARNING((AE_INFO, |
@@ -538,11 +537,11 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
538 | /* Global FADT pointer will point to the new common V2.0 FADT */ | 537 | /* Global FADT pointer will point to the new common V2.0 FADT */ |
539 | 538 | ||
540 | acpi_gbl_FADT = local_fadt; | 539 | acpi_gbl_FADT = local_fadt; |
541 | acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); | 540 | acpi_gbl_FADT->length = sizeof(struct fadt_descriptor); |
542 | 541 | ||
543 | /* Free the original table */ | 542 | /* Free the original table */ |
544 | 543 | ||
545 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; | 544 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_FADT].next; |
546 | acpi_tb_delete_single_table(table_desc); | 545 | acpi_tb_delete_single_table(table_desc); |
547 | 546 | ||
548 | /* Install the new table */ | 547 | /* Install the new table */ |
@@ -550,7 +549,7 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
550 | table_desc->pointer = | 549 | table_desc->pointer = |
551 | ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); | 550 | ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); |
552 | table_desc->allocation = ACPI_MEM_ALLOCATED; | 551 | table_desc->allocation = ACPI_MEM_ALLOCATED; |
553 | table_desc->length = sizeof(struct fadt_descriptor_rev2); | 552 | table_desc->length = sizeof(struct fadt_descriptor); |
554 | 553 | ||
555 | /* Dump the entire FADT */ | 554 | /* Dump the entire FADT */ |
556 | 555 | ||
@@ -580,7 +579,7 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
580 | acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) | 579 | acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) |
581 | { | 580 | { |
582 | 581 | ||
583 | ACPI_FUNCTION_TRACE("tb_build_common_facs"); | 582 | ACPI_FUNCTION_TRACE(tb_build_common_facs); |
584 | 583 | ||
585 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ | 584 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ |
586 | 585 | ||
@@ -603,6 +602,7 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) | |||
603 | if ((acpi_gbl_RSDP->revision < 2) || | 602 | if ((acpi_gbl_RSDP->revision < 2) || |
604 | (acpi_gbl_FACS->length < 32) || | 603 | (acpi_gbl_FACS->length < 32) || |
605 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { | 604 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { |
605 | |||
606 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ | 606 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ |
607 | 607 | ||
608 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, | 608 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, |
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 09b4ee6dfd60..99eacceff563 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
@@ -78,7 +78,7 @@ acpi_tb_get_table(struct acpi_pointer *address, | |||
78 | acpi_status status; | 78 | acpi_status status; |
79 | struct acpi_table_header header; | 79 | struct acpi_table_header header; |
80 | 80 | ||
81 | ACPI_FUNCTION_TRACE("tb_get_table"); | 81 | ACPI_FUNCTION_TRACE(tb_get_table); |
82 | 82 | ||
83 | /* Get the header in order to get signature and table size */ | 83 | /* Get the header in order to get signature and table size */ |
84 | 84 | ||
@@ -124,7 +124,7 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
124 | acpi_status status = AE_OK; | 124 | acpi_status status = AE_OK; |
125 | struct acpi_table_header *header = NULL; | 125 | struct acpi_table_header *header = NULL; |
126 | 126 | ||
127 | ACPI_FUNCTION_TRACE("tb_get_table_header"); | 127 | ACPI_FUNCTION_TRACE(tb_get_table_header); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Flags contains the current processor mode (Virtual or Physical | 130 | * Flags contains the current processor mode (Virtual or Physical |
@@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
148 | sizeof(struct acpi_table_header), | 148 | sizeof(struct acpi_table_header), |
149 | (void *)&header); | 149 | (void *)&header); |
150 | if (ACPI_FAILURE(status)) { | 150 | if (ACPI_FAILURE(status)) { |
151 | ACPI_ERROR((AE_INFO, | ||
152 | "Could not map memory at %8.8X%8.8X for table header", | ||
153 | ACPI_FORMAT_UINT64(address->pointer. | ||
154 | physical))); | ||
151 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
152 | } | 156 | } |
153 | 157 | ||
@@ -198,7 +202,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
198 | { | 202 | { |
199 | acpi_status status; | 203 | acpi_status status; |
200 | 204 | ||
201 | ACPI_FUNCTION_TRACE("tb_get_table_body"); | 205 | ACPI_FUNCTION_TRACE(tb_get_table_body); |
202 | 206 | ||
203 | if (!table_info || !address) { | 207 | if (!table_info || !address) { |
204 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 208 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
208 | 212 | ||
209 | status = acpi_tb_table_override(header, table_info); | 213 | status = acpi_tb_table_override(header, table_info); |
210 | if (ACPI_SUCCESS(status)) { | 214 | if (ACPI_SUCCESS(status)) { |
215 | |||
211 | /* Table was overridden by the host OS */ | 216 | /* Table was overridden by the host OS */ |
212 | 217 | ||
213 | return_ACPI_STATUS(status); | 218 | return_ACPI_STATUS(status); |
@@ -241,7 +246,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
241 | acpi_status status; | 246 | acpi_status status; |
242 | struct acpi_pointer address; | 247 | struct acpi_pointer address; |
243 | 248 | ||
244 | ACPI_FUNCTION_TRACE("tb_table_override"); | 249 | ACPI_FUNCTION_TRACE(tb_table_override); |
245 | 250 | ||
246 | /* | 251 | /* |
247 | * The OSL will examine the header and decide whether to override this | 252 | * The OSL will examine the header and decide whether to override this |
@@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
250 | */ | 255 | */ |
251 | status = acpi_os_table_override(header, &new_table); | 256 | status = acpi_os_table_override(header, &new_table); |
252 | if (ACPI_FAILURE(status)) { | 257 | if (ACPI_FAILURE(status)) { |
258 | |||
253 | /* Some severe error from the OSL, but we basically ignore it */ | 259 | /* Some severe error from the OSL, but we basically ignore it */ |
254 | 260 | ||
255 | ACPI_EXCEPTION((AE_INFO, status, | 261 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
258 | } | 264 | } |
259 | 265 | ||
260 | if (!new_table) { | 266 | if (!new_table) { |
267 | |||
261 | /* No table override */ | 268 | /* No table override */ |
262 | 269 | ||
263 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | 270 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
@@ -311,7 +318,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
311 | u8 allocation; | 318 | u8 allocation; |
312 | acpi_status status = AE_OK; | 319 | acpi_status status = AE_OK; |
313 | 320 | ||
314 | ACPI_FUNCTION_TRACE("tb_get_this_table"); | 321 | ACPI_FUNCTION_TRACE(tb_get_this_table); |
315 | 322 | ||
316 | /* | 323 | /* |
317 | * Flags contains the current processor mode (Virtual or Physical | 324 | * Flags contains the current processor mode (Virtual or Physical |
@@ -323,7 +330,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
323 | 330 | ||
324 | /* Pointer matches processor mode, copy the table to a new buffer */ | 331 | /* Pointer matches processor mode, copy the table to a new buffer */ |
325 | 332 | ||
326 | full_table = ACPI_MEM_ALLOCATE(header->length); | 333 | full_table = ACPI_ALLOCATE(header->length); |
327 | if (!full_table) { | 334 | if (!full_table) { |
328 | ACPI_ERROR((AE_INFO, | 335 | ACPI_ERROR((AE_INFO, |
329 | "Could not allocate table memory for [%4.4s] length %X", | 336 | "Could not allocate table memory for [%4.4s] length %X", |
@@ -376,11 +383,12 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
376 | * Validate checksum for _most_ tables, | 383 | * Validate checksum for _most_ tables, |
377 | * even the ones whose signature we don't recognize | 384 | * even the ones whose signature we don't recognize |
378 | */ | 385 | */ |
379 | if (table_info->type != ACPI_TABLE_FACS) { | 386 | if (table_info->type != ACPI_TABLE_ID_FACS) { |
380 | status = acpi_tb_verify_table_checksum(full_table); | 387 | status = acpi_tb_verify_table_checksum(full_table); |
381 | 388 | ||
382 | #if (!ACPI_CHECKSUM_ABORT) | 389 | #if (!ACPI_CHECKSUM_ABORT) |
383 | if (ACPI_FAILURE(status)) { | 390 | if (ACPI_FAILURE(status)) { |
391 | |||
384 | /* Ignore the error if configuration says so */ | 392 | /* Ignore the error if configuration says so */ |
385 | 393 | ||
386 | status = AE_OK; | 394 | status = AE_OK; |
@@ -409,7 +417,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
409 | * | 417 | * |
410 | * PARAMETERS: table_type - one of the defined table types | 418 | * PARAMETERS: table_type - one of the defined table types |
411 | * Instance - Which table of this type | 419 | * Instance - Which table of this type |
412 | * table_ptr_loc - pointer to location to place the pointer for | 420 | * return_table - pointer to location to place the pointer for |
413 | * return | 421 | * return |
414 | * | 422 | * |
415 | * RETURN: Status | 423 | * RETURN: Status |
@@ -420,57 +428,34 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
420 | 428 | ||
421 | acpi_status | 429 | acpi_status |
422 | acpi_tb_get_table_ptr(acpi_table_type table_type, | 430 | acpi_tb_get_table_ptr(acpi_table_type table_type, |
423 | u32 instance, struct acpi_table_header **table_ptr_loc) | 431 | u32 instance, struct acpi_table_header **return_table) |
424 | { | 432 | { |
425 | struct acpi_table_desc *table_desc; | 433 | struct acpi_table_desc *table_desc; |
426 | u32 i; | 434 | u32 i; |
427 | 435 | ||
428 | ACPI_FUNCTION_TRACE("tb_get_table_ptr"); | 436 | ACPI_FUNCTION_TRACE(tb_get_table_ptr); |
429 | |||
430 | if (!acpi_gbl_DSDT) { | ||
431 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
432 | } | ||
433 | 437 | ||
434 | if (table_type > ACPI_TABLE_MAX) { | 438 | if (table_type > ACPI_TABLE_ID_MAX) { |
435 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 439 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
436 | } | 440 | } |
437 | 441 | ||
438 | /* | 442 | /* Check for instance out of range of the current table count */ |
439 | * For all table types (Single/Multiple), the first | ||
440 | * instance is always in the list head. | ||
441 | */ | ||
442 | if (instance == 1) { | ||
443 | /* Get the first */ | ||
444 | |||
445 | *table_ptr_loc = NULL; | ||
446 | if (acpi_gbl_table_lists[table_type].next) { | ||
447 | *table_ptr_loc = | ||
448 | acpi_gbl_table_lists[table_type].next->pointer; | ||
449 | } | ||
450 | return_ACPI_STATUS(AE_OK); | ||
451 | } | ||
452 | |||
453 | /* Check for instance out of range */ | ||
454 | 443 | ||
455 | if (instance > acpi_gbl_table_lists[table_type].count) { | 444 | if (instance > acpi_gbl_table_lists[table_type].count) { |
456 | return_ACPI_STATUS(AE_NOT_EXIST); | 445 | return_ACPI_STATUS(AE_NOT_EXIST); |
457 | } | 446 | } |
458 | 447 | ||
459 | /* Walk the list to get the desired table | 448 | /* |
460 | * Since the if (Instance == 1) check above checked for the | 449 | * Walk the list to get the desired table |
461 | * first table, setting table_desc equal to the .Next member | 450 | * Note: Instance is one-based |
462 | * is actually pointing to the second table. Therefore, we | ||
463 | * need to walk from the 2nd table until we reach the Instance | ||
464 | * that the user is looking for and return its table pointer. | ||
465 | */ | 451 | */ |
466 | table_desc = acpi_gbl_table_lists[table_type].next; | 452 | table_desc = acpi_gbl_table_lists[table_type].next; |
467 | for (i = 2; i < instance; i++) { | 453 | for (i = 1; i < instance; i++) { |
468 | table_desc = table_desc->next; | 454 | table_desc = table_desc->next; |
469 | } | 455 | } |
470 | 456 | ||
471 | /* We are now pointing to the requested table's descriptor */ | 457 | /* We are now pointing to the requested table's descriptor */ |
472 | 458 | ||
473 | *table_ptr_loc = table_desc->pointer; | 459 | *return_table = table_desc->pointer; |
474 | |||
475 | return_ACPI_STATUS(AE_OK); | 460 | return_ACPI_STATUS(AE_OK); |
476 | } | 461 | } |
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 134e5dce0bc1..ad982112e4c6 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c | |||
@@ -77,7 +77,7 @@ acpi_tb_get_primary_table(struct acpi_pointer *address, | |||
77 | acpi_status status; | 77 | acpi_status status; |
78 | struct acpi_table_header header; | 78 | struct acpi_table_header header; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("tb_get_primary_table"); | 80 | ACPI_FUNCTION_TRACE(tb_get_primary_table); |
81 | 81 | ||
82 | /* Ignore a NULL address in the RSDT */ | 82 | /* Ignore a NULL address in the RSDT */ |
83 | 83 | ||
@@ -140,7 +140,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, | |||
140 | acpi_status status; | 140 | acpi_status status; |
141 | struct acpi_table_header header; | 141 | struct acpi_table_header header; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature); | 143 | ACPI_FUNCTION_TRACE_STR(tb_get_secondary_table, signature); |
144 | 144 | ||
145 | /* Get the header in order to match the signature */ | 145 | /* Get the header in order to match the signature */ |
146 | 146 | ||
@@ -151,7 +151,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, | |||
151 | 151 | ||
152 | /* Signature must match request */ | 152 | /* Signature must match request */ |
153 | 153 | ||
154 | if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) { | 154 | if (!ACPI_COMPARE_NAME(header.signature, signature)) { |
155 | ACPI_ERROR((AE_INFO, | 155 | ACPI_ERROR((AE_INFO, |
156 | "Incorrect table signature - wanted [%s] found [%4.4s]", | 156 | "Incorrect table signature - wanted [%s] found [%4.4s]", |
157 | signature, header.signature)); | 157 | signature, header.signature)); |
@@ -207,7 +207,7 @@ acpi_status acpi_tb_get_required_tables(void) | |||
207 | struct acpi_table_desc table_info; | 207 | struct acpi_table_desc table_info; |
208 | struct acpi_pointer address; | 208 | struct acpi_pointer address; |
209 | 209 | ||
210 | ACPI_FUNCTION_TRACE("tb_get_required_tables"); | 210 | ACPI_FUNCTION_TRACE(tb_get_required_tables); |
211 | 211 | ||
212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", | 212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", |
213 | acpi_gbl_rsdt_table_count)); | 213 | acpi_gbl_rsdt_table_count)); |
@@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables(void) | |||
223 | * any SSDTs. | 223 | * any SSDTs. |
224 | */ | 224 | */ |
225 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 225 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
226 | |||
226 | /* Get the table address from the common internal XSDT */ | 227 | /* Get the table address from the common internal XSDT */ |
227 | 228 | ||
228 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; | 229 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; |
@@ -305,6 +306,6 @@ acpi_status acpi_tb_get_required_tables(void) | |||
305 | 306 | ||
306 | /* Always delete the RSDP mapping, we are done with it */ | 307 | /* Always delete the RSDP mapping, we are done with it */ |
307 | 308 | ||
308 | acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP); | 309 | acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_RSDP); |
309 | return_ACPI_STATUS(status); | 310 | return_ACPI_STATUS(status); |
310 | } | 311 | } |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 7ffd0fddb4e5..7ca2df75bb11 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -73,17 +73,18 @@ acpi_tb_match_signature(char *signature, | |||
73 | { | 73 | { |
74 | acpi_native_uint i; | 74 | acpi_native_uint i; |
75 | 75 | ||
76 | ACPI_FUNCTION_TRACE("tb_match_signature"); | 76 | ACPI_FUNCTION_TRACE(tb_match_signature); |
77 | 77 | ||
78 | /* Search for a signature match among the known table types */ | 78 | /* Search for a signature match among the known table types */ |
79 | 79 | ||
80 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 80 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
81 | if (!(acpi_gbl_table_data[i].flags & search_type)) { | 81 | if (!(acpi_gbl_table_data[i].flags & search_type)) { |
82 | continue; | 82 | continue; |
83 | } | 83 | } |
84 | 84 | ||
85 | if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, | 85 | if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, |
86 | acpi_gbl_table_data[i].sig_length)) { | 86 | acpi_gbl_table_data[i].sig_length)) { |
87 | |||
87 | /* Found a signature match, return index if requested */ | 88 | /* Found a signature match, return index if requested */ |
88 | 89 | ||
89 | if (table_info) { | 90 | if (table_info) { |
@@ -122,7 +123,7 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info) | |||
122 | { | 123 | { |
123 | acpi_status status; | 124 | acpi_status status; |
124 | 125 | ||
125 | ACPI_FUNCTION_TRACE("tb_install_table"); | 126 | ACPI_FUNCTION_TRACE(tb_install_table); |
126 | 127 | ||
127 | /* Lock tables while installing */ | 128 | /* Lock tables while installing */ |
128 | 129 | ||
@@ -187,7 +188,7 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) | |||
187 | struct acpi_table_header *table_header; | 188 | struct acpi_table_header *table_header; |
188 | acpi_status status; | 189 | acpi_status status; |
189 | 190 | ||
190 | ACPI_FUNCTION_TRACE("tb_recognize_table"); | 191 | ACPI_FUNCTION_TRACE(tb_recognize_table); |
191 | 192 | ||
192 | /* Ensure that we have a valid table pointer */ | 193 | /* Ensure that we have a valid table pointer */ |
193 | 194 | ||
@@ -218,7 +219,6 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) | |||
218 | /* Return the table type and length via the info struct */ | 219 | /* Return the table type and length via the info struct */ |
219 | 220 | ||
220 | table_info->length = (acpi_size) table_header->length; | 221 | table_info->length = (acpi_size) table_header->length; |
221 | |||
222 | return_ACPI_STATUS(status); | 222 | return_ACPI_STATUS(status); |
223 | } | 223 | } |
224 | 224 | ||
@@ -243,11 +243,11 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
243 | struct acpi_table_desc *table_desc; | 243 | struct acpi_table_desc *table_desc; |
244 | acpi_status status; | 244 | acpi_status status; |
245 | 245 | ||
246 | ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type); | 246 | ACPI_FUNCTION_TRACE_U32(tb_init_table_descriptor, table_type); |
247 | 247 | ||
248 | /* Allocate a descriptor for this table */ | 248 | /* Allocate a descriptor for this table */ |
249 | 249 | ||
250 | table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); | 250 | table_desc = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); |
251 | if (!table_desc) { | 251 | if (!table_desc) { |
252 | return_ACPI_STATUS(AE_NO_MEMORY); | 252 | return_ACPI_STATUS(AE_NO_MEMORY); |
253 | } | 253 | } |
@@ -274,7 +274,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
274 | * at this location, so return an error. | 274 | * at this location, so return an error. |
275 | */ | 275 | */ |
276 | if (list_head->next) { | 276 | if (list_head->next) { |
277 | ACPI_MEM_FREE(table_desc); | 277 | ACPI_FREE(table_desc); |
278 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 278 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
279 | } | 279 | } |
280 | 280 | ||
@@ -312,15 +312,14 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
312 | 312 | ||
313 | /* Finish initialization of the table descriptor */ | 313 | /* Finish initialization of the table descriptor */ |
314 | 314 | ||
315 | table_desc->loaded_into_namespace = FALSE; | ||
315 | table_desc->type = (u8) table_type; | 316 | table_desc->type = (u8) table_type; |
316 | table_desc->pointer = table_info->pointer; | 317 | table_desc->pointer = table_info->pointer; |
317 | table_desc->length = table_info->length; | 318 | table_desc->length = table_info->length; |
318 | table_desc->allocation = table_info->allocation; | 319 | table_desc->allocation = table_info->allocation; |
319 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), | 320 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), |
320 | table_desc->aml_length = (u32) (table_desc->length - | 321 | table_desc->aml_length = (u32) |
321 | (u32) sizeof(struct | 322 | (table_desc->length - (u32) sizeof(struct acpi_table_header)); |
322 | acpi_table_header)); | ||
323 | table_desc->loaded_into_namespace = FALSE; | ||
324 | 323 | ||
325 | /* | 324 | /* |
326 | * Set the appropriate global pointer (if there is one) to point to the | 325 | * Set the appropriate global pointer (if there is one) to point to the |
@@ -335,7 +334,6 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
335 | 334 | ||
336 | table_info->owner_id = table_desc->owner_id; | 335 | table_info->owner_id = table_desc->owner_id; |
337 | table_info->installed_desc = table_desc; | 336 | table_info->installed_desc = table_desc; |
338 | |||
339 | return_ACPI_STATUS(AE_OK); | 337 | return_ACPI_STATUS(AE_OK); |
340 | } | 338 | } |
341 | 339 | ||
@@ -359,7 +357,7 @@ void acpi_tb_delete_all_tables(void) | |||
359 | * Free memory allocated for ACPI tables | 357 | * Free memory allocated for ACPI tables |
360 | * Memory can either be mapped or allocated | 358 | * Memory can either be mapped or allocated |
361 | */ | 359 | */ |
362 | for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) { | 360 | for (type = 0; type < (ACPI_TABLE_ID_MAX + 1); type++) { |
363 | acpi_tb_delete_tables_by_type(type); | 361 | acpi_tb_delete_tables_by_type(type); |
364 | } | 362 | } |
365 | } | 363 | } |
@@ -383,9 +381,9 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) | |||
383 | u32 count; | 381 | u32 count; |
384 | u32 i; | 382 | u32 i; |
385 | 383 | ||
386 | ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type); | 384 | ACPI_FUNCTION_TRACE_U32(tb_delete_tables_by_type, type); |
387 | 385 | ||
388 | if (type > ACPI_TABLE_MAX) { | 386 | if (type > ACPI_TABLE_ID_MAX) { |
389 | return_VOID; | 387 | return_VOID; |
390 | } | 388 | } |
391 | 389 | ||
@@ -396,28 +394,28 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) | |||
396 | /* Clear the appropriate "typed" global table pointer */ | 394 | /* Clear the appropriate "typed" global table pointer */ |
397 | 395 | ||
398 | switch (type) { | 396 | switch (type) { |
399 | case ACPI_TABLE_RSDP: | 397 | case ACPI_TABLE_ID_RSDP: |
400 | acpi_gbl_RSDP = NULL; | 398 | acpi_gbl_RSDP = NULL; |
401 | break; | 399 | break; |
402 | 400 | ||
403 | case ACPI_TABLE_DSDT: | 401 | case ACPI_TABLE_ID_DSDT: |
404 | acpi_gbl_DSDT = NULL; | 402 | acpi_gbl_DSDT = NULL; |
405 | break; | 403 | break; |
406 | 404 | ||
407 | case ACPI_TABLE_FADT: | 405 | case ACPI_TABLE_ID_FADT: |
408 | acpi_gbl_FADT = NULL; | 406 | acpi_gbl_FADT = NULL; |
409 | break; | 407 | break; |
410 | 408 | ||
411 | case ACPI_TABLE_FACS: | 409 | case ACPI_TABLE_ID_FACS: |
412 | acpi_gbl_FACS = NULL; | 410 | acpi_gbl_FACS = NULL; |
413 | break; | 411 | break; |
414 | 412 | ||
415 | case ACPI_TABLE_XSDT: | 413 | case ACPI_TABLE_ID_XSDT: |
416 | acpi_gbl_XSDT = NULL; | 414 | acpi_gbl_XSDT = NULL; |
417 | break; | 415 | break; |
418 | 416 | ||
419 | case ACPI_TABLE_SSDT: | 417 | case ACPI_TABLE_ID_SSDT: |
420 | case ACPI_TABLE_PSDT: | 418 | case ACPI_TABLE_ID_PSDT: |
421 | default: | 419 | default: |
422 | break; | 420 | break; |
423 | } | 421 | } |
@@ -471,7 +469,7 @@ void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc) | |||
471 | 469 | ||
472 | case ACPI_MEM_ALLOCATED: | 470 | case ACPI_MEM_ALLOCATED: |
473 | 471 | ||
474 | ACPI_MEM_FREE(table_desc->pointer); | 472 | ACPI_FREE(table_desc->pointer); |
475 | break; | 473 | break; |
476 | 474 | ||
477 | case ACPI_MEM_MAPPED: | 475 | case ACPI_MEM_MAPPED: |
@@ -503,7 +501,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc | |||
503 | { | 501 | { |
504 | struct acpi_table_desc *next_desc; | 502 | struct acpi_table_desc *next_desc; |
505 | 503 | ||
506 | ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc); | 504 | ACPI_FUNCTION_TRACE_PTR(tb_uninstall_table, table_desc); |
507 | 505 | ||
508 | if (!table_desc) { | 506 | if (!table_desc) { |
509 | return_PTR(NULL); | 507 | return_PTR(NULL); |
@@ -530,7 +528,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc | |||
530 | /* Free the table descriptor */ | 528 | /* Free the table descriptor */ |
531 | 529 | ||
532 | next_desc = table_desc->next; | 530 | next_desc = table_desc->next; |
533 | ACPI_MEM_FREE(table_desc); | 531 | ACPI_FREE(table_desc); |
534 | 532 | ||
535 | /* Return pointer to the next descriptor */ | 533 | /* Return pointer to the next descriptor */ |
536 | 534 | ||
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 4d308220225d..abcb08c2592a 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -64,7 +64,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
64 | acpi_status status; | 64 | acpi_status status; |
65 | struct rsdp_descriptor *rsdp; | 65 | struct rsdp_descriptor *rsdp; |
66 | 66 | ||
67 | ACPI_FUNCTION_TRACE("tb_verify_rsdp"); | 67 | ACPI_FUNCTION_TRACE(tb_verify_rsdp); |
68 | 68 | ||
69 | switch (address->pointer_type) { | 69 | switch (address->pointer_type) { |
70 | case ACPI_LOGICAL_POINTER: | 70 | case ACPI_LOGICAL_POINTER: |
@@ -78,7 +78,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
78 | */ | 78 | */ |
79 | status = acpi_os_map_memory(address->pointer.physical, | 79 | status = acpi_os_map_memory(address->pointer.physical, |
80 | sizeof(struct rsdp_descriptor), | 80 | sizeof(struct rsdp_descriptor), |
81 | (void *)&rsdp); | 81 | ACPI_CAST_PTR(void, &rsdp)); |
82 | if (ACPI_FAILURE(status)) { | 82 | if (ACPI_FAILURE(status)) { |
83 | return_ACPI_STATUS(status); | 83 | return_ACPI_STATUS(status); |
84 | } | 84 | } |
@@ -95,15 +95,20 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
95 | goto cleanup; | 95 | goto cleanup; |
96 | } | 96 | } |
97 | 97 | ||
98 | /* The RSDP supplied is OK */ | 98 | /* RSDP is ok. Init the table info */ |
99 | 99 | ||
100 | table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); | 100 | table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); |
101 | table_info.length = sizeof(struct rsdp_descriptor); | 101 | table_info.length = sizeof(struct rsdp_descriptor); |
102 | table_info.allocation = ACPI_MEM_MAPPED; | 102 | |
103 | if (address->pointer_type == ACPI_PHYSICAL_POINTER) { | ||
104 | table_info.allocation = ACPI_MEM_MAPPED; | ||
105 | } else { | ||
106 | table_info.allocation = ACPI_MEM_NOT_ALLOCATED; | ||
107 | } | ||
103 | 108 | ||
104 | /* Save the table pointers and allocation info */ | 109 | /* Save the table pointers and allocation info */ |
105 | 110 | ||
106 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info); | 111 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_RSDP, &table_info); |
107 | if (ACPI_FAILURE(status)) { | 112 | if (ACPI_FAILURE(status)) { |
108 | goto cleanup; | 113 | goto cleanup; |
109 | } | 114 | } |
@@ -174,22 +179,20 @@ void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address) | |||
174 | 179 | ||
175 | acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | 180 | acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) |
176 | { | 181 | { |
177 | int no_match; | 182 | char *signature; |
178 | 183 | ||
179 | ACPI_FUNCTION_ENTRY(); | 184 | ACPI_FUNCTION_ENTRY(); |
180 | 185 | ||
181 | /* | 186 | /* Search for appropriate signature, RSDT or XSDT */ |
182 | * Search for appropriate signature, RSDT or XSDT | 187 | |
183 | */ | ||
184 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 188 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
185 | no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG, | 189 | signature = RSDT_SIG; |
186 | sizeof(RSDT_SIG) - 1); | ||
187 | } else { | 190 | } else { |
188 | no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG, | 191 | signature = XSDT_SIG; |
189 | sizeof(XSDT_SIG) - 1); | ||
190 | } | 192 | } |
191 | 193 | ||
192 | if (no_match) { | 194 | if (!ACPI_COMPARE_NAME(table_ptr->signature, signature)) { |
195 | |||
193 | /* Invalid RSDT or XSDT signature */ | 196 | /* Invalid RSDT or XSDT signature */ |
194 | 197 | ||
195 | ACPI_ERROR((AE_INFO, | 198 | ACPI_ERROR((AE_INFO, |
@@ -198,10 +201,8 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | |||
198 | ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); | 201 | ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); |
199 | 202 | ||
200 | ACPI_ERROR((AE_INFO, | 203 | ACPI_ERROR((AE_INFO, |
201 | "RSDT/XSDT signature at %X (%p) is invalid", | 204 | "RSDT/XSDT signature at %X is invalid", |
202 | acpi_gbl_RSDP->rsdt_physical_address, | 205 | acpi_gbl_RSDP->rsdt_physical_address)); |
203 | (void *)(acpi_native_uint) acpi_gbl_RSDP-> | ||
204 | rsdt_physical_address)); | ||
205 | 206 | ||
206 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 207 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
207 | ACPI_ERROR((AE_INFO, "Looking for RSDT")); | 208 | ACPI_ERROR((AE_INFO, "Looking for RSDT")); |
@@ -234,13 +235,13 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
234 | acpi_status status; | 235 | acpi_status status; |
235 | struct acpi_pointer address; | 236 | struct acpi_pointer address; |
236 | 237 | ||
237 | ACPI_FUNCTION_TRACE("tb_get_table_rsdt"); | 238 | ACPI_FUNCTION_TRACE(tb_get_table_rsdt); |
238 | 239 | ||
239 | /* Get the RSDT/XSDT via the RSDP */ | 240 | /* Get the RSDT/XSDT via the RSDP */ |
240 | 241 | ||
241 | acpi_tb_get_rsdt_address(&address); | 242 | acpi_tb_get_rsdt_address(&address); |
242 | 243 | ||
243 | table_info.type = ACPI_TABLE_XSDT; | 244 | table_info.type = ACPI_TABLE_ID_XSDT; |
244 | status = acpi_tb_get_table(&address, &table_info); | 245 | status = acpi_tb_get_table(&address, &table_info); |
245 | if (ACPI_FAILURE(status)) { | 246 | if (ACPI_FAILURE(status)) { |
246 | ACPI_EXCEPTION((AE_INFO, status, | 247 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -274,12 +275,13 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
274 | 275 | ||
275 | /* Save the table pointers and allocation info */ | 276 | /* Save the table pointers and allocation info */ |
276 | 277 | ||
277 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info); | 278 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); |
278 | if (ACPI_FAILURE(status)) { | 279 | if (ACPI_FAILURE(status)) { |
279 | return_ACPI_STATUS(status); | 280 | return_ACPI_STATUS(status); |
280 | } | 281 | } |
281 | 282 | ||
282 | acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer); | 283 | acpi_gbl_XSDT = |
284 | ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer); | ||
283 | 285 | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); | 286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); |
285 | return_ACPI_STATUS(status); | 287 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index bc571592f087..209a401801e3 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -71,7 +71,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
71 | { | 71 | { |
72 | struct acpi_table_desc *table_desc; | 72 | struct acpi_table_desc *table_desc; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE("tb_is_table_installed"); | 74 | ACPI_FUNCTION_TRACE(tb_is_table_installed); |
75 | 75 | ||
76 | /* Get the list descriptor and first table descriptor */ | 76 | /* Get the list descriptor and first table descriptor */ |
77 | 77 | ||
@@ -96,10 +96,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
96 | (!ACPI_MEMCMP | 96 | (!ACPI_MEMCMP |
97 | (table_desc->pointer, new_table_desc->pointer, | 97 | (table_desc->pointer, new_table_desc->pointer, |
98 | new_table_desc->pointer->length))) { | 98 | new_table_desc->pointer->length))) { |
99 | |||
99 | /* Match: this table is already installed */ | 100 | /* Match: this table is already installed */ |
100 | 101 | ||
101 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 102 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
102 | "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", | 103 | "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n", |
103 | new_table_desc->pointer->signature, | 104 | new_table_desc->pointer->signature, |
104 | new_table_desc->pointer->revision, | 105 | new_table_desc->pointer->revision, |
105 | new_table_desc->pointer-> | 106 | new_table_desc->pointer-> |
@@ -159,12 +160,8 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
159 | 160 | ||
160 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); | 161 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); |
161 | if (!acpi_ut_valid_acpi_name(signature)) { | 162 | if (!acpi_ut_valid_acpi_name(signature)) { |
162 | ACPI_ERROR((AE_INFO, | 163 | ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X", |
163 | "Table signature at %p [%p] has invalid characters", | 164 | signature)); |
164 | table_header, &signature)); | ||
165 | |||
166 | ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]", | ||
167 | ACPI_CAST_PTR(char, &signature))); | ||
168 | 165 | ||
169 | ACPI_DUMP_BUFFER(table_header, | 166 | ACPI_DUMP_BUFFER(table_header, |
170 | sizeof(struct acpi_table_header)); | 167 | sizeof(struct acpi_table_header)); |
@@ -175,12 +172,9 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
175 | 172 | ||
176 | if (table_header->length < sizeof(struct acpi_table_header)) { | 173 | if (table_header->length < sizeof(struct acpi_table_header)) { |
177 | ACPI_ERROR((AE_INFO, | 174 | ACPI_ERROR((AE_INFO, |
178 | "Invalid length in table header %p name %4.4s", | 175 | "Invalid length 0x%X in table with signature %4.4s", |
179 | table_header, (char *)&signature)); | 176 | (u32) table_header->length, |
180 | 177 | ACPI_CAST_PTR(char, &signature))); | |
181 | ACPI_WARNING((AE_INFO, | ||
182 | "Invalid table header length (0x%X) found", | ||
183 | (u32) table_header->length)); | ||
184 | 178 | ||
185 | ACPI_DUMP_BUFFER(table_header, | 179 | ACPI_DUMP_BUFFER(table_header, |
186 | sizeof(struct acpi_table_header)); | 180 | sizeof(struct acpi_table_header)); |
@@ -192,72 +186,119 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
192 | 186 | ||
193 | /******************************************************************************* | 187 | /******************************************************************************* |
194 | * | 188 | * |
195 | * FUNCTION: acpi_tb_verify_table_checksum | 189 | * FUNCTION: acpi_tb_sum_table |
196 | * | 190 | * |
197 | * PARAMETERS: *table_header - ACPI table to verify | 191 | * PARAMETERS: Buffer - Buffer to sum |
192 | * Length - Size of the buffer | ||
198 | * | 193 | * |
199 | * RETURN: 8 bit checksum of table | 194 | * RETURN: 8 bit sum of buffer |
200 | * | 195 | * |
201 | * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct | 196 | * DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it. |
202 | * table should have a checksum of 0. | ||
203 | * | 197 | * |
204 | ******************************************************************************/ | 198 | ******************************************************************************/ |
205 | 199 | ||
206 | acpi_status | 200 | u8 acpi_tb_sum_table(void *buffer, u32 length) |
207 | acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) | 201 | { |
202 | acpi_native_uint i; | ||
203 | u8 sum = 0; | ||
204 | |||
205 | if (!buffer || !length) { | ||
206 | return (0); | ||
207 | } | ||
208 | |||
209 | for (i = 0; i < length; i++) { | ||
210 | sum = (u8) (sum + ((u8 *) buffer)[i]); | ||
211 | } | ||
212 | return (sum); | ||
213 | } | ||
214 | |||
215 | /******************************************************************************* | ||
216 | * | ||
217 | * FUNCTION: acpi_tb_generate_checksum | ||
218 | * | ||
219 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a | ||
220 | * standard ACPI header) | ||
221 | * | ||
222 | * RETURN: 8 bit checksum of buffer | ||
223 | * | ||
224 | * DESCRIPTION: Computes an 8 bit checksum of the table. | ||
225 | * | ||
226 | ******************************************************************************/ | ||
227 | |||
228 | u8 acpi_tb_generate_checksum(struct acpi_table_header * table) | ||
208 | { | 229 | { |
209 | u8 checksum; | 230 | u8 checksum; |
210 | acpi_status status = AE_OK; | ||
211 | 231 | ||
212 | ACPI_FUNCTION_TRACE("tb_verify_table_checksum"); | 232 | /* Sum the entire table as-is */ |
213 | 233 | ||
214 | /* Compute the checksum on the table */ | 234 | checksum = acpi_tb_sum_table(table, table->length); |
215 | 235 | ||
216 | checksum = | 236 | /* Subtract off the existing checksum value in the table */ |
217 | acpi_tb_generate_checksum(table_header, table_header->length); | ||
218 | 237 | ||
219 | /* Return the appropriate exception */ | 238 | checksum = (u8) (checksum - table->checksum); |
220 | 239 | ||
221 | if (checksum) { | 240 | /* Compute the final checksum */ |
222 | ACPI_WARNING((AE_INFO, | ||
223 | "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)", | ||
224 | table_header->signature, | ||
225 | (u32) table_header->checksum, (u32) checksum)); | ||
226 | 241 | ||
227 | status = AE_BAD_CHECKSUM; | 242 | checksum = (u8) (0 - checksum); |
228 | } | 243 | return (checksum); |
229 | return_ACPI_STATUS(status); | ||
230 | } | 244 | } |
231 | 245 | ||
232 | /******************************************************************************* | 246 | /******************************************************************************* |
233 | * | 247 | * |
234 | * FUNCTION: acpi_tb_generate_checksum | 248 | * FUNCTION: acpi_tb_set_checksum |
235 | * | 249 | * |
236 | * PARAMETERS: Buffer - Buffer to checksum | 250 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a |
237 | * Length - Size of the buffer | 251 | * standard ACPI header) |
238 | * | 252 | * |
239 | * RETURN: 8 bit checksum of buffer | 253 | * RETURN: None. Sets the table checksum field |
240 | * | 254 | * |
241 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. | 255 | * DESCRIPTION: Computes an 8 bit checksum of the table and inserts the |
256 | * checksum into the table header. | ||
242 | * | 257 | * |
243 | ******************************************************************************/ | 258 | ******************************************************************************/ |
244 | 259 | ||
245 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) | 260 | void acpi_tb_set_checksum(struct acpi_table_header *table) |
246 | { | 261 | { |
247 | u8 *end_buffer; | ||
248 | u8 *rover; | ||
249 | u8 sum = 0; | ||
250 | 262 | ||
251 | if (buffer && length) { | 263 | table->checksum = acpi_tb_generate_checksum(table); |
252 | /* Buffer and Length are valid */ | 264 | } |
253 | 265 | ||
254 | end_buffer = ACPI_ADD_PTR(u8, buffer, length); | 266 | /******************************************************************************* |
267 | * | ||
268 | * FUNCTION: acpi_tb_verify_table_checksum | ||
269 | * | ||
270 | * PARAMETERS: *table_header - ACPI table to verify | ||
271 | * | ||
272 | * RETURN: 8 bit checksum of table | ||
273 | * | ||
274 | * DESCRIPTION: Generates an 8 bit checksum of table and returns and compares | ||
275 | * it to the existing checksum value. | ||
276 | * | ||
277 | ******************************************************************************/ | ||
255 | 278 | ||
256 | for (rover = buffer; rover < end_buffer; rover++) { | 279 | acpi_status |
257 | sum = (u8) (sum + *rover); | 280 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header) |
258 | } | 281 | { |
282 | u8 checksum; | ||
283 | |||
284 | ACPI_FUNCTION_TRACE(tb_verify_table_checksum); | ||
285 | |||
286 | /* Compute the checksum on the table */ | ||
287 | |||
288 | checksum = acpi_tb_generate_checksum(table_header); | ||
289 | |||
290 | /* Checksum ok? */ | ||
291 | |||
292 | if (checksum == table_header->checksum) { | ||
293 | return_ACPI_STATUS(AE_OK); | ||
259 | } | 294 | } |
260 | return (sum); | 295 | |
296 | ACPI_WARNING((AE_INFO, | ||
297 | "Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X", | ||
298 | table_header->signature, table_header->checksum, | ||
299 | checksum)); | ||
300 | |||
301 | return_ACPI_STATUS(AE_BAD_CHECKSUM); | ||
261 | } | 302 | } |
262 | 303 | ||
263 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 304 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
@@ -276,12 +317,12 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length) | |||
276 | 317 | ||
277 | acpi_status | 318 | acpi_status |
278 | acpi_tb_handle_to_object(u16 table_id, | 319 | acpi_tb_handle_to_object(u16 table_id, |
279 | struct acpi_table_desc ** return_table_desc) | 320 | struct acpi_table_desc **return_table_desc) |
280 | { | 321 | { |
281 | u32 i; | 322 | u32 i; |
282 | struct acpi_table_desc *table_desc; | 323 | struct acpi_table_desc *table_desc; |
283 | 324 | ||
284 | ACPI_FUNCTION_NAME("tb_handle_to_object"); | 325 | ACPI_FUNCTION_NAME(tb_handle_to_object); |
285 | 326 | ||
286 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | 327 | for (i = 0; i < ACPI_TABLE_MAX; i++) { |
287 | table_desc = acpi_gbl_table_lists[i].next; | 328 | table_desc = acpi_gbl_table_lists[i].next; |
@@ -295,7 +336,7 @@ acpi_tb_handle_to_object(u16 table_id, | |||
295 | } | 336 | } |
296 | } | 337 | } |
297 | 338 | ||
298 | ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id)); | 339 | ACPI_ERROR((AE_INFO, "TableId=%X does not exist", table_id)); |
299 | return (AE_BAD_PARAMETER); | 340 | return (AE_BAD_PARAMETER); |
300 | } | 341 | } |
301 | #endif | 342 | #endif |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 9fe53c9d5b9a..4e91f2984815 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/actables.h> | 47 | #include <acpi/actables.h> |
@@ -68,7 +66,7 @@ acpi_status acpi_load_tables(void) | |||
68 | struct acpi_pointer rsdp_address; | 66 | struct acpi_pointer rsdp_address; |
69 | acpi_status status; | 67 | acpi_status status; |
70 | 68 | ||
71 | ACPI_FUNCTION_TRACE("acpi_load_tables"); | 69 | ACPI_FUNCTION_TRACE(acpi_load_tables); |
72 | 70 | ||
73 | /* Get the RSDP */ | 71 | /* Get the RSDP */ |
74 | 72 | ||
@@ -123,6 +121,8 @@ acpi_status acpi_load_tables(void) | |||
123 | return_ACPI_STATUS(status); | 121 | return_ACPI_STATUS(status); |
124 | } | 122 | } |
125 | 123 | ||
124 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | ||
125 | |||
126 | #ifdef ACPI_FUTURE_USAGE | 126 | #ifdef ACPI_FUTURE_USAGE |
127 | /******************************************************************************* | 127 | /******************************************************************************* |
128 | * | 128 | * |
@@ -139,14 +139,13 @@ acpi_status acpi_load_tables(void) | |||
139 | * is determined that the table is invalid, the call will fail. | 139 | * is determined that the table is invalid, the call will fail. |
140 | * | 140 | * |
141 | ******************************************************************************/ | 141 | ******************************************************************************/ |
142 | |||
143 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | 142 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) |
144 | { | 143 | { |
145 | acpi_status status; | 144 | acpi_status status; |
146 | struct acpi_table_desc table_info; | 145 | struct acpi_table_desc table_info; |
147 | struct acpi_pointer address; | 146 | struct acpi_pointer address; |
148 | 147 | ||
149 | ACPI_FUNCTION_TRACE("acpi_load_table"); | 148 | ACPI_FUNCTION_TRACE(acpi_load_table); |
150 | 149 | ||
151 | if (!table_ptr) { | 150 | if (!table_ptr) { |
152 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 151 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -174,6 +173,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
174 | status = acpi_tb_install_table(&table_info); | 173 | status = acpi_tb_install_table(&table_info); |
175 | if (ACPI_FAILURE(status)) { | 174 | if (ACPI_FAILURE(status)) { |
176 | if (status == AE_ALREADY_EXISTS) { | 175 | if (status == AE_ALREADY_EXISTS) { |
176 | |||
177 | /* Table already exists, no error */ | 177 | /* Table already exists, no error */ |
178 | 178 | ||
179 | status = AE_OK; | 179 | status = AE_OK; |
@@ -188,12 +188,12 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
188 | /* Convert the table to common format if necessary */ | 188 | /* Convert the table to common format if necessary */ |
189 | 189 | ||
190 | switch (table_info.type) { | 190 | switch (table_info.type) { |
191 | case ACPI_TABLE_FADT: | 191 | case ACPI_TABLE_ID_FADT: |
192 | 192 | ||
193 | status = acpi_tb_convert_table_fadt(); | 193 | status = acpi_tb_convert_table_fadt(); |
194 | break; | 194 | break; |
195 | 195 | ||
196 | case ACPI_TABLE_FACS: | 196 | case ACPI_TABLE_ID_FACS: |
197 | 197 | ||
198 | status = acpi_tb_build_common_facs(&table_info); | 198 | status = acpi_tb_build_common_facs(&table_info); |
199 | break; | 199 | break; |
@@ -208,6 +208,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | if (ACPI_FAILURE(status)) { | 210 | if (ACPI_FAILURE(status)) { |
211 | |||
211 | /* Uninstall table and free the buffer */ | 212 | /* Uninstall table and free the buffer */ |
212 | 213 | ||
213 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | 214 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
@@ -216,6 +217,8 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
216 | return_ACPI_STATUS(status); | 217 | return_ACPI_STATUS(status); |
217 | } | 218 | } |
218 | 219 | ||
220 | ACPI_EXPORT_SYMBOL(acpi_load_table) | ||
221 | |||
219 | /******************************************************************************* | 222 | /******************************************************************************* |
220 | * | 223 | * |
221 | * FUNCTION: acpi_unload_table | 224 | * FUNCTION: acpi_unload_table |
@@ -227,16 +230,15 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
227 | * DESCRIPTION: This routine is used to force the unload of a table | 230 | * DESCRIPTION: This routine is used to force the unload of a table |
228 | * | 231 | * |
229 | ******************************************************************************/ | 232 | ******************************************************************************/ |
230 | |||
231 | acpi_status acpi_unload_table(acpi_table_type table_type) | 233 | acpi_status acpi_unload_table(acpi_table_type table_type) |
232 | { | 234 | { |
233 | struct acpi_table_desc *table_desc; | 235 | struct acpi_table_desc *table_desc; |
234 | 236 | ||
235 | ACPI_FUNCTION_TRACE("acpi_unload_table"); | 237 | ACPI_FUNCTION_TRACE(acpi_unload_table); |
236 | 238 | ||
237 | /* Parameter validation */ | 239 | /* Parameter validation */ |
238 | 240 | ||
239 | if (table_type > ACPI_TABLE_MAX) { | 241 | if (table_type > ACPI_TABLE_ID_MAX) { |
240 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 242 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
241 | } | 243 | } |
242 | 244 | ||
@@ -261,6 +263,8 @@ acpi_status acpi_unload_table(acpi_table_type table_type) | |||
261 | return_ACPI_STATUS(AE_OK); | 263 | return_ACPI_STATUS(AE_OK); |
262 | } | 264 | } |
263 | 265 | ||
266 | ACPI_EXPORT_SYMBOL(acpi_unload_table) | ||
267 | |||
264 | /******************************************************************************* | 268 | /******************************************************************************* |
265 | * | 269 | * |
266 | * FUNCTION: acpi_get_table_header | 270 | * FUNCTION: acpi_get_table_header |
@@ -281,7 +285,6 @@ acpi_status acpi_unload_table(acpi_table_type table_type) | |||
281 | * have a standard header and is fixed length. | 285 | * have a standard header and is fixed length. |
282 | * | 286 | * |
283 | ******************************************************************************/ | 287 | ******************************************************************************/ |
284 | |||
285 | acpi_status | 288 | acpi_status |
286 | acpi_get_table_header(acpi_table_type table_type, | 289 | acpi_get_table_header(acpi_table_type table_type, |
287 | u32 instance, struct acpi_table_header *out_table_header) | 290 | u32 instance, struct acpi_table_header *out_table_header) |
@@ -289,16 +292,16 @@ acpi_get_table_header(acpi_table_type table_type, | |||
289 | struct acpi_table_header *tbl_ptr; | 292 | struct acpi_table_header *tbl_ptr; |
290 | acpi_status status; | 293 | acpi_status status; |
291 | 294 | ||
292 | ACPI_FUNCTION_TRACE("acpi_get_table_header"); | 295 | ACPI_FUNCTION_TRACE(acpi_get_table_header); |
293 | 296 | ||
294 | if ((instance == 0) || | 297 | if ((instance == 0) || |
295 | (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) { | 298 | (table_type == ACPI_TABLE_ID_RSDP) || (!out_table_header)) { |
296 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 299 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
297 | } | 300 | } |
298 | 301 | ||
299 | /* Check the table type and instance */ | 302 | /* Check the table type and instance */ |
300 | 303 | ||
301 | if ((table_type > ACPI_TABLE_MAX) || | 304 | if ((table_type > ACPI_TABLE_ID_MAX) || |
302 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && | 305 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && |
303 | instance > 1)) { | 306 | instance > 1)) { |
304 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 307 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -325,6 +328,7 @@ acpi_get_table_header(acpi_table_type table_type, | |||
325 | return_ACPI_STATUS(status); | 328 | return_ACPI_STATUS(status); |
326 | } | 329 | } |
327 | 330 | ||
331 | ACPI_EXPORT_SYMBOL(acpi_get_table_header) | ||
328 | #endif /* ACPI_FUTURE_USAGE */ | 332 | #endif /* ACPI_FUTURE_USAGE */ |
329 | 333 | ||
330 | /******************************************************************************* | 334 | /******************************************************************************* |
@@ -349,7 +353,6 @@ acpi_get_table_header(acpi_table_type table_type, | |||
349 | * a complete table including the header. | 353 | * a complete table including the header. |
350 | * | 354 | * |
351 | ******************************************************************************/ | 355 | ******************************************************************************/ |
352 | |||
353 | acpi_status | 356 | acpi_status |
354 | acpi_get_table(acpi_table_type table_type, | 357 | acpi_get_table(acpi_table_type table_type, |
355 | u32 instance, struct acpi_buffer *ret_buffer) | 358 | u32 instance, struct acpi_buffer *ret_buffer) |
@@ -358,7 +361,7 @@ acpi_get_table(acpi_table_type table_type, | |||
358 | acpi_status status; | 361 | acpi_status status; |
359 | acpi_size table_length; | 362 | acpi_size table_length; |
360 | 363 | ||
361 | ACPI_FUNCTION_TRACE("acpi_get_table"); | 364 | ACPI_FUNCTION_TRACE(acpi_get_table); |
362 | 365 | ||
363 | /* Parameter validation */ | 366 | /* Parameter validation */ |
364 | 367 | ||
@@ -373,7 +376,7 @@ acpi_get_table(acpi_table_type table_type, | |||
373 | 376 | ||
374 | /* Check the table type and instance */ | 377 | /* Check the table type and instance */ |
375 | 378 | ||
376 | if ((table_type > ACPI_TABLE_MAX) || | 379 | if ((table_type > ACPI_TABLE_ID_MAX) || |
377 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && | 380 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && |
378 | instance > 1)) { | 381 | instance > 1)) { |
379 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 382 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -396,7 +399,8 @@ acpi_get_table(acpi_table_type table_type, | |||
396 | 399 | ||
397 | /* Get the table length */ | 400 | /* Get the table length */ |
398 | 401 | ||
399 | if (table_type == ACPI_TABLE_RSDP) { | 402 | if (table_type == ACPI_TABLE_ID_RSDP) { |
403 | |||
400 | /* RSD PTR is the only "table" without a header */ | 404 | /* RSD PTR is the only "table" without a header */ |
401 | 405 | ||
402 | table_length = sizeof(struct rsdp_descriptor); | 406 | table_length = sizeof(struct rsdp_descriptor); |
@@ -417,4 +421,4 @@ acpi_get_table(acpi_table_type table_type, | |||
417 | return_ACPI_STATUS(AE_OK); | 421 | return_ACPI_STATUS(AE_OK); |
418 | } | 422 | } |
419 | 423 | ||
420 | EXPORT_SYMBOL(acpi_get_table); | 424 | ACPI_EXPORT_SYMBOL(acpi_get_table) |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index a62db6af83c9..da2648bbdbc0 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
48 | 46 | ||
@@ -75,6 +73,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
75 | * The signature and checksum must both be correct | 73 | * The signature and checksum must both be correct |
76 | */ | 74 | */ |
77 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { | 75 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { |
76 | |||
78 | /* Nope, BAD Signature */ | 77 | /* Nope, BAD Signature */ |
79 | 78 | ||
80 | return (AE_BAD_SIGNATURE); | 79 | return (AE_BAD_SIGNATURE); |
@@ -82,15 +81,14 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
82 | 81 | ||
83 | /* Check the standard checksum */ | 82 | /* Check the standard checksum */ |
84 | 83 | ||
85 | if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | 84 | if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { |
86 | return (AE_BAD_CHECKSUM); | 85 | return (AE_BAD_CHECKSUM); |
87 | } | 86 | } |
88 | 87 | ||
89 | /* Check extended checksum if table version >= 2 */ | 88 | /* Check extended checksum if table version >= 2 */ |
90 | 89 | ||
91 | if ((rsdp->revision >= 2) && | 90 | if ((rsdp->revision >= 2) && |
92 | (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != | 91 | (acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { |
93 | 0)) { | ||
94 | return (AE_BAD_CHECKSUM); | 92 | return (AE_BAD_CHECKSUM); |
95 | } | 93 | } |
96 | 94 | ||
@@ -121,7 +119,7 @@ acpi_tb_find_table(char *signature, | |||
121 | acpi_status status; | 119 | acpi_status status; |
122 | struct acpi_table_header *table; | 120 | struct acpi_table_header *table; |
123 | 121 | ||
124 | ACPI_FUNCTION_TRACE("tb_find_table"); | 122 | ACPI_FUNCTION_TRACE(tb_find_table); |
125 | 123 | ||
126 | /* Validate string lengths */ | 124 | /* Validate string lengths */ |
127 | 125 | ||
@@ -131,7 +129,7 @@ acpi_tb_find_table(char *signature, | |||
131 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); | 129 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
132 | } | 130 | } |
133 | 131 | ||
134 | if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) { | 132 | if (ACPI_COMPARE_NAME(signature, DSDT_SIG)) { |
135 | /* | 133 | /* |
136 | * The DSDT pointer is contained in the FADT, not the RSDT. | 134 | * The DSDT pointer is contained in the FADT, not the RSDT. |
137 | * This code should suffice, because the only code that would perform | 135 | * This code should suffice, because the only code that would perform |
@@ -156,10 +154,12 @@ acpi_tb_find_table(char *signature, | |||
156 | 154 | ||
157 | /* Check oem_id and oem_table_id */ | 155 | /* Check oem_id and oem_table_id */ |
158 | 156 | ||
159 | if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id, | 157 | if ((oem_id[0] && |
160 | sizeof(table->oem_id))) || | 158 | ACPI_STRNCMP(oem_id, table->oem_id, |
161 | (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id, | 159 | sizeof(table->oem_id))) || |
162 | sizeof(table->oem_table_id)))) { | 160 | (oem_table_id[0] && |
161 | ACPI_STRNCMP(oem_table_id, table->oem_table_id, | ||
162 | sizeof(table->oem_table_id)))) { | ||
163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); | 163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); |
164 | } | 164 | } |
165 | 165 | ||
@@ -203,7 +203,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
203 | u32 i; | 203 | u32 i; |
204 | u32 j; | 204 | u32 j; |
205 | 205 | ||
206 | ACPI_FUNCTION_TRACE("acpi_get_firmware_table"); | 206 | ACPI_FUNCTION_TRACE(acpi_get_firmware_table); |
207 | 207 | ||
208 | /* | 208 | /* |
209 | * Ensure that at least the table manager is initialized. We don't | 209 | * Ensure that at least the table manager is initialized. We don't |
@@ -217,6 +217,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
217 | /* Ensure that we have a RSDP */ | 217 | /* Ensure that we have a RSDP */ |
218 | 218 | ||
219 | if (!acpi_gbl_RSDP) { | 219 | if (!acpi_gbl_RSDP) { |
220 | |||
220 | /* Get the RSDP */ | 221 | /* Get the RSDP */ |
221 | 222 | ||
222 | status = acpi_os_get_root_pointer(flags, &address); | 223 | status = acpi_os_get_root_pointer(flags, &address); |
@@ -261,7 +262,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
261 | 262 | ||
262 | /* Get and validate the RSDT */ | 263 | /* Get and validate the RSDT */ |
263 | 264 | ||
264 | rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); | 265 | rsdt_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); |
265 | if (!rsdt_info) { | 266 | if (!rsdt_info) { |
266 | return_ACPI_STATUS(AE_NO_MEMORY); | 267 | return_ACPI_STATUS(AE_NO_MEMORY); |
267 | } | 268 | } |
@@ -278,13 +279,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
278 | 279 | ||
279 | /* Allocate a scratch table header and table descriptor */ | 280 | /* Allocate a scratch table header and table descriptor */ |
280 | 281 | ||
281 | header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); | 282 | header = ACPI_ALLOCATE(sizeof(struct acpi_table_header)); |
282 | if (!header) { | 283 | if (!header) { |
283 | status = AE_NO_MEMORY; | 284 | status = AE_NO_MEMORY; |
284 | goto cleanup; | 285 | goto cleanup; |
285 | } | 286 | } |
286 | 287 | ||
287 | table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); | 288 | table_info = ACPI_ALLOCATE(sizeof(struct acpi_table_desc)); |
288 | if (!table_info) { | 289 | if (!table_info) { |
289 | status = AE_NO_MEMORY; | 290 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 291 | goto cleanup; |
@@ -308,12 +309,12 @@ acpi_get_firmware_table(acpi_string signature, | |||
308 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 309 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
309 | address.pointer.value = | 310 | address.pointer.value = |
310 | (ACPI_CAST_PTR | 311 | (ACPI_CAST_PTR |
311 | (RSDT_DESCRIPTOR, | 312 | (struct rsdt_descriptor, |
312 | rsdt_info->pointer))->table_offset_entry[i]; | 313 | rsdt_info->pointer))->table_offset_entry[i]; |
313 | } else { | 314 | } else { |
314 | address.pointer.value = | 315 | address.pointer.value = |
315 | (ACPI_CAST_PTR | 316 | (ACPI_CAST_PTR |
316 | (XSDT_DESCRIPTOR, | 317 | (struct xsdt_descriptor, |
317 | rsdt_info->pointer))->table_offset_entry[i]; | 318 | rsdt_info->pointer))->table_offset_entry[i]; |
318 | } | 319 | } |
319 | 320 | ||
@@ -326,11 +327,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
326 | 327 | ||
327 | /* Compare table signatures and table instance */ | 328 | /* Compare table signatures and table instance */ |
328 | 329 | ||
329 | if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { | 330 | if (ACPI_COMPARE_NAME(header->signature, signature)) { |
331 | |||
330 | /* An instance of the table was found */ | 332 | /* An instance of the table was found */ |
331 | 333 | ||
332 | j++; | 334 | j++; |
333 | if (j >= instance) { | 335 | if (j >= instance) { |
336 | |||
334 | /* Found the correct instance, get the entire table */ | 337 | /* Found the correct instance, get the entire table */ |
335 | 338 | ||
336 | status = | 339 | status = |
@@ -355,23 +358,21 @@ acpi_get_firmware_table(acpi_string signature, | |||
355 | acpi_os_unmap_memory(rsdt_info->pointer, | 358 | acpi_os_unmap_memory(rsdt_info->pointer, |
356 | (acpi_size) rsdt_info->pointer->length); | 359 | (acpi_size) rsdt_info->pointer->length); |
357 | } | 360 | } |
358 | ACPI_MEM_FREE(rsdt_info); | 361 | ACPI_FREE(rsdt_info); |
359 | 362 | ||
360 | if (header) { | 363 | if (header) { |
361 | ACPI_MEM_FREE(header); | 364 | ACPI_FREE(header); |
362 | } | 365 | } |
363 | if (table_info) { | 366 | if (table_info) { |
364 | ACPI_MEM_FREE(table_info); | 367 | ACPI_FREE(table_info); |
365 | } | 368 | } |
366 | return_ACPI_STATUS(status); | 369 | return_ACPI_STATUS(status); |
367 | } | 370 | } |
368 | 371 | ||
369 | EXPORT_SYMBOL(acpi_get_firmware_table); | 372 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_table) |
370 | 373 | ||
371 | /* TBD: Move to a new file */ | 374 | /* TBD: Move to a new file */ |
372 | |||
373 | #if ACPI_MACHINE_WIDTH != 16 | 375 | #if ACPI_MACHINE_WIDTH != 16 |
374 | |||
375 | /******************************************************************************* | 376 | /******************************************************************************* |
376 | * | 377 | * |
377 | * FUNCTION: acpi_find_root_pointer | 378 | * FUNCTION: acpi_find_root_pointer |
@@ -384,13 +385,12 @@ EXPORT_SYMBOL(acpi_get_firmware_table); | |||
384 | * DESCRIPTION: Find the RSDP | 385 | * DESCRIPTION: Find the RSDP |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | 388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) |
389 | { | 389 | { |
390 | struct acpi_table_desc table_info; | 390 | struct acpi_table_desc table_info; |
391 | acpi_status status; | 391 | acpi_status status; |
392 | 392 | ||
393 | ACPI_FUNCTION_TRACE("acpi_find_root_pointer"); | 393 | ACPI_FUNCTION_TRACE(acpi_find_root_pointer); |
394 | 394 | ||
395 | /* Get the RSDP */ | 395 | /* Get the RSDP */ |
396 | 396 | ||
@@ -407,6 +407,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
407 | return_ACPI_STATUS(AE_OK); | 407 | return_ACPI_STATUS(AE_OK); |
408 | } | 408 | } |
409 | 409 | ||
410 | ACPI_EXPORT_SYMBOL(acpi_find_root_pointer) | ||
411 | |||
410 | /******************************************************************************* | 412 | /******************************************************************************* |
411 | * | 413 | * |
412 | * FUNCTION: acpi_tb_scan_memory_for_rsdp | 414 | * FUNCTION: acpi_tb_scan_memory_for_rsdp |
@@ -419,14 +421,13 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
419 | * DESCRIPTION: Search a block of memory for the RSDP signature | 421 | * DESCRIPTION: Search a block of memory for the RSDP signature |
420 | * | 422 | * |
421 | ******************************************************************************/ | 423 | ******************************************************************************/ |
422 | |||
423 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | 424 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) |
424 | { | 425 | { |
425 | acpi_status status; | 426 | acpi_status status; |
426 | u8 *mem_rover; | 427 | u8 *mem_rover; |
427 | u8 *end_address; | 428 | u8 *end_address; |
428 | 429 | ||
429 | ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp"); | 430 | ACPI_FUNCTION_TRACE(tb_scan_memory_for_rsdp); |
430 | 431 | ||
431 | end_address = start_address + length; | 432 | end_address = start_address + length; |
432 | 433 | ||
@@ -434,12 +435,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
434 | 435 | ||
435 | for (mem_rover = start_address; mem_rover < end_address; | 436 | for (mem_rover = start_address; mem_rover < end_address; |
436 | mem_rover += ACPI_RSDP_SCAN_STEP) { | 437 | mem_rover += ACPI_RSDP_SCAN_STEP) { |
438 | |||
437 | /* The RSDP signature and checksum must both be correct */ | 439 | /* The RSDP signature and checksum must both be correct */ |
438 | 440 | ||
439 | status = | 441 | status = |
440 | acpi_tb_validate_rsdp(ACPI_CAST_PTR | 442 | acpi_tb_validate_rsdp(ACPI_CAST_PTR |
441 | (struct rsdp_descriptor, mem_rover)); | 443 | (struct rsdp_descriptor, mem_rover)); |
442 | if (ACPI_SUCCESS(status)) { | 444 | if (ACPI_SUCCESS(status)) { |
445 | |||
443 | /* Sig and checksum valid, we have found a real RSDP */ | 446 | /* Sig and checksum valid, we have found a real RSDP */ |
444 | 447 | ||
445 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 448 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -469,10 +472,10 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
469 | * | 472 | * |
470 | * RETURN: Status, RSDP physical address | 473 | * RETURN: Status, RSDP physical address |
471 | * | 474 | * |
472 | * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor | 475 | * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor |
473 | * pointer structure. If it is found, set *RSDP to point to it. | 476 | * pointer structure. If it is found, set *RSDP to point to it. |
474 | * | 477 | * |
475 | * NOTE1: The RSDp must be either in the first 1_k of the Extended | 478 | * NOTE1: The RSDP must be either in the first 1_k of the Extended |
476 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) | 479 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) |
477 | * Only a 32-bit physical address is necessary. | 480 | * Only a 32-bit physical address is necessary. |
478 | * | 481 | * |
@@ -489,12 +492,13 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
489 | u32 physical_address; | 492 | u32 physical_address; |
490 | acpi_status status; | 493 | acpi_status status; |
491 | 494 | ||
492 | ACPI_FUNCTION_TRACE("tb_find_rsdp"); | 495 | ACPI_FUNCTION_TRACE(tb_find_rsdp); |
493 | 496 | ||
494 | /* | 497 | /* |
495 | * Scan supports either logical addressing or physical addressing | 498 | * Scan supports either logical addressing or physical addressing |
496 | */ | 499 | */ |
497 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 500 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
501 | |||
498 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ | 502 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
499 | 503 | ||
500 | status = acpi_os_map_memory((acpi_physical_address) | 504 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -521,7 +525,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
521 | 525 | ||
522 | if (physical_address > 0x400) { | 526 | if (physical_address > 0x400) { |
523 | /* | 527 | /* |
524 | * 1b) Search EBDA paragraphs (EBDa is required to be a | 528 | * 1b) Search EBDA paragraphs (EBDA is required to be a |
525 | * minimum of 1_k length) | 529 | * minimum of 1_k length) |
526 | */ | 530 | */ |
527 | status = acpi_os_map_memory((acpi_physical_address) | 531 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -542,10 +546,11 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
542 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); | 546 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); |
543 | 547 | ||
544 | if (mem_rover) { | 548 | if (mem_rover) { |
549 | |||
545 | /* Return the physical address */ | 550 | /* Return the physical address */ |
546 | 551 | ||
547 | physical_address += | 552 | physical_address += |
548 | ACPI_PTR_DIFF(mem_rover, table_ptr); | 553 | (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); |
549 | 554 | ||
550 | table_info->physical_address = | 555 | table_info->physical_address = |
551 | (acpi_physical_address) physical_address; | 556 | (acpi_physical_address) physical_address; |
@@ -576,11 +581,12 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
576 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | 581 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); |
577 | 582 | ||
578 | if (mem_rover) { | 583 | if (mem_rover) { |
584 | |||
579 | /* Return the physical address */ | 585 | /* Return the physical address */ |
580 | 586 | ||
581 | physical_address = | 587 | physical_address = (u32) |
582 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, | 588 | (ACPI_HI_RSDP_WINDOW_BASE + |
583 | table_ptr); | 589 | ACPI_PTR_DIFF(mem_rover, table_ptr)); |
584 | 590 | ||
585 | table_info->physical_address = | 591 | table_info->physical_address = |
586 | (acpi_physical_address) physical_address; | 592 | (acpi_physical_address) physical_address; |
@@ -601,7 +607,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
601 | 607 | ||
602 | if (physical_address > 0x400) { | 608 | if (physical_address > 0x400) { |
603 | /* | 609 | /* |
604 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of | 610 | * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of |
605 | * 1_k length) | 611 | * 1_k length) |
606 | */ | 612 | */ |
607 | mem_rover = | 613 | mem_rover = |
@@ -609,6 +615,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
609 | (physical_address), | 615 | (physical_address), |
610 | ACPI_EBDA_WINDOW_SIZE); | 616 | ACPI_EBDA_WINDOW_SIZE); |
611 | if (mem_rover) { | 617 | if (mem_rover) { |
618 | |||
612 | /* Return the physical address */ | 619 | /* Return the physical address */ |
613 | 620 | ||
614 | table_info->physical_address = | 621 | table_info->physical_address = |
@@ -624,6 +631,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
624 | (ACPI_HI_RSDP_WINDOW_BASE), | 631 | (ACPI_HI_RSDP_WINDOW_BASE), |
625 | ACPI_HI_RSDP_WINDOW_SIZE); | 632 | ACPI_HI_RSDP_WINDOW_SIZE); |
626 | if (mem_rover) { | 633 | if (mem_rover) { |
634 | |||
627 | /* Found it, return the physical address */ | 635 | /* Found it, return the physical address */ |
628 | 636 | ||
629 | table_info->physical_address = | 637 | table_info->physical_address = |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 19f3ea48475e..e7fe3a14fdaf 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -82,6 +82,7 @@ MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); | |||
82 | 82 | ||
83 | static int acpi_thermal_add(struct acpi_device *device); | 83 | static int acpi_thermal_add(struct acpi_device *device); |
84 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 84 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
85 | static int acpi_thermal_resume(struct acpi_device *device, int state); | ||
85 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | 86 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); |
86 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | 87 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); |
87 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | 88 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); |
@@ -103,6 +104,7 @@ static struct acpi_driver acpi_thermal_driver = { | |||
103 | .ops = { | 104 | .ops = { |
104 | .add = acpi_thermal_add, | 105 | .add = acpi_thermal_add, |
105 | .remove = acpi_thermal_remove, | 106 | .remove = acpi_thermal_remove, |
107 | .resume = acpi_thermal_resume, | ||
106 | }, | 108 | }, |
107 | }; | 109 | }; |
108 | 110 | ||
@@ -684,8 +686,7 @@ static void acpi_thermal_run(unsigned long data) | |||
684 | { | 686 | { |
685 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 687 | struct acpi_thermal *tz = (struct acpi_thermal *)data; |
686 | if (!tz->zombie) | 688 | if (!tz->zombie) |
687 | acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 689 | acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); |
688 | acpi_thermal_check, (void *)data); | ||
689 | } | 690 | } |
690 | 691 | ||
691 | static void acpi_thermal_check(void *data) | 692 | static void acpi_thermal_check(void *data) |
@@ -942,8 +943,10 @@ acpi_thermal_write_trip_points(struct file *file, | |||
942 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); | 943 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); |
943 | 944 | ||
944 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | 945 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); |
945 | if (!active) | 946 | if (!active) { |
947 | kfree(limit_string); | ||
946 | return_VALUE(-ENOMEM); | 948 | return_VALUE(-ENOMEM); |
949 | } | ||
947 | 950 | ||
948 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | 951 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { |
949 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); | 952 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); |
@@ -1342,7 +1345,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1342 | 1345 | ||
1343 | result = acpi_thermal_add_fs(device); | 1346 | result = acpi_thermal_add_fs(device); |
1344 | if (result) | 1347 | if (result) |
1345 | return_VALUE(result); | 1348 | goto end; |
1346 | 1349 | ||
1347 | init_timer(&tz->timer); | 1350 | init_timer(&tz->timer); |
1348 | 1351 | ||
@@ -1416,6 +1419,20 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1416 | return_VALUE(0); | 1419 | return_VALUE(0); |
1417 | } | 1420 | } |
1418 | 1421 | ||
1422 | static int acpi_thermal_resume(struct acpi_device *device, int state) | ||
1423 | { | ||
1424 | struct acpi_thermal *tz = NULL; | ||
1425 | |||
1426 | if (!device || !acpi_driver_data(device)) | ||
1427 | return_VALUE(-EINVAL); | ||
1428 | |||
1429 | tz = (struct acpi_thermal *)acpi_driver_data(device); | ||
1430 | |||
1431 | acpi_thermal_check(tz); | ||
1432 | |||
1433 | return AE_OK; | ||
1434 | } | ||
1435 | |||
1419 | static int __init acpi_thermal_init(void) | 1436 | static int __init acpi_thermal_init(void) |
1420 | { | 1437 | { |
1421 | int result = 0; | 1438 | int result = 0; |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 03b0044974c2..7940fc1bd69e 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,33 +57,23 @@ 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; |
82 | 63 | ||
83 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 64 | /* Object Caches, for frequently used objects */ |
84 | |||
85 | /* Memory allocation lists */ | ||
86 | |||
87 | status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); | ||
88 | if (ACPI_FAILURE(status)) { | ||
89 | return (status); | ||
90 | } | ||
91 | 65 | ||
92 | status = | 66 | status = |
93 | acpi_ut_create_list("Acpi-Namespace", | 67 | acpi_os_create_cache("Acpi-Namespace", |
94 | sizeof(struct acpi_namespace_node), | 68 | sizeof(struct acpi_namespace_node), |
95 | &acpi_gbl_ns_node_list); | 69 | ACPI_MAX_NAMESPACE_CACHE_DEPTH, |
70 | &acpi_gbl_namespace_cache); | ||
96 | if (ACPI_FAILURE(status)) { | 71 | if (ACPI_FAILURE(status)) { |
97 | return (status); | 72 | return (status); |
98 | } | 73 | } |
99 | #endif | ||
100 | |||
101 | /* Object Caches, for frequently used objects */ | ||
102 | 74 | ||
103 | status = | 75 | status = |
104 | acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), | 76 | acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state), |
105 | ACPI_MAX_STATE_CACHE_DEPTH, | 77 | ACPI_MAX_STATE_CACHE_DEPTH, |
106 | &acpi_gbl_state_cache); | 78 | &acpi_gbl_state_cache); |
107 | if (ACPI_FAILURE(status)) { | 79 | if (ACPI_FAILURE(status)) { |
@@ -109,7 +81,7 @@ acpi_status acpi_ut_create_caches(void) | |||
109 | } | 81 | } |
110 | 82 | ||
111 | status = | 83 | status = |
112 | acpi_os_create_cache("acpi_parse", | 84 | acpi_os_create_cache("Acpi-Parse", |
113 | sizeof(struct acpi_parse_obj_common), | 85 | sizeof(struct acpi_parse_obj_common), |
114 | ACPI_MAX_PARSE_CACHE_DEPTH, | 86 | ACPI_MAX_PARSE_CACHE_DEPTH, |
115 | &acpi_gbl_ps_node_cache); | 87 | &acpi_gbl_ps_node_cache); |
@@ -118,7 +90,7 @@ acpi_status acpi_ut_create_caches(void) | |||
118 | } | 90 | } |
119 | 91 | ||
120 | status = | 92 | status = |
121 | acpi_os_create_cache("acpi_parse_ext", | 93 | acpi_os_create_cache("Acpi-ParseExt", |
122 | sizeof(struct acpi_parse_obj_named), | 94 | sizeof(struct acpi_parse_obj_named), |
123 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, | 95 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, |
124 | &acpi_gbl_ps_node_ext_cache); | 96 | &acpi_gbl_ps_node_ext_cache); |
@@ -127,7 +99,7 @@ acpi_status acpi_ut_create_caches(void) | |||
127 | } | 99 | } |
128 | 100 | ||
129 | status = | 101 | status = |
130 | acpi_os_create_cache("acpi_operand", | 102 | acpi_os_create_cache("Acpi-Operand", |
131 | sizeof(union acpi_operand_object), | 103 | sizeof(union acpi_operand_object), |
132 | ACPI_MAX_OBJECT_CACHE_DEPTH, | 104 | ACPI_MAX_OBJECT_CACHE_DEPTH, |
133 | &acpi_gbl_operand_cache); | 105 | &acpi_gbl_operand_cache); |
@@ -135,6 +107,24 @@ acpi_status acpi_ut_create_caches(void) | |||
135 | return (status); | 107 | return (status); |
136 | } | 108 | } |
137 | 109 | ||
110 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
111 | |||
112 | /* Memory allocation lists */ | ||
113 | |||
114 | status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); | ||
115 | if (ACPI_FAILURE(status)) { | ||
116 | return (status); | ||
117 | } | ||
118 | |||
119 | status = | ||
120 | acpi_ut_create_list("Acpi-Namespace", | ||
121 | sizeof(struct acpi_namespace_node), | ||
122 | &acpi_gbl_ns_node_list); | ||
123 | if (ACPI_FAILURE(status)) { | ||
124 | return (status); | ||
125 | } | ||
126 | #endif | ||
127 | |||
138 | return (AE_OK); | 128 | return (AE_OK); |
139 | } | 129 | } |
140 | 130 | ||
@@ -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 | ||
@@ -165,6 +158,21 @@ acpi_status acpi_ut_delete_caches(void) | |||
165 | (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); | 158 | (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); |
166 | acpi_gbl_ps_node_ext_cache = NULL; | 159 | acpi_gbl_ps_node_ext_cache = NULL; |
167 | 160 | ||
161 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
162 | |||
163 | /* Debug only - display leftover memory allocation, if any */ | ||
164 | |||
165 | acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); | ||
166 | |||
167 | /* Free memory lists */ | ||
168 | |||
169 | acpi_os_free(acpi_gbl_global_list); | ||
170 | acpi_gbl_global_list = NULL; | ||
171 | |||
172 | acpi_os_free(acpi_gbl_ns_node_list); | ||
173 | acpi_gbl_ns_node_list = NULL; | ||
174 | #endif | ||
175 | |||
168 | return (AE_OK); | 176 | return (AE_OK); |
169 | } | 177 | } |
170 | 178 | ||
@@ -252,7 +260,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
252 | 260 | ||
253 | /* Allocate a new buffer with local interface to allow tracking */ | 261 | /* Allocate a new buffer with local interface to allow tracking */ |
254 | 262 | ||
255 | buffer->pointer = ACPI_MEM_CALLOCATE(required_length); | 263 | buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length); |
256 | if (!buffer->pointer) { | 264 | if (!buffer->pointer) { |
257 | return (AE_NO_MEMORY); | 265 | return (AE_NO_MEMORY); |
258 | } | 266 | } |
@@ -288,7 +296,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
288 | * | 296 | * |
289 | * RETURN: Address of the allocated memory on success, NULL on failure. | 297 | * RETURN: Address of the allocated memory on success, NULL on failure. |
290 | * | 298 | * |
291 | * DESCRIPTION: The subsystem's equivalent of malloc. | 299 | * DESCRIPTION: Subsystem equivalent of malloc. |
292 | * | 300 | * |
293 | ******************************************************************************/ | 301 | ******************************************************************************/ |
294 | 302 | ||
@@ -296,23 +304,23 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
296 | { | 304 | { |
297 | void *allocation; | 305 | void *allocation; |
298 | 306 | ||
299 | ACPI_FUNCTION_TRACE_U32("ut_allocate", size); | 307 | ACPI_FUNCTION_TRACE_U32(ut_allocate, size); |
300 | 308 | ||
301 | /* Check for an inadvertent size of zero bytes */ | 309 | /* Check for an inadvertent size of zero bytes */ |
302 | 310 | ||
303 | if (!size) { | 311 | if (!size) { |
304 | ACPI_ERROR((module, line, | 312 | ACPI_WARNING((module, line, |
305 | "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); | 313 | "Attempt to allocate zero bytes, allocating 1 byte")); |
306 | size = 1; | 314 | size = 1; |
307 | } | 315 | } |
308 | 316 | ||
309 | allocation = acpi_os_allocate(size); | 317 | allocation = acpi_os_allocate(size); |
310 | if (!allocation) { | 318 | if (!allocation) { |
319 | |||
311 | /* Report allocation error */ | 320 | /* Report allocation error */ |
312 | 321 | ||
313 | ACPI_ERROR((module, line, | 322 | ACPI_WARNING((module, line, |
314 | "ut_allocate: Could not allocate size %X", | 323 | "Could not allocate size %X", (u32) size)); |
315 | (u32) size)); | ||
316 | 324 | ||
317 | return_PTR(NULL); | 325 | return_PTR(NULL); |
318 | } | 326 | } |
@@ -322,7 +330,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
322 | 330 | ||
323 | /******************************************************************************* | 331 | /******************************************************************************* |
324 | * | 332 | * |
325 | * FUNCTION: acpi_ut_callocate | 333 | * FUNCTION: acpi_ut_allocate_zeroed |
326 | * | 334 | * |
327 | * PARAMETERS: Size - Size of the allocation | 335 | * PARAMETERS: Size - Size of the allocation |
328 | * Component - Component type of caller | 336 | * Component - Component type of caller |
@@ -331,542 +339,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
331 | * | 339 | * |
332 | * RETURN: Address of the allocated memory on success, NULL on failure. | 340 | * RETURN: Address of the allocated memory on success, NULL on failure. |
333 | * | 341 | * |
334 | * DESCRIPTION: Subsystem equivalent of calloc. | 342 | * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. |
335 | * | 343 | * |
336 | ******************************************************************************/ | 344 | ******************************************************************************/ |
337 | 345 | ||
338 | void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) | 346 | void *acpi_ut_allocate_zeroed(acpi_size size, |
347 | u32 component, char *module, u32 line) | ||
339 | { | 348 | { |
340 | void *allocation; | 349 | void *allocation; |
341 | 350 | ||
342 | ACPI_FUNCTION_TRACE_U32("ut_callocate", size); | ||
343 | |||
344 | /* Check for an inadvertent size of zero bytes */ | ||
345 | |||
346 | if (!size) { | ||
347 | ACPI_ERROR((module, line, | ||
348 | "Attempt to allocate zero bytes, allocating 1 byte")); | ||
349 | size = 1; | ||
350 | } | ||
351 | |||
352 | allocation = acpi_os_allocate(size); | ||
353 | if (!allocation) { | ||
354 | /* Report allocation error */ | ||
355 | |||
356 | ACPI_ERROR((module, line, | ||
357 | "Could not allocate size %X", (u32) size)); | ||
358 | return_PTR(NULL); | ||
359 | } | ||
360 | |||
361 | /* Clear the memory block */ | ||
362 | |||
363 | ACPI_MEMSET(allocation, 0, size); | ||
364 | return_PTR(allocation); | ||
365 | } | ||
366 | |||
367 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
368 | /* | ||
369 | * These procedures are used for tracking memory leaks in the subsystem, and | ||
370 | * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. | ||
371 | * | ||
372 | * Each memory allocation is tracked via a doubly linked list. Each | ||
373 | * element contains the caller's component, module name, function name, and | ||
374 | * line number. acpi_ut_allocate and acpi_ut_callocate call | ||
375 | * acpi_ut_track_allocation to add an element to the list; deletion | ||
376 | * occurs in the body of acpi_ut_free. | ||
377 | */ | ||
378 | |||
379 | /******************************************************************************* | ||
380 | * | ||
381 | * FUNCTION: acpi_ut_create_list | ||
382 | * | ||
383 | * PARAMETERS: cache_name - Ascii name for the cache | ||
384 | * object_size - Size of each cached object | ||
385 | * return_cache - Where the new cache object is returned | ||
386 | * | ||
387 | * RETURN: Status | ||
388 | * | ||
389 | * DESCRIPTION: Create a local memory list for tracking purposed | ||
390 | * | ||
391 | ******************************************************************************/ | ||
392 | |||
393 | static acpi_status | ||
394 | acpi_ut_create_list(char *list_name, | ||
395 | u16 object_size, struct acpi_memory_list **return_cache) | ||
396 | { | ||
397 | struct acpi_memory_list *cache; | ||
398 | |||
399 | cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); | ||
400 | if (!cache) { | ||
401 | return (AE_NO_MEMORY); | ||
402 | } | ||
403 | |||
404 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); | ||
405 | |||
406 | cache->list_name = list_name; | ||
407 | cache->object_size = object_size; | ||
408 | |||
409 | *return_cache = cache; | ||
410 | return (AE_OK); | ||
411 | } | ||
412 | |||
413 | /******************************************************************************* | ||
414 | * | ||
415 | * FUNCTION: acpi_ut_allocate_and_track | ||
416 | * | ||
417 | * PARAMETERS: Size - Size of the allocation | ||
418 | * Component - Component type of caller | ||
419 | * Module - Source file name of caller | ||
420 | * Line - Line number of caller | ||
421 | * | ||
422 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
423 | * | ||
424 | * DESCRIPTION: The subsystem's equivalent of malloc. | ||
425 | * | ||
426 | ******************************************************************************/ | ||
427 | |||
428 | void *acpi_ut_allocate_and_track(acpi_size size, | ||
429 | u32 component, char *module, u32 line) | ||
430 | { | ||
431 | struct acpi_debug_mem_block *allocation; | ||
432 | acpi_status status; | ||
433 | |||
434 | allocation = | ||
435 | acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), | ||
436 | component, module, line); | ||
437 | if (!allocation) { | ||
438 | return (NULL); | ||
439 | } | ||
440 | |||
441 | status = acpi_ut_track_allocation(allocation, size, | ||
442 | ACPI_MEM_MALLOC, component, module, | ||
443 | line); | ||
444 | if (ACPI_FAILURE(status)) { | ||
445 | acpi_os_free(allocation); | ||
446 | return (NULL); | ||
447 | } | ||
448 | |||
449 | acpi_gbl_global_list->total_allocated++; | ||
450 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
451 | |||
452 | return ((void *)&allocation->user_space); | ||
453 | } | ||
454 | |||
455 | /******************************************************************************* | ||
456 | * | ||
457 | * FUNCTION: acpi_ut_callocate_and_track | ||
458 | * | ||
459 | * PARAMETERS: Size - Size of the allocation | ||
460 | * Component - Component type of caller | ||
461 | * Module - Source file name of caller | ||
462 | * Line - Line number of caller | ||
463 | * | ||
464 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
465 | * | ||
466 | * DESCRIPTION: Subsystem equivalent of calloc. | ||
467 | * | ||
468 | ******************************************************************************/ | ||
469 | |||
470 | void *acpi_ut_callocate_and_track(acpi_size size, | ||
471 | u32 component, char *module, u32 line) | ||
472 | { | ||
473 | struct acpi_debug_mem_block *allocation; | ||
474 | acpi_status status; | ||
475 | |||
476 | allocation = | ||
477 | acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), | ||
478 | component, module, line); | ||
479 | if (!allocation) { | ||
480 | /* Report allocation error */ | ||
481 | |||
482 | ACPI_ERROR((module, line, | ||
483 | "Could not allocate size %X", (u32) size)); | ||
484 | return (NULL); | ||
485 | } | ||
486 | |||
487 | status = acpi_ut_track_allocation(allocation, size, | ||
488 | ACPI_MEM_CALLOC, component, module, | ||
489 | line); | ||
490 | if (ACPI_FAILURE(status)) { | ||
491 | acpi_os_free(allocation); | ||
492 | return (NULL); | ||
493 | } | ||
494 | |||
495 | acpi_gbl_global_list->total_allocated++; | ||
496 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
497 | |||
498 | return ((void *)&allocation->user_space); | ||
499 | } | ||
500 | |||
501 | /******************************************************************************* | ||
502 | * | ||
503 | * FUNCTION: acpi_ut_free_and_track | ||
504 | * | ||
505 | * PARAMETERS: Allocation - Address of the memory to deallocate | ||
506 | * Component - Component type of caller | ||
507 | * Module - Source file name of caller | ||
508 | * Line - Line number of caller | ||
509 | * | ||
510 | * RETURN: None | ||
511 | * | ||
512 | * DESCRIPTION: Frees the memory at Allocation | ||
513 | * | ||
514 | ******************************************************************************/ | ||
515 | |||
516 | void | ||
517 | acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) | ||
518 | { | ||
519 | struct acpi_debug_mem_block *debug_block; | ||
520 | acpi_status status; | ||
521 | |||
522 | ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); | ||
523 | |||
524 | if (NULL == allocation) { | ||
525 | ACPI_ERROR((module, line, "Attempt to delete a NULL address")); | ||
526 | |||
527 | return_VOID; | ||
528 | } | ||
529 | |||
530 | debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, | ||
531 | (((char *)allocation) - | ||
532 | sizeof(struct acpi_debug_mem_header))); | ||
533 | |||
534 | acpi_gbl_global_list->total_freed++; | ||
535 | acpi_gbl_global_list->current_total_size -= debug_block->size; | ||
536 | |||
537 | status = acpi_ut_remove_allocation(debug_block, | ||
538 | component, module, line); | ||
539 | if (ACPI_FAILURE(status)) { | ||
540 | ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); | ||
541 | } | ||
542 | |||
543 | acpi_os_free(debug_block); | ||
544 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); | ||
545 | return_VOID; | ||
546 | } | ||
547 | |||
548 | /******************************************************************************* | ||
549 | * | ||
550 | * FUNCTION: acpi_ut_find_allocation | ||
551 | * | ||
552 | * PARAMETERS: Allocation - Address of allocated memory | ||
553 | * | ||
554 | * RETURN: A list element if found; NULL otherwise. | ||
555 | * | ||
556 | * DESCRIPTION: Searches for an element in the global allocation tracking list. | ||
557 | * | ||
558 | ******************************************************************************/ | ||
559 | |||
560 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation) | ||
561 | { | ||
562 | struct acpi_debug_mem_block *element; | ||
563 | |||
564 | ACPI_FUNCTION_ENTRY(); | 351 | ACPI_FUNCTION_ENTRY(); |
565 | 352 | ||
566 | element = acpi_gbl_global_list->list_head; | 353 | allocation = acpi_ut_allocate(size, component, module, line); |
567 | 354 | if (allocation) { | |
568 | /* Search for the address. */ | ||
569 | |||
570 | while (element) { | ||
571 | if (element == allocation) { | ||
572 | return (element); | ||
573 | } | ||
574 | |||
575 | element = element->next; | ||
576 | } | ||
577 | |||
578 | return (NULL); | ||
579 | } | ||
580 | |||
581 | /******************************************************************************* | ||
582 | * | ||
583 | * FUNCTION: acpi_ut_track_allocation | ||
584 | * | ||
585 | * PARAMETERS: Allocation - Address of allocated memory | ||
586 | * Size - Size of the allocation | ||
587 | * alloc_type - MEM_MALLOC or MEM_CALLOC | ||
588 | * Component - Component type of caller | ||
589 | * Module - Source file name of caller | ||
590 | * Line - Line number of caller | ||
591 | * | ||
592 | * RETURN: None. | ||
593 | * | ||
594 | * DESCRIPTION: Inserts an element into the global allocation tracking list. | ||
595 | * | ||
596 | ******************************************************************************/ | ||
597 | |||
598 | static acpi_status | ||
599 | acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, | ||
600 | acpi_size size, | ||
601 | u8 alloc_type, u32 component, char *module, u32 line) | ||
602 | { | ||
603 | struct acpi_memory_list *mem_list; | ||
604 | struct acpi_debug_mem_block *element; | ||
605 | acpi_status status = AE_OK; | ||
606 | |||
607 | ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation); | ||
608 | |||
609 | mem_list = acpi_gbl_global_list; | ||
610 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
611 | if (ACPI_FAILURE(status)) { | ||
612 | return_ACPI_STATUS(status); | ||
613 | } | ||
614 | |||
615 | /* | ||
616 | * Search list for this address to make sure it is not already on the list. | ||
617 | * This will catch several kinds of problems. | ||
618 | */ | ||
619 | element = acpi_ut_find_allocation(allocation); | ||
620 | if (element) { | ||
621 | ACPI_ERROR((AE_INFO, | ||
622 | "ut_track_allocation: Allocation already present in list! (%p)", | ||
623 | allocation)); | ||
624 | |||
625 | ACPI_ERROR((AE_INFO, "Element %p Address %p", | ||
626 | element, allocation)); | ||
627 | |||
628 | goto unlock_and_exit; | ||
629 | } | ||
630 | |||
631 | /* Fill in the instance data. */ | ||
632 | |||
633 | allocation->size = (u32) size; | ||
634 | allocation->alloc_type = alloc_type; | ||
635 | allocation->component = component; | ||
636 | allocation->line = line; | ||
637 | |||
638 | ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); | ||
639 | allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; | ||
640 | |||
641 | /* Insert at list head */ | ||
642 | |||
643 | if (mem_list->list_head) { | ||
644 | ((struct acpi_debug_mem_block *)(mem_list->list_head))-> | ||
645 | previous = allocation; | ||
646 | } | ||
647 | |||
648 | allocation->next = mem_list->list_head; | ||
649 | allocation->previous = NULL; | ||
650 | |||
651 | mem_list->list_head = allocation; | ||
652 | |||
653 | unlock_and_exit: | ||
654 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
655 | return_ACPI_STATUS(status); | ||
656 | } | ||
657 | |||
658 | /******************************************************************************* | ||
659 | * | ||
660 | * FUNCTION: acpi_ut_remove_allocation | ||
661 | * | ||
662 | * PARAMETERS: Allocation - Address of allocated memory | ||
663 | * Component - Component type of caller | ||
664 | * Module - Source file name of caller | ||
665 | * Line - Line number of caller | ||
666 | * | ||
667 | * RETURN: | ||
668 | * | ||
669 | * DESCRIPTION: Deletes an element from the global allocation tracking list. | ||
670 | * | ||
671 | ******************************************************************************/ | ||
672 | |||
673 | static acpi_status | ||
674 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | ||
675 | u32 component, char *module, u32 line) | ||
676 | { | ||
677 | struct acpi_memory_list *mem_list; | ||
678 | acpi_status status; | ||
679 | |||
680 | ACPI_FUNCTION_TRACE("ut_remove_allocation"); | ||
681 | |||
682 | mem_list = acpi_gbl_global_list; | ||
683 | if (NULL == mem_list->list_head) { | ||
684 | /* No allocations! */ | ||
685 | |||
686 | ACPI_ERROR((module, line, | ||
687 | "Empty allocation list, nothing to free!")); | ||
688 | |||
689 | return_ACPI_STATUS(AE_OK); | ||
690 | } | ||
691 | |||
692 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
693 | if (ACPI_FAILURE(status)) { | ||
694 | return_ACPI_STATUS(status); | ||
695 | } | ||
696 | |||
697 | /* Unlink */ | ||
698 | |||
699 | if (allocation->previous) { | ||
700 | (allocation->previous)->next = allocation->next; | ||
701 | } else { | ||
702 | mem_list->list_head = allocation->next; | ||
703 | } | ||
704 | |||
705 | if (allocation->next) { | ||
706 | (allocation->next)->previous = allocation->previous; | ||
707 | } | ||
708 | |||
709 | /* Mark the segment as deleted */ | ||
710 | |||
711 | ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); | ||
712 | |||
713 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", | ||
714 | allocation->size)); | ||
715 | 355 | ||
716 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | 356 | /* Clear the memory block */ |
717 | return_ACPI_STATUS(status); | ||
718 | } | ||
719 | |||
720 | /******************************************************************************* | ||
721 | * | ||
722 | * FUNCTION: acpi_ut_dump_allocation_info | ||
723 | * | ||
724 | * PARAMETERS: | ||
725 | * | ||
726 | * RETURN: None | ||
727 | * | ||
728 | * DESCRIPTION: Print some info about the outstanding allocations. | ||
729 | * | ||
730 | ******************************************************************************/ | ||
731 | 357 | ||
732 | #ifdef ACPI_FUTURE_USAGE | 358 | ACPI_MEMSET(allocation, 0, size); |
733 | void acpi_ut_dump_allocation_info(void) | ||
734 | { | ||
735 | /* | ||
736 | struct acpi_memory_list *mem_list; | ||
737 | */ | ||
738 | |||
739 | ACPI_FUNCTION_TRACE("ut_dump_allocation_info"); | ||
740 | |||
741 | /* | ||
742 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
743 | ("%30s: %4d (%3d Kb)\n", "Current allocations", | ||
744 | mem_list->current_count, | ||
745 | ROUND_UP_TO_1K (mem_list->current_size))); | ||
746 | |||
747 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
748 | ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", | ||
749 | mem_list->max_concurrent_count, | ||
750 | ROUND_UP_TO_1K (mem_list->max_concurrent_size))); | ||
751 | |||
752 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
753 | ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", | ||
754 | running_object_count, | ||
755 | ROUND_UP_TO_1K (running_object_size))); | ||
756 | |||
757 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
758 | ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", | ||
759 | running_alloc_count, | ||
760 | ROUND_UP_TO_1K (running_alloc_size))); | ||
761 | |||
762 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
763 | ("%30s: %4d (%3d Kb)\n", "Current Nodes", | ||
764 | acpi_gbl_current_node_count, | ||
765 | ROUND_UP_TO_1K (acpi_gbl_current_node_size))); | ||
766 | |||
767 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
768 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", | ||
769 | acpi_gbl_max_concurrent_node_count, | ||
770 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * | ||
771 | sizeof (struct acpi_namespace_node))))); | ||
772 | */ | ||
773 | return_VOID; | ||
774 | } | ||
775 | #endif /* ACPI_FUTURE_USAGE */ | ||
776 | |||
777 | /******************************************************************************* | ||
778 | * | ||
779 | * FUNCTION: acpi_ut_dump_allocations | ||
780 | * | ||
781 | * PARAMETERS: Component - Component(s) to dump info for. | ||
782 | * Module - Module to dump info for. NULL means all. | ||
783 | * | ||
784 | * RETURN: None | ||
785 | * | ||
786 | * DESCRIPTION: Print a list of all outstanding allocations. | ||
787 | * | ||
788 | ******************************************************************************/ | ||
789 | |||
790 | void acpi_ut_dump_allocations(u32 component, char *module) | ||
791 | { | ||
792 | struct acpi_debug_mem_block *element; | ||
793 | union acpi_descriptor *descriptor; | ||
794 | u32 num_outstanding = 0; | ||
795 | |||
796 | ACPI_FUNCTION_TRACE("ut_dump_allocations"); | ||
797 | |||
798 | /* | ||
799 | * Walk the allocation list. | ||
800 | */ | ||
801 | if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) { | ||
802 | return; | ||
803 | } | 359 | } |
804 | 360 | ||
805 | element = acpi_gbl_global_list->list_head; | 361 | return (allocation); |
806 | while (element) { | ||
807 | if ((element->component & component) && | ||
808 | ((module == NULL) | ||
809 | || (0 == ACPI_STRCMP(module, element->module)))) { | ||
810 | /* Ignore allocated objects that are in a cache */ | ||
811 | |||
812 | descriptor = | ||
813 | ACPI_CAST_PTR(union acpi_descriptor, | ||
814 | &element->user_space); | ||
815 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { | ||
816 | acpi_os_printf("%p Len %04X %9.9s-%d [%s] ", | ||
817 | descriptor, element->size, | ||
818 | element->module, element->line, | ||
819 | acpi_ut_get_descriptor_name | ||
820 | (descriptor)); | ||
821 | |||
822 | /* Most of the elements will be Operand objects. */ | ||
823 | |||
824 | switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) { | ||
825 | case ACPI_DESC_TYPE_OPERAND: | ||
826 | acpi_os_printf("%12.12s R%hd", | ||
827 | acpi_ut_get_type_name | ||
828 | (descriptor->object. | ||
829 | common.type), | ||
830 | descriptor->object. | ||
831 | common.reference_count); | ||
832 | break; | ||
833 | |||
834 | case ACPI_DESC_TYPE_PARSER: | ||
835 | acpi_os_printf("aml_opcode %04hX", | ||
836 | descriptor->op.asl. | ||
837 | aml_opcode); | ||
838 | break; | ||
839 | |||
840 | case ACPI_DESC_TYPE_NAMED: | ||
841 | acpi_os_printf("%4.4s", | ||
842 | acpi_ut_get_node_name | ||
843 | (&descriptor->node)); | ||
844 | break; | ||
845 | |||
846 | default: | ||
847 | break; | ||
848 | } | ||
849 | |||
850 | acpi_os_printf("\n"); | ||
851 | num_outstanding++; | ||
852 | } | ||
853 | } | ||
854 | element = element->next; | ||
855 | } | ||
856 | |||
857 | (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
858 | |||
859 | /* Print summary */ | ||
860 | |||
861 | if (!num_outstanding) { | ||
862 | ACPI_INFO((AE_INFO, "No outstanding allocations")); | ||
863 | } else { | ||
864 | ACPI_ERROR((AE_INFO, | ||
865 | "%d(%X) Outstanding allocations", | ||
866 | num_outstanding, num_outstanding)); | ||
867 | } | ||
868 | |||
869 | return_VOID; | ||
870 | } | 362 | } |
871 | |||
872 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ | ||
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 2177cb1ef2c4..56270a30718a 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c | |||
@@ -118,13 +118,14 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | |||
118 | /* Walk the list of objects in this cache */ | 118 | /* Walk the list of objects in this cache */ |
119 | 119 | ||
120 | while (cache->list_head) { | 120 | while (cache->list_head) { |
121 | |||
121 | /* Delete and unlink one cached state object */ | 122 | /* Delete and unlink one cached state object */ |
122 | 123 | ||
123 | next = *(ACPI_CAST_INDIRECT_PTR(char, | 124 | next = *(ACPI_CAST_INDIRECT_PTR(char, |
124 | &(((char *)cache-> | 125 | &(((char *)cache-> |
125 | list_head)[cache-> | 126 | list_head)[cache-> |
126 | link_offset]))); | 127 | link_offset]))); |
127 | ACPI_MEM_FREE(cache->list_head); | 128 | ACPI_FREE(cache->list_head); |
128 | 129 | ||
129 | cache->list_head = next; | 130 | cache->list_head = next; |
130 | cache->current_depth--; | 131 | cache->current_depth--; |
@@ -193,7 +194,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object) | |||
193 | /* If cache is full, just free this object */ | 194 | /* If cache is full, just free this object */ |
194 | 195 | ||
195 | if (cache->current_depth >= cache->max_depth) { | 196 | if (cache->current_depth >= cache->max_depth) { |
196 | ACPI_MEM_FREE(object); | 197 | ACPI_FREE(object); |
197 | ACPI_MEM_TRACKING(cache->total_freed++); | 198 | ACPI_MEM_TRACKING(cache->total_freed++); |
198 | } | 199 | } |
199 | 200 | ||
@@ -243,7 +244,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
243 | acpi_status status; | 244 | acpi_status status; |
244 | void *object; | 245 | void *object; |
245 | 246 | ||
246 | ACPI_FUNCTION_NAME("os_acquire_object"); | 247 | ACPI_FUNCTION_NAME(os_acquire_object); |
247 | 248 | ||
248 | if (!cache) { | 249 | if (!cache) { |
249 | return (NULL); | 250 | return (NULL); |
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
259 | /* Check the cache first */ | 260 | /* Check the cache first */ |
260 | 261 | ||
261 | if (cache->list_head) { | 262 | if (cache->list_head) { |
263 | |||
262 | /* There is an object available, use it */ | 264 | /* There is an object available, use it */ |
263 | 265 | ||
264 | object = cache->list_head; | 266 | object = cache->list_head; |
@@ -270,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
270 | cache->current_depth--; | 272 | cache->current_depth--; |
271 | 273 | ||
272 | ACPI_MEM_TRACKING(cache->hits++); | 274 | ACPI_MEM_TRACKING(cache->hits++); |
273 | ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 275 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
274 | "Object %p from %s cache\n", | 276 | "Object %p from %s cache\n", object, |
275 | object, cache->list_name))); | 277 | cache->list_name)); |
276 | 278 | ||
277 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 279 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
278 | if (ACPI_FAILURE(status)) { | 280 | if (ACPI_FAILURE(status)) { |
@@ -287,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
287 | 289 | ||
288 | ACPI_MEM_TRACKING(cache->total_allocated++); | 290 | ACPI_MEM_TRACKING(cache->total_allocated++); |
289 | 291 | ||
290 | /* Avoid deadlock with ACPI_MEM_CALLOCATE */ | 292 | /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ |
291 | 293 | ||
292 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 294 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
293 | if (ACPI_FAILURE(status)) { | 295 | if (ACPI_FAILURE(status)) { |
294 | return (NULL); | 296 | return (NULL); |
295 | } | 297 | } |
296 | 298 | ||
297 | object = ACPI_MEM_CALLOCATE(cache->object_size); | 299 | object = ACPI_ALLOCATE_ZEROED(cache->object_size); |
298 | if (!object) { | 300 | if (!object) { |
299 | return (NULL); | 301 | return (NULL); |
300 | } | 302 | } |
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index df2d32096b72..5e1a80d1bc36 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, | |||
109 | { | 109 | { |
110 | acpi_status status = AE_OK; | 110 | acpi_status status = AE_OK; |
111 | 111 | ||
112 | ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); | 112 | ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple); |
113 | 113 | ||
114 | *buffer_space_used = 0; | 114 | *buffer_space_used = 0; |
115 | 115 | ||
@@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, | |||
325 | acpi_status status; | 325 | acpi_status status; |
326 | struct acpi_pkg_info info; | 326 | struct acpi_pkg_info info; |
327 | 327 | ||
328 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); | 328 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage); |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * First package at head of the buffer | 331 | * First package at head of the buffer |
@@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, | |||
383 | { | 383 | { |
384 | acpi_status status; | 384 | acpi_status status; |
385 | 385 | ||
386 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); | 386 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject); |
387 | 387 | ||
388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { | 388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { |
389 | /* | 389 | /* |
@@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
442 | { | 442 | { |
443 | union acpi_operand_object *internal_object; | 443 | union acpi_operand_object *internal_object; |
444 | 444 | ||
445 | ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); | 445 | ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple); |
446 | 446 | ||
447 | /* | 447 | /* |
448 | * Simple types supported are: String, Buffer, Integer | 448 | * Simple types supported are: String, Buffer, Integer |
@@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
472 | case ACPI_TYPE_STRING: | 472 | case ACPI_TYPE_STRING: |
473 | 473 | ||
474 | internal_object->string.pointer = | 474 | internal_object->string.pointer = |
475 | ACPI_MEM_CALLOCATE((acpi_size) external_object->string. | 475 | ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string. |
476 | length + 1); | 476 | length + 1); |
477 | if (!internal_object->string.pointer) { | 477 | if (!internal_object->string.pointer) { |
478 | goto error_exit; | 478 | goto error_exit; |
479 | } | 479 | } |
@@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
488 | case ACPI_TYPE_BUFFER: | 488 | case ACPI_TYPE_BUFFER: |
489 | 489 | ||
490 | internal_object->buffer.pointer = | 490 | internal_object->buffer.pointer = |
491 | ACPI_MEM_CALLOCATE(external_object->buffer.length); | 491 | ACPI_ALLOCATE_ZEROED(external_object->buffer.length); |
492 | if (!internal_object->buffer.pointer) { | 492 | if (!internal_object->buffer.pointer) { |
493 | goto error_exit; | 493 | goto error_exit; |
494 | } | 494 | } |
@@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, | |||
552 | union acpi_operand_object *this_internal_obj; | 552 | union acpi_operand_object *this_internal_obj; |
553 | union acpi_object *this_external_obj; | 553 | union acpi_object *this_external_obj; |
554 | 554 | ||
555 | ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); | 555 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); |
556 | 556 | ||
557 | /* | 557 | /* |
558 | * First package at head of the buffer | 558 | * First package at head of the buffer |
@@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, | |||
600 | { | 600 | { |
601 | acpi_status status; | 601 | acpi_status status; |
602 | 602 | ||
603 | ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); | 603 | ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); |
604 | 604 | ||
605 | if (external_object->type == ACPI_TYPE_PACKAGE) { | 605 | if (external_object->type == ACPI_TYPE_PACKAGE) { |
606 | /* | 606 | /* |
@@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
676 | if ((source_desc->buffer.pointer) && | 676 | if ((source_desc->buffer.pointer) && |
677 | (source_desc->buffer.length)) { | 677 | (source_desc->buffer.length)) { |
678 | dest_desc->buffer.pointer = | 678 | dest_desc->buffer.pointer = |
679 | ACPI_MEM_ALLOCATE(source_desc->buffer.length); | 679 | ACPI_ALLOCATE(source_desc->buffer.length); |
680 | if (!dest_desc->buffer.pointer) { | 680 | if (!dest_desc->buffer.pointer) { |
681 | return (AE_NO_MEMORY); | 681 | return (AE_NO_MEMORY); |
682 | } | 682 | } |
@@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
697 | */ | 697 | */ |
698 | if (source_desc->string.pointer) { | 698 | if (source_desc->string.pointer) { |
699 | dest_desc->string.pointer = | 699 | dest_desc->string.pointer = |
700 | ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. | 700 | ACPI_ALLOCATE((acpi_size) source_desc->string. |
701 | length + 1); | 701 | length + 1); |
702 | if (!dest_desc->string.pointer) { | 702 | if (!dest_desc->string.pointer) { |
703 | return (AE_NO_MEMORY); | 703 | return (AE_NO_MEMORY); |
704 | } | 704 | } |
@@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, | |||
805 | /* | 805 | /* |
806 | * Create the object array | 806 | * Create the object array |
807 | */ | 807 | */ |
808 | target_object->package.elements = | 808 | target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); |
809 | ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. | ||
810 | count + 1) * sizeof(void *)); | ||
811 | if (!target_object->package.elements) { | 809 | if (!target_object->package.elements) { |
812 | status = AE_NO_MEMORY; | 810 | status = AE_NO_MEMORY; |
813 | goto error_exit; | 811 | goto error_exit; |
@@ -856,7 +854,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
856 | { | 854 | { |
857 | acpi_status status = AE_OK; | 855 | acpi_status status = AE_OK; |
858 | 856 | ||
859 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); | 857 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage); |
860 | 858 | ||
861 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); | 859 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); |
862 | dest_obj->common.flags = source_obj->common.flags; | 860 | dest_obj->common.flags = source_obj->common.flags; |
@@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
865 | /* | 863 | /* |
866 | * Create the object array and walk the source package tree | 864 | * Create the object array and walk the source package tree |
867 | */ | 865 | */ |
868 | dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) | 866 | dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
869 | source_obj->package. | 867 | source_obj->package. |
870 | count + | 868 | count + |
871 | 1) * sizeof(void *)); | 869 | 1) * sizeof(void *)); |
872 | if (!dest_obj->package.elements) { | 870 | if (!dest_obj->package.elements) { |
873 | ACPI_ERROR((AE_INFO, "Package allocation failure")); | 871 | ACPI_ERROR((AE_INFO, "Package allocation failure")); |
874 | return_ACPI_STATUS(AE_NO_MEMORY); | 872 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -882,6 +880,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
882 | acpi_ut_copy_ielement_to_ielement, | 880 | acpi_ut_copy_ielement_to_ielement, |
883 | walk_state); | 881 | walk_state); |
884 | if (ACPI_FAILURE(status)) { | 882 | if (ACPI_FAILURE(status)) { |
883 | |||
885 | /* On failure, delete the destination package object */ | 884 | /* On failure, delete the destination package object */ |
886 | 885 | ||
887 | acpi_ut_remove_reference(dest_obj); | 886 | acpi_ut_remove_reference(dest_obj); |
@@ -911,7 +910,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, | |||
911 | { | 910 | { |
912 | acpi_status status = AE_OK; | 911 | acpi_status status = AE_OK; |
913 | 912 | ||
914 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); | 913 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject); |
915 | 914 | ||
916 | /* Create the top level object */ | 915 | /* Create the top level object */ |
917 | 916 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 35f3d581e034..5ec1cfcc611d 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | 45 | ||
48 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
@@ -123,12 +121,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name) | |||
123 | /* All Function names are longer than 4 chars, check is safe */ | 121 | /* All Function names are longer than 4 chars, check is safe */ |
124 | 122 | ||
125 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { | 123 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { |
124 | |||
126 | /* This is the case where the original source has not been modified */ | 125 | /* This is the case where the original source has not been modified */ |
127 | 126 | ||
128 | return (function_name + 4); | 127 | return (function_name + 4); |
129 | } | 128 | } |
130 | 129 | ||
131 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { | 130 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { |
131 | |||
132 | /* This is the case where the source has been 'linuxized' */ | 132 | /* This is the case where the source has been 'linuxized' */ |
133 | 133 | ||
134 | return (function_name + 5); | 134 | return (function_name + 5); |
@@ -162,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
162 | const char *function_name, | 162 | const char *function_name, |
163 | char *module_name, u32 component_id, char *format, ...) | 163 | char *module_name, u32 component_id, char *format, ...) |
164 | { | 164 | { |
165 | u32 thread_id; | 165 | acpi_thread_id thread_id; |
166 | va_list args; | 166 | va_list args; |
167 | 167 | ||
168 | /* | 168 | /* |
@@ -177,7 +177,6 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
177 | * Thread tracking and context switch notification | 177 | * Thread tracking and context switch notification |
178 | */ | 178 | */ |
179 | thread_id = acpi_os_get_thread_id(); | 179 | thread_id = acpi_os_get_thread_id(); |
180 | |||
181 | if (thread_id != acpi_gbl_prev_thread_id) { | 180 | if (thread_id != acpi_gbl_prev_thread_id) { |
182 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 181 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
183 | acpi_os_printf | 182 | acpi_os_printf |
@@ -206,7 +205,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
206 | acpi_os_vprintf(format, args); | 205 | acpi_os_vprintf(format, args); |
207 | } | 206 | } |
208 | 207 | ||
209 | EXPORT_SYMBOL(acpi_ut_debug_print); | 208 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) |
210 | 209 | ||
211 | /******************************************************************************* | 210 | /******************************************************************************* |
212 | * | 211 | * |
@@ -226,7 +225,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print); | |||
226 | * debug_print so that the same macros can be used. | 225 | * debug_print so that the same macros can be used. |
227 | * | 226 | * |
228 | ******************************************************************************/ | 227 | ******************************************************************************/ |
229 | |||
230 | void ACPI_INTERNAL_VAR_XFACE | 228 | void ACPI_INTERNAL_VAR_XFACE |
231 | acpi_ut_debug_print_raw(u32 requested_debug_level, | 229 | acpi_ut_debug_print_raw(u32 requested_debug_level, |
232 | u32 line_number, | 230 | u32 line_number, |
@@ -244,7 +242,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, | |||
244 | acpi_os_vprintf(format, args); | 242 | acpi_os_vprintf(format, args); |
245 | } | 243 | } |
246 | 244 | ||
247 | EXPORT_SYMBOL(acpi_ut_debug_print_raw); | 245 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) |
248 | 246 | ||
249 | /******************************************************************************* | 247 | /******************************************************************************* |
250 | * | 248 | * |
@@ -261,7 +259,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); | |||
261 | * set in debug_level | 259 | * set in debug_level |
262 | * | 260 | * |
263 | ******************************************************************************/ | 261 | ******************************************************************************/ |
264 | |||
265 | void | 262 | void |
266 | acpi_ut_trace(u32 line_number, | 263 | acpi_ut_trace(u32 line_number, |
267 | const char *function_name, char *module_name, u32 component_id) | 264 | const char *function_name, char *module_name, u32 component_id) |
@@ -275,7 +272,7 @@ acpi_ut_trace(u32 line_number, | |||
275 | component_id, "%s\n", acpi_gbl_fn_entry_str); | 272 | component_id, "%s\n", acpi_gbl_fn_entry_str); |
276 | } | 273 | } |
277 | 274 | ||
278 | EXPORT_SYMBOL(acpi_ut_trace); | 275 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) |
279 | 276 | ||
280 | /******************************************************************************* | 277 | /******************************************************************************* |
281 | * | 278 | * |
@@ -293,7 +290,6 @@ EXPORT_SYMBOL(acpi_ut_trace); | |||
293 | * set in debug_level | 290 | * set in debug_level |
294 | * | 291 | * |
295 | ******************************************************************************/ | 292 | ******************************************************************************/ |
296 | |||
297 | void | 293 | void |
298 | acpi_ut_trace_ptr(u32 line_number, | 294 | acpi_ut_trace_ptr(u32 line_number, |
299 | const char *function_name, | 295 | const char *function_name, |
@@ -400,7 +396,7 @@ acpi_ut_exit(u32 line_number, | |||
400 | acpi_gbl_nesting_level--; | 396 | acpi_gbl_nesting_level--; |
401 | } | 397 | } |
402 | 398 | ||
403 | EXPORT_SYMBOL(acpi_ut_exit); | 399 | ACPI_EXPORT_SYMBOL(acpi_ut_exit) |
404 | 400 | ||
405 | /******************************************************************************* | 401 | /******************************************************************************* |
406 | * | 402 | * |
@@ -418,7 +414,6 @@ EXPORT_SYMBOL(acpi_ut_exit); | |||
418 | * set in debug_level. Prints exit status also. | 414 | * set in debug_level. Prints exit status also. |
419 | * | 415 | * |
420 | ******************************************************************************/ | 416 | ******************************************************************************/ |
421 | |||
422 | void | 417 | void |
423 | acpi_ut_status_exit(u32 line_number, | 418 | acpi_ut_status_exit(u32 line_number, |
424 | const char *function_name, | 419 | const char *function_name, |
@@ -442,7 +437,7 @@ acpi_ut_status_exit(u32 line_number, | |||
442 | acpi_gbl_nesting_level--; | 437 | acpi_gbl_nesting_level--; |
443 | } | 438 | } |
444 | 439 | ||
445 | EXPORT_SYMBOL(acpi_ut_status_exit); | 440 | ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) |
446 | 441 | ||
447 | /******************************************************************************* | 442 | /******************************************************************************* |
448 | * | 443 | * |
@@ -460,7 +455,6 @@ EXPORT_SYMBOL(acpi_ut_status_exit); | |||
460 | * set in debug_level. Prints exit value also. | 455 | * set in debug_level. Prints exit value also. |
461 | * | 456 | * |
462 | ******************************************************************************/ | 457 | ******************************************************************************/ |
463 | |||
464 | void | 458 | void |
465 | acpi_ut_value_exit(u32 line_number, | 459 | acpi_ut_value_exit(u32 line_number, |
466 | const char *function_name, | 460 | const char *function_name, |
@@ -475,7 +469,7 @@ acpi_ut_value_exit(u32 line_number, | |||
475 | acpi_gbl_nesting_level--; | 469 | acpi_gbl_nesting_level--; |
476 | } | 470 | } |
477 | 471 | ||
478 | EXPORT_SYMBOL(acpi_ut_value_exit); | 472 | ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) |
479 | 473 | ||
480 | /******************************************************************************* | 474 | /******************************************************************************* |
481 | * | 475 | * |
@@ -493,7 +487,6 @@ EXPORT_SYMBOL(acpi_ut_value_exit); | |||
493 | * set in debug_level. Prints exit value also. | 487 | * set in debug_level. Prints exit value also. |
494 | * | 488 | * |
495 | ******************************************************************************/ | 489 | ******************************************************************************/ |
496 | |||
497 | void | 490 | void |
498 | acpi_ut_ptr_exit(u32 line_number, | 491 | acpi_ut_ptr_exit(u32 line_number, |
499 | const char *function_name, | 492 | const char *function_name, |
@@ -524,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number, | |||
524 | * | 517 | * |
525 | ******************************************************************************/ | 518 | ******************************************************************************/ |
526 | 519 | ||
527 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | 520 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) |
528 | { | 521 | { |
529 | acpi_native_uint i = 0; | 522 | acpi_native_uint i = 0; |
530 | acpi_native_uint j; | 523 | acpi_native_uint j; |
531 | u32 temp32; | 524 | u32 temp32; |
532 | u8 buf_char; | 525 | u8 buf_char; |
533 | 526 | ||
534 | /* Only dump the buffer if tracing is enabled */ | ||
535 | |||
536 | if (!((ACPI_LV_TABLES & acpi_dbg_level) && | ||
537 | (component_id & acpi_dbg_layer))) { | ||
538 | return; | ||
539 | } | ||
540 | |||
541 | if ((count < 4) || (count & 0x01)) { | 527 | if ((count < 4) || (count & 0x01)) { |
542 | display = DB_BYTE_DISPLAY; | 528 | display = DB_BYTE_DISPLAY; |
543 | } | 529 | } |
@@ -545,6 +531,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
545 | /* Nasty little dump buffer routine! */ | 531 | /* Nasty little dump buffer routine! */ |
546 | 532 | ||
547 | while (i < count) { | 533 | while (i < count) { |
534 | |||
548 | /* Print current offset */ | 535 | /* Print current offset */ |
549 | 536 | ||
550 | acpi_os_printf("%6.4X: ", (u32) i); | 537 | acpi_os_printf("%6.4X: ", (u32) i); |
@@ -553,6 +540,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
553 | 540 | ||
554 | for (j = 0; j < 16;) { | 541 | for (j = 0; j < 16;) { |
555 | if (i + j >= count) { | 542 | if (i + j >= count) { |
543 | |||
556 | /* Dump fill spaces */ | 544 | /* Dump fill spaces */ |
557 | 545 | ||
558 | acpi_os_printf("%*s", ((display * 2) + 1), " "); | 546 | acpi_os_printf("%*s", ((display * 2) + 1), " "); |
@@ -561,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
561 | } | 549 | } |
562 | 550 | ||
563 | switch (display) { | 551 | switch (display) { |
552 | case DB_BYTE_DISPLAY: | ||
564 | default: /* Default is BYTE display */ | 553 | default: /* Default is BYTE display */ |
565 | 554 | ||
566 | acpi_os_printf("%02X ", buffer[i + j]); | 555 | acpi_os_printf("%02X ", buffer[i + j]); |
@@ -618,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
618 | 607 | ||
619 | return; | 608 | return; |
620 | } | 609 | } |
610 | |||
611 | /******************************************************************************* | ||
612 | * | ||
613 | * FUNCTION: acpi_ut_dump_buffer | ||
614 | * | ||
615 | * PARAMETERS: Buffer - Buffer to dump | ||
616 | * Count - Amount to dump, in bytes | ||
617 | * Display - BYTE, WORD, DWORD, or QWORD display | ||
618 | * component_iD - Caller's component ID | ||
619 | * | ||
620 | * RETURN: None | ||
621 | * | ||
622 | * DESCRIPTION: Generic dump buffer in both hex and ascii. | ||
623 | * | ||
624 | ******************************************************************************/ | ||
625 | |||
626 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | ||
627 | { | ||
628 | |||
629 | /* Only dump the buffer if tracing is enabled */ | ||
630 | |||
631 | if (!((ACPI_LV_TABLES & acpi_dbg_level) && | ||
632 | (component_id & acpi_dbg_layer))) { | ||
633 | return; | ||
634 | } | ||
635 | |||
636 | acpi_ut_dump_buffer2(buffer, count, display); | ||
637 | } | ||
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 1db9695b0029..67b9f325c6fa 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
76 | union acpi_operand_object *second_desc; | 76 | union acpi_operand_object *second_desc; |
77 | union acpi_operand_object *next_desc; | 77 | union acpi_operand_object *next_desc; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); | 79 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); |
80 | 80 | ||
81 | if (!object) { | 81 | if (!object) { |
82 | return_VOID; | 82 | return_VOID; |
@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
96 | /* Free the actual string buffer */ | 96 | /* Free the actual string buffer */ |
97 | 97 | ||
98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
99 | |||
99 | /* But only if it is NOT a pointer into an ACPI table */ | 100 | /* But only if it is NOT a pointer into an ACPI table */ |
100 | 101 | ||
101 | obj_pointer = object->string.pointer; | 102 | obj_pointer = object->string.pointer; |
@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
111 | /* Free the actual buffer */ | 112 | /* Free the actual buffer */ |
112 | 113 | ||
113 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 114 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
115 | |||
114 | /* But only if it is NOT a pointer into an ACPI table */ | 116 | /* But only if it is NOT a pointer into an ACPI table */ |
115 | 117 | ||
116 | obj_pointer = object->buffer.pointer; | 118 | obj_pointer = object->buffer.pointer; |
@@ -198,11 +200,22 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
198 | */ | 200 | */ |
199 | handler_desc = object->region.handler; | 201 | handler_desc = object->region.handler; |
200 | if (handler_desc) { | 202 | if (handler_desc) { |
201 | if (handler_desc->address_space. | 203 | if (handler_desc->address_space.handler_flags & |
202 | hflags & | ||
203 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | 204 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { |
204 | obj_pointer = | 205 | |
205 | second_desc->extra.region_context; | 206 | /* Deactivate region and free region context */ |
207 | |||
208 | if (handler_desc->address_space.setup) { | ||
209 | (void)handler_desc-> | ||
210 | address_space.setup(object, | ||
211 | ACPI_REGION_DEACTIVATE, | ||
212 | handler_desc-> | ||
213 | address_space. | ||
214 | context, | ||
215 | &second_desc-> | ||
216 | extra. | ||
217 | region_context); | ||
218 | } | ||
206 | } | 219 | } |
207 | 220 | ||
208 | acpi_ut_remove_reference(handler_desc); | 221 | acpi_ut_remove_reference(handler_desc); |
@@ -234,7 +247,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
234 | if (obj_pointer) { | 247 | if (obj_pointer) { |
235 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 248 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
236 | "Deleting Object Subptr %p\n", obj_pointer)); | 249 | "Deleting Object Subptr %p\n", obj_pointer)); |
237 | ACPI_MEM_FREE(obj_pointer); | 250 | ACPI_FREE(obj_pointer); |
238 | } | 251 | } |
239 | 252 | ||
240 | /* Now the object can be safely deleted */ | 253 | /* Now the object can be safely deleted */ |
@@ -263,7 +276,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
263 | { | 276 | { |
264 | union acpi_operand_object **internal_obj; | 277 | union acpi_operand_object **internal_obj; |
265 | 278 | ||
266 | ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); | 279 | ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); |
267 | 280 | ||
268 | /* Walk the null-terminated internal list */ | 281 | /* Walk the null-terminated internal list */ |
269 | 282 | ||
@@ -273,7 +286,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
273 | 286 | ||
274 | /* Free the combined parameter pointer list and object array */ | 287 | /* Free the combined parameter pointer list and object array */ |
275 | 288 | ||
276 | ACPI_MEM_FREE(obj_list); | 289 | ACPI_FREE(obj_list); |
277 | return_VOID; | 290 | return_VOID; |
278 | } | 291 | } |
279 | 292 | ||
@@ -296,7 +309,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
296 | u16 count; | 309 | u16 count; |
297 | u16 new_count; | 310 | u16 new_count; |
298 | 311 | ||
299 | ACPI_FUNCTION_NAME("ut_update_ref_count"); | 312 | ACPI_FUNCTION_NAME(ut_update_ref_count); |
300 | 313 | ||
301 | if (!object) { | 314 | if (!object) { |
302 | return; | 315 | return; |
@@ -306,11 +319,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
306 | new_count = count; | 319 | new_count = count; |
307 | 320 | ||
308 | /* | 321 | /* |
309 | * Perform the reference count action | 322 | * Perform the reference count action (increment, decrement, force delete) |
310 | * (increment, decrement, or force delete) | ||
311 | */ | 323 | */ |
312 | switch (action) { | 324 | switch (action) { |
313 | |||
314 | case REF_INCREMENT: | 325 | case REF_INCREMENT: |
315 | 326 | ||
316 | new_count++; | 327 | new_count++; |
@@ -347,7 +358,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
347 | if (new_count == 0) { | 358 | if (new_count == 0) { |
348 | acpi_ut_delete_internal_obj(object); | 359 | acpi_ut_delete_internal_obj(object); |
349 | } | 360 | } |
350 | |||
351 | break; | 361 | break; |
352 | 362 | ||
353 | case REF_FORCE_DELETE: | 363 | case REF_FORCE_DELETE: |
@@ -372,13 +382,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
372 | * (A deleted object will have a huge reference count) | 382 | * (A deleted object will have a huge reference count) |
373 | */ | 383 | */ |
374 | if (count > ACPI_MAX_REFERENCE_COUNT) { | 384 | if (count > ACPI_MAX_REFERENCE_COUNT) { |
375 | |||
376 | ACPI_WARNING((AE_INFO, | 385 | ACPI_WARNING((AE_INFO, |
377 | "Large Reference Count (%X) in object %p", | 386 | "Large Reference Count (%X) in object %p", count, |
378 | count, object)); | 387 | object)); |
379 | } | 388 | } |
380 | |||
381 | return; | ||
382 | } | 389 | } |
383 | 390 | ||
384 | /******************************************************************************* | 391 | /******************************************************************************* |
@@ -404,7 +411,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
404 | ******************************************************************************/ | 411 | ******************************************************************************/ |
405 | 412 | ||
406 | acpi_status | 413 | acpi_status |
407 | acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | 414 | acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
408 | { | 415 | { |
409 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
410 | union acpi_generic_state *state_list = NULL; | 417 | union acpi_generic_state *state_list = NULL; |
@@ -412,9 +419,10 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
412 | union acpi_generic_state *state; | 419 | union acpi_generic_state *state; |
413 | acpi_native_uint i; | 420 | acpi_native_uint i; |
414 | 421 | ||
415 | ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); | 422 | ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); |
416 | 423 | ||
417 | while (object) { | 424 | while (object) { |
425 | |||
418 | /* Make sure that this isn't a namespace handle */ | 426 | /* Make sure that this isn't a namespace handle */ |
419 | 427 | ||
420 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { | 428 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { |
@@ -507,11 +515,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
507 | 515 | ||
508 | case ACPI_TYPE_REGION: | 516 | case ACPI_TYPE_REGION: |
509 | default: | 517 | default: |
510 | break; /* No subobjects */ | 518 | break; /* No subobjects for all other types */ |
511 | } | 519 | } |
512 | 520 | ||
513 | /* | 521 | /* |
514 | * Now we can update the count in the main object. This can only | 522 | * Now we can update the count in the main object. This can only |
515 | * happen after we update the sub-objects in case this causes the | 523 | * happen after we update the sub-objects in case this causes the |
516 | * main object to be deleted. | 524 | * main object to be deleted. |
517 | */ | 525 | */ |
@@ -556,7 +564,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
556 | void acpi_ut_add_reference(union acpi_operand_object *object) | 564 | void acpi_ut_add_reference(union acpi_operand_object *object) |
557 | { | 565 | { |
558 | 566 | ||
559 | ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); | 567 | ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); |
560 | 568 | ||
561 | /* Ensure that we have a valid object */ | 569 | /* Ensure that we have a valid object */ |
562 | 570 | ||
@@ -589,11 +597,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object) | |||
589 | void acpi_ut_remove_reference(union acpi_operand_object *object) | 597 | void acpi_ut_remove_reference(union acpi_operand_object *object) |
590 | { | 598 | { |
591 | 599 | ||
592 | ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); | 600 | ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); |
593 | 601 | ||
594 | /* | 602 | /* |
595 | * Allow a NULL pointer to be passed in, just ignore it. This saves | 603 | * Allow a NULL pointer to be passed in, just ignore it. This saves |
596 | * each caller from having to check. Also, ignore NS nodes. | 604 | * each caller from having to check. Also, ignore NS nodes. |
597 | * | 605 | * |
598 | */ | 606 | */ |
599 | if (!object || | 607 | if (!object || |
@@ -613,7 +621,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) | |||
613 | 621 | ||
614 | /* | 622 | /* |
615 | * Decrement the reference count, and only actually delete the object | 623 | * Decrement the reference count, and only actually delete the object |
616 | * if the reference count becomes 0. (Must also decrement the ref count | 624 | * if the reference count becomes 0. (Must also decrement the ref count |
617 | * of all subobjects!) | 625 | * of all subobjects!) |
618 | */ | 626 | */ |
619 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); | 627 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 106cc97cb4af..d6d7121583c0 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -56,6 +56,34 @@ static acpi_status | |||
56 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | 56 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, |
57 | struct acpi_compatible_id *one_cid); | 57 | struct acpi_compatible_id *one_cid); |
58 | 58 | ||
59 | /* | ||
60 | * Strings supported by the _OSI predefined (internal) method. | ||
61 | */ | ||
62 | static const char *acpi_interfaces_supported[] = { | ||
63 | /* Operating System Vendor Strings */ | ||
64 | |||
65 | "Linux", | ||
66 | "Windows 2000", | ||
67 | "Windows 2001", | ||
68 | "Windows 2001 SP0", | ||
69 | "Windows 2001 SP1", | ||
70 | "Windows 2001 SP2", | ||
71 | "Windows 2001 SP3", | ||
72 | "Windows 2001 SP4", | ||
73 | "Windows 2001.1", | ||
74 | "Windows 2001.1 SP1", /* Added 03/2006 */ | ||
75 | "Windows 2006", /* Added 03/2006 */ | ||
76 | |||
77 | /* Feature Group Strings */ | ||
78 | |||
79 | "Extended Address Space Descriptor" | ||
80 | /* | ||
81 | * All "optional" feature group strings (features that are implemented | ||
82 | * by the host) should be implemented in the host version of | ||
83 | * acpi_os_validate_interface and should not be added here. | ||
84 | */ | ||
85 | }; | ||
86 | |||
59 | /******************************************************************************* | 87 | /******************************************************************************* |
60 | * | 88 | * |
61 | * FUNCTION: acpi_ut_osi_implementation | 89 | * FUNCTION: acpi_ut_osi_implementation |
@@ -64,18 +92,18 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | |||
64 | * | 92 | * |
65 | * RETURN: Status | 93 | * RETURN: Status |
66 | * | 94 | * |
67 | * DESCRIPTION: Implementation of _OSI predefined control method | 95 | * DESCRIPTION: Implementation of the _OSI predefined control method |
68 | * Supported = _OSI (String) | ||
69 | * | 96 | * |
70 | ******************************************************************************/ | 97 | ******************************************************************************/ |
71 | 98 | ||
72 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | 99 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) |
73 | { | 100 | { |
101 | acpi_status status; | ||
74 | union acpi_operand_object *string_desc; | 102 | union acpi_operand_object *string_desc; |
75 | union acpi_operand_object *return_desc; | 103 | union acpi_operand_object *return_desc; |
76 | acpi_native_uint i; | 104 | acpi_native_uint i; |
77 | 105 | ||
78 | ACPI_FUNCTION_TRACE("ut_osi_implementation"); | 106 | ACPI_FUNCTION_TRACE(ut_osi_implementation); |
79 | 107 | ||
80 | /* Validate the string input argument */ | 108 | /* Validate the string input argument */ |
81 | 109 | ||
@@ -84,28 +112,47 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
84 | return_ACPI_STATUS(AE_TYPE); | 112 | return_ACPI_STATUS(AE_TYPE); |
85 | } | 113 | } |
86 | 114 | ||
87 | /* Create a return object (Default value = 0) */ | 115 | /* Create a return object */ |
88 | 116 | ||
89 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 117 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
90 | if (!return_desc) { | 118 | if (!return_desc) { |
91 | return_ACPI_STATUS(AE_NO_MEMORY); | 119 | return_ACPI_STATUS(AE_NO_MEMORY); |
92 | } | 120 | } |
93 | 121 | ||
94 | /* Compare input string to table of supported strings */ | 122 | /* Default return value is SUPPORTED */ |
123 | |||
124 | return_desc->integer.value = ACPI_UINT32_MAX; | ||
125 | walk_state->return_desc = return_desc; | ||
126 | |||
127 | /* Compare input string to static table of supported interfaces */ | ||
95 | 128 | ||
96 | for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { | 129 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { |
97 | if (!ACPI_STRCMP(string_desc->string.pointer, | 130 | if (!ACPI_STRCMP |
98 | ACPI_CAST_PTR(char, | 131 | (string_desc->string.pointer, |
99 | acpi_gbl_valid_osi_strings[i]))) | 132 | acpi_interfaces_supported[i])) { |
100 | { | ||
101 | /* This string is supported */ | ||
102 | 133 | ||
103 | return_desc->integer.value = 0xFFFFFFFF; | 134 | /* The interface is supported */ |
104 | break; | 135 | |
136 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | ||
105 | } | 137 | } |
106 | } | 138 | } |
107 | 139 | ||
108 | walk_state->return_desc = return_desc; | 140 | /* |
141 | * Did not match the string in the static table, call the host OSL to | ||
142 | * check for a match with one of the optional strings (such as | ||
143 | * "Module Device", "3.0 Thermal Model", etc.) | ||
144 | */ | ||
145 | status = acpi_os_validate_interface(string_desc->string.pointer); | ||
146 | if (ACPI_SUCCESS(status)) { | ||
147 | |||
148 | /* The interface is supported */ | ||
149 | |||
150 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | ||
151 | } | ||
152 | |||
153 | /* The interface is not supported */ | ||
154 | |||
155 | return_desc->integer.value = 0; | ||
109 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 156 | return_ACPI_STATUS(AE_CTRL_TERMINATE); |
110 | } | 157 | } |
111 | 158 | ||
@@ -134,19 +181,26 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
134 | u32 expected_return_btypes, | 181 | u32 expected_return_btypes, |
135 | union acpi_operand_object **return_desc) | 182 | union acpi_operand_object **return_desc) |
136 | { | 183 | { |
137 | struct acpi_parameter_info info; | 184 | struct acpi_evaluate_info *info; |
138 | acpi_status status; | 185 | acpi_status status; |
139 | u32 return_btype; | 186 | u32 return_btype; |
140 | 187 | ||
141 | ACPI_FUNCTION_TRACE("ut_evaluate_object"); | 188 | ACPI_FUNCTION_TRACE(ut_evaluate_object); |
142 | 189 | ||
143 | info.node = prefix_node; | 190 | /* Allocate the evaluation information block */ |
144 | info.parameters = NULL; | 191 | |
145 | info.parameter_type = ACPI_PARAM_ARGS; | 192 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
193 | if (!info) { | ||
194 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
195 | } | ||
196 | |||
197 | info->prefix_node = prefix_node; | ||
198 | info->pathname = path; | ||
199 | info->parameter_type = ACPI_PARAM_ARGS; | ||
146 | 200 | ||
147 | /* Evaluate the object/method */ | 201 | /* Evaluate the object/method */ |
148 | 202 | ||
149 | status = acpi_ns_evaluate_relative(path, &info); | 203 | status = acpi_ns_evaluate(info); |
150 | if (ACPI_FAILURE(status)) { | 204 | if (ACPI_FAILURE(status)) { |
151 | if (status == AE_NOT_FOUND) { | 205 | if (status == AE_NOT_FOUND) { |
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -158,25 +212,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
158 | prefix_node, path, status); | 212 | prefix_node, path, status); |
159 | } | 213 | } |
160 | 214 | ||
161 | return_ACPI_STATUS(status); | 215 | goto cleanup; |
162 | } | 216 | } |
163 | 217 | ||
164 | /* Did we get a return object? */ | 218 | /* Did we get a return object? */ |
165 | 219 | ||
166 | if (!info.return_object) { | 220 | if (!info->return_object) { |
167 | if (expected_return_btypes) { | 221 | if (expected_return_btypes) { |
168 | ACPI_ERROR_METHOD("No object was returned from", | 222 | ACPI_ERROR_METHOD("No object was returned from", |
169 | prefix_node, path, AE_NOT_EXIST); | 223 | prefix_node, path, AE_NOT_EXIST); |
170 | 224 | ||
171 | return_ACPI_STATUS(AE_NOT_EXIST); | 225 | status = AE_NOT_EXIST; |
172 | } | 226 | } |
173 | 227 | ||
174 | return_ACPI_STATUS(AE_OK); | 228 | goto cleanup; |
175 | } | 229 | } |
176 | 230 | ||
177 | /* Map the return object type to the bitmapped type */ | 231 | /* Map the return object type to the bitmapped type */ |
178 | 232 | ||
179 | switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { | 233 | switch (ACPI_GET_OBJECT_TYPE(info->return_object)) { |
180 | case ACPI_TYPE_INTEGER: | 234 | case ACPI_TYPE_INTEGER: |
181 | return_btype = ACPI_BTYPE_INTEGER; | 235 | return_btype = ACPI_BTYPE_INTEGER; |
182 | break; | 236 | break; |
@@ -204,8 +258,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
204 | * happen frequently if the "implicit return" feature is enabled. | 258 | * happen frequently if the "implicit return" feature is enabled. |
205 | * Just delete the return object and return AE_OK. | 259 | * Just delete the return object and return AE_OK. |
206 | */ | 260 | */ |
207 | acpi_ut_remove_reference(info.return_object); | 261 | acpi_ut_remove_reference(info->return_object); |
208 | return_ACPI_STATUS(AE_OK); | 262 | goto cleanup; |
209 | } | 263 | } |
210 | 264 | ||
211 | /* Is the return object one of the expected types? */ | 265 | /* Is the return object one of the expected types? */ |
@@ -217,19 +271,23 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
217 | ACPI_ERROR((AE_INFO, | 271 | ACPI_ERROR((AE_INFO, |
218 | "Type returned from %s was incorrect: %s, expected Btypes: %X", | 272 | "Type returned from %s was incorrect: %s, expected Btypes: %X", |
219 | path, | 273 | path, |
220 | acpi_ut_get_object_type_name(info.return_object), | 274 | acpi_ut_get_object_type_name(info->return_object), |
221 | expected_return_btypes)); | 275 | expected_return_btypes)); |
222 | 276 | ||
223 | /* On error exit, we must delete the return object */ | 277 | /* On error exit, we must delete the return object */ |
224 | 278 | ||
225 | acpi_ut_remove_reference(info.return_object); | 279 | acpi_ut_remove_reference(info->return_object); |
226 | return_ACPI_STATUS(AE_TYPE); | 280 | status = AE_TYPE; |
281 | goto cleanup; | ||
227 | } | 282 | } |
228 | 283 | ||
229 | /* Object type is OK, return it */ | 284 | /* Object type is OK, return it */ |
230 | 285 | ||
231 | *return_desc = info.return_object; | 286 | *return_desc = info->return_object; |
232 | return_ACPI_STATUS(AE_OK); | 287 | |
288 | cleanup: | ||
289 | ACPI_FREE(info); | ||
290 | return_ACPI_STATUS(status); | ||
233 | } | 291 | } |
234 | 292 | ||
235 | /******************************************************************************* | 293 | /******************************************************************************* |
@@ -257,7 +315,7 @@ acpi_ut_evaluate_numeric_object(char *object_name, | |||
257 | union acpi_operand_object *obj_desc; | 315 | union acpi_operand_object *obj_desc; |
258 | acpi_status status; | 316 | acpi_status status; |
259 | 317 | ||
260 | ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object"); | 318 | ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object); |
261 | 319 | ||
262 | status = acpi_ut_evaluate_object(device_node, object_name, | 320 | status = acpi_ut_evaluate_object(device_node, object_name, |
263 | ACPI_BTYPE_INTEGER, &obj_desc); | 321 | ACPI_BTYPE_INTEGER, &obj_desc); |
@@ -333,7 +391,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
333 | union acpi_operand_object *obj_desc; | 391 | union acpi_operand_object *obj_desc; |
334 | acpi_status status; | 392 | acpi_status status; |
335 | 393 | ||
336 | ACPI_FUNCTION_TRACE("ut_execute_HID"); | 394 | ACPI_FUNCTION_TRACE(ut_execute_HID); |
337 | 395 | ||
338 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, | 396 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, |
339 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | 397 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, |
@@ -343,6 +401,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
343 | } | 401 | } |
344 | 402 | ||
345 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 403 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
404 | |||
346 | /* Convert the Numeric HID to string */ | 405 | /* Convert the Numeric HID to string */ |
347 | 406 | ||
348 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, | 407 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, |
@@ -436,7 +495,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
436 | struct acpi_compatible_id_list *cid_list; | 495 | struct acpi_compatible_id_list *cid_list; |
437 | acpi_native_uint i; | 496 | acpi_native_uint i; |
438 | 497 | ||
439 | ACPI_FUNCTION_TRACE("ut_execute_CID"); | 498 | ACPI_FUNCTION_TRACE(ut_execute_CID); |
440 | 499 | ||
441 | /* Evaluate the _CID method for this device */ | 500 | /* Evaluate the _CID method for this device */ |
442 | 501 | ||
@@ -459,7 +518,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
459 | size = (((count - 1) * sizeof(struct acpi_compatible_id)) + | 518 | size = (((count - 1) * sizeof(struct acpi_compatible_id)) + |
460 | sizeof(struct acpi_compatible_id_list)); | 519 | sizeof(struct acpi_compatible_id_list)); |
461 | 520 | ||
462 | cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); | 521 | cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); |
463 | if (!cid_list) { | 522 | if (!cid_list) { |
464 | return_ACPI_STATUS(AE_NO_MEMORY); | 523 | return_ACPI_STATUS(AE_NO_MEMORY); |
465 | } | 524 | } |
@@ -479,6 +538,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
479 | /* The _CID object can be either a single CID or a package (list) of CIDs */ | 538 | /* The _CID object can be either a single CID or a package (list) of CIDs */ |
480 | 539 | ||
481 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 540 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { |
541 | |||
482 | /* Translate each package element */ | 542 | /* Translate each package element */ |
483 | 543 | ||
484 | for (i = 0; i < count; i++) { | 544 | for (i = 0; i < count; i++) { |
@@ -499,7 +559,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
499 | /* Cleanup on error */ | 559 | /* Cleanup on error */ |
500 | 560 | ||
501 | if (ACPI_FAILURE(status)) { | 561 | if (ACPI_FAILURE(status)) { |
502 | ACPI_MEM_FREE(cid_list); | 562 | ACPI_FREE(cid_list); |
503 | } else { | 563 | } else { |
504 | *return_cid_list = cid_list; | 564 | *return_cid_list = cid_list; |
505 | } | 565 | } |
@@ -533,7 +593,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
533 | union acpi_operand_object *obj_desc; | 593 | union acpi_operand_object *obj_desc; |
534 | acpi_status status; | 594 | acpi_status status; |
535 | 595 | ||
536 | ACPI_FUNCTION_TRACE("ut_execute_UID"); | 596 | ACPI_FUNCTION_TRACE(ut_execute_UID); |
537 | 597 | ||
538 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, | 598 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, |
539 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | 599 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, |
@@ -543,6 +603,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
543 | } | 603 | } |
544 | 604 | ||
545 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 605 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
606 | |||
546 | /* Convert the Numeric UID to string */ | 607 | /* Convert the Numeric UID to string */ |
547 | 608 | ||
548 | acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, | 609 | acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, |
@@ -582,7 +643,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) | |||
582 | union acpi_operand_object *obj_desc; | 643 | union acpi_operand_object *obj_desc; |
583 | acpi_status status; | 644 | acpi_status status; |
584 | 645 | ||
585 | ACPI_FUNCTION_TRACE("ut_execute_STA"); | 646 | ACPI_FUNCTION_TRACE(ut_execute_STA); |
586 | 647 | ||
587 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, | 648 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, |
588 | ACPI_BTYPE_INTEGER, &obj_desc); | 649 | ACPI_BTYPE_INTEGER, &obj_desc); |
@@ -632,7 +693,7 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) | |||
632 | acpi_status status; | 693 | acpi_status status; |
633 | u32 i; | 694 | u32 i; |
634 | 695 | ||
635 | ACPI_FUNCTION_TRACE("ut_execute_Sxds"); | 696 | ACPI_FUNCTION_TRACE(ut_execute_sxds); |
636 | 697 | ||
637 | for (i = 0; i < 4; i++) { | 698 | for (i = 0; i < 4; i++) { |
638 | highest[i] = 0xFF; | 699 | highest[i] = 0xFF; |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index ffd13383a325..e5999c65c0b8 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #define DEFINE_ACPI_GLOBALS | 44 | #define DEFINE_ACPI_GLOBALS |
45 | 45 | ||
46 | #include <linux/module.h> | ||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
49 | 48 | ||
@@ -119,6 +118,7 @@ const char *acpi_format_exception(acpi_status status) | |||
119 | } | 118 | } |
120 | 119 | ||
121 | if (!exception) { | 120 | if (!exception) { |
121 | |||
122 | /* Exception code was not recognized */ | 122 | /* Exception code was not recognized */ |
123 | 123 | ||
124 | ACPI_ERROR((AE_INFO, | 124 | ACPI_ERROR((AE_INFO, |
@@ -143,12 +143,10 @@ const char *acpi_format_exception(acpi_status status) | |||
143 | 143 | ||
144 | /* Debug switch - level and trace mask */ | 144 | /* Debug switch - level and trace mask */ |
145 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; | 145 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
146 | EXPORT_SYMBOL(acpi_dbg_level); | ||
147 | 146 | ||
148 | /* Debug switch - layer (component) mask */ | 147 | /* Debug switch - layer (component) mask */ |
149 | 148 | ||
150 | u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; | 149 | u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; |
151 | EXPORT_SYMBOL(acpi_dbg_layer); | ||
152 | u32 acpi_gbl_nesting_level = 0; | 150 | u32 acpi_gbl_nesting_level = 0; |
153 | 151 | ||
154 | /* Debugger globals */ | 152 | /* Debugger globals */ |
@@ -183,28 +181,6 @@ const char *acpi_gbl_highest_dstate_names[4] = { | |||
183 | "_S4D" | 181 | "_S4D" |
184 | }; | 182 | }; |
185 | 183 | ||
186 | /* | ||
187 | * Strings supported by the _OSI predefined (internal) method. | ||
188 | * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS. | ||
189 | */ | ||
190 | const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { | ||
191 | /* Operating System Vendor Strings */ | ||
192 | |||
193 | "Linux", | ||
194 | "Windows 2000", | ||
195 | "Windows 2001", | ||
196 | "Windows 2001.1", | ||
197 | "Windows 2001 SP0", | ||
198 | "Windows 2001 SP1", | ||
199 | "Windows 2001 SP2", | ||
200 | "Windows 2001 SP3", | ||
201 | "Windows 2001 SP4", | ||
202 | |||
203 | /* Feature Group Strings */ | ||
204 | |||
205 | "Extended Address Space Descriptor" | ||
206 | }; | ||
207 | |||
208 | /******************************************************************************* | 184 | /******************************************************************************* |
209 | * | 185 | * |
210 | * Namespace globals | 186 | * Namespace globals |
@@ -317,9 +293,9 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) | |||
317 | * | 293 | * |
318 | ******************************************************************************/ | 294 | ******************************************************************************/ |
319 | 295 | ||
320 | struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; | 296 | struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; |
321 | 297 | ||
322 | struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = { | 298 | struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = { |
323 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ | 299 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ |
324 | 300 | ||
325 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, | 301 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, |
@@ -467,7 +443,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = | |||
467 | /* Region type decoding */ | 443 | /* Region type decoding */ |
468 | 444 | ||
469 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | 445 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { |
470 | /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ | ||
471 | "SystemMemory", | 446 | "SystemMemory", |
472 | "SystemIO", | 447 | "SystemIO", |
473 | "PCI_Config", | 448 | "PCI_Config", |
@@ -476,16 +451,15 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | |||
476 | "CMOS", | 451 | "CMOS", |
477 | "PCIBARTarget", | 452 | "PCIBARTarget", |
478 | "DataTable" | 453 | "DataTable" |
479 | /*! [End] no source code translation !*/ | ||
480 | }; | 454 | }; |
481 | 455 | ||
482 | char *acpi_ut_get_region_name(u8 space_id) | 456 | char *acpi_ut_get_region_name(u8 space_id) |
483 | { | 457 | { |
484 | 458 | ||
485 | if (space_id >= ACPI_USER_REGION_BEGIN) { | 459 | if (space_id >= ACPI_USER_REGION_BEGIN) { |
486 | return ("user_defined_region"); | 460 | return ("UserDefinedRegion"); |
487 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { | 461 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { |
488 | return ("invalid_space_id"); | 462 | return ("InvalidSpaceId"); |
489 | } | 463 | } |
490 | 464 | ||
491 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); | 465 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); |
@@ -506,20 +480,18 @@ char *acpi_ut_get_region_name(u8 space_id) | |||
506 | /* Event type decoding */ | 480 | /* Event type decoding */ |
507 | 481 | ||
508 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { | 482 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { |
509 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
510 | "PM_Timer", | 483 | "PM_Timer", |
511 | "GlobalLock", | 484 | "GlobalLock", |
512 | "PowerButton", | 485 | "PowerButton", |
513 | "SleepButton", | 486 | "SleepButton", |
514 | "RealTimeClock", | 487 | "RealTimeClock", |
515 | /*! [End] no source code translation !*/ | ||
516 | }; | 488 | }; |
517 | 489 | ||
518 | char *acpi_ut_get_event_name(u32 event_id) | 490 | char *acpi_ut_get_event_name(u32 event_id) |
519 | { | 491 | { |
520 | 492 | ||
521 | if (event_id > ACPI_EVENT_MAX) { | 493 | if (event_id > ACPI_EVENT_MAX) { |
522 | return ("invalid_event_iD"); | 494 | return ("InvalidEventID"); |
523 | } | 495 | } |
524 | 496 | ||
525 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); | 497 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); |
@@ -550,7 +522,6 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED"; | |||
550 | /* Printable names of the ACPI object types */ | 522 | /* Printable names of the ACPI object types */ |
551 | 523 | ||
552 | static const char *acpi_gbl_ns_type_names[] = { | 524 | static const char *acpi_gbl_ns_type_names[] = { |
553 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
554 | /* 00 */ "Untyped", | 525 | /* 00 */ "Untyped", |
555 | /* 01 */ "Integer", | 526 | /* 01 */ "Integer", |
556 | /* 02 */ "String", | 527 | /* 02 */ "String", |
@@ -582,7 +553,6 @@ static const char *acpi_gbl_ns_type_names[] = { | |||
582 | /* 28 */ "Extra", | 553 | /* 28 */ "Extra", |
583 | /* 29 */ "Data", | 554 | /* 29 */ "Data", |
584 | /* 30 */ "Invalid" | 555 | /* 30 */ "Invalid" |
585 | /*! [End] no source code translation !*/ | ||
586 | }; | 556 | }; |
587 | 557 | ||
588 | char *acpi_ut_get_type_name(acpi_object_type type) | 558 | char *acpi_ut_get_type_name(acpi_object_type type) |
@@ -635,14 +605,14 @@ char *acpi_ut_get_node_name(void *object) | |||
635 | 605 | ||
636 | /* Descriptor must be a namespace node */ | 606 | /* Descriptor must be a namespace node */ |
637 | 607 | ||
638 | if (node->descriptor != ACPI_DESC_TYPE_NAMED) { | 608 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
639 | return ("####"); | 609 | return ("####"); |
640 | } | 610 | } |
641 | 611 | ||
642 | /* Name must be a valid ACPI name */ | 612 | /* Name must be a valid ACPI name */ |
643 | 613 | ||
644 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { | 614 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { |
645 | return ("????"); | 615 | node->name.integer = acpi_ut_repair_name(node->name.integer); |
646 | } | 616 | } |
647 | 617 | ||
648 | /* Return the name */ | 618 | /* Return the name */ |
@@ -665,7 +635,6 @@ char *acpi_ut_get_node_name(void *object) | |||
665 | /* Printable names of object descriptor types */ | 635 | /* Printable names of object descriptor types */ |
666 | 636 | ||
667 | static const char *acpi_gbl_desc_type_names[] = { | 637 | static const char *acpi_gbl_desc_type_names[] = { |
668 | /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ | ||
669 | /* 00 */ "Invalid", | 638 | /* 00 */ "Invalid", |
670 | /* 01 */ "Cached", | 639 | /* 01 */ "Cached", |
671 | /* 02 */ "State-Generic", | 640 | /* 02 */ "State-Generic", |
@@ -682,7 +651,6 @@ static const char *acpi_gbl_desc_type_names[] = { | |||
682 | /* 13 */ "Parser", | 651 | /* 13 */ "Parser", |
683 | /* 14 */ "Operand", | 652 | /* 14 */ "Operand", |
684 | /* 15 */ "Node" | 653 | /* 15 */ "Node" |
685 | /*! [End] no source code translation !*/ | ||
686 | }; | 654 | }; |
687 | 655 | ||
688 | char *acpi_ut_get_descriptor_name(void *object) | 656 | char *acpi_ut_get_descriptor_name(void *object) |
@@ -723,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object) | |||
723 | char *acpi_ut_get_mutex_name(u32 mutex_id) | 691 | char *acpi_ut_get_mutex_name(u32 mutex_id) |
724 | { | 692 | { |
725 | 693 | ||
726 | if (mutex_id > MAX_MUTEX) { | 694 | if (mutex_id > ACPI_MAX_MUTEX) { |
727 | return ("Invalid Mutex ID"); | 695 | return ("Invalid Mutex ID"); |
728 | } | 696 | } |
729 | 697 | ||
@@ -747,6 +715,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type) | |||
747 | { | 715 | { |
748 | 716 | ||
749 | if (type > ACPI_TYPE_LOCAL_MAX) { | 717 | if (type > ACPI_TYPE_LOCAL_MAX) { |
718 | |||
750 | /* Note: Assumes all TYPEs are contiguous (external/local) */ | 719 | /* Note: Assumes all TYPEs are contiguous (external/local) */ |
751 | 720 | ||
752 | return (FALSE); | 721 | return (FALSE); |
@@ -773,7 +742,7 @@ void acpi_ut_init_globals(void) | |||
773 | acpi_status status; | 742 | acpi_status status; |
774 | u32 i; | 743 | u32 i; |
775 | 744 | ||
776 | ACPI_FUNCTION_TRACE("ut_init_globals"); | 745 | ACPI_FUNCTION_TRACE(ut_init_globals); |
777 | 746 | ||
778 | /* Create all memory caches */ | 747 | /* Create all memory caches */ |
779 | 748 | ||
@@ -784,14 +753,14 @@ void acpi_ut_init_globals(void) | |||
784 | 753 | ||
785 | /* ACPI table structure */ | 754 | /* ACPI table structure */ |
786 | 755 | ||
787 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 756 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
788 | acpi_gbl_table_lists[i].next = NULL; | 757 | acpi_gbl_table_lists[i].next = NULL; |
789 | acpi_gbl_table_lists[i].count = 0; | 758 | acpi_gbl_table_lists[i].count = 0; |
790 | } | 759 | } |
791 | 760 | ||
792 | /* Mutex locked flags */ | 761 | /* Mutex locked flags */ |
793 | 762 | ||
794 | for (i = 0; i < NUM_MUTEX; i++) { | 763 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
795 | acpi_gbl_mutex_info[i].mutex = NULL; | 764 | acpi_gbl_mutex_info[i].mutex = NULL; |
796 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 765 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
797 | acpi_gbl_mutex_info[i].use_count = 0; | 766 | acpi_gbl_mutex_info[i].use_count = 0; |
@@ -856,7 +825,7 @@ void acpi_ut_init_globals(void) | |||
856 | 825 | ||
857 | acpi_gbl_root_node = NULL; | 826 | acpi_gbl_root_node = NULL; |
858 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | 827 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
859 | acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; | 828 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
860 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | 829 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
861 | acpi_gbl_root_node_struct.child = NULL; | 830 | acpi_gbl_root_node_struct.child = NULL; |
862 | acpi_gbl_root_node_struct.peer = NULL; | 831 | acpi_gbl_root_node_struct.peer = NULL; |
@@ -869,3 +838,6 @@ void acpi_ut_init_globals(void) | |||
869 | 838 | ||
870 | return_VOID; | 839 | return_VOID; |
871 | } | 840 | } |
841 | |||
842 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | ||
843 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | ||
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index ba771b4f39bc..ff76055eb7d6 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit") | |||
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static void | 52 | static void |
53 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); | 53 | acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset); |
54 | 54 | ||
55 | static void acpi_ut_terminate(void); | 55 | static void acpi_ut_terminate(void); |
56 | 56 | ||
@@ -69,12 +69,12 @@ static void acpi_ut_terminate(void); | |||
69 | ******************************************************************************/ | 69 | ******************************************************************************/ |
70 | 70 | ||
71 | static void | 71 | static void |
72 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) | 72 | acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset) |
73 | { | 73 | { |
74 | 74 | ||
75 | ACPI_WARNING((AE_INFO, | 75 | ACPI_WARNING((AE_INFO, |
76 | "Invalid FADT value %s=%X at offset %X FADT=%p", | 76 | "Invalid FADT value %s=%X at offset %X FADT=%p", |
77 | register_name, value, (u32) offset, acpi_gbl_FADT)); | 77 | register_name, value, offset, acpi_gbl_FADT)); |
78 | } | 78 | } |
79 | 79 | ||
80 | /****************************************************************************** | 80 | /****************************************************************************** |
@@ -176,7 +176,7 @@ static void acpi_ut_terminate(void) | |||
176 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 176 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
177 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; | 177 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; |
178 | 178 | ||
179 | ACPI_FUNCTION_TRACE("ut_terminate"); | 179 | ACPI_FUNCTION_TRACE(ut_terminate); |
180 | 180 | ||
181 | /* Free global tables, etc. */ | 181 | /* Free global tables, etc. */ |
182 | /* Free global GPE blocks and related info structures */ | 182 | /* Free global GPE blocks and related info structures */ |
@@ -186,14 +186,14 @@ static void acpi_ut_terminate(void) | |||
186 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | 186 | gpe_block = gpe_xrupt_info->gpe_block_list_head; |
187 | while (gpe_block) { | 187 | while (gpe_block) { |
188 | next_gpe_block = gpe_block->next; | 188 | next_gpe_block = gpe_block->next; |
189 | ACPI_MEM_FREE(gpe_block->event_info); | 189 | ACPI_FREE(gpe_block->event_info); |
190 | ACPI_MEM_FREE(gpe_block->register_info); | 190 | ACPI_FREE(gpe_block->register_info); |
191 | ACPI_MEM_FREE(gpe_block); | 191 | ACPI_FREE(gpe_block); |
192 | 192 | ||
193 | gpe_block = next_gpe_block; | 193 | gpe_block = next_gpe_block; |
194 | } | 194 | } |
195 | next_gpe_xrupt_info = gpe_xrupt_info->next; | 195 | next_gpe_xrupt_info = gpe_xrupt_info->next; |
196 | ACPI_MEM_FREE(gpe_xrupt_info); | 196 | ACPI_FREE(gpe_xrupt_info); |
197 | gpe_xrupt_info = next_gpe_xrupt_info; | 197 | gpe_xrupt_info = next_gpe_xrupt_info; |
198 | } | 198 | } |
199 | 199 | ||
@@ -216,7 +216,7 @@ static void acpi_ut_terminate(void) | |||
216 | void acpi_ut_subsystem_shutdown(void) | 216 | void acpi_ut_subsystem_shutdown(void) |
217 | { | 217 | { |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); | 219 | ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); |
220 | 220 | ||
221 | /* Just exit if subsystem is already shutdown */ | 221 | /* Just exit if subsystem is already shutdown */ |
222 | 222 | ||
@@ -228,6 +228,7 @@ void acpi_ut_subsystem_shutdown(void) | |||
228 | /* Subsystem appears active, go ahead and shut it down */ | 228 | /* Subsystem appears active, go ahead and shut it down */ |
229 | 229 | ||
230 | acpi_gbl_shutdown = TRUE; | 230 | acpi_gbl_shutdown = TRUE; |
231 | acpi_gbl_startup_flags = 0; | ||
231 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); | 232 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); |
232 | 233 | ||
233 | /* Close the acpi_event Handling */ | 234 | /* Close the acpi_event Handling */ |
@@ -245,12 +246,5 @@ void acpi_ut_subsystem_shutdown(void) | |||
245 | /* Purge the local caches */ | 246 | /* Purge the local caches */ |
246 | 247 | ||
247 | (void)acpi_ut_delete_caches(); | 248 | (void)acpi_ut_delete_caches(); |
248 | |||
249 | /* Debug only - display leftover memory allocation, if any */ | ||
250 | |||
251 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
252 | acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); | ||
253 | #endif | ||
254 | |||
255 | return_VOID; | 249 | return_VOID; |
256 | } | 250 | } |
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 4a3360484e72..19d74bedce27 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c | |||
@@ -77,7 +77,7 @@ acpi_ut_short_divide(acpi_integer dividend, | |||
77 | union uint64_overlay quotient; | 77 | union uint64_overlay quotient; |
78 | u32 remainder32; | 78 | u32 remainder32; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ut_short_divide"); | 80 | ACPI_FUNCTION_TRACE(ut_short_divide); |
81 | 81 | ||
82 | /* Always check for a zero divisor */ | 82 | /* Always check for a zero divisor */ |
83 | 83 | ||
@@ -139,7 +139,7 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
139 | union uint64_overlay partial2; | 139 | union uint64_overlay partial2; |
140 | union uint64_overlay partial3; | 140 | union uint64_overlay partial3; |
141 | 141 | ||
142 | ACPI_FUNCTION_TRACE("ut_divide"); | 142 | ACPI_FUNCTION_TRACE(ut_divide); |
143 | 143 | ||
144 | /* Always check for a zero divisor */ | 144 | /* Always check for a zero divisor */ |
145 | 145 | ||
@@ -261,7 +261,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
261 | acpi_integer * out_quotient, u32 * out_remainder) | 261 | acpi_integer * out_quotient, u32 * out_remainder) |
262 | { | 262 | { |
263 | 263 | ||
264 | ACPI_FUNCTION_TRACE("ut_short_divide"); | 264 | ACPI_FUNCTION_TRACE(ut_short_divide); |
265 | 265 | ||
266 | /* Always check for a zero divisor */ | 266 | /* Always check for a zero divisor */ |
267 | 267 | ||
@@ -287,7 +287,7 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
287 | acpi_integer in_divisor, | 287 | acpi_integer in_divisor, |
288 | acpi_integer * out_quotient, acpi_integer * out_remainder) | 288 | acpi_integer * out_quotient, acpi_integer * out_remainder) |
289 | { | 289 | { |
290 | ACPI_FUNCTION_TRACE("ut_divide"); | 290 | ACPI_FUNCTION_TRACE(ut_divide); |
291 | 291 | ||
292 | /* Always check for a zero divisor */ | 292 | /* Always check for a zero divisor */ |
293 | 293 | ||
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 7364f5f8c9cd..5c75d35ad1cd 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -49,6 +49,33 @@ ACPI_MODULE_NAME("utmisc") | |||
49 | 49 | ||
50 | /******************************************************************************* | 50 | /******************************************************************************* |
51 | * | 51 | * |
52 | * FUNCTION: acpi_ut_is_aml_table | ||
53 | * | ||
54 | * PARAMETERS: Table - An ACPI table | ||
55 | * | ||
56 | * RETURN: TRUE if table contains executable AML; FALSE otherwise | ||
57 | * | ||
58 | * DESCRIPTION: Check ACPI Signature for a table that contains AML code. | ||
59 | * Currently, these are DSDT,SSDT,PSDT. All other table types are | ||
60 | * data tables that do not contain AML code. | ||
61 | * | ||
62 | ******************************************************************************/ | ||
63 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) | ||
64 | { | ||
65 | |||
66 | /* Ignore tables that contain AML */ | ||
67 | |||
68 | if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || | ||
69 | ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || | ||
70 | ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { | ||
71 | return (TRUE); | ||
72 | } | ||
73 | |||
74 | return (FALSE); | ||
75 | } | ||
76 | |||
77 | /******************************************************************************* | ||
78 | * | ||
52 | * FUNCTION: acpi_ut_allocate_owner_id | 79 | * FUNCTION: acpi_ut_allocate_owner_id |
53 | * | 80 | * |
54 | * PARAMETERS: owner_id - Where the new owner ID is returned | 81 | * PARAMETERS: owner_id - Where the new owner ID is returned |
@@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc") | |||
60 | * when the method exits or the table is unloaded. | 87 | * when the method exits or the table is unloaded. |
61 | * | 88 | * |
62 | ******************************************************************************/ | 89 | ******************************************************************************/ |
90 | |||
63 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | 91 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) |
64 | { | 92 | { |
65 | acpi_native_uint i; | 93 | acpi_native_uint i; |
@@ -67,7 +95,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
67 | acpi_native_uint k; | 95 | acpi_native_uint k; |
68 | acpi_status status; | 96 | acpi_status status; |
69 | 97 | ||
70 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); | 98 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); |
71 | 99 | ||
72 | /* Guard against multiple allocations of ID to the same location */ | 100 | /* Guard against multiple allocations of ID to the same location */ |
73 | 101 | ||
@@ -97,6 +125,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
97 | 125 | ||
98 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { | 126 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { |
99 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { | 127 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { |
128 | |||
100 | /* There are no free IDs in this mask */ | 129 | /* There are no free IDs in this mask */ |
101 | 130 | ||
102 | break; | 131 | break; |
@@ -123,7 +152,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
123 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); | 152 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); |
124 | 153 | ||
125 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, | 154 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, |
126 | "Allocated owner_id: %2.2X\n", | 155 | "Allocated OwnerId: %2.2X\n", |
127 | (unsigned int)*owner_id)); | 156 | (unsigned int)*owner_id)); |
128 | goto exit; | 157 | goto exit; |
129 | } | 158 | } |
@@ -144,7 +173,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
144 | */ | 173 | */ |
145 | status = AE_OWNER_ID_LIMIT; | 174 | status = AE_OWNER_ID_LIMIT; |
146 | ACPI_ERROR((AE_INFO, | 175 | ACPI_ERROR((AE_INFO, |
147 | "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT")); | 176 | "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); |
148 | 177 | ||
149 | exit: | 178 | exit: |
150 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | 179 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); |
@@ -172,7 +201,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
172 | acpi_native_uint index; | 201 | acpi_native_uint index; |
173 | u32 bit; | 202 | u32 bit; |
174 | 203 | ||
175 | ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); | 204 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); |
176 | 205 | ||
177 | /* Always clear the input owner_id (zero is an invalid ID) */ | 206 | /* Always clear the input owner_id (zero is an invalid ID) */ |
178 | 207 | ||
@@ -181,7 +210,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
181 | /* Zero is not a valid owner_iD */ | 210 | /* Zero is not a valid owner_iD */ |
182 | 211 | ||
183 | if (owner_id == 0) { | 212 | if (owner_id == 0) { |
184 | ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id)); | 213 | ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id)); |
185 | return_VOID; | 214 | return_VOID; |
186 | } | 215 | } |
187 | 216 | ||
@@ -207,7 +236,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
207 | acpi_gbl_owner_id_mask[index] ^= bit; | 236 | acpi_gbl_owner_id_mask[index] ^= bit; |
208 | } else { | 237 | } else { |
209 | ACPI_ERROR((AE_INFO, | 238 | ACPI_ERROR((AE_INFO, |
210 | "Release of non-allocated owner_id: %2.2X", | 239 | "Release of non-allocated OwnerId: %2.2X", |
211 | owner_id + 1)); | 240 | owner_id + 1)); |
212 | } | 241 | } |
213 | 242 | ||
@@ -273,6 +302,7 @@ void acpi_ut_print_string(char *string, u8 max_length) | |||
273 | 302 | ||
274 | acpi_os_printf("\""); | 303 | acpi_os_printf("\""); |
275 | for (i = 0; string[i] && (i < max_length); i++) { | 304 | for (i = 0; string[i] && (i < max_length); i++) { |
305 | |||
276 | /* Escape sequences */ | 306 | /* Escape sequences */ |
277 | 307 | ||
278 | switch (string[i]) { | 308 | switch (string[i]) { |
@@ -461,12 +491,47 @@ acpi_ut_display_init_pathname(u8 type, | |||
461 | } | 491 | } |
462 | acpi_os_printf("\n"); | 492 | acpi_os_printf("\n"); |
463 | 493 | ||
464 | ACPI_MEM_FREE(buffer.pointer); | 494 | ACPI_FREE(buffer.pointer); |
465 | } | 495 | } |
466 | #endif | 496 | #endif |
467 | 497 | ||
468 | /******************************************************************************* | 498 | /******************************************************************************* |
469 | * | 499 | * |
500 | * FUNCTION: acpi_ut_valid_acpi_char | ||
501 | * | ||
502 | * PARAMETERS: Char - The character to be examined | ||
503 | * | ||
504 | * RETURN: TRUE if the character is valid, FALSE otherwise | ||
505 | * | ||
506 | * DESCRIPTION: Check for a valid ACPI character. Must be one of: | ||
507 | * 1) Upper case alpha | ||
508 | * 2) numeric | ||
509 | * 3) underscore | ||
510 | * | ||
511 | * We allow a '!' as the last character because of the ASF! table | ||
512 | * | ||
513 | ******************************************************************************/ | ||
514 | |||
515 | u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) | ||
516 | { | ||
517 | |||
518 | if (!((character >= 'A' && character <= 'Z') || | ||
519 | (character >= '0' && character <= '9') || (character == '_'))) { | ||
520 | |||
521 | /* Allow a '!' in the last position */ | ||
522 | |||
523 | if (character == '!' && position == 3) { | ||
524 | return (TRUE); | ||
525 | } | ||
526 | |||
527 | return (FALSE); | ||
528 | } | ||
529 | |||
530 | return (TRUE); | ||
531 | } | ||
532 | |||
533 | /******************************************************************************* | ||
534 | * | ||
470 | * FUNCTION: acpi_ut_valid_acpi_name | 535 | * FUNCTION: acpi_ut_valid_acpi_name |
471 | * | 536 | * |
472 | * PARAMETERS: Name - The name to be examined | 537 | * PARAMETERS: Name - The name to be examined |
@@ -482,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type, | |||
482 | 547 | ||
483 | u8 acpi_ut_valid_acpi_name(u32 name) | 548 | u8 acpi_ut_valid_acpi_name(u32 name) |
484 | { | 549 | { |
485 | char *name_ptr = (char *)&name; | ||
486 | char character; | ||
487 | acpi_native_uint i; | 550 | acpi_native_uint i; |
488 | 551 | ||
489 | ACPI_FUNCTION_ENTRY(); | 552 | ACPI_FUNCTION_ENTRY(); |
490 | 553 | ||
491 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 554 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
492 | character = *name_ptr; | 555 | if (!acpi_ut_valid_acpi_char |
493 | name_ptr++; | 556 | ((ACPI_CAST_PTR(char, &name))[i], i)) { |
494 | |||
495 | if (!((character == '_') || | ||
496 | (character >= 'A' && character <= 'Z') || | ||
497 | (character >= '0' && character <= '9'))) { | ||
498 | return (FALSE); | 557 | return (FALSE); |
499 | } | 558 | } |
500 | } | 559 | } |
@@ -504,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name) | |||
504 | 563 | ||
505 | /******************************************************************************* | 564 | /******************************************************************************* |
506 | * | 565 | * |
507 | * FUNCTION: acpi_ut_valid_acpi_character | 566 | * FUNCTION: acpi_ut_repair_name |
508 | * | 567 | * |
509 | * PARAMETERS: Character - The character to be examined | 568 | * PARAMETERS: Name - The ACPI name to be repaired |
510 | * | 569 | * |
511 | * RETURN: 1 if Character may appear in a name, else 0 | 570 | * RETURN: Repaired version of the name |
512 | * | 571 | * |
513 | * DESCRIPTION: Check for a printable character | 572 | * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and |
573 | * return the new name. | ||
514 | * | 574 | * |
515 | ******************************************************************************/ | 575 | ******************************************************************************/ |
516 | 576 | ||
517 | u8 acpi_ut_valid_acpi_character(char character) | 577 | acpi_name acpi_ut_repair_name(acpi_name name) |
518 | { | 578 | { |
579 | char *name_ptr = ACPI_CAST_PTR(char, &name); | ||
580 | char new_name[ACPI_NAME_SIZE]; | ||
581 | acpi_native_uint i; | ||
519 | 582 | ||
520 | ACPI_FUNCTION_ENTRY(); | 583 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
584 | new_name[i] = name_ptr[i]; | ||
521 | 585 | ||
522 | return ((u8) ((character == '_') || | 586 | /* |
523 | (character >= 'A' && character <= 'Z') || | 587 | * Replace a bad character with something printable, yet technically |
524 | (character >= '0' && character <= '9'))); | 588 | * still invalid. This prevents any collisions with existing "good" |
589 | * names in the namespace. | ||
590 | */ | ||
591 | if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) { | ||
592 | new_name[i] = '*'; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | return (*ACPI_CAST_PTR(u32, new_name)); | ||
525 | } | 597 | } |
526 | 598 | ||
527 | /******************************************************************************* | 599 | /******************************************************************************* |
@@ -529,7 +601,8 @@ u8 acpi_ut_valid_acpi_character(char character) | |||
529 | * FUNCTION: acpi_ut_strtoul64 | 601 | * FUNCTION: acpi_ut_strtoul64 |
530 | * | 602 | * |
531 | * PARAMETERS: String - Null terminated string | 603 | * PARAMETERS: String - Null terminated string |
532 | * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE | 604 | * Base - Radix of the string: 16 or ACPI_ANY_BASE; |
605 | * ACPI_ANY_BASE means 'in behalf of to_integer' | ||
533 | * ret_integer - Where the converted integer is returned | 606 | * ret_integer - Where the converted integer is returned |
534 | * | 607 | * |
535 | * RETURN: Status and Converted value | 608 | * RETURN: Status and Converted value |
@@ -545,16 +618,17 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
545 | u32 this_digit = 0; | 618 | u32 this_digit = 0; |
546 | acpi_integer return_value = 0; | 619 | acpi_integer return_value = 0; |
547 | acpi_integer quotient; | 620 | acpi_integer quotient; |
621 | acpi_integer dividend; | ||
622 | u32 to_integer_op = (base == ACPI_ANY_BASE); | ||
623 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); | ||
624 | u8 valid_digits = 0; | ||
625 | u8 sign_of0x = 0; | ||
626 | u8 term = 0; | ||
548 | 627 | ||
549 | ACPI_FUNCTION_TRACE("ut_stroul64"); | 628 | ACPI_FUNCTION_TRACE(ut_stroul64); |
550 | |||
551 | if ((!string) || !(*string)) { | ||
552 | goto error_exit; | ||
553 | } | ||
554 | 629 | ||
555 | switch (base) { | 630 | switch (base) { |
556 | case ACPI_ANY_BASE: | 631 | case ACPI_ANY_BASE: |
557 | case 10: | ||
558 | case 16: | 632 | case 16: |
559 | break; | 633 | break; |
560 | 634 | ||
@@ -563,76 +637,110 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
563 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 637 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
564 | } | 638 | } |
565 | 639 | ||
640 | if (!string) { | ||
641 | goto error_exit; | ||
642 | } | ||
643 | |||
566 | /* Skip over any white space in the buffer */ | 644 | /* Skip over any white space in the buffer */ |
567 | 645 | ||
568 | while (ACPI_IS_SPACE(*string) || *string == '\t') { | 646 | while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { |
569 | string++; | 647 | string++; |
570 | } | 648 | } |
571 | 649 | ||
572 | /* | 650 | if (to_integer_op) { |
573 | * If the input parameter Base is zero, then we need to | 651 | /* |
574 | * determine if it is decimal or hexadecimal: | 652 | * Base equal to ACPI_ANY_BASE means 'to_integer operation case'. |
575 | */ | 653 | * We need to determine if it is decimal or hexadecimal. |
576 | if (base == 0) { | 654 | */ |
577 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | 655 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { |
656 | sign_of0x = 1; | ||
578 | base = 16; | 657 | base = 16; |
658 | |||
659 | /* Skip over the leading '0x' */ | ||
579 | string += 2; | 660 | string += 2; |
580 | } else { | 661 | } else { |
581 | base = 10; | 662 | base = 10; |
582 | } | 663 | } |
583 | } | 664 | } |
584 | 665 | ||
585 | /* | 666 | /* Any string left? Check that '0x' is not followed by white space. */ |
586 | * For hexadecimal base, skip over the leading | 667 | |
587 | * 0 or 0x, if they are present. | 668 | if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { |
588 | */ | 669 | if (to_integer_op) { |
589 | if ((base == 16) && | 670 | goto error_exit; |
590 | (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | 671 | } else { |
591 | string += 2; | 672 | goto all_done; |
673 | } | ||
592 | } | 674 | } |
593 | 675 | ||
594 | /* Any string left? */ | 676 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; |
595 | 677 | ||
596 | if (!(*string)) { | 678 | /* At least one character in the string here */ |
597 | goto error_exit; | ||
598 | } | ||
599 | 679 | ||
600 | /* Main loop: convert the string to a 64-bit integer */ | 680 | /* Main loop: convert the string to a 64-bit integer */ |
601 | 681 | ||
602 | while (*string) { | 682 | while (*string) { |
603 | if (ACPI_IS_DIGIT(*string)) { | 683 | if (ACPI_IS_DIGIT(*string)) { |
684 | |||
604 | /* Convert ASCII 0-9 to Decimal value */ | 685 | /* Convert ASCII 0-9 to Decimal value */ |
605 | 686 | ||
606 | this_digit = ((u8) * string) - '0'; | 687 | this_digit = ((u8) * string) - '0'; |
607 | } else { | 688 | } else if (base == 10) { |
608 | if (base == 10) { | ||
609 | /* Digit is out of range */ | ||
610 | 689 | ||
611 | goto error_exit; | 690 | /* Digit is out of range; possible in to_integer case only */ |
612 | } | ||
613 | 691 | ||
692 | term = 1; | ||
693 | } else { | ||
614 | this_digit = (u8) ACPI_TOUPPER(*string); | 694 | this_digit = (u8) ACPI_TOUPPER(*string); |
615 | if (ACPI_IS_XDIGIT((char)this_digit)) { | 695 | if (ACPI_IS_XDIGIT((char)this_digit)) { |
696 | |||
616 | /* Convert ASCII Hex char to value */ | 697 | /* Convert ASCII Hex char to value */ |
617 | 698 | ||
618 | this_digit = this_digit - 'A' + 10; | 699 | this_digit = this_digit - 'A' + 10; |
619 | } else { | 700 | } else { |
620 | /* | 701 | term = 1; |
621 | * We allow non-hex chars, just stop now, same as end-of-string. | 702 | } |
622 | * See ACPI spec, string-to-integer conversion. | 703 | } |
623 | */ | 704 | |
705 | if (term) { | ||
706 | if (to_integer_op) { | ||
707 | goto error_exit; | ||
708 | } else { | ||
624 | break; | 709 | break; |
625 | } | 710 | } |
711 | } else if ((valid_digits == 0) && (this_digit == 0) | ||
712 | && !sign_of0x) { | ||
713 | |||
714 | /* Skip zeros */ | ||
715 | string++; | ||
716 | continue; | ||
717 | } | ||
718 | |||
719 | valid_digits++; | ||
720 | |||
721 | if (sign_of0x | ||
722 | && ((valid_digits > 16) | ||
723 | || ((valid_digits > 8) && mode32))) { | ||
724 | /* | ||
725 | * This is to_integer operation case. | ||
726 | * No any restrictions for string-to-integer conversion, | ||
727 | * see ACPI spec. | ||
728 | */ | ||
729 | goto error_exit; | ||
626 | } | 730 | } |
627 | 731 | ||
628 | /* Divide the digit into the correct position */ | 732 | /* Divide the digit into the correct position */ |
629 | 733 | ||
630 | (void) | 734 | (void) |
631 | acpi_ut_short_divide((ACPI_INTEGER_MAX - | 735 | acpi_ut_short_divide((dividend - (acpi_integer) this_digit), |
632 | (acpi_integer) this_digit), base, | 736 | base, "ient, NULL); |
633 | "ient, NULL); | 737 | |
634 | if (return_value > quotient) { | 738 | if (return_value > quotient) { |
635 | goto error_exit; | 739 | if (to_integer_op) { |
740 | goto error_exit; | ||
741 | } else { | ||
742 | break; | ||
743 | } | ||
636 | } | 744 | } |
637 | 745 | ||
638 | return_value *= base; | 746 | return_value *= base; |
@@ -642,6 +750,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
642 | 750 | ||
643 | /* All done, normal exit */ | 751 | /* All done, normal exit */ |
644 | 752 | ||
753 | all_done: | ||
754 | |||
645 | *ret_integer = return_value; | 755 | *ret_integer = return_value; |
646 | return_ACPI_STATUS(AE_OK); | 756 | return_ACPI_STATUS(AE_OK); |
647 | 757 | ||
@@ -719,7 +829,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
719 | u32 this_index; | 829 | u32 this_index; |
720 | union acpi_operand_object *this_source_obj; | 830 | union acpi_operand_object *this_source_obj; |
721 | 831 | ||
722 | ACPI_FUNCTION_TRACE("ut_walk_package_tree"); | 832 | ACPI_FUNCTION_TRACE(ut_walk_package_tree); |
723 | 833 | ||
724 | state = acpi_ut_create_pkg_state(source_object, target_object, 0); | 834 | state = acpi_ut_create_pkg_state(source_object, target_object, 0); |
725 | if (!state) { | 835 | if (!state) { |
@@ -727,6 +837,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
727 | } | 837 | } |
728 | 838 | ||
729 | while (state) { | 839 | while (state) { |
840 | |||
730 | /* Get one element of the package */ | 841 | /* Get one element of the package */ |
731 | 842 | ||
732 | this_index = state->pkg.index; | 843 | this_index = state->pkg.index; |
@@ -814,31 +925,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
814 | 925 | ||
815 | /******************************************************************************* | 926 | /******************************************************************************* |
816 | * | 927 | * |
817 | * FUNCTION: acpi_ut_generate_checksum | ||
818 | * | ||
819 | * PARAMETERS: Buffer - Buffer to be scanned | ||
820 | * Length - number of bytes to examine | ||
821 | * | ||
822 | * RETURN: The generated checksum | ||
823 | * | ||
824 | * DESCRIPTION: Generate a checksum on a raw buffer | ||
825 | * | ||
826 | ******************************************************************************/ | ||
827 | |||
828 | u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) | ||
829 | { | ||
830 | u32 i; | ||
831 | signed char sum = 0; | ||
832 | |||
833 | for (i = 0; i < length; i++) { | ||
834 | sum = (signed char)(sum + buffer[i]); | ||
835 | } | ||
836 | |||
837 | return ((u8) (0 - sum)); | ||
838 | } | ||
839 | |||
840 | /******************************************************************************* | ||
841 | * | ||
842 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info | 928 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info |
843 | * | 929 | * |
844 | * PARAMETERS: module_name - Caller's module name (for error output) | 930 | * PARAMETERS: module_name - Caller's module name (for error output) |
@@ -900,36 +986,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) | |||
900 | acpi_os_vprintf(format, args); | 986 | acpi_os_vprintf(format, args); |
901 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 987 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
902 | } | 988 | } |
903 | |||
904 | /******************************************************************************* | ||
905 | * | ||
906 | * FUNCTION: acpi_ut_report_error, Warning, Info | ||
907 | * | ||
908 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
909 | * line_number - Caller's line number (for error output) | ||
910 | * | ||
911 | * RETURN: None | ||
912 | * | ||
913 | * DESCRIPTION: Print error message | ||
914 | * | ||
915 | * Note: Legacy only, should be removed when no longer used by drivers. | ||
916 | * | ||
917 | ******************************************************************************/ | ||
918 | |||
919 | void acpi_ut_report_error(char *module_name, u32 line_number) | ||
920 | { | ||
921 | |||
922 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
923 | } | ||
924 | |||
925 | void acpi_ut_report_warning(char *module_name, u32 line_number) | ||
926 | { | ||
927 | |||
928 | acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); | ||
929 | } | ||
930 | |||
931 | void acpi_ut_report_info(char *module_name, u32 line_number) | ||
932 | { | ||
933 | |||
934 | acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); | ||
935 | } | ||
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 45a7244df924..25eb34369afa 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -68,19 +68,26 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
68 | u32 i; | 68 | u32 i; |
69 | acpi_status status; | 69 | acpi_status status; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ut_mutex_initialize"); | 71 | ACPI_FUNCTION_TRACE(ut_mutex_initialize); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Create each of the predefined mutex objects | 74 | * Create each of the predefined mutex objects |
75 | */ | 75 | */ |
76 | for (i = 0; i < NUM_MUTEX; i++) { | 76 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
77 | status = acpi_ut_create_mutex(i); | 77 | status = acpi_ut_create_mutex(i); |
78 | if (ACPI_FAILURE(status)) { | 78 | if (ACPI_FAILURE(status)) { |
79 | return_ACPI_STATUS(status); | 79 | return_ACPI_STATUS(status); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | /* Create the spinlocks for use at interrupt level */ | ||
84 | |||
83 | status = acpi_os_create_lock(&acpi_gbl_gpe_lock); | 85 | status = acpi_os_create_lock(&acpi_gbl_gpe_lock); |
86 | if (ACPI_FAILURE(status)) { | ||
87 | return_ACPI_STATUS(status); | ||
88 | } | ||
89 | |||
90 | status = acpi_os_create_lock(&acpi_gbl_hardware_lock); | ||
84 | return_ACPI_STATUS(status); | 91 | return_ACPI_STATUS(status); |
85 | } | 92 | } |
86 | 93 | ||
@@ -100,16 +107,19 @@ void acpi_ut_mutex_terminate(void) | |||
100 | { | 107 | { |
101 | u32 i; | 108 | u32 i; |
102 | 109 | ||
103 | ACPI_FUNCTION_TRACE("ut_mutex_terminate"); | 110 | ACPI_FUNCTION_TRACE(ut_mutex_terminate); |
104 | 111 | ||
105 | /* | 112 | /* |
106 | * Delete each predefined mutex object | 113 | * Delete each predefined mutex object |
107 | */ | 114 | */ |
108 | for (i = 0; i < NUM_MUTEX; i++) { | 115 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
109 | (void)acpi_ut_delete_mutex(i); | 116 | (void)acpi_ut_delete_mutex(i); |
110 | } | 117 | } |
111 | 118 | ||
119 | /* Delete the spinlocks */ | ||
120 | |||
112 | acpi_os_delete_lock(acpi_gbl_gpe_lock); | 121 | acpi_os_delete_lock(acpi_gbl_gpe_lock); |
122 | acpi_os_delete_lock(acpi_gbl_hardware_lock); | ||
113 | return_VOID; | 123 | return_VOID; |
114 | } | 124 | } |
115 | 125 | ||
@@ -129,9 +139,9 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
129 | { | 139 | { |
130 | acpi_status status = AE_OK; | 140 | acpi_status status = AE_OK; |
131 | 141 | ||
132 | ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); | 142 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); |
133 | 143 | ||
134 | if (mutex_id > MAX_MUTEX) { | 144 | if (mutex_id > ACPI_MAX_MUTEX) { |
135 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 145 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
136 | } | 146 | } |
137 | 147 | ||
@@ -163,9 +173,9 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | |||
163 | { | 173 | { |
164 | acpi_status status; | 174 | acpi_status status; |
165 | 175 | ||
166 | ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); | 176 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); |
167 | 177 | ||
168 | if (mutex_id > MAX_MUTEX) { | 178 | if (mutex_id > ACPI_MAX_MUTEX) { |
169 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 179 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
170 | } | 180 | } |
171 | 181 | ||
@@ -192,11 +202,11 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | |||
192 | acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | 202 | acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) |
193 | { | 203 | { |
194 | acpi_status status; | 204 | acpi_status status; |
195 | u32 this_thread_id; | 205 | acpi_thread_id this_thread_id; |
196 | 206 | ||
197 | ACPI_FUNCTION_NAME("ut_acquire_mutex"); | 207 | ACPI_FUNCTION_NAME(ut_acquire_mutex); |
198 | 208 | ||
199 | if (mutex_id > MAX_MUTEX) { | 209 | if (mutex_id > ACPI_MAX_MUTEX) { |
200 | return (AE_BAD_PARAMETER); | 210 | return (AE_BAD_PARAMETER); |
201 | } | 211 | } |
202 | 212 | ||
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
213 | * the mutex ordering rule. This indicates a coding error somewhere in | 223 | * the mutex ordering rule. This indicates a coding error somewhere in |
214 | * the ACPI subsystem code. | 224 | * the ACPI subsystem code. |
215 | */ | 225 | */ |
216 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 226 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { |
217 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 227 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
218 | if (i == mutex_id) { | 228 | if (i == mutex_id) { |
219 | ACPI_ERROR((AE_INFO, | 229 | ACPI_ERROR((AE_INFO, |
@@ -275,16 +285,16 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
275 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | 285 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) |
276 | { | 286 | { |
277 | acpi_status status; | 287 | acpi_status status; |
278 | u32 this_thread_id; | 288 | acpi_thread_id this_thread_id; |
279 | 289 | ||
280 | ACPI_FUNCTION_NAME("ut_release_mutex"); | 290 | ACPI_FUNCTION_NAME(ut_release_mutex); |
281 | 291 | ||
282 | this_thread_id = acpi_os_get_thread_id(); | 292 | this_thread_id = acpi_os_get_thread_id(); |
283 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 293 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
284 | "Thread %X releasing Mutex [%s]\n", this_thread_id, | 294 | "Thread %X releasing Mutex [%s]\n", this_thread_id, |
285 | acpi_ut_get_mutex_name(mutex_id))); | 295 | acpi_ut_get_mutex_name(mutex_id))); |
286 | 296 | ||
287 | if (mutex_id > MAX_MUTEX) { | 297 | if (mutex_id > ACPI_MAX_MUTEX) { |
288 | return (AE_BAD_PARAMETER); | 298 | return (AE_BAD_PARAMETER); |
289 | } | 299 | } |
290 | 300 | ||
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
309 | * ordering rule. This indicates a coding error somewhere in | 319 | * ordering rule. This indicates a coding error somewhere in |
310 | * the ACPI subsystem code. | 320 | * the ACPI subsystem code. |
311 | */ | 321 | */ |
312 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 322 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { |
313 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 323 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
314 | if (i == mutex_id) { | 324 | if (i == mutex_id) { |
315 | continue; | 325 | continue; |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 7ee2d1d98071..ba7d8ac702df 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -92,7 +92,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, | |||
92 | union acpi_operand_object *object; | 92 | union acpi_operand_object *object; |
93 | union acpi_operand_object *second_object; | 93 | union acpi_operand_object *second_object; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg", | 95 | ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg, |
96 | acpi_ut_get_type_name(type)); | 96 | acpi_ut_get_type_name(type)); |
97 | 97 | ||
98 | /* Allocate the raw object descriptor */ | 98 | /* Allocate the raw object descriptor */ |
@@ -161,7 +161,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) | |||
161 | union acpi_operand_object *buffer_desc; | 161 | union acpi_operand_object *buffer_desc; |
162 | u8 *buffer = NULL; | 162 | u8 *buffer = NULL; |
163 | 163 | ||
164 | ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size); | 164 | ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size); |
165 | 165 | ||
166 | /* Create a new Buffer object */ | 166 | /* Create a new Buffer object */ |
167 | 167 | ||
@@ -173,9 +173,10 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) | |||
173 | /* Create an actual buffer only if size > 0 */ | 173 | /* Create an actual buffer only if size > 0 */ |
174 | 174 | ||
175 | if (buffer_size > 0) { | 175 | if (buffer_size > 0) { |
176 | |||
176 | /* Allocate the actual buffer */ | 177 | /* Allocate the actual buffer */ |
177 | 178 | ||
178 | buffer = ACPI_MEM_CALLOCATE(buffer_size); | 179 | buffer = ACPI_ALLOCATE_ZEROED(buffer_size); |
179 | if (!buffer) { | 180 | if (!buffer) { |
180 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", | 181 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", |
181 | (u32) buffer_size)); | 182 | (u32) buffer_size)); |
@@ -214,7 +215,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
214 | union acpi_operand_object *string_desc; | 215 | union acpi_operand_object *string_desc; |
215 | char *string; | 216 | char *string; |
216 | 217 | ||
217 | ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size); | 218 | ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size); |
218 | 219 | ||
219 | /* Create a new String object */ | 220 | /* Create a new String object */ |
220 | 221 | ||
@@ -227,7 +228,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
227 | * Allocate the actual string buffer -- (Size + 1) for NULL terminator. | 228 | * Allocate the actual string buffer -- (Size + 1) for NULL terminator. |
228 | * NOTE: Zero-length strings are NULL terminated | 229 | * NOTE: Zero-length strings are NULL terminated |
229 | */ | 230 | */ |
230 | string = ACPI_MEM_CALLOCATE(string_size + 1); | 231 | string = ACPI_ALLOCATE_ZEROED(string_size + 1); |
231 | if (!string) { | 232 | if (!string) { |
232 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", | 233 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", |
233 | (u32) string_size)); | 234 | (u32) string_size)); |
@@ -260,7 +261,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
260 | u8 acpi_ut_valid_internal_object(void *object) | 261 | u8 acpi_ut_valid_internal_object(void *object) |
261 | { | 262 | { |
262 | 263 | ||
263 | ACPI_FUNCTION_NAME("ut_valid_internal_object"); | 264 | ACPI_FUNCTION_NAME(ut_valid_internal_object); |
264 | 265 | ||
265 | /* Check for a null pointer */ | 266 | /* Check for a null pointer */ |
266 | 267 | ||
@@ -308,7 +309,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
308 | { | 309 | { |
309 | union acpi_operand_object *object; | 310 | union acpi_operand_object *object; |
310 | 311 | ||
311 | ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg"); | 312 | ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg); |
312 | 313 | ||
313 | object = acpi_os_acquire_object(acpi_gbl_operand_cache); | 314 | object = acpi_os_acquire_object(acpi_gbl_operand_cache); |
314 | if (!object) { | 315 | if (!object) { |
@@ -319,6 +320,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
319 | } | 320 | } |
320 | 321 | ||
321 | /* Mark the descriptor type */ | 322 | /* Mark the descriptor type */ |
323 | |||
322 | memset(object, 0, sizeof(union acpi_operand_object)); | 324 | memset(object, 0, sizeof(union acpi_operand_object)); |
323 | ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); | 325 | ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); |
324 | 326 | ||
@@ -342,7 +344,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
342 | 344 | ||
343 | void acpi_ut_delete_object_desc(union acpi_operand_object *object) | 345 | void acpi_ut_delete_object_desc(union acpi_operand_object *object) |
344 | { | 346 | { |
345 | ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object); | 347 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); |
346 | 348 | ||
347 | /* Object must be an union acpi_operand_object */ | 349 | /* Object must be an union acpi_operand_object */ |
348 | 350 | ||
@@ -381,7 +383,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
381 | acpi_size length; | 383 | acpi_size length; |
382 | acpi_status status = AE_OK; | 384 | acpi_status status = AE_OK; |
383 | 385 | ||
384 | ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object); | 386 | ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); |
385 | 387 | ||
386 | /* | 388 | /* |
387 | * Handle a null object (Could be a uninitialized package | 389 | * Handle a null object (Could be a uninitialized package |
@@ -397,6 +399,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
397 | length = sizeof(union acpi_object); | 399 | length = sizeof(union acpi_object); |
398 | 400 | ||
399 | if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { | 401 | if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { |
402 | |||
400 | /* Object is a named object (reference), just return the length */ | 403 | /* Object is a named object (reference), just return the length */ |
401 | 404 | ||
402 | *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); | 405 | *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); |
@@ -559,7 +562,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, | |||
559 | acpi_status status; | 562 | acpi_status status; |
560 | struct acpi_pkg_info info; | 563 | struct acpi_pkg_info info; |
561 | 564 | ||
562 | ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object); | 565 | ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object); |
563 | 566 | ||
564 | info.length = 0; | 567 | info.length = 0; |
565 | info.object_space = 0; | 568 | info.object_space = 0; |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 16461317113f..5a2de92831d3 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -45,113 +45,113 @@ | |||
45 | #include <acpi/amlresrc.h> | 45 | #include <acpi/amlresrc.h> |
46 | 46 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utmisc") | 48 | ACPI_MODULE_NAME("utresrc") |
49 | 49 | ||
50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) |
51 | /* | 51 | /* |
52 | * Strings used to decode resource descriptors. | 52 | * Strings used to decode resource descriptors. |
53 | * Used by both the disasssembler and the debugger resource dump routines | 53 | * Used by both the disasssembler and the debugger resource dump routines |
54 | */ | 54 | */ |
55 | const char *acpi_gbl_BMdecode[2] = { | 55 | const char *acpi_gbl_bm_decode[] = { |
56 | "not_bus_master", | 56 | "NotBusMaster", |
57 | "bus_master" | 57 | "BusMaster" |
58 | }; | 58 | }; |
59 | 59 | ||
60 | const char *acpi_gbl_config_decode[4] = { | 60 | const char *acpi_gbl_config_decode[] = { |
61 | "0 - Good Configuration", | 61 | "0 - Good Configuration", |
62 | "1 - Acceptable Configuration", | 62 | "1 - Acceptable Configuration", |
63 | "2 - Suboptimal Configuration", | 63 | "2 - Suboptimal Configuration", |
64 | "3 - ***Invalid Configuration***", | 64 | "3 - ***Invalid Configuration***", |
65 | }; | 65 | }; |
66 | 66 | ||
67 | const char *acpi_gbl_consume_decode[2] = { | 67 | const char *acpi_gbl_consume_decode[] = { |
68 | "resource_producer", | 68 | "ResourceProducer", |
69 | "resource_consumer" | 69 | "ResourceConsumer" |
70 | }; | 70 | }; |
71 | 71 | ||
72 | const char *acpi_gbl_DECdecode[2] = { | 72 | const char *acpi_gbl_dec_decode[] = { |
73 | "pos_decode", | 73 | "PosDecode", |
74 | "sub_decode" | 74 | "SubDecode" |
75 | }; | 75 | }; |
76 | 76 | ||
77 | const char *acpi_gbl_HEdecode[2] = { | 77 | const char *acpi_gbl_he_decode[] = { |
78 | "Level", | 78 | "Level", |
79 | "Edge" | 79 | "Edge" |
80 | }; | 80 | }; |
81 | 81 | ||
82 | const char *acpi_gbl_io_decode[2] = { | 82 | const char *acpi_gbl_io_decode[] = { |
83 | "Decode10", | 83 | "Decode10", |
84 | "Decode16" | 84 | "Decode16" |
85 | }; | 85 | }; |
86 | 86 | ||
87 | const char *acpi_gbl_LLdecode[2] = { | 87 | const char *acpi_gbl_ll_decode[] = { |
88 | "active_high", | 88 | "ActiveHigh", |
89 | "active_low" | 89 | "ActiveLow" |
90 | }; | 90 | }; |
91 | 91 | ||
92 | const char *acpi_gbl_max_decode[2] = { | 92 | const char *acpi_gbl_max_decode[] = { |
93 | "max_not_fixed", | 93 | "MaxNotFixed", |
94 | "max_fixed" | 94 | "MaxFixed" |
95 | }; | 95 | }; |
96 | 96 | ||
97 | const char *acpi_gbl_MEMdecode[4] = { | 97 | const char *acpi_gbl_mem_decode[] = { |
98 | "non_cacheable", | 98 | "NonCacheable", |
99 | "Cacheable", | 99 | "Cacheable", |
100 | "write_combining", | 100 | "WriteCombining", |
101 | "Prefetchable" | 101 | "Prefetchable" |
102 | }; | 102 | }; |
103 | 103 | ||
104 | const char *acpi_gbl_min_decode[2] = { | 104 | const char *acpi_gbl_min_decode[] = { |
105 | "min_not_fixed", | 105 | "MinNotFixed", |
106 | "min_fixed" | 106 | "MinFixed" |
107 | }; | 107 | }; |
108 | 108 | ||
109 | const char *acpi_gbl_MTPdecode[4] = { | 109 | const char *acpi_gbl_mtp_decode[] = { |
110 | "address_range_memory", | 110 | "AddressRangeMemory", |
111 | "address_range_reserved", | 111 | "AddressRangeReserved", |
112 | "address_range_aCPI", | 112 | "AddressRangeACPI", |
113 | "address_range_nVS" | 113 | "AddressRangeNVS" |
114 | }; | 114 | }; |
115 | 115 | ||
116 | const char *acpi_gbl_RNGdecode[4] = { | 116 | const char *acpi_gbl_rng_decode[] = { |
117 | "invalid_ranges", | 117 | "InvalidRanges", |
118 | "non_iSAonly_ranges", | 118 | "NonISAOnlyRanges", |
119 | "ISAonly_ranges", | 119 | "ISAOnlyRanges", |
120 | "entire_range" | 120 | "EntireRange" |
121 | }; | 121 | }; |
122 | 122 | ||
123 | const char *acpi_gbl_RWdecode[2] = { | 123 | const char *acpi_gbl_rw_decode[] = { |
124 | "read_only", | 124 | "ReadOnly", |
125 | "read_write" | 125 | "ReadWrite" |
126 | }; | 126 | }; |
127 | 127 | ||
128 | const char *acpi_gbl_SHRdecode[2] = { | 128 | const char *acpi_gbl_shr_decode[] = { |
129 | "Exclusive", | 129 | "Exclusive", |
130 | "Shared" | 130 | "Shared" |
131 | }; | 131 | }; |
132 | 132 | ||
133 | const char *acpi_gbl_SIZdecode[4] = { | 133 | const char *acpi_gbl_siz_decode[] = { |
134 | "Transfer8", | 134 | "Transfer8", |
135 | "Transfer8_16", | 135 | "Transfer8_16", |
136 | "Transfer16", | 136 | "Transfer16", |
137 | "invalid_size" | 137 | "InvalidSize" |
138 | }; | 138 | }; |
139 | 139 | ||
140 | const char *acpi_gbl_TRSdecode[2] = { | 140 | const char *acpi_gbl_trs_decode[] = { |
141 | "dense_translation", | 141 | "DenseTranslation", |
142 | "sparse_translation" | 142 | "SparseTranslation" |
143 | }; | 143 | }; |
144 | 144 | ||
145 | const char *acpi_gbl_TTPdecode[2] = { | 145 | const char *acpi_gbl_ttp_decode[] = { |
146 | "type_static", | 146 | "TypeStatic", |
147 | "type_translation" | 147 | "TypeTranslation" |
148 | }; | 148 | }; |
149 | 149 | ||
150 | const char *acpi_gbl_TYPdecode[4] = { | 150 | const char *acpi_gbl_typ_decode[] = { |
151 | "Compatibility", | 151 | "Compatibility", |
152 | "type_a", | 152 | "TypeA", |
153 | "type_b", | 153 | "TypeB", |
154 | "type_f" | 154 | "TypeF" |
155 | }; | 155 | }; |
156 | 156 | ||
157 | #endif | 157 | #endif |
@@ -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 | *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 |
@@ -273,6 +371,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) | |||
273 | * Examine the large/small bit in the resource header | 371 | * Examine the large/small bit in the resource header |
274 | */ | 372 | */ |
275 | if (resource_type & ACPI_RESOURCE_NAME_LARGE) { | 373 | if (resource_type & ACPI_RESOURCE_NAME_LARGE) { |
374 | |||
276 | /* Verify the large resource type (name) against the max */ | 375 | /* Verify the large resource type (name) against the max */ |
277 | 376 | ||
278 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { | 377 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { |
@@ -376,6 +475,7 @@ u8 acpi_ut_get_resource_type(void *aml) | |||
376 | * Examine the large/small bit in the resource header | 475 | * Examine the large/small bit in the resource header |
377 | */ | 476 | */ |
378 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | 477 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { |
478 | |||
379 | /* Large Resource Type -- bits 6:0 contain the name */ | 479 | /* Large Resource Type -- bits 6:0 contain the name */ |
380 | 480 | ||
381 | return (ACPI_GET8(aml)); | 481 | return (ACPI_GET8(aml)); |
@@ -411,6 +511,7 @@ u16 acpi_ut_get_resource_length(void *aml) | |||
411 | * Examine the large/small bit in the resource header | 511 | * Examine the large/small bit in the resource header |
412 | */ | 512 | */ |
413 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | 513 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { |
514 | |||
414 | /* Large Resource type -- bytes 1-2 contain the 16-bit length */ | 515 | /* Large Resource type -- bytes 1-2 contain the 16-bit length */ |
415 | 516 | ||
416 | ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); | 517 | ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); |
@@ -495,60 +596,21 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, | |||
495 | u8 ** end_tag) | 596 | u8 ** end_tag) |
496 | { | 597 | { |
497 | acpi_status status; | 598 | acpi_status status; |
498 | u8 *aml; | ||
499 | u8 *end_aml; | ||
500 | |||
501 | ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); | ||
502 | 599 | ||
503 | /* Get start and end pointers */ | 600 | ACPI_FUNCTION_TRACE(ut_get_resource_end_tag); |
504 | |||
505 | aml = obj_desc->buffer.pointer; | ||
506 | end_aml = aml + obj_desc->buffer.length; | ||
507 | 601 | ||
508 | /* Allow a buffer length of zero */ | 602 | /* Allow a buffer length of zero */ |
509 | 603 | ||
510 | if (!obj_desc->buffer.length) { | 604 | if (!obj_desc->buffer.length) { |
511 | *end_tag = aml; | 605 | *end_tag = obj_desc->buffer.pointer; |
512 | return_ACPI_STATUS(AE_OK); | 606 | return_ACPI_STATUS(AE_OK); |
513 | } | 607 | } |
514 | 608 | ||
515 | /* Walk the resource template, one descriptor per iteration */ | 609 | /* Validate the template and get a pointer to the end_tag */ |
516 | |||
517 | while (aml < end_aml) { | ||
518 | /* Validate the Resource Type and Resource Length */ | ||
519 | |||
520 | status = acpi_ut_validate_resource(aml, NULL); | ||
521 | if (ACPI_FAILURE(status)) { | ||
522 | return_ACPI_STATUS(status); | ||
523 | } | ||
524 | |||
525 | /* end_tag resource indicates the end of the resource template */ | ||
526 | |||
527 | if (acpi_ut_get_resource_type(aml) == | ||
528 | ACPI_RESOURCE_NAME_END_TAG) { | ||
529 | /* | ||
530 | * There must be at least one more byte in the buffer for | ||
531 | * the 2nd byte of the end_tag | ||
532 | */ | ||
533 | if ((aml + 1) >= end_aml) { | ||
534 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
535 | } | ||
536 | |||
537 | /* Return the pointer to the end_tag */ | ||
538 | |||
539 | *end_tag = aml; | ||
540 | return_ACPI_STATUS(AE_OK); | ||
541 | } | ||
542 | |||
543 | /* | ||
544 | * Point to the next resource descriptor in the AML buffer. The | ||
545 | * descriptor length is guaranteed to be non-zero by resource | ||
546 | * validation above. | ||
547 | */ | ||
548 | aml += acpi_ut_get_descriptor_length(aml); | ||
549 | } | ||
550 | 610 | ||
551 | /* 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 | (void **)end_tag); | ||
552 | 614 | ||
553 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 615 | return_ACPI_STATUS(status); |
554 | } | 616 | } |
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 4b134a722907..0f5c5bb5deff 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -96,7 +96,7 @@ void | |||
96 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, | 96 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, |
97 | union acpi_generic_state *state) | 97 | union acpi_generic_state *state) |
98 | { | 98 | { |
99 | ACPI_FUNCTION_TRACE("ut_push_generic_state"); | 99 | ACPI_FUNCTION_TRACE(ut_push_generic_state); |
100 | 100 | ||
101 | /* Push the state object onto the front of the list (stack) */ | 101 | /* Push the state object onto the front of the list (stack) */ |
102 | 102 | ||
@@ -123,12 +123,13 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state | |||
123 | { | 123 | { |
124 | union acpi_generic_state *state; | 124 | union acpi_generic_state *state; |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ut_pop_generic_state"); | 126 | ACPI_FUNCTION_TRACE(ut_pop_generic_state); |
127 | 127 | ||
128 | /* Remove the state object at the head of the list (stack) */ | 128 | /* Remove the state object at the head of the list (stack) */ |
129 | 129 | ||
130 | state = *list_head; | 130 | state = *list_head; |
131 | if (state) { | 131 | if (state) { |
132 | |||
132 | /* Update the list head */ | 133 | /* Update the list head */ |
133 | 134 | ||
134 | *list_head = state->common.next; | 135 | *list_head = state->common.next; |
@@ -158,9 +159,10 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) | |||
158 | 159 | ||
159 | state = acpi_os_acquire_object(acpi_gbl_state_cache); | 160 | state = acpi_os_acquire_object(acpi_gbl_state_cache); |
160 | if (state) { | 161 | if (state) { |
162 | |||
161 | /* Initialize */ | 163 | /* Initialize */ |
162 | memset(state, 0, sizeof(union acpi_generic_state)); | 164 | memset(state, 0, sizeof(union acpi_generic_state)); |
163 | state->common.data_type = ACPI_DESC_TYPE_STATE; | 165 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE; |
164 | } | 166 | } |
165 | 167 | ||
166 | return (state); | 168 | return (state); |
@@ -183,7 +185,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
183 | { | 185 | { |
184 | union acpi_generic_state *state; | 186 | union acpi_generic_state *state; |
185 | 187 | ||
186 | ACPI_FUNCTION_TRACE("ut_create_thread_state"); | 188 | ACPI_FUNCTION_TRACE(ut_create_thread_state); |
187 | 189 | ||
188 | /* Create the generic state object */ | 190 | /* Create the generic state object */ |
189 | 191 | ||
@@ -194,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
194 | 196 | ||
195 | /* Init fields specific to the update struct */ | 197 | /* Init fields specific to the update struct */ |
196 | 198 | ||
197 | state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; | 199 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; |
198 | state->thread.thread_id = acpi_os_get_thread_id(); | 200 | state->thread.thread_id = acpi_os_get_thread_id(); |
199 | 201 | ||
200 | return_PTR((struct acpi_thread_state *)state); | 202 | return_PTR((struct acpi_thread_state *)state); |
@@ -220,7 +222,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
220 | { | 222 | { |
221 | union acpi_generic_state *state; | 223 | union acpi_generic_state *state; |
222 | 224 | ||
223 | ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); | 225 | ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object); |
224 | 226 | ||
225 | /* Create the generic state object */ | 227 | /* Create the generic state object */ |
226 | 228 | ||
@@ -231,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
231 | 233 | ||
232 | /* Init fields specific to the update struct */ | 234 | /* Init fields specific to the update struct */ |
233 | 235 | ||
234 | state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; | 236 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; |
235 | state->update.object = object; | 237 | state->update.object = object; |
236 | state->update.value = action; | 238 | state->update.value = action; |
237 | 239 | ||
@@ -257,7 +259,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
257 | { | 259 | { |
258 | union acpi_generic_state *state; | 260 | union acpi_generic_state *state; |
259 | 261 | ||
260 | ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); | 262 | ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object); |
261 | 263 | ||
262 | /* Create the generic state object */ | 264 | /* Create the generic state object */ |
263 | 265 | ||
@@ -268,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
268 | 270 | ||
269 | /* Init fields specific to the update struct */ | 271 | /* Init fields specific to the update struct */ |
270 | 272 | ||
271 | state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; | 273 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE; |
272 | state->pkg.source_object = (union acpi_operand_object *)internal_object; | 274 | state->pkg.source_object = (union acpi_operand_object *)internal_object; |
273 | state->pkg.dest_object = external_object; | 275 | state->pkg.dest_object = external_object; |
274 | state->pkg.index = index; | 276 | state->pkg.index = index; |
@@ -294,7 +296,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
294 | { | 296 | { |
295 | union acpi_generic_state *state; | 297 | union acpi_generic_state *state; |
296 | 298 | ||
297 | ACPI_FUNCTION_TRACE("ut_create_control_state"); | 299 | ACPI_FUNCTION_TRACE(ut_create_control_state); |
298 | 300 | ||
299 | /* Create the generic state object */ | 301 | /* Create the generic state object */ |
300 | 302 | ||
@@ -305,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
305 | 307 | ||
306 | /* Init fields specific to the control struct */ | 308 | /* Init fields specific to the control struct */ |
307 | 309 | ||
308 | state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; | 310 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; |
309 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; | 311 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
310 | 312 | ||
311 | return_PTR(state); | 313 | return_PTR(state); |
@@ -319,15 +321,19 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
319 | * | 321 | * |
320 | * RETURN: None | 322 | * RETURN: None |
321 | * | 323 | * |
322 | * DESCRIPTION: Put a state object back into the global state cache. The object | 324 | * DESCRIPTION: Release a state object to the state cache. NULL state objects |
323 | * is not actually freed at this time. | 325 | * are ignored. |
324 | * | 326 | * |
325 | ******************************************************************************/ | 327 | ******************************************************************************/ |
326 | 328 | ||
327 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) | 329 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) |
328 | { | 330 | { |
329 | ACPI_FUNCTION_TRACE("ut_delete_generic_state"); | 331 | ACPI_FUNCTION_TRACE(ut_delete_generic_state); |
332 | |||
333 | /* Ignore null state */ | ||
330 | 334 | ||
331 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | 335 | if (state) { |
336 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | ||
337 | } | ||
332 | return_VOID; | 338 | return_VOID; |
333 | } | 339 | } |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 308a960871be..3538f69c82a1 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acevents.h> | 45 | #include <acpi/acevents.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
@@ -67,7 +65,7 @@ acpi_status acpi_initialize_subsystem(void) | |||
67 | { | 65 | { |
68 | acpi_status status; | 66 | acpi_status status; |
69 | 67 | ||
70 | ACPI_FUNCTION_TRACE("acpi_initialize_subsystem"); | 68 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); |
71 | 69 | ||
72 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | 70 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); |
73 | 71 | ||
@@ -109,6 +107,8 @@ acpi_status acpi_initialize_subsystem(void) | |||
109 | return_ACPI_STATUS(status); | 107 | return_ACPI_STATUS(status); |
110 | } | 108 | } |
111 | 109 | ||
110 | ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) | ||
111 | |||
112 | /******************************************************************************* | 112 | /******************************************************************************* |
113 | * | 113 | * |
114 | * FUNCTION: acpi_enable_subsystem | 114 | * FUNCTION: acpi_enable_subsystem |
@@ -121,12 +121,11 @@ acpi_status acpi_initialize_subsystem(void) | |||
121 | * Puts system into ACPI mode if it isn't already. | 121 | * Puts system into ACPI mode if it isn't already. |
122 | * | 122 | * |
123 | ******************************************************************************/ | 123 | ******************************************************************************/ |
124 | |||
125 | acpi_status acpi_enable_subsystem(u32 flags) | 124 | acpi_status acpi_enable_subsystem(u32 flags) |
126 | { | 125 | { |
127 | acpi_status status = AE_OK; | 126 | acpi_status status = AE_OK; |
128 | 127 | ||
129 | ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); | 128 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); |
130 | 129 | ||
131 | /* | 130 | /* |
132 | * We must initialize the hardware before we can enable ACPI. | 131 | * We must initialize the hardware before we can enable ACPI. |
@@ -152,7 +151,7 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
152 | 151 | ||
153 | status = acpi_enable(); | 152 | status = acpi_enable(); |
154 | if (ACPI_FAILURE(status)) { | 153 | if (ACPI_FAILURE(status)) { |
155 | ACPI_WARNING((AE_INFO, "acpi_enable failed")); | 154 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); |
156 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
157 | } | 156 | } |
158 | } | 157 | } |
@@ -229,6 +228,8 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
229 | return_ACPI_STATUS(status); | 228 | return_ACPI_STATUS(status); |
230 | } | 229 | } |
231 | 230 | ||
231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
232 | |||
232 | /******************************************************************************* | 233 | /******************************************************************************* |
233 | * | 234 | * |
234 | * FUNCTION: acpi_initialize_objects | 235 | * FUNCTION: acpi_initialize_objects |
@@ -241,12 +242,11 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
241 | * objects and executing AML code for Regions, buffers, etc. | 242 | * objects and executing AML code for Regions, buffers, etc. |
242 | * | 243 | * |
243 | ******************************************************************************/ | 244 | ******************************************************************************/ |
244 | |||
245 | acpi_status acpi_initialize_objects(u32 flags) | 245 | acpi_status acpi_initialize_objects(u32 flags) |
246 | { | 246 | { |
247 | acpi_status status = AE_OK; | 247 | acpi_status status = AE_OK; |
248 | 248 | ||
249 | ACPI_FUNCTION_TRACE("acpi_initialize_objects"); | 249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * Run all _REG methods | 252 | * Run all _REG methods |
@@ -257,7 +257,7 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
257 | */ | 257 | */ |
258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
260 | "[Init] Executing _REG op_region methods\n")); | 260 | "[Init] Executing _REG OpRegion methods\n")); |
261 | 261 | ||
262 | status = acpi_ev_initialize_op_regions(); | 262 | status = acpi_ev_initialize_op_regions(); |
263 | if (ACPI_FAILURE(status)) { | 263 | if (ACPI_FAILURE(status)) { |
@@ -305,6 +305,8 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
305 | return_ACPI_STATUS(status); | 305 | return_ACPI_STATUS(status); |
306 | } | 306 | } |
307 | 307 | ||
308 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
309 | |||
308 | /******************************************************************************* | 310 | /******************************************************************************* |
309 | * | 311 | * |
310 | * FUNCTION: acpi_terminate | 312 | * FUNCTION: acpi_terminate |
@@ -316,12 +318,11 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
316 | * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. | 318 | * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. |
317 | * | 319 | * |
318 | ******************************************************************************/ | 320 | ******************************************************************************/ |
319 | |||
320 | acpi_status acpi_terminate(void) | 321 | acpi_status acpi_terminate(void) |
321 | { | 322 | { |
322 | acpi_status status; | 323 | acpi_status status; |
323 | 324 | ||
324 | ACPI_FUNCTION_TRACE("acpi_terminate"); | 325 | ACPI_FUNCTION_TRACE(acpi_terminate); |
325 | 326 | ||
326 | /* Terminate the AML Debugger if present */ | 327 | /* Terminate the AML Debugger if present */ |
327 | 328 | ||
@@ -348,6 +349,8 @@ acpi_status acpi_terminate(void) | |||
348 | return_ACPI_STATUS(status); | 349 | return_ACPI_STATUS(status); |
349 | } | 350 | } |
350 | 351 | ||
352 | ACPI_EXPORT_SYMBOL(acpi_terminate) | ||
353 | |||
351 | #ifdef ACPI_FUTURE_USAGE | 354 | #ifdef ACPI_FUTURE_USAGE |
352 | /******************************************************************************* | 355 | /******************************************************************************* |
353 | * | 356 | * |
@@ -362,7 +365,6 @@ acpi_status acpi_terminate(void) | |||
362 | * initialized successfully. | 365 | * initialized successfully. |
363 | * | 366 | * |
364 | ******************************************************************************/ | 367 | ******************************************************************************/ |
365 | |||
366 | acpi_status acpi_subsystem_status(void) | 368 | acpi_status acpi_subsystem_status(void) |
367 | { | 369 | { |
368 | 370 | ||
@@ -373,6 +375,8 @@ acpi_status acpi_subsystem_status(void) | |||
373 | } | 375 | } |
374 | } | 376 | } |
375 | 377 | ||
378 | ACPI_EXPORT_SYMBOL(acpi_subsystem_status) | ||
379 | |||
376 | /******************************************************************************* | 380 | /******************************************************************************* |
377 | * | 381 | * |
378 | * FUNCTION: acpi_get_system_info | 382 | * FUNCTION: acpi_get_system_info |
@@ -390,14 +394,13 @@ acpi_status acpi_subsystem_status(void) | |||
390 | * and the value of out_buffer is undefined. | 394 | * and the value of out_buffer is undefined. |
391 | * | 395 | * |
392 | ******************************************************************************/ | 396 | ******************************************************************************/ |
393 | |||
394 | acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) | 397 | acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) |
395 | { | 398 | { |
396 | struct acpi_system_info *info_ptr; | 399 | struct acpi_system_info *info_ptr; |
397 | acpi_status status; | 400 | acpi_status status; |
398 | u32 i; | 401 | u32 i; |
399 | 402 | ||
400 | ACPI_FUNCTION_TRACE("acpi_get_system_info"); | 403 | ACPI_FUNCTION_TRACE(acpi_get_system_info); |
401 | 404 | ||
402 | /* Parameter validation */ | 405 | /* Parameter validation */ |
403 | 406 | ||
@@ -448,15 +451,15 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) | |||
448 | 451 | ||
449 | /* Current status of the ACPI tables, per table type */ | 452 | /* Current status of the ACPI tables, per table type */ |
450 | 453 | ||
451 | info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES; | 454 | info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1; |
452 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 455 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
453 | info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; | 456 | info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; |
454 | } | 457 | } |
455 | 458 | ||
456 | return_ACPI_STATUS(AE_OK); | 459 | return_ACPI_STATUS(AE_OK); |
457 | } | 460 | } |
458 | 461 | ||
459 | EXPORT_SYMBOL(acpi_get_system_info); | 462 | ACPI_EXPORT_SYMBOL(acpi_get_system_info) |
460 | 463 | ||
461 | /***************************************************************************** | 464 | /***************************************************************************** |
462 | * | 465 | * |
@@ -472,7 +475,6 @@ EXPORT_SYMBOL(acpi_get_system_info); | |||
472 | * TBD: When a second function is added, must save the Function also. | 475 | * TBD: When a second function is added, must save the Function also. |
473 | * | 476 | * |
474 | ****************************************************************************/ | 477 | ****************************************************************************/ |
475 | |||
476 | acpi_status | 478 | acpi_status |
477 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | 479 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function) |
478 | { | 480 | { |
@@ -489,6 +491,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
489 | return AE_OK; | 491 | return AE_OK; |
490 | } | 492 | } |
491 | 493 | ||
494 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) | ||
492 | #endif /* ACPI_FUTURE_USAGE */ | 495 | #endif /* ACPI_FUTURE_USAGE */ |
493 | 496 | ||
494 | /***************************************************************************** | 497 | /***************************************************************************** |
@@ -502,10 +505,9 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
502 | * DESCRIPTION: Empty all caches (delete the cached objects) | 505 | * DESCRIPTION: Empty all caches (delete the cached objects) |
503 | * | 506 | * |
504 | ****************************************************************************/ | 507 | ****************************************************************************/ |
505 | |||
506 | acpi_status acpi_purge_cached_objects(void) | 508 | acpi_status acpi_purge_cached_objects(void) |
507 | { | 509 | { |
508 | ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); | 510 | ACPI_FUNCTION_TRACE(acpi_purge_cached_objects); |
509 | 511 | ||
510 | (void)acpi_os_purge_cache(acpi_gbl_state_cache); | 512 | (void)acpi_os_purge_cache(acpi_gbl_state_cache); |
511 | (void)acpi_os_purge_cache(acpi_gbl_operand_cache); | 513 | (void)acpi_os_purge_cache(acpi_gbl_operand_cache); |
@@ -513,3 +515,5 @@ acpi_status acpi_purge_cached_objects(void) | |||
513 | (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); | 515 | (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); |
514 | return_ACPI_STATUS(AE_OK); | 516 | return_ACPI_STATUS(AE_OK); |
515 | } | 517 | } |
518 | |||
519 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) | ||
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 6458c47f7ac2..6b516852ac12 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -273,11 +273,13 @@ acpi_evaluate_integer(acpi_handle handle, | |||
273 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); | 273 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); |
274 | if (ACPI_FAILURE(status)) { | 274 | if (ACPI_FAILURE(status)) { |
275 | acpi_util_eval_error(handle, pathname, status); | 275 | acpi_util_eval_error(handle, pathname, status); |
276 | kfree(element); | ||
276 | return_ACPI_STATUS(status); | 277 | return_ACPI_STATUS(status); |
277 | } | 278 | } |
278 | 279 | ||
279 | if (element->type != ACPI_TYPE_INTEGER) { | 280 | if (element->type != ACPI_TYPE_INTEGER) { |
280 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); | 281 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); |
282 | kfree(element); | ||
281 | return_ACPI_STATUS(AE_BAD_DATA); | 283 | return_ACPI_STATUS(AE_BAD_DATA); |
282 | } | 284 | } |
283 | 285 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bd4887518373..86531ab4ee55 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -323,7 +323,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, | |||
323 | if (!ACPI_SUCCESS(status)) | 323 | if (!ACPI_SUCCESS(status)) |
324 | return_VALUE(status); | 324 | return_VALUE(status); |
325 | obj = (union acpi_object *)buffer.pointer; | 325 | obj = (union acpi_object *)buffer.pointer; |
326 | if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { | 326 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { |
327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); | 327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); |
328 | status = -EFAULT; | 328 | status = -EFAULT; |
329 | goto err; | 329 | goto err; |
@@ -1294,7 +1294,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1294 | struct acpi_video_bus *video) | 1294 | struct acpi_video_bus *video) |
1295 | { | 1295 | { |
1296 | unsigned long device_id; | 1296 | unsigned long device_id; |
1297 | int status, result; | 1297 | int status; |
1298 | struct acpi_video_device *data; | 1298 | struct acpi_video_device *data; |
1299 | 1299 | ||
1300 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); | 1300 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); |
@@ -1346,8 +1346,11 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1346 | if (ACPI_FAILURE(status)) { | 1346 | if (ACPI_FAILURE(status)) { |
1347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1348 | "Error installing notify handler\n")); | 1348 | "Error installing notify handler\n")); |
1349 | result = -ENODEV; | 1349 | if(data->brightness) |
1350 | goto end; | 1350 | kfree(data->brightness->levels); |
1351 | kfree(data->brightness); | ||
1352 | kfree(data); | ||
1353 | return -ENODEV; | ||
1351 | } | 1354 | } |
1352 | 1355 | ||
1353 | down(&video->sem); | 1356 | down(&video->sem); |
@@ -1359,7 +1362,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1359 | return_VALUE(0); | 1362 | return_VALUE(0); |
1360 | } | 1363 | } |
1361 | 1364 | ||
1362 | end: | ||
1363 | return_VALUE(-ENOENT); | 1365 | return_VALUE(-ENOENT); |
1364 | } | 1366 | } |
1365 | 1367 | ||
@@ -1643,8 +1645,9 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | |||
1643 | printk(KERN_WARNING PREFIX | 1645 | printk(KERN_WARNING PREFIX |
1644 | "hhuuhhuu bug in acpi video driver.\n"); | 1646 | "hhuuhhuu bug in acpi video driver.\n"); |
1645 | 1647 | ||
1648 | if (data->brightness); | ||
1649 | kfree(data->brightness->levels); | ||
1646 | kfree(data->brightness); | 1650 | kfree(data->brightness); |
1647 | |||
1648 | kfree(data); | 1651 | kfree(data); |
1649 | } | 1652 | } |
1650 | 1653 | ||
@@ -1785,6 +1788,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1785 | if (ACPI_FAILURE(status)) { | 1788 | if (ACPI_FAILURE(status)) { |
1786 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1789 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1787 | "Error installing notify handler\n")); | 1790 | "Error installing notify handler\n")); |
1791 | acpi_video_bus_stop_devices(video); | ||
1792 | acpi_video_bus_put_devices(video); | ||
1793 | kfree(video->attached_array); | ||
1794 | acpi_video_bus_remove_fs(device); | ||
1788 | result = -ENODEV; | 1795 | result = -ENODEV; |
1789 | goto end; | 1796 | goto end; |
1790 | } | 1797 | } |
@@ -1796,10 +1803,8 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1796 | video->flags.post ? "yes" : "no"); | 1803 | video->flags.post ? "yes" : "no"); |
1797 | 1804 | ||
1798 | end: | 1805 | end: |
1799 | if (result) { | 1806 | if (result) |
1800 | acpi_video_bus_remove_fs(device); | ||
1801 | kfree(video); | 1807 | kfree(video); |
1802 | } | ||
1803 | 1808 | ||
1804 | return_VALUE(result); | 1809 | return_VALUE(result); |
1805 | } | 1810 | } |