diff options
Diffstat (limited to 'drivers')
361 files changed, 9814 insertions, 5927 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index c24652d31bf9..2b2fbec14540 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 fccbf938ea04..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,7 +1230,19 @@ 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) { |
1234 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | ||
1235 | return -ENODEV; | ||
1236 | } | ||
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) { | ||
1230 | acpi_bus_unregister_driver(&asus_hotk_driver); | 1246 | acpi_bus_unregister_driver(&asus_hotk_driver); |
1231 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | 1247 | remove_proc_entry(PROC_ASUS, acpi_root_dir); |
1232 | return result; | 1248 | return result; |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 606f8733a776..b77f03d51f0b 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; |
@@ -596,6 +596,8 @@ void __init acpi_early_init(void) | |||
596 | if (acpi_disabled) | 596 | if (acpi_disabled) |
597 | return_VOID; | 597 | return_VOID; |
598 | 598 | ||
599 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); | ||
600 | |||
599 | /* enable workarounds, unless strict ACPI spec. compliance */ | 601 | /* enable workarounds, unless strict ACPI spec. compliance */ |
600 | if (!acpi_strict) | 602 | if (!acpi_strict) |
601 | acpi_gbl_enable_interpreter_slack = TRUE; | 603 | acpi_gbl_enable_interpreter_slack = TRUE; |
@@ -617,7 +619,7 @@ void __init acpi_early_init(void) | |||
617 | /* | 619 | /* |
618 | * Get a separate copy of the FADT for use by other drivers. | 620 | * Get a separate copy of the FADT for use by other drivers. |
619 | */ | 621 | */ |
620 | status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer); | 622 | status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &buffer); |
621 | if (ACPI_FAILURE(status)) { | 623 | if (ACPI_FAILURE(status)) { |
622 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); | 624 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); |
623 | goto error0; | 625 | goto error0; |
@@ -743,8 +745,6 @@ static int __init acpi_init(void) | |||
743 | 745 | ||
744 | ACPI_FUNCTION_TRACE("acpi_init"); | 746 | ACPI_FUNCTION_TRACE("acpi_init"); |
745 | 747 | ||
746 | printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); | ||
747 | |||
748 | if (acpi_disabled) { | 748 | if (acpi_disabled) { |
749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); | 749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); |
750 | return_VALUE(-ENODEV); | 750 | return_VALUE(-ENODEV); |
diff --git a/drivers/acpi/dispatcher/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..c036e2a69f33 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -763,8 +763,7 @@ static u32 acpi_ec_gpe_poll_handler(void *data) | |||
763 | 763 | ||
764 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | 764 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
765 | 765 | ||
766 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 766 | status = acpi_os_execute(OSL_EC_POLL_HANDLER, acpi_ec_gpe_query, ec); |
767 | acpi_ec_gpe_query, ec); | ||
768 | 767 | ||
769 | if (status == AE_OK) | 768 | if (status == AE_OK) |
770 | return ACPI_INTERRUPT_HANDLED; | 769 | return ACPI_INTERRUPT_HANDLED; |
@@ -799,7 +798,7 @@ static u32 acpi_ec_gpe_intr_handler(void *data) | |||
799 | 798 | ||
800 | if (value & ACPI_EC_FLAG_SCI) { | 799 | if (value & ACPI_EC_FLAG_SCI) { |
801 | atomic_add(1, &ec->intr.pending_gpe); | 800 | atomic_add(1, &ec->intr.pending_gpe); |
802 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 801 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
803 | acpi_ec_gpe_query, ec); | 802 | acpi_ec_gpe_query, ec); |
804 | return status == AE_OK ? | 803 | return status == AE_OK ? |
805 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 804 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
@@ -991,7 +990,6 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
991 | int result = 0; | 990 | int result = 0; |
992 | acpi_status status = AE_OK; | 991 | acpi_status status = AE_OK; |
993 | union acpi_ec *ec = NULL; | 992 | union acpi_ec *ec = NULL; |
994 | unsigned long uid; | ||
995 | 993 | ||
996 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 994 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
997 | 995 | ||
@@ -1014,10 +1012,9 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1014 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1012 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1015 | &ec->common.global_lock); | 1013 | &ec->common.global_lock); |
1016 | 1014 | ||
1017 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1015 | /* 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. */ | 1016 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1019 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1017 | if (ec_ecdt) { |
1020 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1021 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1018 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1022 | ACPI_ADR_SPACE_EC, | 1019 | ACPI_ADR_SPACE_EC, |
1023 | &acpi_ec_space_handler); | 1020 | &acpi_ec_space_handler); |
@@ -1062,7 +1059,6 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1062 | int result = 0; | 1059 | int result = 0; |
1063 | acpi_status status = AE_OK; | 1060 | acpi_status status = AE_OK; |
1064 | union acpi_ec *ec = NULL; | 1061 | union acpi_ec *ec = NULL; |
1065 | unsigned long uid; | ||
1066 | 1062 | ||
1067 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1063 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
1068 | 1064 | ||
@@ -1088,10 +1084,9 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1088 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1084 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1089 | &ec->common.global_lock); | 1085 | &ec->common.global_lock); |
1090 | 1086 | ||
1091 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1087 | /* 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. */ | 1088 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1093 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1089 | if (ec_ecdt) { |
1094 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1095 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1090 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1096 | ACPI_ADR_SPACE_EC, | 1091 | ACPI_ADR_SPACE_EC, |
1097 | &acpi_ec_space_handler); | 1092 | &acpi_ec_space_handler); |
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/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/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/processor_core.c b/drivers/acpi/processor_core.c index 713b763884a9..a1b46fb41c80 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_perflib.c b/drivers/acpi/processor_perflib.c index abbdb37a7f5f..f36db22ce1ae 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -577,6 +577,8 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
577 | return_VALUE(-EBUSY); | 577 | return_VALUE(-EBUSY); |
578 | } | 578 | } |
579 | 579 | ||
580 | WARN_ON(!performance); | ||
581 | |||
580 | pr->performance = performance; | 582 | pr->performance = performance; |
581 | 583 | ||
582 | if (acpi_processor_get_performance_info(pr)) { | 584 | if (acpi_processor_get_performance_info(pr)) { |
@@ -609,7 +611,8 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
609 | return_VOID; | 611 | return_VOID; |
610 | } | 612 | } |
611 | 613 | ||
612 | kfree(pr->performance->states); | 614 | if (pr->performance) |
615 | kfree(pr->performance->states); | ||
613 | pr->performance = NULL; | 616 | pr->performance = NULL; |
614 | 617 | ||
615 | acpi_cpufreq_remove_file(pr); | 618 | acpi_cpufreq_remove_file(pr); |
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..fc676ac0e3ed 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); |
@@ -548,10 +536,9 @@ static int acpi_start_single_object(struct acpi_device *device) | |||
548 | return_VALUE(result); | 536 | return_VALUE(result); |
549 | } | 537 | } |
550 | 538 | ||
551 | static int acpi_driver_attach(struct acpi_driver *drv) | 539 | static void acpi_driver_attach(struct acpi_driver *drv) |
552 | { | 540 | { |
553 | struct list_head *node, *next; | 541 | struct list_head *node, *next; |
554 | int count = 0; | ||
555 | 542 | ||
556 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); | 543 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); |
557 | 544 | ||
@@ -568,7 +555,6 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
568 | if (!acpi_bus_driver_init(dev, drv)) { | 555 | if (!acpi_bus_driver_init(dev, drv)) { |
569 | acpi_start_single_object(dev); | 556 | acpi_start_single_object(dev); |
570 | atomic_inc(&drv->references); | 557 | atomic_inc(&drv->references); |
571 | count++; | ||
572 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 558 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
573 | "Found driver [%s] for device [%s]\n", | 559 | "Found driver [%s] for device [%s]\n", |
574 | drv->name, dev->pnp.bus_id)); | 560 | drv->name, dev->pnp.bus_id)); |
@@ -577,10 +563,9 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
577 | spin_lock(&acpi_device_lock); | 563 | spin_lock(&acpi_device_lock); |
578 | } | 564 | } |
579 | spin_unlock(&acpi_device_lock); | 565 | spin_unlock(&acpi_device_lock); |
580 | return_VALUE(count); | ||
581 | } | 566 | } |
582 | 567 | ||
583 | static int acpi_driver_detach(struct acpi_driver *drv) | 568 | static void acpi_driver_detach(struct acpi_driver *drv) |
584 | { | 569 | { |
585 | struct list_head *node, *next; | 570 | struct list_head *node, *next; |
586 | 571 | ||
@@ -602,7 +587,6 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
602 | } | 587 | } |
603 | } | 588 | } |
604 | spin_unlock(&acpi_device_lock); | 589 | spin_unlock(&acpi_device_lock); |
605 | return_VALUE(0); | ||
606 | } | 590 | } |
607 | 591 | ||
608 | /** | 592 | /** |
@@ -610,28 +594,22 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
610 | * @driver: driver being registered | 594 | * @driver: driver being registered |
611 | * | 595 | * |
612 | * Registers a driver with the ACPI bus. Searches the namespace for all | 596 | * Registers a driver with the ACPI bus. Searches the namespace for all |
613 | * devices that match the driver's criteria and binds. Returns the | 597 | * 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 | 598 | * success or a negative error status for failure. |
615 | * error status for failure. | ||
616 | */ | 599 | */ |
617 | int acpi_bus_register_driver(struct acpi_driver *driver) | 600 | int acpi_bus_register_driver(struct acpi_driver *driver) |
618 | { | 601 | { |
619 | int count; | ||
620 | |||
621 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); | 602 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); |
622 | 603 | ||
623 | if (acpi_disabled) | 604 | if (acpi_disabled) |
624 | return_VALUE(-ENODEV); | 605 | return_VALUE(-ENODEV); |
625 | 606 | ||
626 | if (!driver) | ||
627 | return_VALUE(-EINVAL); | ||
628 | |||
629 | spin_lock(&acpi_device_lock); | 607 | spin_lock(&acpi_device_lock); |
630 | list_add_tail(&driver->node, &acpi_bus_drivers); | 608 | list_add_tail(&driver->node, &acpi_bus_drivers); |
631 | spin_unlock(&acpi_device_lock); | 609 | spin_unlock(&acpi_device_lock); |
632 | count = acpi_driver_attach(driver); | 610 | acpi_driver_attach(driver); |
633 | 611 | ||
634 | return_VALUE(count); | 612 | return_VALUE(0); |
635 | } | 613 | } |
636 | 614 | ||
637 | EXPORT_SYMBOL(acpi_bus_register_driver); | 615 | EXPORT_SYMBOL(acpi_bus_register_driver); |
@@ -643,23 +621,16 @@ EXPORT_SYMBOL(acpi_bus_register_driver); | |||
643 | * Unregisters a driver with the ACPI bus. Searches the namespace for all | 621 | * Unregisters a driver with the ACPI bus. Searches the namespace for all |
644 | * devices that match the driver's criteria and unbinds. | 622 | * devices that match the driver's criteria and unbinds. |
645 | */ | 623 | */ |
646 | int acpi_bus_unregister_driver(struct acpi_driver *driver) | 624 | void acpi_bus_unregister_driver(struct acpi_driver *driver) |
647 | { | 625 | { |
648 | int error = 0; | 626 | acpi_driver_detach(driver); |
649 | |||
650 | ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver"); | ||
651 | |||
652 | if (driver) { | ||
653 | acpi_driver_detach(driver); | ||
654 | 627 | ||
655 | if (!atomic_read(&driver->references)) { | 628 | if (!atomic_read(&driver->references)) { |
656 | spin_lock(&acpi_device_lock); | 629 | spin_lock(&acpi_device_lock); |
657 | list_del_init(&driver->node); | 630 | list_del_init(&driver->node); |
658 | spin_unlock(&acpi_device_lock); | 631 | spin_unlock(&acpi_device_lock); |
659 | } | 632 | } |
660 | } else | 633 | return; |
661 | error = -EINVAL; | ||
662 | return_VALUE(error); | ||
663 | } | 634 | } |
664 | 635 | ||
665 | EXPORT_SYMBOL(acpi_bus_unregister_driver); | 636 | EXPORT_SYMBOL(acpi_bus_unregister_driver); |
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 82389b178130..f003763de7bb 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -684,8 +684,7 @@ static void acpi_thermal_run(unsigned long data) | |||
684 | { | 684 | { |
685 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 685 | struct acpi_thermal *tz = (struct acpi_thermal *)data; |
686 | if (!tz->zombie) | 686 | if (!tz->zombie) |
687 | acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 687 | acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); |
688 | acpi_thermal_check, (void *)data); | ||
689 | } | 688 | } |
690 | 689 | ||
691 | static void acpi_thermal_check(void *data) | 690 | static void acpi_thermal_check(void *data) |
@@ -942,8 +941,10 @@ acpi_thermal_write_trip_points(struct file *file, | |||
942 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); | 941 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); |
943 | 942 | ||
944 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | 943 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); |
945 | if (!active) | 944 | if (!active) { |
945 | kfree(limit_string); | ||
946 | return_VALUE(-ENOMEM); | 946 | return_VALUE(-ENOMEM); |
947 | } | ||
947 | 948 | ||
948 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | 949 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { |
949 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); | 950 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); |
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/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 | } |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 472318205236..0c99ae6a3407 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -86,18 +86,9 @@ firmware_timeout_store(struct class *class, const char *buf, size_t count) | |||
86 | static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); | 86 | static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); |
87 | 87 | ||
88 | static void fw_class_dev_release(struct class_device *class_dev); | 88 | static void fw_class_dev_release(struct class_device *class_dev); |
89 | int firmware_class_uevent(struct class_device *dev, char **envp, | ||
90 | int num_envp, char *buffer, int buffer_size); | ||
91 | 89 | ||
92 | static struct class firmware_class = { | 90 | static int firmware_class_uevent(struct class_device *class_dev, char **envp, |
93 | .name = "firmware", | 91 | int num_envp, char *buffer, int buffer_size) |
94 | .uevent = firmware_class_uevent, | ||
95 | .release = fw_class_dev_release, | ||
96 | }; | ||
97 | |||
98 | int | ||
99 | firmware_class_uevent(struct class_device *class_dev, char **envp, | ||
100 | int num_envp, char *buffer, int buffer_size) | ||
101 | { | 92 | { |
102 | struct firmware_priv *fw_priv = class_get_devdata(class_dev); | 93 | struct firmware_priv *fw_priv = class_get_devdata(class_dev); |
103 | int i = 0, len = 0; | 94 | int i = 0, len = 0; |
@@ -116,6 +107,12 @@ firmware_class_uevent(struct class_device *class_dev, char **envp, | |||
116 | return 0; | 107 | return 0; |
117 | } | 108 | } |
118 | 109 | ||
110 | static struct class firmware_class = { | ||
111 | .name = "firmware", | ||
112 | .uevent = firmware_class_uevent, | ||
113 | .release = fw_class_dev_release, | ||
114 | }; | ||
115 | |||
119 | static ssize_t | 116 | static ssize_t |
120 | firmware_loading_show(struct class_device *class_dev, char *buf) | 117 | firmware_loading_show(struct class_device *class_dev, char *buf) |
121 | { | 118 | { |
@@ -493,25 +490,6 @@ release_firmware(const struct firmware *fw) | |||
493 | } | 490 | } |
494 | } | 491 | } |
495 | 492 | ||
496 | /** | ||
497 | * register_firmware: - provide a firmware image for later usage | ||
498 | * @name: name of firmware image file | ||
499 | * @data: buffer pointer for the firmware image | ||
500 | * @size: size of the data buffer area | ||
501 | * | ||
502 | * Make sure that @data will be available by requesting firmware @name. | ||
503 | * | ||
504 | * Note: This will not be possible until some kind of persistence | ||
505 | * is available. | ||
506 | **/ | ||
507 | void | ||
508 | register_firmware(const char *name, const u8 *data, size_t size) | ||
509 | { | ||
510 | /* This is meaningless without firmware caching, so until we | ||
511 | * decide if firmware caching is reasonable just leave it as a | ||
512 | * noop */ | ||
513 | } | ||
514 | |||
515 | /* Async support */ | 493 | /* Async support */ |
516 | struct firmware_work { | 494 | struct firmware_work { |
517 | struct work_struct work; | 495 | struct work_struct work; |
@@ -630,4 +608,3 @@ module_exit(firmware_class_exit); | |||
630 | EXPORT_SYMBOL(release_firmware); | 608 | EXPORT_SYMBOL(release_firmware); |
631 | EXPORT_SYMBOL(request_firmware); | 609 | EXPORT_SYMBOL(request_firmware); |
632 | EXPORT_SYMBOL(request_firmware_nowait); | 610 | EXPORT_SYMBOL(request_firmware_nowait); |
633 | EXPORT_SYMBOL(register_firmware); | ||
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 662209d3f42d..2a769cc6f5f9 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/vt_kern.h> | ||
12 | #include <linux/device.h> | 11 | #include <linux/device.h> |
13 | #include <linux/kallsyms.h> | 12 | #include <linux/kallsyms.h> |
14 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
@@ -66,6 +65,7 @@ int suspend_device(struct device * dev, pm_message_t state) | |||
66 | return error; | 65 | return error; |
67 | } | 66 | } |
68 | 67 | ||
68 | |||
69 | /** | 69 | /** |
70 | * device_suspend - Save state and stop all devices in system. | 70 | * device_suspend - Save state and stop all devices in system. |
71 | * @state: Power state to put each device in. | 71 | * @state: Power state to put each device in. |
@@ -85,9 +85,6 @@ int device_suspend(pm_message_t state) | |||
85 | { | 85 | { |
86 | int error = 0; | 86 | int error = 0; |
87 | 87 | ||
88 | if (!is_console_suspend_safe()) | ||
89 | return -EINVAL; | ||
90 | |||
91 | down(&dpm_sem); | 88 | down(&dpm_sem); |
92 | down(&dpm_list_sem); | 89 | down(&dpm_list_sem); |
93 | while (!list_empty(&dpm_active) && error == 0) { | 90 | while (!list_empty(&dpm_active) && error == 0) { |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index f73446f580df..c688c25992e4 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -536,6 +536,9 @@ static void ub_cleanup(struct ub_dev *sc) | |||
536 | kfree(lun); | 536 | kfree(lun); |
537 | } | 537 | } |
538 | 538 | ||
539 | usb_set_intfdata(sc->intf, NULL); | ||
540 | usb_put_intf(sc->intf); | ||
541 | usb_put_dev(sc->dev); | ||
539 | kfree(sc); | 542 | kfree(sc); |
540 | } | 543 | } |
541 | 544 | ||
@@ -2221,7 +2224,12 @@ static int ub_probe(struct usb_interface *intf, | |||
2221 | // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; | 2224 | // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; |
2222 | usb_set_intfdata(intf, sc); | 2225 | usb_set_intfdata(intf, sc); |
2223 | usb_get_dev(sc->dev); | 2226 | usb_get_dev(sc->dev); |
2224 | // usb_get_intf(sc->intf); /* Do we need this? */ | 2227 | /* |
2228 | * Since we give the interface struct to the block level through | ||
2229 | * disk->driverfs_dev, we have to pin it. Otherwise, block_uevent | ||
2230 | * oopses on close after a disconnect (kernels 2.6.16 and up). | ||
2231 | */ | ||
2232 | usb_get_intf(sc->intf); | ||
2225 | 2233 | ||
2226 | snprintf(sc->name, 12, DRV_NAME "(%d.%d)", | 2234 | snprintf(sc->name, 12, DRV_NAME "(%d.%d)", |
2227 | sc->dev->bus->busnum, sc->dev->devnum); | 2235 | sc->dev->bus->busnum, sc->dev->devnum); |
@@ -2286,7 +2294,7 @@ static int ub_probe(struct usb_interface *intf, | |||
2286 | 2294 | ||
2287 | err_dev_desc: | 2295 | err_dev_desc: |
2288 | usb_set_intfdata(intf, NULL); | 2296 | usb_set_intfdata(intf, NULL); |
2289 | // usb_put_intf(sc->intf); | 2297 | usb_put_intf(sc->intf); |
2290 | usb_put_dev(sc->dev); | 2298 | usb_put_dev(sc->dev); |
2291 | kfree(sc); | 2299 | kfree(sc); |
2292 | err_core: | 2300 | err_core: |
@@ -2461,12 +2469,6 @@ static void ub_disconnect(struct usb_interface *intf) | |||
2461 | * and no URBs left in transit. | 2469 | * and no URBs left in transit. |
2462 | */ | 2470 | */ |
2463 | 2471 | ||
2464 | usb_set_intfdata(intf, NULL); | ||
2465 | // usb_put_intf(sc->intf); | ||
2466 | sc->intf = NULL; | ||
2467 | usb_put_dev(sc->dev); | ||
2468 | sc->dev = NULL; | ||
2469 | |||
2470 | ub_put(sc); | 2472 | ub_put(sc); |
2471 | } | 2473 | } |
2472 | 2474 | ||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 402296670d3a..78d928f9d9f1 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -291,7 +291,7 @@ config SX | |||
291 | 291 | ||
292 | config RIO | 292 | config RIO |
293 | tristate "Specialix RIO system support" | 293 | tristate "Specialix RIO system support" |
294 | depends on SERIAL_NONSTANDARD && !64BIT | 294 | depends on SERIAL_NONSTANDARD |
295 | help | 295 | help |
296 | This is a driver for the Specialix RIO, a smart serial card which | 296 | This is a driver for the Specialix RIO, a smart serial card which |
297 | drives an outboard box that can support up to 128 ports. Product | 297 | drives an outboard box that can support up to 128 ports. Product |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index f5b01c6d498e..fb919bfb2824 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -41,9 +41,9 @@ obj-$(CONFIG_N_HDLC) += n_hdlc.o | |||
41 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o | 41 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o |
42 | obj-$(CONFIG_SX) += sx.o generic_serial.o | 42 | obj-$(CONFIG_SX) += sx.o generic_serial.o |
43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o | 43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o |
44 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | ||
45 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o | 44 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o |
46 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o | 45 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o |
46 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | ||
47 | obj-$(CONFIG_RAW_DRIVER) += raw.o | 47 | obj-$(CONFIG_RAW_DRIVER) += raw.o |
48 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o | 48 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o |
49 | obj-$(CONFIG_MMTIMER) += mmtimer.o | 49 | obj-$(CONFIG_MMTIMER) += mmtimer.o |
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index 0b9cf9c59a21..7c88c060a9e6 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -86,7 +86,7 @@ config AGP_NVIDIA | |||
86 | 86 | ||
87 | config AGP_SIS | 87 | config AGP_SIS |
88 | tristate "SiS chipset support" | 88 | tristate "SiS chipset support" |
89 | depends on AGP && X86_32 | 89 | depends on AGP |
90 | help | 90 | help |
91 | This option gives you AGP support for the GLX component of | 91 | This option gives you AGP support for the GLX component of |
92 | X on Silicon Integrated Systems [SiS] chipsets. | 92 | X on Silicon Integrated Systems [SiS] chipsets. |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 36517d4d1ad9..ac3c33a2e37d 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -617,6 +617,9 @@ static int agp_amd64_resume(struct pci_dev *pdev) | |||
617 | pci_set_power_state(pdev, PCI_D0); | 617 | pci_set_power_state(pdev, PCI_D0); |
618 | pci_restore_state(pdev); | 618 | pci_restore_state(pdev); |
619 | 619 | ||
620 | if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) | ||
621 | nforce3_agp_init(pdev); | ||
622 | |||
620 | return amd_8151_configure(); | 623 | return amd_8151_configure(); |
621 | } | 624 | } |
622 | 625 | ||
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 8c4c6ef748ec..907fb66ec4a9 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -497,7 +497,7 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
497 | info = buffer.pointer; | 497 | info = buffer.pointer; |
498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; | 498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; |
499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); | 499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); |
500 | ACPI_MEM_FREE(info); | 500 | kfree(info); |
501 | if (match) { | 501 | if (match) { |
502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); | 502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); |
503 | if (ACPI_SUCCESS(status)) | 503 | if (ACPI_SUCCESS(status)) |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index 97b0a890ba7f..b8ec25d17478 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -345,6 +345,12 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata = | |||
345 | .chipset_name = "PT880", | 345 | .chipset_name = "PT880", |
346 | }, | 346 | }, |
347 | 347 | ||
348 | /* PT880 Ultra */ | ||
349 | { | ||
350 | .device_id = PCI_DEVICE_ID_VIA_PT880ULTRA, | ||
351 | .chipset_name = "PT880 Ultra", | ||
352 | }, | ||
353 | |||
348 | /* PT890 */ | 354 | /* PT890 */ |
349 | { | 355 | { |
350 | .device_id = PCI_DEVICE_ID_VIA_8783_0, | 356 | .device_id = PCI_DEVICE_ID_VIA_8783_0, |
@@ -511,6 +517,7 @@ static struct pci_device_id agp_via_pci_table[] = { | |||
511 | ID(PCI_DEVICE_ID_VIA_8763_0), | 517 | ID(PCI_DEVICE_ID_VIA_8763_0), |
512 | ID(PCI_DEVICE_ID_VIA_8378_0), | 518 | ID(PCI_DEVICE_ID_VIA_8378_0), |
513 | ID(PCI_DEVICE_ID_VIA_PT880), | 519 | ID(PCI_DEVICE_ID_VIA_PT880), |
520 | ID(PCI_DEVICE_ID_VIA_PT880ULTRA), | ||
514 | ID(PCI_DEVICE_ID_VIA_8783_0), | 521 | ID(PCI_DEVICE_ID_VIA_8783_0), |
515 | ID(PCI_DEVICE_ID_VIA_PX8X0_0), | 522 | ID(PCI_DEVICE_ID_VIA_PX8X0_0), |
516 | ID(PCI_DEVICE_ID_VIA_3269_0), | 523 | ID(PCI_DEVICE_ID_VIA_3269_0), |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index ef140ebde117..07473cd84121 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -925,11 +925,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
925 | status = acpi_resource_to_address64(res, &addr); | 925 | status = acpi_resource_to_address64(res, &addr); |
926 | 926 | ||
927 | if (ACPI_SUCCESS(status)) { | 927 | if (ACPI_SUCCESS(status)) { |
928 | unsigned long size; | ||
929 | |||
930 | size = addr.maximum - addr.minimum + 1; | ||
931 | hdp->hd_phys_address = addr.minimum; | 928 | hdp->hd_phys_address = addr.minimum; |
932 | hdp->hd_address = ioremap(addr.minimum, size); | 929 | hdp->hd_address = ioremap(addr.minimum, addr.address_length); |
933 | 930 | ||
934 | if (hpet_is_known(hdp)) { | 931 | if (hpet_is_known(hdp)) { |
935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | 932 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index b36eef0e9d19..02a7dd7a8a55 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1184,20 +1184,20 @@ static void port_outl(struct si_sm_io *io, unsigned int offset, | |||
1184 | static void port_cleanup(struct smi_info *info) | 1184 | static void port_cleanup(struct smi_info *info) |
1185 | { | 1185 | { |
1186 | unsigned int addr = info->io.addr_data; | 1186 | unsigned int addr = info->io.addr_data; |
1187 | int mapsize; | 1187 | int idx; |
1188 | 1188 | ||
1189 | if (addr) { | 1189 | if (addr) { |
1190 | mapsize = ((info->io_size * info->io.regspacing) | 1190 | for (idx = 0; idx < info->io_size; idx++) { |
1191 | - (info->io.regspacing - info->io.regsize)); | 1191 | release_region(addr + idx * info->io.regspacing, |
1192 | 1192 | info->io.regsize); | |
1193 | release_region (addr, mapsize); | 1193 | } |
1194 | } | 1194 | } |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | static int port_setup(struct smi_info *info) | 1197 | static int port_setup(struct smi_info *info) |
1198 | { | 1198 | { |
1199 | unsigned int addr = info->io.addr_data; | 1199 | unsigned int addr = info->io.addr_data; |
1200 | int mapsize; | 1200 | int idx; |
1201 | 1201 | ||
1202 | if (!addr) | 1202 | if (!addr) |
1203 | return -ENODEV; | 1203 | return -ENODEV; |
@@ -1225,16 +1225,22 @@ static int port_setup(struct smi_info *info) | |||
1225 | return -EINVAL; | 1225 | return -EINVAL; |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | /* Calculate the total amount of memory to claim. This is an | 1228 | /* Some BIOSes reserve disjoint I/O regions in their ACPI |
1229 | * unusual looking calculation, but it avoids claiming any | 1229 | * tables. This causes problems when trying to register the |
1230 | * more memory than it has to. It will claim everything | 1230 | * entire I/O region. Therefore we must register each I/O |
1231 | * between the first address to the end of the last full | 1231 | * port separately. |
1232 | * register. */ | 1232 | */ |
1233 | mapsize = ((info->io_size * info->io.regspacing) | 1233 | for (idx = 0; idx < info->io_size; idx++) { |
1234 | - (info->io.regspacing - info->io.regsize)); | 1234 | if (request_region(addr + idx * info->io.regspacing, |
1235 | 1235 | info->io.regsize, DEVICE_NAME) == NULL) { | |
1236 | if (request_region(addr, mapsize, DEVICE_NAME) == NULL) | 1236 | /* Undo allocations */ |
1237 | return -EIO; | 1237 | while (idx--) { |
1238 | release_region(addr + idx * info->io.regspacing, | ||
1239 | info->io.regsize); | ||
1240 | } | ||
1241 | return -EIO; | ||
1242 | } | ||
1243 | } | ||
1238 | return 0; | 1244 | return 0; |
1239 | } | 1245 | } |
1240 | 1246 | ||
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index ede365d05387..b9371d5bf790 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -1384,8 +1384,10 @@ do_it_again: | |||
1384 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, | 1384 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, |
1385 | * we won't get any more characters. | 1385 | * we won't get any more characters. |
1386 | */ | 1386 | */ |
1387 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) | 1387 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) { |
1388 | n_tty_set_room(tty); | ||
1388 | check_unthrottle(tty); | 1389 | check_unthrottle(tty); |
1390 | } | ||
1389 | 1391 | ||
1390 | if (b - buf >= minimum) | 1392 | if (b - buf >= minimum) |
1391 | break; | 1393 | break; |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 128b2632512d..eab5394da666 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -149,7 +149,7 @@ struct cm4000_dev { | |||
149 | #define ZERO_DEV(dev) \ | 149 | #define ZERO_DEV(dev) \ |
150 | memset(&dev->atr_csum,0, \ | 150 | memset(&dev->atr_csum,0, \ |
151 | sizeof(struct cm4000_dev) - \ | 151 | sizeof(struct cm4000_dev) - \ |
152 | /*link*/ sizeof(struct pcmcia_device) - \ | 152 | /*link*/ sizeof(struct pcmcia_device *) - \ |
153 | /*node*/ sizeof(dev_node_t) - \ | 153 | /*node*/ sizeof(dev_node_t) - \ |
154 | /*atr*/ MAX_ATR*sizeof(char) - \ | 154 | /*atr*/ MAX_ATR*sizeof(char) - \ |
155 | /*rbuf*/ 512*sizeof(char) - \ | 155 | /*rbuf*/ 512*sizeof(char) - \ |
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h index 3ec73d1a279a..179cdbea712b 100644 --- a/drivers/char/rio/host.h +++ b/drivers/char/rio/host.h | |||
@@ -33,12 +33,6 @@ | |||
33 | #ifndef __rio_host_h__ | 33 | #ifndef __rio_host_h__ |
34 | #define __rio_host_h__ | 34 | #define __rio_host_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | #ifndef lint | ||
38 | static char *_host_h_sccs_ = "@(#)host.h 1.2"; | ||
39 | #endif | ||
40 | #endif | ||
41 | |||
42 | /* | 36 | /* |
43 | ** the host structure - one per host card in the system. | 37 | ** the host structure - one per host card in the system. |
44 | */ | 38 | */ |
@@ -77,9 +71,6 @@ struct Host { | |||
77 | #define RC_STARTUP 1 | 71 | #define RC_STARTUP 1 |
78 | #define RC_RUNNING 2 | 72 | #define RC_RUNNING 2 |
79 | #define RC_STUFFED 3 | 73 | #define RC_STUFFED 3 |
80 | #define RC_SOMETHING 4 | ||
81 | #define RC_SOMETHING_NEW 5 | ||
82 | #define RC_SOMETHING_ELSE 6 | ||
83 | #define RC_READY 7 | 74 | #define RC_READY 7 |
84 | #define RUN_STATE 7 | 75 | #define RUN_STATE 7 |
85 | /* | 76 | /* |
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c index acda9326c2ef..290143addd34 100644 --- a/drivers/char/rio/rioboot.c +++ b/drivers/char/rio/rioboot.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/termios.h> | 35 | #include <linux/termios.h> |
36 | #include <linux/serial.h> | 36 | #include <linux/serial.h> |
37 | #include <linux/vmalloc.h> | ||
37 | #include <asm/semaphore.h> | 38 | #include <asm/semaphore.h> |
38 | #include <linux/generic_serial.h> | 39 | #include <linux/generic_serial.h> |
39 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index d31aba62bb7f..75b2557c37ec 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -1394,14 +1394,17 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) | |||
1394 | return RIO_FAIL; | 1394 | return RIO_FAIL; |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) { | 1397 | if ((PortP->InUse == (typeof(PortP->InUse))-1) || |
1398 | rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum); | 1398 | !(CmdBlkP = RIOGetCmdBlk())) { |
1399 | rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block " | ||
1400 | "for command %d on port %d\n", Cmd, PortP->PortNum); | ||
1399 | return RIO_FAIL; | 1401 | return RIO_FAIL; |
1400 | } | 1402 | } |
1401 | 1403 | ||
1402 | rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", CmdBlkP, PortP->InUse); | 1404 | rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", |
1405 | CmdBlkP, PortP->InUse); | ||
1403 | 1406 | ||
1404 | PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0]; | 1407 | PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0]; |
1405 | 1408 | ||
1406 | CmdBlkP->Packet.src_unit = 0; | 1409 | CmdBlkP->Packet.src_unit = 0; |
1407 | if (PortP->SecondBlock) | 1410 | if (PortP->SecondBlock) |
@@ -1425,38 +1428,46 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) | |||
1425 | 1428 | ||
1426 | switch (Cmd) { | 1429 | switch (Cmd) { |
1427 | case MEMDUMP: | 1430 | case MEMDUMP: |
1428 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr); | 1431 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p " |
1432 | "(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr); | ||
1429 | PktCmdP->SubCommand = MEMDUMP; | 1433 | PktCmdP->SubCommand = MEMDUMP; |
1430 | PktCmdP->SubAddr = SubCmd.Addr; | 1434 | PktCmdP->SubAddr = SubCmd.Addr; |
1431 | break; | 1435 | break; |
1432 | case FCLOSE: | 1436 | case FCLOSE: |
1433 | rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", CmdBlkP); | 1437 | rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", |
1438 | CmdBlkP); | ||
1434 | break; | 1439 | break; |
1435 | case READ_REGISTER: | 1440 | case READ_REGISTER: |
1436 | rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk %p\n", (int) SubCmd.Addr, CmdBlkP); | 1441 | rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) " |
1442 | "command blk %p\n", (int) SubCmd.Addr, CmdBlkP); | ||
1437 | PktCmdP->SubCommand = READ_REGISTER; | 1443 | PktCmdP->SubCommand = READ_REGISTER; |
1438 | PktCmdP->SubAddr = SubCmd.Addr; | 1444 | PktCmdP->SubAddr = SubCmd.Addr; |
1439 | break; | 1445 | break; |
1440 | case RESUME: | 1446 | case RESUME: |
1441 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", CmdBlkP); | 1447 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", |
1448 | CmdBlkP); | ||
1442 | break; | 1449 | break; |
1443 | case RFLUSH: | 1450 | case RFLUSH: |
1444 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", CmdBlkP); | 1451 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", |
1452 | CmdBlkP); | ||
1445 | CmdBlkP->PostFuncP = RIORFlushEnable; | 1453 | CmdBlkP->PostFuncP = RIORFlushEnable; |
1446 | break; | 1454 | break; |
1447 | case SUSPEND: | 1455 | case SUSPEND: |
1448 | rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", CmdBlkP); | 1456 | rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", |
1457 | CmdBlkP); | ||
1449 | break; | 1458 | break; |
1450 | 1459 | ||
1451 | case MGET: | 1460 | case MGET: |
1452 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", CmdBlkP); | 1461 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", |
1462 | CmdBlkP); | ||
1453 | break; | 1463 | break; |
1454 | 1464 | ||
1455 | case MSET: | 1465 | case MSET: |
1456 | case MBIC: | 1466 | case MBIC: |
1457 | case MBIS: | 1467 | case MBIS: |
1458 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; | 1468 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; |
1459 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk %p\n", CmdBlkP); | 1469 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command " |
1470 | "blk %p\n", CmdBlkP); | ||
1460 | break; | 1471 | break; |
1461 | 1472 | ||
1462 | case WFLUSH: | 1473 | case WFLUSH: |
@@ -1465,12 +1476,14 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) | |||
1465 | ** allowed then we should not bother sending any more to the | 1476 | ** allowed then we should not bother sending any more to the |
1466 | ** RTA. | 1477 | ** RTA. |
1467 | */ | 1478 | */ |
1468 | if ((int) ((char) PortP->WflushFlag) == (int) -1) { | 1479 | if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) { |
1469 | rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); | 1480 | rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, " |
1481 | "WflushFlag about to wrap!"); | ||
1470 | RIOFreeCmdBlk(CmdBlkP); | 1482 | RIOFreeCmdBlk(CmdBlkP); |
1471 | return (RIO_FAIL); | 1483 | return (RIO_FAIL); |
1472 | } else { | 1484 | } else { |
1473 | rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk %p\n", CmdBlkP); | 1485 | rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command " |
1486 | "blk %p\n", CmdBlkP); | ||
1474 | CmdBlkP->PostFuncP = RIOWFlushMark; | 1487 | CmdBlkP->PostFuncP = RIOWFlushMark; |
1475 | } | 1488 | } |
1476 | break; | 1489 | break; |
diff --git a/drivers/char/rio/rioioctl.h b/drivers/char/rio/rioioctl.h index 14b83fae75c8..e8af5b30519e 100644 --- a/drivers/char/rio/rioioctl.h +++ b/drivers/char/rio/rioioctl.h | |||
@@ -33,10 +33,6 @@ | |||
33 | #ifndef __rioioctl_h__ | 33 | #ifndef __rioioctl_h__ |
34 | #define __rioioctl_h__ | 34 | #define __rioioctl_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | /* | 36 | /* |
41 | ** RIO device driver - user ioctls and associated structures. | 37 | ** RIO device driver - user ioctls and associated structures. |
42 | */ | 38 | */ |
@@ -44,55 +40,13 @@ static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2"; | |||
44 | struct portStats { | 40 | struct portStats { |
45 | int port; | 41 | int port; |
46 | int gather; | 42 | int gather; |
47 | ulong txchars; | 43 | unsigned long txchars; |
48 | ulong rxchars; | 44 | unsigned long rxchars; |
49 | ulong opens; | 45 | unsigned long opens; |
50 | ulong closes; | 46 | unsigned long closes; |
51 | ulong ioctls; | 47 | unsigned long ioctls; |
52 | }; | 48 | }; |
53 | 49 | ||
54 | |||
55 | #define rIOC ('r'<<8) | ||
56 | #define TCRIOSTATE (rIOC | 1) | ||
57 | #define TCRIOXPON (rIOC | 2) | ||
58 | #define TCRIOXPOFF (rIOC | 3) | ||
59 | #define TCRIOXPCPS (rIOC | 4) | ||
60 | #define TCRIOXPRINT (rIOC | 5) | ||
61 | #define TCRIOIXANYON (rIOC | 6) | ||
62 | #define TCRIOIXANYOFF (rIOC | 7) | ||
63 | #define TCRIOIXONON (rIOC | 8) | ||
64 | #define TCRIOIXONOFF (rIOC | 9) | ||
65 | #define TCRIOMBIS (rIOC | 10) | ||
66 | #define TCRIOMBIC (rIOC | 11) | ||
67 | #define TCRIOTRIAD (rIOC | 12) | ||
68 | #define TCRIOTSTATE (rIOC | 13) | ||
69 | |||
70 | /* | ||
71 | ** 15.10.1998 ARG - ESIL 0761 part fix | ||
72 | ** Add RIO ioctls for manipulating RTS and CTS flow control, (as LynxOS | ||
73 | ** appears to not support hardware flow control). | ||
74 | */ | ||
75 | #define TCRIOCTSFLOWEN (rIOC | 14) /* enable CTS flow control */ | ||
76 | #define TCRIOCTSFLOWDIS (rIOC | 15) /* disable CTS flow control */ | ||
77 | #define TCRIORTSFLOWEN (rIOC | 16) /* enable RTS flow control */ | ||
78 | #define TCRIORTSFLOWDIS (rIOC | 17) /* disable RTS flow control */ | ||
79 | |||
80 | /* | ||
81 | ** 09.12.1998 ARG - ESIL 0776 part fix | ||
82 | ** Definition for 'RIOC' also appears in daemon.h, so we'd better do a | ||
83 | ** #ifndef here first. | ||
84 | ** 'RIO_QUICK_CHECK' also #define'd here as this ioctl is now | ||
85 | ** allowed to be used by customers. | ||
86 | ** | ||
87 | ** 05.02.1999 ARG - | ||
88 | ** This is what I've decied to do with ioctls etc., which are intended to be | ||
89 | ** invoked from users applications : | ||
90 | ** Anything that needs to be defined here will be removed from daemon.h, that | ||
91 | ** way it won't end up having to be defined/maintained in two places. The only | ||
92 | ** consequence of this is that this file should now be #include'd by daemon.h | ||
93 | ** | ||
94 | ** 'stats' ioctls now #define'd here as they are to be used by customers. | ||
95 | */ | ||
96 | #define RIOC ('R'<<8)|('i'<<16)|('o'<<24) | 50 | #define RIOC ('R'<<8)|('i'<<16)|('o'<<24) |
97 | 51 | ||
98 | #define RIO_QUICK_CHECK (RIOC | 105) | 52 | #define RIO_QUICK_CHECK (RIOC | 105) |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index a90f5d97df35..43dfd8689dce 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -512,7 +512,7 @@ static struct sonypi_device { | |||
512 | 512 | ||
513 | #ifdef CONFIG_ACPI | 513 | #ifdef CONFIG_ACPI |
514 | static struct acpi_device *sonypi_acpi_device; | 514 | static struct acpi_device *sonypi_acpi_device; |
515 | static int acpi_enabled; | 515 | static int acpi_driver_registered; |
516 | #endif | 516 | #endif |
517 | 517 | ||
518 | static int sonypi_ec_write(u8 addr, u8 value) | 518 | static int sonypi_ec_write(u8 addr, u8 value) |
@@ -869,7 +869,7 @@ found: | |||
869 | sonypi_report_input_event(event); | 869 | sonypi_report_input_event(event); |
870 | 870 | ||
871 | #ifdef CONFIG_ACPI | 871 | #ifdef CONFIG_ACPI |
872 | if (acpi_enabled) | 872 | if (sonypi_acpi_device) |
873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); | 873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); |
874 | #endif | 874 | #endif |
875 | 875 | ||
@@ -1551,8 +1551,8 @@ static int __init sonypi_init(void) | |||
1551 | goto err_free_device; | 1551 | goto err_free_device; |
1552 | 1552 | ||
1553 | #ifdef CONFIG_ACPI | 1553 | #ifdef CONFIG_ACPI |
1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) | 1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) |
1555 | acpi_enabled = 1; | 1555 | acpi_driver_registered = 1; |
1556 | #endif | 1556 | #endif |
1557 | 1557 | ||
1558 | return 0; | 1558 | return 0; |
@@ -1567,7 +1567,7 @@ static int __init sonypi_init(void) | |||
1567 | static void __exit sonypi_exit(void) | 1567 | static void __exit sonypi_exit(void) |
1568 | { | 1568 | { |
1569 | #ifdef CONFIG_ACPI | 1569 | #ifdef CONFIG_ACPI |
1570 | if (acpi_enabled) | 1570 | if (acpi_driver_registered) |
1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); | 1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); |
1572 | #endif | 1572 | #endif |
1573 | platform_device_unregister(sonypi_platform_device); | 1573 | platform_device_unregister(sonypi_platform_device); |
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index 1efde3b27619..fe00c7dfb649 100644 --- a/drivers/char/tpm/Kconfig +++ b/drivers/char/tpm/Kconfig | |||
@@ -22,7 +22,7 @@ config TCG_TPM | |||
22 | 22 | ||
23 | config TCG_TIS | 23 | config TCG_TIS |
24 | tristate "TPM Interface Specification 1.2 Interface" | 24 | tristate "TPM Interface Specification 1.2 Interface" |
25 | depends on TCG_TPM | 25 | depends on TCG_TPM && PNPACPI |
26 | ---help--- | 26 | ---help--- |
27 | If you have a TPM security chip that is compliant with the | 27 | If you have a TPM security chip that is compliant with the |
28 | TCG TIS 1.2 TPM specification say Yes and it will be accessible | 28 | TCG TIS 1.2 TPM specification say Yes and it will be accessible |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 54a4c804e25f..050ced247f68 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -140,7 +140,7 @@ extern int tpm_pm_resume(struct device *); | |||
140 | extern struct dentry ** tpm_bios_log_setup(char *); | 140 | extern struct dentry ** tpm_bios_log_setup(char *); |
141 | extern void tpm_bios_log_teardown(struct dentry **); | 141 | extern void tpm_bios_log_teardown(struct dentry **); |
142 | #else | 142 | #else |
143 | static inline struct dentry* tpm_bios_log_setup(char *name) | 143 | static inline struct dentry ** tpm_bios_log_setup(char *name) |
144 | { | 144 | { |
145 | return NULL; | 145 | return NULL; |
146 | } | 146 | } |
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index e45f0d3d12de..a611972024e6 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -105,6 +105,12 @@ static const char* tcpa_event_type_strings[] = { | |||
105 | "Non-Host Info" | 105 | "Non-Host Info" |
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct tcpa_pc_event { | ||
109 | u32 event_id; | ||
110 | u32 event_size; | ||
111 | u8 event_data[0]; | ||
112 | }; | ||
113 | |||
108 | enum tcpa_pc_event_ids { | 114 | enum tcpa_pc_event_ids { |
109 | SMBIOS = 1, | 115 | SMBIOS = 1, |
110 | BIS_CERT, | 116 | BIS_CERT, |
@@ -114,14 +120,15 @@ enum tcpa_pc_event_ids { | |||
114 | NVRAM, | 120 | NVRAM, |
115 | OPTION_ROM_EXEC, | 121 | OPTION_ROM_EXEC, |
116 | OPTION_ROM_CONFIG, | 122 | OPTION_ROM_CONFIG, |
117 | OPTION_ROM_MICROCODE, | 123 | OPTION_ROM_MICROCODE = 10, |
118 | S_CRTM_VERSION, | 124 | S_CRTM_VERSION, |
119 | S_CRTM_CONTENTS, | 125 | S_CRTM_CONTENTS, |
120 | POST_CONTENTS, | 126 | POST_CONTENTS, |
127 | HOST_TABLE_OF_DEVICES, | ||
121 | }; | 128 | }; |
122 | 129 | ||
123 | static const char* tcpa_pc_event_id_strings[] = { | 130 | static const char* tcpa_pc_event_id_strings[] = { |
124 | "" | 131 | "", |
125 | "SMBIOS", | 132 | "SMBIOS", |
126 | "BIS Certificate", | 133 | "BIS Certificate", |
127 | "POST BIOS ", | 134 | "POST BIOS ", |
@@ -130,11 +137,12 @@ static const char* tcpa_pc_event_id_strings[] = { | |||
130 | "NVRAM", | 137 | "NVRAM", |
131 | "Option ROM", | 138 | "Option ROM", |
132 | "Option ROM config", | 139 | "Option ROM config", |
133 | "Option ROM microcode", | 140 | "", |
141 | "Option ROM microcode ", | ||
134 | "S-CRTM Version", | 142 | "S-CRTM Version", |
135 | "S-CRTM Contents", | 143 | "S-CRTM Contents ", |
136 | "S-CRTM POST Contents", | 144 | "POST Contents ", |
137 | "POST Contents", | 145 | "Table of Devices", |
138 | }; | 146 | }; |
139 | 147 | ||
140 | /* returns pointer to start of pos. entry of tcg log */ | 148 | /* returns pointer to start of pos. entry of tcg log */ |
@@ -206,7 +214,7 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
206 | const char *name = ""; | 214 | const char *name = ""; |
207 | char data[40] = ""; | 215 | char data[40] = ""; |
208 | int i, n_len = 0, d_len = 0; | 216 | int i, n_len = 0, d_len = 0; |
209 | u32 event_id; | 217 | struct tcpa_pc_event *pc_event; |
210 | 218 | ||
211 | switch(event->event_type) { | 219 | switch(event->event_type) { |
212 | case PREBOOT: | 220 | case PREBOOT: |
@@ -235,31 +243,32 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
235 | } | 243 | } |
236 | break; | 244 | break; |
237 | case EVENT_TAG: | 245 | case EVENT_TAG: |
238 | event_id = be32_to_cpu(*((u32 *)event_entry)); | 246 | pc_event = (struct tcpa_pc_event *)event_entry; |
239 | 247 | ||
240 | /* ToDo Row data -> Base64 */ | 248 | /* ToDo Row data -> Base64 */ |
241 | 249 | ||
242 | switch (event_id) { | 250 | switch (pc_event->event_id) { |
243 | case SMBIOS: | 251 | case SMBIOS: |
244 | case BIS_CERT: | 252 | case BIS_CERT: |
245 | case CMOS: | 253 | case CMOS: |
246 | case NVRAM: | 254 | case NVRAM: |
247 | case OPTION_ROM_EXEC: | 255 | case OPTION_ROM_EXEC: |
248 | case OPTION_ROM_CONFIG: | 256 | case OPTION_ROM_CONFIG: |
249 | case OPTION_ROM_MICROCODE: | ||
250 | case S_CRTM_VERSION: | 257 | case S_CRTM_VERSION: |
251 | case S_CRTM_CONTENTS: | 258 | name = tcpa_pc_event_id_strings[pc_event->event_id]; |
252 | case POST_CONTENTS: | ||
253 | name = tcpa_pc_event_id_strings[event_id]; | ||
254 | n_len = strlen(name); | 259 | n_len = strlen(name); |
255 | break; | 260 | break; |
261 | /* hash data */ | ||
256 | case POST_BIOS_ROM: | 262 | case POST_BIOS_ROM: |
257 | case ESCD: | 263 | case ESCD: |
258 | name = tcpa_pc_event_id_strings[event_id]; | 264 | case OPTION_ROM_MICROCODE: |
265 | case S_CRTM_CONTENTS: | ||
266 | case POST_CONTENTS: | ||
267 | name = tcpa_pc_event_id_strings[pc_event->event_id]; | ||
259 | n_len = strlen(name); | 268 | n_len = strlen(name); |
260 | for (i = 0; i < 20; i++) | 269 | for (i = 0; i < 20; i++) |
261 | d_len += sprintf(data, "%02x", | 270 | d_len += sprintf(&data[2*i], "%02x", |
262 | event_entry[8 + i]); | 271 | pc_event->event_data[i]); |
263 | break; | 272 | break; |
264 | default: | 273 | default: |
265 | break; | 274 | break; |
@@ -275,53 +284,13 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
275 | 284 | ||
276 | static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v) | 285 | static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v) |
277 | { | 286 | { |
287 | struct tcpa_event *event = v; | ||
288 | char *data = v; | ||
289 | int i; | ||
278 | 290 | ||
279 | char *eventname; | 291 | for (i = 0; i < sizeof(struct tcpa_event) + event->event_size; i++) |
280 | char data[4]; | ||
281 | u32 help; | ||
282 | int i, len; | ||
283 | struct tcpa_event *event = (struct tcpa_event *) v; | ||
284 | unsigned char *event_entry = | ||
285 | (unsigned char *) (v + sizeof(struct tcpa_event)); | ||
286 | |||
287 | eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL); | ||
288 | if (!eventname) { | ||
289 | printk(KERN_ERR "%s: ERROR - No Memory for event name\n ", | ||
290 | __func__); | ||
291 | return -ENOMEM; | ||
292 | } | ||
293 | |||
294 | /* 1st: PCR used is in little-endian format (4 bytes) */ | ||
295 | help = le32_to_cpu(event->pcr_index); | ||
296 | memcpy(data, &help, 4); | ||
297 | for (i = 0; i < 4; i++) | ||
298 | seq_putc(m, data[i]); | ||
299 | |||
300 | /* 2nd: SHA1 (20 bytes) */ | ||
301 | for (i = 0; i < 20; i++) | ||
302 | seq_putc(m, event->pcr_value[i]); | ||
303 | |||
304 | /* 3rd: event type identifier (4 bytes) */ | ||
305 | help = le32_to_cpu(event->event_type); | ||
306 | memcpy(data, &help, 4); | ||
307 | for (i = 0; i < 4; i++) | ||
308 | seq_putc(m, data[i]); | 292 | seq_putc(m, data[i]); |
309 | 293 | ||
310 | len = 0; | ||
311 | |||
312 | len += get_event_name(eventname, event, event_entry); | ||
313 | |||
314 | /* 4th: filename <= 255 + \'0' delimiter */ | ||
315 | if (len > TCG_EVENT_NAME_LEN_MAX) | ||
316 | len = TCG_EVENT_NAME_LEN_MAX; | ||
317 | |||
318 | for (i = 0; i < len; i++) | ||
319 | seq_putc(m, eventname[i]); | ||
320 | |||
321 | /* 5th: delimiter */ | ||
322 | seq_putc(m, '\0'); | ||
323 | |||
324 | kfree(eventname); | ||
325 | return 0; | 294 | return 0; |
326 | } | 295 | } |
327 | 296 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index b9cae9a238bb..8ea70625f7ea 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -55,7 +55,7 @@ enum tis_int_flags { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | enum tis_defaults { | 57 | enum tis_defaults { |
58 | TIS_MEM_BASE = 0xFED4000, | 58 | TIS_MEM_BASE = 0xFED40000, |
59 | TIS_MEM_LEN = 0x5000, | 59 | TIS_MEM_LEN = 0x5000, |
60 | TIS_SHORT_TIMEOUT = 750, /* ms */ | 60 | TIS_SHORT_TIMEOUT = 750, /* ms */ |
61 | TIS_LONG_TIMEOUT = 2000, /* 2 sec */ | 61 | TIS_LONG_TIMEOUT = 2000, /* 2 sec */ |
@@ -457,10 +457,6 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
457 | } | 457 | } |
458 | 458 | ||
459 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); | 459 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); |
460 | if ((vendor & 0xFFFF) == 0xFFFF) { | ||
461 | rc = -ENODEV; | ||
462 | goto out_err; | ||
463 | } | ||
464 | 460 | ||
465 | /* Default timeouts */ | 461 | /* Default timeouts */ |
466 | chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | 462 | chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index f07637a8f88f..a88b94a82b14 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -398,7 +398,7 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, | |||
398 | while (unlikely(size > copied)); | 398 | while (unlikely(size > copied)); |
399 | return copied; | 399 | return copied; |
400 | } | 400 | } |
401 | EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags); | 401 | EXPORT_SYMBOL(tty_insert_flip_string_flags); |
402 | 402 | ||
403 | void tty_schedule_flip(struct tty_struct *tty) | 403 | void tty_schedule_flip(struct tty_struct *tty) |
404 | { | 404 | { |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index acc5d47844eb..6c94879e0b99 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -3238,14 +3238,6 @@ void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) | |||
3238 | } | 3238 | } |
3239 | } | 3239 | } |
3240 | 3240 | ||
3241 | int is_console_suspend_safe(void) | ||
3242 | { | ||
3243 | /* It is unsafe to suspend devices while X has control of the | ||
3244 | * hardware. Make sure we are running on a kernel-controlled console. | ||
3245 | */ | ||
3246 | return vc_cons[fg_console].d->vc_mode == KD_TEXT; | ||
3247 | } | ||
3248 | |||
3249 | /* | 3241 | /* |
3250 | * Visible symbols for modules | 3242 | * Visible symbols for modules |
3251 | */ | 3243 | */ |
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index a13395e2c372..fa2ba9ebe42a 100644 --- a/drivers/char/watchdog/i8xx_tco.c +++ b/drivers/char/watchdog/i8xx_tco.c | |||
@@ -33,11 +33,6 @@ | |||
33 | * 82801E (C-ICH) : document number 273599-001, 273645-002, | 33 | * 82801E (C-ICH) : document number 273599-001, 273645-002, |
34 | * 82801EB (ICH5) : document number 252516-001, 252517-003, | 34 | * 82801EB (ICH5) : document number 252516-001, 252517-003, |
35 | * 82801ER (ICH5R) : document number 252516-001, 252517-003, | 35 | * 82801ER (ICH5R) : document number 252516-001, 252517-003, |
36 | * 82801FB (ICH6) : document number 301473-002, 301474-007, | ||
37 | * 82801FR (ICH6R) : document number 301473-002, 301474-007, | ||
38 | * 82801FBM (ICH6-M) : document number 301473-002, 301474-007, | ||
39 | * 82801FW (ICH6W) : document number 301473-001, 301474-007, | ||
40 | * 82801FRW (ICH6RW) : document number 301473-001, 301474-007 | ||
41 | * | 36 | * |
42 | * 20000710 Nils Faerber | 37 | * 20000710 Nils Faerber |
43 | * Initial Version 0.01 | 38 | * Initial Version 0.01 |
@@ -66,6 +61,10 @@ | |||
66 | * 20050807 Wim Van Sebroeck <wim@iguana.be> | 61 | * 20050807 Wim Van Sebroeck <wim@iguana.be> |
67 | * 0.08 Make sure that the watchdog is only "armed" when started. | 62 | * 0.08 Make sure that the watchdog is only "armed" when started. |
68 | * (Kernel Bug 4251) | 63 | * (Kernel Bug 4251) |
64 | * 20060416 Wim Van Sebroeck <wim@iguana.be> | ||
65 | * 0.09 Remove support for the ICH6, ICH6R, ICH6-M, ICH6W and ICH6RW and | ||
66 | * ICH7 chipsets. (See Kernel Bug 6031 - other code will support these | ||
67 | * chipsets) | ||
69 | */ | 68 | */ |
70 | 69 | ||
71 | /* | 70 | /* |
@@ -90,7 +89,7 @@ | |||
90 | #include "i8xx_tco.h" | 89 | #include "i8xx_tco.h" |
91 | 90 | ||
92 | /* Module and version information */ | 91 | /* Module and version information */ |
93 | #define TCO_VERSION "0.08" | 92 | #define TCO_VERSION "0.09" |
94 | #define TCO_MODULE_NAME "i8xx TCO timer" | 93 | #define TCO_MODULE_NAME "i8xx TCO timer" |
95 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 94 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
96 | #define PFX TCO_MODULE_NAME ": " | 95 | #define PFX TCO_MODULE_NAME ": " |
@@ -391,11 +390,6 @@ static struct pci_device_id i8xx_tco_pci_tbl[] = { | |||
391 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, }, | 390 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, }, |
392 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, }, | 391 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, }, |
393 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, }, | 392 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, }, |
394 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, PCI_ANY_ID, PCI_ANY_ID, }, | ||
395 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, PCI_ANY_ID, PCI_ANY_ID, }, | ||
396 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, }, | ||
397 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, }, | ||
398 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, }, | ||
399 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, }, | 393 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, }, |
400 | { 0, }, /* End of list */ | 394 | { 0, }, /* End of list */ |
401 | }; | 395 | }; |
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 9dc54736e4eb..1ea04e9b2b0b 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -423,6 +423,12 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
423 | if (tmr_atboot && started == 0) { | 423 | if (tmr_atboot && started == 0) { |
424 | printk(KERN_INFO PFX "Starting Watchdog Timer\n"); | 424 | printk(KERN_INFO PFX "Starting Watchdog Timer\n"); |
425 | s3c2410wdt_start(); | 425 | s3c2410wdt_start(); |
426 | } else if (!tmr_atboot) { | ||
427 | /* if we're not enabling the watchdog, then ensure it is | ||
428 | * disabled if it has been left running from the bootloader | ||
429 | * or other source */ | ||
430 | |||
431 | s3c2410wdt_stop(); | ||
426 | } | 432 | } |
427 | 433 | ||
428 | return 0; | 434 | return 0; |
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index 515ce7572049..20b88f9b7be2 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c | |||
@@ -377,7 +377,7 @@ static int __init sc1200wdt_init(void) | |||
377 | { | 377 | { |
378 | int ret; | 378 | int ret; |
379 | 379 | ||
380 | printk(banner); | 380 | printk("%s\n", banner); |
381 | 381 | ||
382 | spin_lock_init(&sc1200wdt_lock); | 382 | spin_lock_init(&sc1200wdt_lock); |
383 | sema_init(&open_sem, 1); | 383 | sema_init(&open_sem, 1); |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 8bd305e47f0d..766cc969c4d0 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -133,6 +133,9 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status) | |||
133 | 133 | ||
134 | outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); | 134 | outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); |
135 | outb(ACBST_STASTR | ACBST_NEGACK, ACBST); | 135 | outb(ACBST_STASTR | ACBST_NEGACK, ACBST); |
136 | |||
137 | /* Reset the status register */ | ||
138 | outb(0, ACBST); | ||
136 | return; | 139 | return; |
137 | } | 140 | } |
138 | 141 | ||
@@ -228,6 +231,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) | |||
228 | timeout = jiffies + POLL_TIMEOUT; | 231 | timeout = jiffies + POLL_TIMEOUT; |
229 | while (time_before(jiffies, timeout)) { | 232 | while (time_before(jiffies, timeout)) { |
230 | status = inb(ACBST); | 233 | status = inb(ACBST); |
234 | |||
235 | /* Reset the status register to avoid the hang */ | ||
236 | outb(0, ACBST); | ||
237 | |||
231 | if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) { | 238 | if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) { |
232 | scx200_acb_machine(iface, status); | 239 | scx200_acb_machine(iface, status); |
233 | return; | 240 | return; |
@@ -415,7 +422,6 @@ static int __init scx200_acb_create(const char *text, int base, int index) | |||
415 | struct scx200_acb_iface *iface; | 422 | struct scx200_acb_iface *iface; |
416 | struct i2c_adapter *adapter; | 423 | struct i2c_adapter *adapter; |
417 | int rc; | 424 | int rc; |
418 | char description[64]; | ||
419 | 425 | ||
420 | iface = kzalloc(sizeof(*iface), GFP_KERNEL); | 426 | iface = kzalloc(sizeof(*iface), GFP_KERNEL); |
421 | if (!iface) { | 427 | if (!iface) { |
@@ -434,10 +440,7 @@ static int __init scx200_acb_create(const char *text, int base, int index) | |||
434 | 440 | ||
435 | mutex_init(&iface->mutex); | 441 | mutex_init(&iface->mutex); |
436 | 442 | ||
437 | snprintf(description, sizeof(description), "%s ACCESS.bus [%s]", | 443 | if (!request_region(base, 8, adapter->name)) { |
438 | text, adapter->name); | ||
439 | |||
440 | if (request_region(base, 8, description) == 0) { | ||
441 | printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n", | 444 | printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n", |
442 | base, base + 8-1); | 445 | base, base + 8-1); |
443 | rc = -EBUSY; | 446 | rc = -EBUSY; |
@@ -488,7 +491,7 @@ static struct pci_device_id divil_pci[] = { | |||
488 | 491 | ||
489 | #define MSR_LBAR_SMB 0x5140000B | 492 | #define MSR_LBAR_SMB 0x5140000B |
490 | 493 | ||
491 | static int scx200_add_cs553x(void) | 494 | static __init int scx200_add_cs553x(void) |
492 | { | 495 | { |
493 | u32 low, hi; | 496 | u32 low, hi; |
494 | u32 smb_base; | 497 | u32 smb_base; |
@@ -524,6 +527,9 @@ static int __init scx200_acb_init(void) | |||
524 | } else if (pci_dev_present(divil_pci)) | 527 | } else if (pci_dev_present(divil_pci)) |
525 | rc = scx200_add_cs553x(); | 528 | rc = scx200_add_cs553x(); |
526 | 529 | ||
530 | /* If at least one bus was created, init must succeed */ | ||
531 | if (scx200_acb_list) | ||
532 | return 0; | ||
527 | return rc; | 533 | return rc; |
528 | } | 534 | } |
529 | 535 | ||
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 4961f1e764a7..602797a44208 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -392,6 +392,7 @@ static struct pcmcia_device_id ide_ids[] = { | |||
392 | PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), | 392 | PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), |
393 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae), | 393 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae), |
394 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), | 394 | PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), |
395 | PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), | ||
395 | PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), | 396 | PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), |
396 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), | 397 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), |
397 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), | 398 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 43b96e298363..27c9eb989a9a 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -345,17 +345,17 @@ sgiioc4_resetproc(ide_drive_t * drive) | |||
345 | static u8 | 345 | static u8 |
346 | sgiioc4_INB(unsigned long port) | 346 | sgiioc4_INB(unsigned long port) |
347 | { | 347 | { |
348 | u8 reg = (u8) inb(port); | 348 | u8 reg = (u8) readb((void __iomem *) port); |
349 | 349 | ||
350 | if ((port & 0xFFF) == 0x11C) { /* Status register of IOC4 */ | 350 | if ((port & 0xFFF) == 0x11C) { /* Status register of IOC4 */ |
351 | if (reg & 0x51) { /* Not busy...check for interrupt */ | 351 | if (reg & 0x51) { /* Not busy...check for interrupt */ |
352 | unsigned long other_ir = port - 0x110; | 352 | unsigned long other_ir = port - 0x110; |
353 | unsigned int intr_reg = (u32) inl(other_ir); | 353 | unsigned int intr_reg = (u32) readl((void __iomem *) other_ir); |
354 | 354 | ||
355 | /* Clear the Interrupt, Error bits on the IOC4 */ | 355 | /* Clear the Interrupt, Error bits on the IOC4 */ |
356 | if (intr_reg & 0x03) { | 356 | if (intr_reg & 0x03) { |
357 | outl(0x03, other_ir); | 357 | writel(0x03, (void __iomem *) other_ir); |
358 | intr_reg = (u32) inl(other_ir); | 358 | intr_reg = (u32) readl((void __iomem *) other_ir); |
359 | } | 359 | } |
360 | } | 360 | } |
361 | } | 361 | } |
@@ -606,6 +606,12 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
606 | hwif->ide_dma_host_off = &sgiioc4_ide_dma_host_off; | 606 | hwif->ide_dma_host_off = &sgiioc4_ide_dma_host_off; |
607 | hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq; | 607 | hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq; |
608 | hwif->ide_dma_timeout = &__ide_dma_timeout; | 608 | hwif->ide_dma_timeout = &__ide_dma_timeout; |
609 | |||
610 | /* | ||
611 | * The IOC4 uses MMIO rather than Port IO. | ||
612 | * It also needs special workarounds for INB. | ||
613 | */ | ||
614 | default_hwif_mmiops(hwif); | ||
609 | hwif->INB = &sgiioc4_INB; | 615 | hwif->INB = &sgiioc4_INB; |
610 | } | 616 | } |
611 | 617 | ||
@@ -743,6 +749,6 @@ ioc4_ide_exit(void) | |||
743 | module_init(ioc4_ide_init); | 749 | module_init(ioc4_ide_init); |
744 | module_exit(ioc4_ide_exit); | 750 | module_exit(ioc4_ide_exit); |
745 | 751 | ||
746 | MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)"); | 752 | MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon"); |
747 | MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); | 753 | MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); |
748 | MODULE_LICENSE("GPL"); | 754 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 78e30f803671..ffca8b63ee79 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -553,6 +553,8 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw, | |||
553 | 553 | ||
554 | if (irq != NULL) | 554 | if (irq != NULL) |
555 | *irq = pmac_ide[ix].irq; | 555 | *irq = pmac_ide[ix].irq; |
556 | |||
557 | hw->dev = &pmac_ide[ix].mdev->ofdev.dev; | ||
556 | } | 558 | } |
557 | 559 | ||
558 | #define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x))) | 560 | #define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x))) |
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 19222878aae9..11f13778f139 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -553,7 +553,7 @@ static void ohci_initialize(struct ti_ohci *ohci) | |||
553 | * register content. | 553 | * register content. |
554 | * To actually enable physical responses is the job of our interrupt | 554 | * To actually enable physical responses is the job of our interrupt |
555 | * handler which programs the physical request filter. */ | 555 | * handler which programs the physical request filter. */ |
556 | reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000); | 556 | reg_write(ohci, OHCI1394_PhyUpperBound, 0x01000000); |
557 | 557 | ||
558 | DBGMSG("physUpperBoundOffset=%08x", | 558 | DBGMSG("physUpperBoundOffset=%08x", |
559 | reg_read(ohci, OHCI1394_PhyUpperBound)); | 559 | reg_read(ohci, OHCI1394_PhyUpperBound)); |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index f4206604db03..5413dc43b9f1 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
43 | #include <linux/list.h> | 43 | #include <linux/list.h> |
44 | #include <linux/string.h> | 44 | #include <linux/string.h> |
45 | #include <linux/stringify.h> | ||
45 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
46 | #include <linux/interrupt.h> | 47 | #include <linux/interrupt.h> |
47 | #include <linux/fs.h> | 48 | #include <linux/fs.h> |
@@ -117,7 +118,8 @@ MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers (default | |||
117 | */ | 118 | */ |
118 | static int max_sectors = SBP2_MAX_SECTORS; | 119 | static int max_sectors = SBP2_MAX_SECTORS; |
119 | module_param(max_sectors, int, 0444); | 120 | module_param(max_sectors, int, 0444); |
120 | MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = 255)"); | 121 | MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = " |
122 | __stringify(SBP2_MAX_SECTORS) ")"); | ||
121 | 123 | ||
122 | /* | 124 | /* |
123 | * Exclusive login to sbp2 device? In most cases, the sbp2 driver should | 125 | * Exclusive login to sbp2 device? In most cases, the sbp2 driver should |
@@ -135,18 +137,45 @@ module_param(exclusive_login, int, 0644); | |||
135 | MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)"); | 137 | MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)"); |
136 | 138 | ||
137 | /* | 139 | /* |
138 | * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on | 140 | * If any of the following workarounds is required for your device to work, |
139 | * if your sbp2 device is not properly handling the SCSI inquiry command. | 141 | * please submit the kernel messages logged by sbp2 to the linux1394-devel |
140 | * This hack makes the inquiry look more like a typical MS Windows inquiry | 142 | * mailing list. |
141 | * by enforcing 36 byte inquiry and avoiding access to mode_sense page 8. | ||
142 | * | 143 | * |
143 | * If force_inquiry_hack=1 is required for your device to work, | 144 | * - 128kB max transfer |
144 | * please submit the logged sbp2_firmware_revision value of this device to | 145 | * Limit transfer size. Necessary for some old bridges. |
145 | * the linux1394-devel mailing list. | 146 | * |
147 | * - 36 byte inquiry | ||
148 | * When scsi_mod probes the device, let the inquiry command look like that | ||
149 | * from MS Windows. | ||
150 | * | ||
151 | * - skip mode page 8 | ||
152 | * Suppress sending of mode_sense for mode page 8 if the device pretends to | ||
153 | * support the SCSI Primary Block commands instead of Reduced Block Commands. | ||
154 | * | ||
155 | * - fix capacity | ||
156 | * Tell sd_mod to correct the last sector number reported by read_capacity. | ||
157 | * Avoids access beyond actual disk limits on devices with an off-by-one bug. | ||
158 | * Don't use this with devices which don't have this bug. | ||
159 | * | ||
160 | * - override internal blacklist | ||
161 | * Instead of adding to the built-in blacklist, use only the workarounds | ||
162 | * specified in the module load parameter. | ||
163 | * Useful if a blacklist entry interfered with a non-broken device. | ||
146 | */ | 164 | */ |
165 | static int sbp2_default_workarounds; | ||
166 | module_param_named(workarounds, sbp2_default_workarounds, int, 0644); | ||
167 | MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0" | ||
168 | ", 128kB max transfer = " __stringify(SBP2_WORKAROUND_128K_MAX_TRANS) | ||
169 | ", 36 byte inquiry = " __stringify(SBP2_WORKAROUND_INQUIRY_36) | ||
170 | ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8) | ||
171 | ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY) | ||
172 | ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) | ||
173 | ", or a combination)"); | ||
174 | |||
175 | /* legacy parameter */ | ||
147 | static int force_inquiry_hack; | 176 | static int force_inquiry_hack; |
148 | module_param(force_inquiry_hack, int, 0644); | 177 | module_param(force_inquiry_hack, int, 0644); |
149 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); | 178 | MODULE_PARM_DESC(force_inquiry_hack, "Deprecated, use 'workarounds'"); |
150 | 179 | ||
151 | /* | 180 | /* |
152 | * Export information about protocols/devices supported by this driver. | 181 | * Export information about protocols/devices supported by this driver. |
@@ -266,14 +295,55 @@ static struct hpsb_protocol_driver sbp2_driver = { | |||
266 | }; | 295 | }; |
267 | 296 | ||
268 | /* | 297 | /* |
269 | * List of device firmwares that require the inquiry hack. | 298 | * List of devices with known bugs. |
270 | * Yields a few false positives but did not break other devices so far. | 299 | * |
300 | * The firmware_revision field, masked with 0xffff00, is the best indicator | ||
301 | * for the type of bridge chip of a device. It yields a few false positives | ||
302 | * but this did not break correctly behaving devices so far. | ||
271 | */ | 303 | */ |
272 | static u32 sbp2_broken_inquiry_list[] = { | 304 | static const struct { |
273 | 0x00002800, /* Stefan Richter <stefanr@s5r6.in-berlin.de> */ | 305 | u32 firmware_revision; |
274 | /* DViCO Momobay CX-1 */ | 306 | u32 model_id; |
275 | 0x00000200 /* Andreas Plesch <plesch@fas.harvard.edu> */ | 307 | unsigned workarounds; |
276 | /* QPS Fire DVDBurner */ | 308 | } sbp2_workarounds_table[] = { |
309 | /* TSB42AA9 */ { | ||
310 | .firmware_revision = 0x002800, | ||
311 | .workarounds = SBP2_WORKAROUND_INQUIRY_36 | | ||
312 | SBP2_WORKAROUND_MODE_SENSE_8, | ||
313 | }, | ||
314 | /* Initio bridges, actually only needed for some older ones */ { | ||
315 | .firmware_revision = 0x000200, | ||
316 | .workarounds = SBP2_WORKAROUND_INQUIRY_36, | ||
317 | }, | ||
318 | /* Symbios bridge */ { | ||
319 | .firmware_revision = 0xa0b800, | ||
320 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | ||
321 | }, | ||
322 | /* | ||
323 | * Note about the following Apple iPod blacklist entries: | ||
324 | * | ||
325 | * There are iPods (2nd gen, 3rd gen) with model_id==0. Since our | ||
326 | * matching logic treats 0 as a wildcard, we cannot match this ID | ||
327 | * without rewriting the matching routine. Fortunately these iPods | ||
328 | * do not feature the read_capacity bug according to one report. | ||
329 | * Read_capacity behaviour as well as model_id could change due to | ||
330 | * Apple-supplied firmware updates though. | ||
331 | */ | ||
332 | /* iPod 4th generation */ { | ||
333 | .firmware_revision = 0x0a2700, | ||
334 | .model_id = 0x000021, | ||
335 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | ||
336 | }, | ||
337 | /* iPod mini */ { | ||
338 | .firmware_revision = 0x0a2700, | ||
339 | .model_id = 0x000023, | ||
340 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | ||
341 | }, | ||
342 | /* iPod Photo */ { | ||
343 | .firmware_revision = 0x0a2700, | ||
344 | .model_id = 0x00007e, | ||
345 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | ||
346 | } | ||
277 | }; | 347 | }; |
278 | 348 | ||
279 | /************************************** | 349 | /************************************** |
@@ -765,12 +835,17 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
765 | 835 | ||
766 | /* Register the status FIFO address range. We could use the same FIFO | 836 | /* Register the status FIFO address range. We could use the same FIFO |
767 | * for targets at different nodes. However we need different FIFOs per | 837 | * for targets at different nodes. However we need different FIFOs per |
768 | * target in order to support multi-unit devices. */ | 838 | * target in order to support multi-unit devices. |
839 | * The FIFO is located out of the local host controller's physical range | ||
840 | * but, if possible, within the posted write area. Status writes will | ||
841 | * then be performed as unified transactions. This slightly reduces | ||
842 | * bandwidth usage, and some Prolific based devices seem to require it. | ||
843 | */ | ||
769 | scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace( | 844 | scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace( |
770 | &sbp2_highlevel, ud->ne->host, &sbp2_ops, | 845 | &sbp2_highlevel, ud->ne->host, &sbp2_ops, |
771 | sizeof(struct sbp2_status_block), sizeof(quadlet_t), | 846 | sizeof(struct sbp2_status_block), sizeof(quadlet_t), |
772 | ~0ULL, ~0ULL); | 847 | 0x010000000000ULL, CSR1212_ALL_SPACE_END); |
773 | if (!scsi_id->status_fifo_addr) { | 848 | if (scsi_id->status_fifo_addr == ~0ULL) { |
774 | SBP2_ERR("failed to allocate status FIFO address range"); | 849 | SBP2_ERR("failed to allocate status FIFO address range"); |
775 | goto failed_alloc; | 850 | goto failed_alloc; |
776 | } | 851 | } |
@@ -1450,7 +1525,8 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1450 | struct csr1212_dentry *dentry; | 1525 | struct csr1212_dentry *dentry; |
1451 | u64 management_agent_addr; | 1526 | u64 management_agent_addr; |
1452 | u32 command_set_spec_id, command_set, unit_characteristics, | 1527 | u32 command_set_spec_id, command_set, unit_characteristics, |
1453 | firmware_revision, workarounds; | 1528 | firmware_revision; |
1529 | unsigned workarounds; | ||
1454 | int i; | 1530 | int i; |
1455 | 1531 | ||
1456 | SBP2_DEBUG_ENTER(); | 1532 | SBP2_DEBUG_ENTER(); |
@@ -1506,12 +1582,8 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1506 | case SBP2_FIRMWARE_REVISION_KEY: | 1582 | case SBP2_FIRMWARE_REVISION_KEY: |
1507 | /* Firmware revision */ | 1583 | /* Firmware revision */ |
1508 | firmware_revision = kv->value.immediate; | 1584 | firmware_revision = kv->value.immediate; |
1509 | if (force_inquiry_hack) | 1585 | SBP2_DEBUG("sbp2_firmware_revision = %x", |
1510 | SBP2_INFO("sbp2_firmware_revision = %x", | 1586 | (unsigned int)firmware_revision); |
1511 | (unsigned int)firmware_revision); | ||
1512 | else | ||
1513 | SBP2_DEBUG("sbp2_firmware_revision = %x", | ||
1514 | (unsigned int)firmware_revision); | ||
1515 | break; | 1587 | break; |
1516 | 1588 | ||
1517 | default: | 1589 | default: |
@@ -1519,41 +1591,44 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1519 | } | 1591 | } |
1520 | } | 1592 | } |
1521 | 1593 | ||
1522 | /* This is the start of our broken device checking. We try to hack | 1594 | workarounds = sbp2_default_workarounds; |
1523 | * around oddities and known defects. */ | 1595 | if (force_inquiry_hack) { |
1524 | workarounds = 0x0; | 1596 | SBP2_WARN("force_inquiry_hack is deprecated. " |
1597 | "Use parameter 'workarounds' instead."); | ||
1598 | workarounds |= SBP2_WORKAROUND_INQUIRY_36; | ||
1599 | } | ||
1525 | 1600 | ||
1526 | /* If the vendor id is 0xa0b8 (Symbios vendor id), then we have a | 1601 | if (!(workarounds & SBP2_WORKAROUND_OVERRIDE)) |
1527 | * bridge with 128KB max transfer size limitation. For sanity, we | 1602 | for (i = 0; i < ARRAY_SIZE(sbp2_workarounds_table); i++) { |
1528 | * only voice this when the current max_sectors setting | 1603 | if (sbp2_workarounds_table[i].firmware_revision && |
1529 | * exceeds the 128k limit. By default, that is not the case. | 1604 | sbp2_workarounds_table[i].firmware_revision != |
1530 | * | 1605 | (firmware_revision & 0xffff00)) |
1531 | * It would be really nice if we could detect this before the scsi | 1606 | continue; |
1532 | * host gets initialized. That way we can down-force the | 1607 | if (sbp2_workarounds_table[i].model_id && |
1533 | * max_sectors to account for it. That is not currently | 1608 | sbp2_workarounds_table[i].model_id != ud->model_id) |
1534 | * possible. */ | 1609 | continue; |
1535 | if ((firmware_revision & 0xffff00) == | 1610 | workarounds |= sbp2_workarounds_table[i].workarounds; |
1536 | SBP2_128KB_BROKEN_FIRMWARE && | 1611 | break; |
1537 | (max_sectors * 512) > (128*1024)) { | ||
1538 | SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB max transfer size.", | ||
1539 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid)); | ||
1540 | SBP2_WARN("WARNING: Current max_sectors setting is larger than 128KB (%d sectors)!", | ||
1541 | max_sectors); | ||
1542 | workarounds |= SBP2_BREAKAGE_128K_MAX_TRANSFER; | ||
1543 | } | ||
1544 | |||
1545 | /* Check for a blacklisted set of devices that require us to force | ||
1546 | * a 36 byte host inquiry. This can be overriden as a module param | ||
1547 | * (to force all hosts). */ | ||
1548 | for (i = 0; i < ARRAY_SIZE(sbp2_broken_inquiry_list); i++) { | ||
1549 | if ((firmware_revision & 0xffff00) == | ||
1550 | sbp2_broken_inquiry_list[i]) { | ||
1551 | SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround", | ||
1552 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid)); | ||
1553 | workarounds |= SBP2_BREAKAGE_INQUIRY_HACK; | ||
1554 | break; /* No need to continue. */ | ||
1555 | } | 1612 | } |
1556 | } | 1613 | |
1614 | if (workarounds) | ||
1615 | SBP2_INFO("Workarounds for node " NODE_BUS_FMT ": 0x%x " | ||
1616 | "(firmware_revision 0x%06x, vendor_id 0x%06x," | ||
1617 | " model_id 0x%06x)", | ||
1618 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid), | ||
1619 | workarounds, firmware_revision, | ||
1620 | ud->vendor_id ? ud->vendor_id : ud->ne->vendor_id, | ||
1621 | ud->model_id); | ||
1622 | |||
1623 | /* We would need one SCSI host template for each target to adjust | ||
1624 | * max_sectors on the fly, therefore warn only. */ | ||
1625 | if (workarounds & SBP2_WORKAROUND_128K_MAX_TRANS && | ||
1626 | (max_sectors * 512) > (128 * 1024)) | ||
1627 | SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB " | ||
1628 | "max transfer size. WARNING: Current max_sectors " | ||
1629 | "setting is larger than 128KB (%d sectors)", | ||
1630 | NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid), | ||
1631 | max_sectors); | ||
1557 | 1632 | ||
1558 | /* If this is a logical unit directory entry, process the parent | 1633 | /* If this is a logical unit directory entry, process the parent |
1559 | * to get the values. */ | 1634 | * to get the values. */ |
@@ -2447,19 +2522,25 @@ static int sbp2scsi_slave_alloc(struct scsi_device *sdev) | |||
2447 | 2522 | ||
2448 | scsi_id->sdev = sdev; | 2523 | scsi_id->sdev = sdev; |
2449 | 2524 | ||
2450 | if (force_inquiry_hack || | 2525 | if (scsi_id->workarounds & SBP2_WORKAROUND_INQUIRY_36) |
2451 | scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) { | ||
2452 | sdev->inquiry_len = 36; | 2526 | sdev->inquiry_len = 36; |
2453 | sdev->skip_ms_page_8 = 1; | ||
2454 | } | ||
2455 | return 0; | 2527 | return 0; |
2456 | } | 2528 | } |
2457 | 2529 | ||
2458 | static int sbp2scsi_slave_configure(struct scsi_device *sdev) | 2530 | static int sbp2scsi_slave_configure(struct scsi_device *sdev) |
2459 | { | 2531 | { |
2532 | struct scsi_id_instance_data *scsi_id = | ||
2533 | (struct scsi_id_instance_data *)sdev->host->hostdata[0]; | ||
2534 | |||
2460 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); | 2535 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); |
2461 | sdev->use_10_for_rw = 1; | 2536 | sdev->use_10_for_rw = 1; |
2462 | sdev->use_10_for_ms = 1; | 2537 | sdev->use_10_for_ms = 1; |
2538 | |||
2539 | if (sdev->type == TYPE_DISK && | ||
2540 | scsi_id->workarounds & SBP2_WORKAROUND_MODE_SENSE_8) | ||
2541 | sdev->skip_ms_page_8 = 1; | ||
2542 | if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) | ||
2543 | sdev->fix_capacity = 1; | ||
2463 | return 0; | 2544 | return 0; |
2464 | } | 2545 | } |
2465 | 2546 | ||
@@ -2603,7 +2684,9 @@ static int sbp2_module_init(void) | |||
2603 | scsi_driver_template.cmd_per_lun = 1; | 2684 | scsi_driver_template.cmd_per_lun = 1; |
2604 | } | 2685 | } |
2605 | 2686 | ||
2606 | /* Set max sectors (module load option). Default is 255 sectors. */ | 2687 | if (sbp2_default_workarounds & SBP2_WORKAROUND_128K_MAX_TRANS && |
2688 | (max_sectors * 512) > (128 * 1024)) | ||
2689 | max_sectors = 128 * 1024 / 512; | ||
2607 | scsi_driver_template.max_sectors = max_sectors; | 2690 | scsi_driver_template.max_sectors = max_sectors; |
2608 | 2691 | ||
2609 | /* Register our high level driver with 1394 stack */ | 2692 | /* Register our high level driver with 1394 stack */ |
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h index e2d357a9ea3a..f4ccc9d0fba4 100644 --- a/drivers/ieee1394/sbp2.h +++ b/drivers/ieee1394/sbp2.h | |||
@@ -227,11 +227,6 @@ struct sbp2_status_block { | |||
227 | #define SBP2_SW_VERSION_ENTRY 0x00010483 | 227 | #define SBP2_SW_VERSION_ENTRY 0x00010483 |
228 | 228 | ||
229 | /* | 229 | /* |
230 | * Other misc defines | ||
231 | */ | ||
232 | #define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800 | ||
233 | |||
234 | /* | ||
235 | * SCSI specific stuff | 230 | * SCSI specific stuff |
236 | */ | 231 | */ |
237 | 232 | ||
@@ -239,6 +234,13 @@ struct sbp2_status_block { | |||
239 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ | 234 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ |
240 | #define SBP2_MAX_CMDS 8 /* This should be safe */ | 235 | #define SBP2_MAX_CMDS 8 /* This should be safe */ |
241 | 236 | ||
237 | /* Flags for detected oddities and brokeness */ | ||
238 | #define SBP2_WORKAROUND_128K_MAX_TRANS 0x1 | ||
239 | #define SBP2_WORKAROUND_INQUIRY_36 0x2 | ||
240 | #define SBP2_WORKAROUND_MODE_SENSE_8 0x4 | ||
241 | #define SBP2_WORKAROUND_FIX_CAPACITY 0x8 | ||
242 | #define SBP2_WORKAROUND_OVERRIDE 0x100 | ||
243 | |||
242 | /* This is the two dma types we use for cmd_dma below */ | 244 | /* This is the two dma types we use for cmd_dma below */ |
243 | enum cmd_dma_types { | 245 | enum cmd_dma_types { |
244 | CMD_DMA_NONE, | 246 | CMD_DMA_NONE, |
@@ -268,10 +270,6 @@ struct sbp2_command_info { | |||
268 | 270 | ||
269 | }; | 271 | }; |
270 | 272 | ||
271 | /* A list of flags for detected oddities and brokeness. */ | ||
272 | #define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1 | ||
273 | #define SBP2_BREAKAGE_INQUIRY_HACK 0x2 | ||
274 | |||
275 | struct sbp2scsi_host_info; | 273 | struct sbp2scsi_host_info; |
276 | 274 | ||
277 | /* | 275 | /* |
@@ -345,7 +343,7 @@ struct scsi_id_instance_data { | |||
345 | struct Scsi_Host *scsi_host; | 343 | struct Scsi_Host *scsi_host; |
346 | 344 | ||
347 | /* Device specific workarounds/brokeness */ | 345 | /* Device specific workarounds/brokeness */ |
348 | u32 workarounds; | 346 | unsigned workarounds; |
349 | }; | 347 | }; |
350 | 348 | ||
351 | /* Sbp2 host data structure (one per IEEE1394 host) */ | 349 | /* Sbp2 host data structure (one per IEEE1394 host) */ |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 7cfedb8d9bcd..86fee43502cd 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -34,6 +34,8 @@ | |||
34 | * | 34 | * |
35 | * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $ | 35 | * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $ |
36 | */ | 36 | */ |
37 | |||
38 | #include <linux/completion.h> | ||
37 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
38 | #include <linux/err.h> | 40 | #include <linux/err.h> |
39 | #include <linux/idr.h> | 41 | #include <linux/idr.h> |
@@ -122,7 +124,7 @@ struct cm_id_private { | |||
122 | struct rb_node service_node; | 124 | struct rb_node service_node; |
123 | struct rb_node sidr_id_node; | 125 | struct rb_node sidr_id_node; |
124 | spinlock_t lock; /* Do not acquire inside cm.lock */ | 126 | spinlock_t lock; /* Do not acquire inside cm.lock */ |
125 | wait_queue_head_t wait; | 127 | struct completion comp; |
126 | atomic_t refcount; | 128 | atomic_t refcount; |
127 | 129 | ||
128 | struct ib_mad_send_buf *msg; | 130 | struct ib_mad_send_buf *msg; |
@@ -159,7 +161,7 @@ static void cm_work_handler(void *data); | |||
159 | static inline void cm_deref_id(struct cm_id_private *cm_id_priv) | 161 | static inline void cm_deref_id(struct cm_id_private *cm_id_priv) |
160 | { | 162 | { |
161 | if (atomic_dec_and_test(&cm_id_priv->refcount)) | 163 | if (atomic_dec_and_test(&cm_id_priv->refcount)) |
162 | wake_up(&cm_id_priv->wait); | 164 | complete(&cm_id_priv->comp); |
163 | } | 165 | } |
164 | 166 | ||
165 | static int cm_alloc_msg(struct cm_id_private *cm_id_priv, | 167 | static int cm_alloc_msg(struct cm_id_private *cm_id_priv, |
@@ -559,7 +561,7 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device, | |||
559 | goto error; | 561 | goto error; |
560 | 562 | ||
561 | spin_lock_init(&cm_id_priv->lock); | 563 | spin_lock_init(&cm_id_priv->lock); |
562 | init_waitqueue_head(&cm_id_priv->wait); | 564 | init_completion(&cm_id_priv->comp); |
563 | INIT_LIST_HEAD(&cm_id_priv->work_list); | 565 | INIT_LIST_HEAD(&cm_id_priv->work_list); |
564 | atomic_set(&cm_id_priv->work_count, -1); | 566 | atomic_set(&cm_id_priv->work_count, -1); |
565 | atomic_set(&cm_id_priv->refcount, 1); | 567 | atomic_set(&cm_id_priv->refcount, 1); |
@@ -724,8 +726,8 @@ retest: | |||
724 | } | 726 | } |
725 | 727 | ||
726 | cm_free_id(cm_id->local_id); | 728 | cm_free_id(cm_id->local_id); |
727 | atomic_dec(&cm_id_priv->refcount); | 729 | cm_deref_id(cm_id_priv); |
728 | wait_event(cm_id_priv->wait, !atomic_read(&cm_id_priv->refcount)); | 730 | wait_for_completion(&cm_id_priv->comp); |
729 | while ((work = cm_dequeue_work(cm_id_priv)) != NULL) | 731 | while ((work = cm_dequeue_work(cm_id_priv)) != NULL) |
730 | cm_free_work(work); | 732 | cm_free_work(work); |
731 | if (cm_id_priv->private_data && cm_id_priv->private_data_len) | 733 | if (cm_id_priv->private_data && cm_id_priv->private_data_len) |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 469b6923a2e2..5ad41a64314c 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -352,7 +352,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, | |||
352 | INIT_WORK(&mad_agent_priv->local_work, local_completions, | 352 | INIT_WORK(&mad_agent_priv->local_work, local_completions, |
353 | mad_agent_priv); | 353 | mad_agent_priv); |
354 | atomic_set(&mad_agent_priv->refcount, 1); | 354 | atomic_set(&mad_agent_priv->refcount, 1); |
355 | init_waitqueue_head(&mad_agent_priv->wait); | 355 | init_completion(&mad_agent_priv->comp); |
356 | 356 | ||
357 | return &mad_agent_priv->agent; | 357 | return &mad_agent_priv->agent; |
358 | 358 | ||
@@ -467,7 +467,7 @@ struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device, | |||
467 | mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp; | 467 | mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp; |
468 | mad_snoop_priv->agent.port_num = port_num; | 468 | mad_snoop_priv->agent.port_num = port_num; |
469 | mad_snoop_priv->mad_snoop_flags = mad_snoop_flags; | 469 | mad_snoop_priv->mad_snoop_flags = mad_snoop_flags; |
470 | init_waitqueue_head(&mad_snoop_priv->wait); | 470 | init_completion(&mad_snoop_priv->comp); |
471 | mad_snoop_priv->snoop_index = register_snoop_agent( | 471 | mad_snoop_priv->snoop_index = register_snoop_agent( |
472 | &port_priv->qp_info[qpn], | 472 | &port_priv->qp_info[qpn], |
473 | mad_snoop_priv); | 473 | mad_snoop_priv); |
@@ -486,6 +486,18 @@ error1: | |||
486 | } | 486 | } |
487 | EXPORT_SYMBOL(ib_register_mad_snoop); | 487 | EXPORT_SYMBOL(ib_register_mad_snoop); |
488 | 488 | ||
489 | static inline void deref_mad_agent(struct ib_mad_agent_private *mad_agent_priv) | ||
490 | { | ||
491 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | ||
492 | complete(&mad_agent_priv->comp); | ||
493 | } | ||
494 | |||
495 | static inline void deref_snoop_agent(struct ib_mad_snoop_private *mad_snoop_priv) | ||
496 | { | ||
497 | if (atomic_dec_and_test(&mad_snoop_priv->refcount)) | ||
498 | complete(&mad_snoop_priv->comp); | ||
499 | } | ||
500 | |||
489 | static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) | 501 | static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) |
490 | { | 502 | { |
491 | struct ib_mad_port_private *port_priv; | 503 | struct ib_mad_port_private *port_priv; |
@@ -509,9 +521,8 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) | |||
509 | flush_workqueue(port_priv->wq); | 521 | flush_workqueue(port_priv->wq); |
510 | ib_cancel_rmpp_recvs(mad_agent_priv); | 522 | ib_cancel_rmpp_recvs(mad_agent_priv); |
511 | 523 | ||
512 | atomic_dec(&mad_agent_priv->refcount); | 524 | deref_mad_agent(mad_agent_priv); |
513 | wait_event(mad_agent_priv->wait, | 525 | wait_for_completion(&mad_agent_priv->comp); |
514 | !atomic_read(&mad_agent_priv->refcount)); | ||
515 | 526 | ||
516 | kfree(mad_agent_priv->reg_req); | 527 | kfree(mad_agent_priv->reg_req); |
517 | ib_dereg_mr(mad_agent_priv->agent.mr); | 528 | ib_dereg_mr(mad_agent_priv->agent.mr); |
@@ -529,9 +540,8 @@ static void unregister_mad_snoop(struct ib_mad_snoop_private *mad_snoop_priv) | |||
529 | atomic_dec(&qp_info->snoop_count); | 540 | atomic_dec(&qp_info->snoop_count); |
530 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 541 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
531 | 542 | ||
532 | atomic_dec(&mad_snoop_priv->refcount); | 543 | deref_snoop_agent(mad_snoop_priv); |
533 | wait_event(mad_snoop_priv->wait, | 544 | wait_for_completion(&mad_snoop_priv->comp); |
534 | !atomic_read(&mad_snoop_priv->refcount)); | ||
535 | 545 | ||
536 | kfree(mad_snoop_priv); | 546 | kfree(mad_snoop_priv); |
537 | } | 547 | } |
@@ -600,8 +610,7 @@ static void snoop_send(struct ib_mad_qp_info *qp_info, | |||
600 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 610 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
601 | mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent, | 611 | mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent, |
602 | send_buf, mad_send_wc); | 612 | send_buf, mad_send_wc); |
603 | if (atomic_dec_and_test(&mad_snoop_priv->refcount)) | 613 | deref_snoop_agent(mad_snoop_priv); |
604 | wake_up(&mad_snoop_priv->wait); | ||
605 | spin_lock_irqsave(&qp_info->snoop_lock, flags); | 614 | spin_lock_irqsave(&qp_info->snoop_lock, flags); |
606 | } | 615 | } |
607 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 616 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
@@ -626,8 +635,7 @@ static void snoop_recv(struct ib_mad_qp_info *qp_info, | |||
626 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 635 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
627 | mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, | 636 | mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, |
628 | mad_recv_wc); | 637 | mad_recv_wc); |
629 | if (atomic_dec_and_test(&mad_snoop_priv->refcount)) | 638 | deref_snoop_agent(mad_snoop_priv); |
630 | wake_up(&mad_snoop_priv->wait); | ||
631 | spin_lock_irqsave(&qp_info->snoop_lock, flags); | 639 | spin_lock_irqsave(&qp_info->snoop_lock, flags); |
632 | } | 640 | } |
633 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); | 641 | spin_unlock_irqrestore(&qp_info->snoop_lock, flags); |
@@ -968,8 +976,7 @@ void ib_free_send_mad(struct ib_mad_send_buf *send_buf) | |||
968 | 976 | ||
969 | free_send_rmpp_list(mad_send_wr); | 977 | free_send_rmpp_list(mad_send_wr); |
970 | kfree(send_buf->mad); | 978 | kfree(send_buf->mad); |
971 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 979 | deref_mad_agent(mad_agent_priv); |
972 | wake_up(&mad_agent_priv->wait); | ||
973 | } | 980 | } |
974 | EXPORT_SYMBOL(ib_free_send_mad); | 981 | EXPORT_SYMBOL(ib_free_send_mad); |
975 | 982 | ||
@@ -1757,8 +1764,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
1757 | mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv, | 1764 | mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv, |
1758 | mad_recv_wc); | 1765 | mad_recv_wc); |
1759 | if (!mad_recv_wc) { | 1766 | if (!mad_recv_wc) { |
1760 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 1767 | deref_mad_agent(mad_agent_priv); |
1761 | wake_up(&mad_agent_priv->wait); | ||
1762 | return; | 1768 | return; |
1763 | } | 1769 | } |
1764 | } | 1770 | } |
@@ -1770,8 +1776,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
1770 | if (!mad_send_wr) { | 1776 | if (!mad_send_wr) { |
1771 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); | 1777 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); |
1772 | ib_free_recv_mad(mad_recv_wc); | 1778 | ib_free_recv_mad(mad_recv_wc); |
1773 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 1779 | deref_mad_agent(mad_agent_priv); |
1774 | wake_up(&mad_agent_priv->wait); | ||
1775 | return; | 1780 | return; |
1776 | } | 1781 | } |
1777 | ib_mark_mad_done(mad_send_wr); | 1782 | ib_mark_mad_done(mad_send_wr); |
@@ -1790,8 +1795,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
1790 | } else { | 1795 | } else { |
1791 | mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, | 1796 | mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, |
1792 | mad_recv_wc); | 1797 | mad_recv_wc); |
1793 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 1798 | deref_mad_agent(mad_agent_priv); |
1794 | wake_up(&mad_agent_priv->wait); | ||
1795 | } | 1799 | } |
1796 | } | 1800 | } |
1797 | 1801 | ||
@@ -2021,8 +2025,7 @@ void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, | |||
2021 | mad_send_wc); | 2025 | mad_send_wc); |
2022 | 2026 | ||
2023 | /* Release reference on agent taken when sending */ | 2027 | /* Release reference on agent taken when sending */ |
2024 | if (atomic_dec_and_test(&mad_agent_priv->refcount)) | 2028 | deref_mad_agent(mad_agent_priv); |
2025 | wake_up(&mad_agent_priv->wait); | ||
2026 | return; | 2029 | return; |
2027 | done: | 2030 | done: |
2028 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); | 2031 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); |
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h index 6c9c133d71ef..b4fa28d3160f 100644 --- a/drivers/infiniband/core/mad_priv.h +++ b/drivers/infiniband/core/mad_priv.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #ifndef __IB_MAD_PRIV_H__ | 37 | #ifndef __IB_MAD_PRIV_H__ |
38 | #define __IB_MAD_PRIV_H__ | 38 | #define __IB_MAD_PRIV_H__ |
39 | 39 | ||
40 | #include <linux/completion.h> | ||
40 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
41 | #include <linux/kthread.h> | 42 | #include <linux/kthread.h> |
42 | #include <linux/workqueue.h> | 43 | #include <linux/workqueue.h> |
@@ -108,7 +109,7 @@ struct ib_mad_agent_private { | |||
108 | struct list_head rmpp_list; | 109 | struct list_head rmpp_list; |
109 | 110 | ||
110 | atomic_t refcount; | 111 | atomic_t refcount; |
111 | wait_queue_head_t wait; | 112 | struct completion comp; |
112 | }; | 113 | }; |
113 | 114 | ||
114 | struct ib_mad_snoop_private { | 115 | struct ib_mad_snoop_private { |
@@ -117,7 +118,7 @@ struct ib_mad_snoop_private { | |||
117 | int snoop_index; | 118 | int snoop_index; |
118 | int mad_snoop_flags; | 119 | int mad_snoop_flags; |
119 | atomic_t refcount; | 120 | atomic_t refcount; |
120 | wait_queue_head_t wait; | 121 | struct completion comp; |
121 | }; | 122 | }; |
122 | 123 | ||
123 | struct ib_mad_send_wr_private { | 124 | struct ib_mad_send_wr_private { |
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c index dfd4e588ce03..d4704e054e30 100644 --- a/drivers/infiniband/core/mad_rmpp.c +++ b/drivers/infiniband/core/mad_rmpp.c | |||
@@ -49,7 +49,7 @@ struct mad_rmpp_recv { | |||
49 | struct list_head list; | 49 | struct list_head list; |
50 | struct work_struct timeout_work; | 50 | struct work_struct timeout_work; |
51 | struct work_struct cleanup_work; | 51 | struct work_struct cleanup_work; |
52 | wait_queue_head_t wait; | 52 | struct completion comp; |
53 | enum rmpp_state state; | 53 | enum rmpp_state state; |
54 | spinlock_t lock; | 54 | spinlock_t lock; |
55 | atomic_t refcount; | 55 | atomic_t refcount; |
@@ -69,10 +69,16 @@ struct mad_rmpp_recv { | |||
69 | u8 method; | 69 | u8 method; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) | ||
73 | { | ||
74 | if (atomic_dec_and_test(&rmpp_recv->refcount)) | ||
75 | complete(&rmpp_recv->comp); | ||
76 | } | ||
77 | |||
72 | static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) | 78 | static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) |
73 | { | 79 | { |
74 | atomic_dec(&rmpp_recv->refcount); | 80 | deref_rmpp_recv(rmpp_recv); |
75 | wait_event(rmpp_recv->wait, !atomic_read(&rmpp_recv->refcount)); | 81 | wait_for_completion(&rmpp_recv->comp); |
76 | ib_destroy_ah(rmpp_recv->ah); | 82 | ib_destroy_ah(rmpp_recv->ah); |
77 | kfree(rmpp_recv); | 83 | kfree(rmpp_recv); |
78 | } | 84 | } |
@@ -253,7 +259,7 @@ create_rmpp_recv(struct ib_mad_agent_private *agent, | |||
253 | goto error; | 259 | goto error; |
254 | 260 | ||
255 | rmpp_recv->agent = agent; | 261 | rmpp_recv->agent = agent; |
256 | init_waitqueue_head(&rmpp_recv->wait); | 262 | init_completion(&rmpp_recv->comp); |
257 | INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv); | 263 | INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv); |
258 | INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv); | 264 | INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv); |
259 | spin_lock_init(&rmpp_recv->lock); | 265 | spin_lock_init(&rmpp_recv->lock); |
@@ -279,12 +285,6 @@ error: kfree(rmpp_recv); | |||
279 | return NULL; | 285 | return NULL; |
280 | } | 286 | } |
281 | 287 | ||
282 | static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) | ||
283 | { | ||
284 | if (atomic_dec_and_test(&rmpp_recv->refcount)) | ||
285 | wake_up(&rmpp_recv->wait); | ||
286 | } | ||
287 | |||
288 | static struct mad_rmpp_recv * | 288 | static struct mad_rmpp_recv * |
289 | find_rmpp_recv(struct ib_mad_agent_private *agent, | 289 | find_rmpp_recv(struct ib_mad_agent_private *agent, |
290 | struct ib_mad_recv_wc *mad_recv_wc) | 290 | struct ib_mad_recv_wc *mad_recv_wc) |
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index f6a05965a4e8..9164a09b6ccd 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -32,6 +32,8 @@ | |||
32 | * | 32 | * |
33 | * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ | 33 | * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ |
34 | */ | 34 | */ |
35 | |||
36 | #include <linux/completion.h> | ||
35 | #include <linux/init.h> | 37 | #include <linux/init.h> |
36 | #include <linux/fs.h> | 38 | #include <linux/fs.h> |
37 | #include <linux/module.h> | 39 | #include <linux/module.h> |
@@ -72,7 +74,7 @@ struct ib_ucm_file { | |||
72 | 74 | ||
73 | struct ib_ucm_context { | 75 | struct ib_ucm_context { |
74 | int id; | 76 | int id; |
75 | wait_queue_head_t wait; | 77 | struct completion comp; |
76 | atomic_t ref; | 78 | atomic_t ref; |
77 | int events_reported; | 79 | int events_reported; |
78 | 80 | ||
@@ -138,7 +140,7 @@ static struct ib_ucm_context *ib_ucm_ctx_get(struct ib_ucm_file *file, int id) | |||
138 | static void ib_ucm_ctx_put(struct ib_ucm_context *ctx) | 140 | static void ib_ucm_ctx_put(struct ib_ucm_context *ctx) |
139 | { | 141 | { |
140 | if (atomic_dec_and_test(&ctx->ref)) | 142 | if (atomic_dec_and_test(&ctx->ref)) |
141 | wake_up(&ctx->wait); | 143 | complete(&ctx->comp); |
142 | } | 144 | } |
143 | 145 | ||
144 | static inline int ib_ucm_new_cm_id(int event) | 146 | static inline int ib_ucm_new_cm_id(int event) |
@@ -178,7 +180,7 @@ static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file) | |||
178 | return NULL; | 180 | return NULL; |
179 | 181 | ||
180 | atomic_set(&ctx->ref, 1); | 182 | atomic_set(&ctx->ref, 1); |
181 | init_waitqueue_head(&ctx->wait); | 183 | init_completion(&ctx->comp); |
182 | ctx->file = file; | 184 | ctx->file = file; |
183 | INIT_LIST_HEAD(&ctx->events); | 185 | INIT_LIST_HEAD(&ctx->events); |
184 | 186 | ||
@@ -586,8 +588,8 @@ static ssize_t ib_ucm_destroy_id(struct ib_ucm_file *file, | |||
586 | if (IS_ERR(ctx)) | 588 | if (IS_ERR(ctx)) |
587 | return PTR_ERR(ctx); | 589 | return PTR_ERR(ctx); |
588 | 590 | ||
589 | atomic_dec(&ctx->ref); | 591 | ib_ucm_ctx_put(ctx); |
590 | wait_event(ctx->wait, !atomic_read(&ctx->ref)); | 592 | wait_for_completion(&ctx->comp); |
591 | 593 | ||
592 | /* No new events will be generated after destroying the cm_id. */ | 594 | /* No new events will be generated after destroying the cm_id. */ |
593 | ib_destroy_cm_id(ctx->cm_id); | 595 | ib_destroy_cm_id(ctx->cm_id); |
diff --git a/drivers/infiniband/core/uverbs_mem.c b/drivers/infiniband/core/uverbs_mem.c index 36a32c315668..efe147dbeb42 100644 --- a/drivers/infiniband/core/uverbs_mem.c +++ b/drivers/infiniband/core/uverbs_mem.c | |||
@@ -211,8 +211,10 @@ void ib_umem_release_on_close(struct ib_device *dev, struct ib_umem *umem) | |||
211 | */ | 211 | */ |
212 | 212 | ||
213 | work = kmalloc(sizeof *work, GFP_KERNEL); | 213 | work = kmalloc(sizeof *work, GFP_KERNEL); |
214 | if (!work) | 214 | if (!work) { |
215 | mmput(mm); | ||
215 | return; | 216 | return; |
217 | } | ||
216 | 218 | ||
217 | INIT_WORK(&work->work, ib_umem_account, work); | 219 | INIT_WORK(&work->work, ib_umem_account, work); |
218 | work->mm = mm; | 220 | work->mm = mm; |
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 398add4d4cb1..dddcdae736ac 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -116,10 +116,9 @@ static int __devinit ipath_init_one(struct pci_dev *, | |||
116 | #define PCI_DEVICE_ID_INFINIPATH_PE800 0x10 | 116 | #define PCI_DEVICE_ID_INFINIPATH_PE800 0x10 |
117 | 117 | ||
118 | static const struct pci_device_id ipath_pci_tbl[] = { | 118 | static const struct pci_device_id ipath_pci_tbl[] = { |
119 | {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, | 119 | { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) }, |
120 | PCI_DEVICE_ID_INFINIPATH_HT)}, | 120 | { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) }, |
121 | {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, | 121 | { 0, } |
122 | PCI_DEVICE_ID_INFINIPATH_PE800)}, | ||
123 | }; | 122 | }; |
124 | 123 | ||
125 | MODULE_DEVICE_TABLE(pci, ipath_pci_tbl); | 124 | MODULE_DEVICE_TABLE(pci, ipath_pci_tbl); |
@@ -1906,19 +1905,19 @@ static void __exit infinipath_cleanup(void) | |||
1906 | } else | 1905 | } else |
1907 | ipath_dbg("irq is 0, not doing free_irq " | 1906 | ipath_dbg("irq is 0, not doing free_irq " |
1908 | "for unit %u\n", dd->ipath_unit); | 1907 | "for unit %u\n", dd->ipath_unit); |
1909 | dd->pcidev = NULL; | ||
1910 | } | ||
1911 | 1908 | ||
1912 | /* | 1909 | /* |
1913 | * we check for NULL here, because it's outside the kregbase | 1910 | * we check for NULL here, because it's outside |
1914 | * check, and we need to call it after the free_irq. Thus | 1911 | * the kregbase check, and we need to call it |
1915 | * it's possible that the function pointers were never | 1912 | * after the free_irq. Thus it's possible that |
1916 | * initialized. | 1913 | * the function pointers were never initialized. |
1917 | */ | 1914 | */ |
1918 | if (dd->ipath_f_cleanup) | 1915 | if (dd->ipath_f_cleanup) |
1919 | /* clean up chip-specific stuff */ | 1916 | /* clean up chip-specific stuff */ |
1920 | dd->ipath_f_cleanup(dd); | 1917 | dd->ipath_f_cleanup(dd); |
1921 | 1918 | ||
1919 | dd->pcidev = NULL; | ||
1920 | } | ||
1922 | spin_lock_irqsave(&ipath_devs_lock, flags); | 1921 | spin_lock_irqsave(&ipath_devs_lock, flags); |
1923 | } | 1922 | } |
1924 | 1923 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c index f11a900e8cd7..a2f1ceafcca9 100644 --- a/drivers/infiniband/hw/ipath/ipath_eeprom.c +++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c | |||
@@ -505,11 +505,10 @@ static u8 flash_csum(struct ipath_flash *ifp, int adjust) | |||
505 | * ipath_get_guid - get the GUID from the i2c device | 505 | * ipath_get_guid - get the GUID from the i2c device |
506 | * @dd: the infinipath device | 506 | * @dd: the infinipath device |
507 | * | 507 | * |
508 | * When we add the multi-chip support, we will probably have to add | 508 | * We have the capability to use the ipath_nguid field, and get |
509 | * the ability to use the number of guids field, and get the guid from | 509 | * the guid from the first chip's flash, to use for all of them. |
510 | * the first chip's flash, to use for all of them. | ||
511 | */ | 510 | */ |
512 | void ipath_get_guid(struct ipath_devdata *dd) | 511 | void ipath_get_eeprom_info(struct ipath_devdata *dd) |
513 | { | 512 | { |
514 | void *buf; | 513 | void *buf; |
515 | struct ipath_flash *ifp; | 514 | struct ipath_flash *ifp; |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index c347191f02bf..ada267e41f6c 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -139,7 +139,7 @@ static int ipath_get_base_info(struct ipath_portdata *pd, | |||
139 | kinfo->spi_piosize = dd->ipath_ibmaxlen; | 139 | kinfo->spi_piosize = dd->ipath_ibmaxlen; |
140 | kinfo->spi_mtu = dd->ipath_ibmaxlen; /* maxlen, not ibmtu */ | 140 | kinfo->spi_mtu = dd->ipath_ibmaxlen; /* maxlen, not ibmtu */ |
141 | kinfo->spi_port = pd->port_port; | 141 | kinfo->spi_port = pd->port_port; |
142 | kinfo->spi_sw_version = IPATH_USER_SWVERSION; | 142 | kinfo->spi_sw_version = IPATH_KERN_SWVERSION; |
143 | kinfo->spi_hw_version = dd->ipath_revision; | 143 | kinfo->spi_hw_version = dd->ipath_revision; |
144 | 144 | ||
145 | if (copy_to_user(ubase, kinfo, sizeof(*kinfo))) | 145 | if (copy_to_user(ubase, kinfo, sizeof(*kinfo))) |
@@ -1224,6 +1224,10 @@ static unsigned int ipath_poll(struct file *fp, | |||
1224 | 1224 | ||
1225 | if (tail == head) { | 1225 | if (tail == head) { |
1226 | set_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag); | 1226 | set_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag); |
1227 | if(dd->ipath_rhdrhead_intr_off) /* arm rcv interrupt */ | ||
1228 | (void)ipath_write_ureg(dd, ur_rcvhdrhead, | ||
1229 | dd->ipath_rhdrhead_intr_off | ||
1230 | | head, pd->port_port); | ||
1227 | poll_wait(fp, &pd->port_wait, pt); | 1231 | poll_wait(fp, &pd->port_wait, pt); |
1228 | 1232 | ||
1229 | if (test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) { | 1233 | if (test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) { |
diff --git a/drivers/infiniband/hw/ipath/ipath_ht400.c b/drivers/infiniband/hw/ipath/ipath_ht400.c index 4652435998f3..fac0a2b74de2 100644 --- a/drivers/infiniband/hw/ipath/ipath_ht400.c +++ b/drivers/infiniband/hw/ipath/ipath_ht400.c | |||
@@ -607,7 +607,12 @@ static int ipath_ht_boardname(struct ipath_devdata *dd, char *name, | |||
607 | case 4: /* Ponderosa is one of the bringup boards */ | 607 | case 4: /* Ponderosa is one of the bringup boards */ |
608 | n = "Ponderosa"; | 608 | n = "Ponderosa"; |
609 | break; | 609 | break; |
610 | case 5: /* HT-460 original production board */ | 610 | case 5: |
611 | /* | ||
612 | * HT-460 original production board; two production levels, with | ||
613 | * different serial number ranges. See ipath_ht_early_init() for | ||
614 | * case where we enable IPATH_GPIO_INTR for later serial # range. | ||
615 | */ | ||
611 | n = "InfiniPath_HT-460"; | 616 | n = "InfiniPath_HT-460"; |
612 | break; | 617 | break; |
613 | case 6: | 618 | case 6: |
@@ -642,7 +647,7 @@ static int ipath_ht_boardname(struct ipath_devdata *dd, char *name, | |||
642 | if (n) | 647 | if (n) |
643 | snprintf(name, namelen, "%s", n); | 648 | snprintf(name, namelen, "%s", n); |
644 | 649 | ||
645 | if (dd->ipath_majrev != 3 || dd->ipath_minrev != 2) { | 650 | if (dd->ipath_majrev != 3 || (dd->ipath_minrev < 2 || dd->ipath_minrev > 3)) { |
646 | /* | 651 | /* |
647 | * This version of the driver only supports the HT-400 | 652 | * This version of the driver only supports the HT-400 |
648 | * Rev 3.2 | 653 | * Rev 3.2 |
@@ -1520,6 +1525,18 @@ static int ipath_ht_early_init(struct ipath_devdata *dd) | |||
1520 | */ | 1525 | */ |
1521 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | 1526 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, |
1522 | INFINIPATH_S_ABORT); | 1527 | INFINIPATH_S_ABORT); |
1528 | |||
1529 | ipath_get_eeprom_info(dd); | ||
1530 | if(dd->ipath_boardrev == 5 && dd->ipath_serial[0] == '1' && | ||
1531 | dd->ipath_serial[1] == '2' && dd->ipath_serial[2] == '8') { | ||
1532 | /* | ||
1533 | * Later production HT-460 has same changes as HT-465, so | ||
1534 | * can use GPIO interrupts. They have serial #'s starting | ||
1535 | * with 128, rather than 112. | ||
1536 | */ | ||
1537 | dd->ipath_flags |= IPATH_GPIO_INTR; | ||
1538 | dd->ipath_flags &= ~IPATH_POLL_RX_INTR; | ||
1539 | } | ||
1523 | return 0; | 1540 | return 0; |
1524 | } | 1541 | } |
1525 | 1542 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index 16f640e1c16e..dc83250d26a6 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c | |||
@@ -879,7 +879,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
879 | 879 | ||
880 | done: | 880 | done: |
881 | if (!ret) { | 881 | if (!ret) { |
882 | ipath_get_guid(dd); | ||
883 | *dd->ipath_statusp |= IPATH_STATUS_CHIP_PRESENT; | 882 | *dd->ipath_statusp |= IPATH_STATUS_CHIP_PRESENT; |
884 | if (!dd->ipath_f_intrsetup(dd)) { | 883 | if (!dd->ipath_f_intrsetup(dd)) { |
885 | /* now we can enable all interrupts from the chip */ | 884 | /* now we can enable all interrupts from the chip */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index e6507f8115bc..5d92d57b6f54 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -650,7 +650,7 @@ u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32 *); | |||
650 | void ipath_init_pe800_funcs(struct ipath_devdata *); | 650 | void ipath_init_pe800_funcs(struct ipath_devdata *); |
651 | /* init HT-400-specific func */ | 651 | /* init HT-400-specific func */ |
652 | void ipath_init_ht400_funcs(struct ipath_devdata *); | 652 | void ipath_init_ht400_funcs(struct ipath_devdata *); |
653 | void ipath_get_guid(struct ipath_devdata *); | 653 | void ipath_get_eeprom_info(struct ipath_devdata *); |
654 | u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg); | 654 | u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg); |
655 | 655 | ||
656 | /* | 656 | /* |
diff --git a/drivers/infiniband/hw/ipath/ipath_keys.c b/drivers/infiniband/hw/ipath/ipath_keys.c index aa33b0e9f2f6..5ae8761f9dd2 100644 --- a/drivers/infiniband/hw/ipath/ipath_keys.c +++ b/drivers/infiniband/hw/ipath/ipath_keys.c | |||
@@ -136,9 +136,7 @@ int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge, | |||
136 | ret = 1; | 136 | ret = 1; |
137 | goto bail; | 137 | goto bail; |
138 | } | 138 | } |
139 | spin_lock(&rkt->lock); | ||
140 | mr = rkt->table[(sge->lkey >> (32 - ib_ipath_lkey_table_size))]; | 139 | mr = rkt->table[(sge->lkey >> (32 - ib_ipath_lkey_table_size))]; |
141 | spin_unlock(&rkt->lock); | ||
142 | if (unlikely(mr == NULL || mr->lkey != sge->lkey)) { | 140 | if (unlikely(mr == NULL || mr->lkey != sge->lkey)) { |
143 | ret = 0; | 141 | ret = 0; |
144 | goto bail; | 142 | goto bail; |
@@ -184,8 +182,6 @@ bail: | |||
184 | * @acc: access flags | 182 | * @acc: access flags |
185 | * | 183 | * |
186 | * Return 1 if successful, otherwise 0. | 184 | * Return 1 if successful, otherwise 0. |
187 | * | ||
188 | * The QP r_rq.lock should be held. | ||
189 | */ | 185 | */ |
190 | int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, | 186 | int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, |
191 | u32 len, u64 vaddr, u32 rkey, int acc) | 187 | u32 len, u64 vaddr, u32 rkey, int acc) |
@@ -196,9 +192,7 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, | |||
196 | size_t off; | 192 | size_t off; |
197 | int ret; | 193 | int ret; |
198 | 194 | ||
199 | spin_lock(&rkt->lock); | ||
200 | mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))]; | 195 | mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))]; |
201 | spin_unlock(&rkt->lock); | ||
202 | if (unlikely(mr == NULL || mr->lkey != rkey)) { | 196 | if (unlikely(mr == NULL || mr->lkey != rkey)) { |
203 | ret = 0; | 197 | ret = 0; |
204 | goto bail; | 198 | goto bail; |
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c index 9cb5258ffed9..9ec4ac77b87f 100644 --- a/drivers/infiniband/hw/ipath/ipath_layer.c +++ b/drivers/infiniband/hw/ipath/ipath_layer.c | |||
@@ -872,12 +872,13 @@ static void copy_io(u32 __iomem *piobuf, struct ipath_sge_state *ss, | |||
872 | update_sge(ss, len); | 872 | update_sge(ss, len); |
873 | length -= len; | 873 | length -= len; |
874 | } | 874 | } |
875 | /* Update address before sending packet. */ | ||
876 | update_sge(ss, length); | ||
875 | /* must flush early everything before trigger word */ | 877 | /* must flush early everything before trigger word */ |
876 | ipath_flush_wc(); | 878 | ipath_flush_wc(); |
877 | __raw_writel(last, piobuf); | 879 | __raw_writel(last, piobuf); |
878 | /* be sure trigger word is written */ | 880 | /* be sure trigger word is written */ |
879 | ipath_flush_wc(); | 881 | ipath_flush_wc(); |
880 | update_sge(ss, length); | ||
881 | } | 882 | } |
882 | 883 | ||
883 | /** | 884 | /** |
@@ -943,17 +944,18 @@ int ipath_verbs_send(struct ipath_devdata *dd, u32 hdrwords, | |||
943 | if (likely(ss->num_sge == 1 && len <= ss->sge.length && | 944 | if (likely(ss->num_sge == 1 && len <= ss->sge.length && |
944 | !((unsigned long)ss->sge.vaddr & (sizeof(u32) - 1)))) { | 945 | !((unsigned long)ss->sge.vaddr & (sizeof(u32) - 1)))) { |
945 | u32 w; | 946 | u32 w; |
947 | u32 *addr = (u32 *) ss->sge.vaddr; | ||
946 | 948 | ||
949 | /* Update address before sending packet. */ | ||
950 | update_sge(ss, len); | ||
947 | /* Need to round up for the last dword in the packet. */ | 951 | /* Need to round up for the last dword in the packet. */ |
948 | w = (len + 3) >> 2; | 952 | w = (len + 3) >> 2; |
949 | __iowrite32_copy(piobuf, ss->sge.vaddr, w - 1); | 953 | __iowrite32_copy(piobuf, addr, w - 1); |
950 | /* must flush early everything before trigger word */ | 954 | /* must flush early everything before trigger word */ |
951 | ipath_flush_wc(); | 955 | ipath_flush_wc(); |
952 | __raw_writel(((u32 *) ss->sge.vaddr)[w - 1], | 956 | __raw_writel(addr[w - 1], piobuf + w - 1); |
953 | piobuf + w - 1); | ||
954 | /* be sure trigger word is written */ | 957 | /* be sure trigger word is written */ |
955 | ipath_flush_wc(); | 958 | ipath_flush_wc(); |
956 | update_sge(ss, len); | ||
957 | ret = 0; | 959 | ret = 0; |
958 | goto bail; | 960 | goto bail; |
959 | } | 961 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_pe800.c b/drivers/infiniband/hw/ipath/ipath_pe800.c index 6318067ab5ec..02e8c75b24f6 100644 --- a/drivers/infiniband/hw/ipath/ipath_pe800.c +++ b/drivers/infiniband/hw/ipath/ipath_pe800.c | |||
@@ -1180,6 +1180,8 @@ static int ipath_pe_early_init(struct ipath_devdata *dd) | |||
1180 | */ | 1180 | */ |
1181 | dd->ipath_rhdrhead_intr_off = 1ULL<<32; | 1181 | dd->ipath_rhdrhead_intr_off = 1ULL<<32; |
1182 | 1182 | ||
1183 | ipath_get_eeprom_info(dd); | ||
1184 | |||
1183 | return 0; | 1185 | return 0; |
1184 | } | 1186 | } |
1185 | 1187 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 18890716db1e..9f8855d970c8 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -375,10 +375,10 @@ static void ipath_error_qp(struct ipath_qp *qp) | |||
375 | 375 | ||
376 | spin_lock(&dev->pending_lock); | 376 | spin_lock(&dev->pending_lock); |
377 | /* XXX What if its already removed by the timeout code? */ | 377 | /* XXX What if its already removed by the timeout code? */ |
378 | if (qp->timerwait.next != LIST_POISON1) | 378 | if (!list_empty(&qp->timerwait)) |
379 | list_del(&qp->timerwait); | 379 | list_del_init(&qp->timerwait); |
380 | if (qp->piowait.next != LIST_POISON1) | 380 | if (!list_empty(&qp->piowait)) |
381 | list_del(&qp->piowait); | 381 | list_del_init(&qp->piowait); |
382 | spin_unlock(&dev->pending_lock); | 382 | spin_unlock(&dev->pending_lock); |
383 | 383 | ||
384 | wc.status = IB_WC_WR_FLUSH_ERR; | 384 | wc.status = IB_WC_WR_FLUSH_ERR; |
@@ -427,6 +427,7 @@ static void ipath_error_qp(struct ipath_qp *qp) | |||
427 | int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | 427 | int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
428 | int attr_mask) | 428 | int attr_mask) |
429 | { | 429 | { |
430 | struct ipath_ibdev *dev = to_idev(ibqp->device); | ||
430 | struct ipath_qp *qp = to_iqp(ibqp); | 431 | struct ipath_qp *qp = to_iqp(ibqp); |
431 | enum ib_qp_state cur_state, new_state; | 432 | enum ib_qp_state cur_state, new_state; |
432 | unsigned long flags; | 433 | unsigned long flags; |
@@ -443,6 +444,19 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
443 | attr_mask)) | 444 | attr_mask)) |
444 | goto inval; | 445 | goto inval; |
445 | 446 | ||
447 | if (attr_mask & IB_QP_AV) | ||
448 | if (attr->ah_attr.dlid == 0 || | ||
449 | attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE) | ||
450 | goto inval; | ||
451 | |||
452 | if (attr_mask & IB_QP_PKEY_INDEX) | ||
453 | if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd)) | ||
454 | goto inval; | ||
455 | |||
456 | if (attr_mask & IB_QP_MIN_RNR_TIMER) | ||
457 | if (attr->min_rnr_timer > 31) | ||
458 | goto inval; | ||
459 | |||
446 | switch (new_state) { | 460 | switch (new_state) { |
447 | case IB_QPS_RESET: | 461 | case IB_QPS_RESET: |
448 | ipath_reset_qp(qp); | 462 | ipath_reset_qp(qp); |
@@ -457,13 +471,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
457 | 471 | ||
458 | } | 472 | } |
459 | 473 | ||
460 | if (attr_mask & IB_QP_PKEY_INDEX) { | 474 | if (attr_mask & IB_QP_PKEY_INDEX) |
461 | struct ipath_ibdev *dev = to_idev(ibqp->device); | ||
462 | |||
463 | if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd)) | ||
464 | goto inval; | ||
465 | qp->s_pkey_index = attr->pkey_index; | 475 | qp->s_pkey_index = attr->pkey_index; |
466 | } | ||
467 | 476 | ||
468 | if (attr_mask & IB_QP_DEST_QPN) | 477 | if (attr_mask & IB_QP_DEST_QPN) |
469 | qp->remote_qpn = attr->dest_qp_num; | 478 | qp->remote_qpn = attr->dest_qp_num; |
@@ -479,12 +488,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
479 | if (attr_mask & IB_QP_ACCESS_FLAGS) | 488 | if (attr_mask & IB_QP_ACCESS_FLAGS) |
480 | qp->qp_access_flags = attr->qp_access_flags; | 489 | qp->qp_access_flags = attr->qp_access_flags; |
481 | 490 | ||
482 | if (attr_mask & IB_QP_AV) { | 491 | if (attr_mask & IB_QP_AV) |
483 | if (attr->ah_attr.dlid == 0 || | ||
484 | attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE) | ||
485 | goto inval; | ||
486 | qp->remote_ah_attr = attr->ah_attr; | 492 | qp->remote_ah_attr = attr->ah_attr; |
487 | } | ||
488 | 493 | ||
489 | if (attr_mask & IB_QP_PATH_MTU) | 494 | if (attr_mask & IB_QP_PATH_MTU) |
490 | qp->path_mtu = attr->path_mtu; | 495 | qp->path_mtu = attr->path_mtu; |
@@ -499,11 +504,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
499 | qp->s_rnr_retry_cnt = qp->s_rnr_retry; | 504 | qp->s_rnr_retry_cnt = qp->s_rnr_retry; |
500 | } | 505 | } |
501 | 506 | ||
502 | if (attr_mask & IB_QP_MIN_RNR_TIMER) { | 507 | if (attr_mask & IB_QP_MIN_RNR_TIMER) |
503 | if (attr->min_rnr_timer > 31) | ||
504 | goto inval; | ||
505 | qp->s_min_rnr_timer = attr->min_rnr_timer; | 508 | qp->s_min_rnr_timer = attr->min_rnr_timer; |
506 | } | ||
507 | 509 | ||
508 | if (attr_mask & IB_QP_QKEY) | 510 | if (attr_mask & IB_QP_QKEY) |
509 | qp->qkey = attr->qkey; | 511 | qp->qkey = attr->qkey; |
@@ -710,10 +712,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
710 | init_attr->qp_type == IB_QPT_RC ? | 712 | init_attr->qp_type == IB_QPT_RC ? |
711 | ipath_do_rc_send : ipath_do_uc_send, | 713 | ipath_do_rc_send : ipath_do_uc_send, |
712 | (unsigned long)qp); | 714 | (unsigned long)qp); |
713 | qp->piowait.next = LIST_POISON1; | 715 | INIT_LIST_HEAD(&qp->piowait); |
714 | qp->piowait.prev = LIST_POISON2; | 716 | INIT_LIST_HEAD(&qp->timerwait); |
715 | qp->timerwait.next = LIST_POISON1; | ||
716 | qp->timerwait.prev = LIST_POISON2; | ||
717 | qp->state = IB_QPS_RESET; | 717 | qp->state = IB_QPS_RESET; |
718 | qp->s_wq = swq; | 718 | qp->s_wq = swq; |
719 | qp->s_size = init_attr->cap.max_send_wr + 1; | 719 | qp->s_size = init_attr->cap.max_send_wr + 1; |
@@ -734,7 +734,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
734 | ipath_reset_qp(qp); | 734 | ipath_reset_qp(qp); |
735 | 735 | ||
736 | /* Tell the core driver that the kernel SMA is present. */ | 736 | /* Tell the core driver that the kernel SMA is present. */ |
737 | if (qp->ibqp.qp_type == IB_QPT_SMI) | 737 | if (init_attr->qp_type == IB_QPT_SMI) |
738 | ipath_layer_set_verbs_flags(dev->dd, | 738 | ipath_layer_set_verbs_flags(dev->dd, |
739 | IPATH_VERBS_KERNEL_SMA); | 739 | IPATH_VERBS_KERNEL_SMA); |
740 | break; | 740 | break; |
@@ -783,10 +783,10 @@ int ipath_destroy_qp(struct ib_qp *ibqp) | |||
783 | 783 | ||
784 | /* Make sure the QP isn't on the timeout list. */ | 784 | /* Make sure the QP isn't on the timeout list. */ |
785 | spin_lock_irqsave(&dev->pending_lock, flags); | 785 | spin_lock_irqsave(&dev->pending_lock, flags); |
786 | if (qp->timerwait.next != LIST_POISON1) | 786 | if (!list_empty(&qp->timerwait)) |
787 | list_del(&qp->timerwait); | 787 | list_del_init(&qp->timerwait); |
788 | if (qp->piowait.next != LIST_POISON1) | 788 | if (!list_empty(&qp->piowait)) |
789 | list_del(&qp->piowait); | 789 | list_del_init(&qp->piowait); |
790 | spin_unlock_irqrestore(&dev->pending_lock, flags); | 790 | spin_unlock_irqrestore(&dev->pending_lock, flags); |
791 | 791 | ||
792 | /* | 792 | /* |
@@ -855,10 +855,10 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc) | |||
855 | 855 | ||
856 | spin_lock(&dev->pending_lock); | 856 | spin_lock(&dev->pending_lock); |
857 | /* XXX What if its already removed by the timeout code? */ | 857 | /* XXX What if its already removed by the timeout code? */ |
858 | if (qp->timerwait.next != LIST_POISON1) | 858 | if (!list_empty(&qp->timerwait)) |
859 | list_del(&qp->timerwait); | 859 | list_del_init(&qp->timerwait); |
860 | if (qp->piowait.next != LIST_POISON1) | 860 | if (!list_empty(&qp->piowait)) |
861 | list_del(&qp->piowait); | 861 | list_del_init(&qp->piowait); |
862 | spin_unlock(&dev->pending_lock); | 862 | spin_unlock(&dev->pending_lock); |
863 | 863 | ||
864 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1); | 864 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1); |
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index a4055ca00614..493b1821a934 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c | |||
@@ -57,7 +57,7 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe) | |||
57 | qp->s_len = wqe->length - len; | 57 | qp->s_len = wqe->length - len; |
58 | dev = to_idev(qp->ibqp.device); | 58 | dev = to_idev(qp->ibqp.device); |
59 | spin_lock(&dev->pending_lock); | 59 | spin_lock(&dev->pending_lock); |
60 | if (qp->timerwait.next == LIST_POISON1) | 60 | if (list_empty(&qp->timerwait)) |
61 | list_add_tail(&qp->timerwait, | 61 | list_add_tail(&qp->timerwait, |
62 | &dev->pending[dev->pending_index]); | 62 | &dev->pending[dev->pending_index]); |
63 | spin_unlock(&dev->pending_lock); | 63 | spin_unlock(&dev->pending_lock); |
@@ -356,7 +356,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, | |||
356 | if ((int)(qp->s_psn - qp->s_next_psn) > 0) | 356 | if ((int)(qp->s_psn - qp->s_next_psn) > 0) |
357 | qp->s_next_psn = qp->s_psn; | 357 | qp->s_next_psn = qp->s_psn; |
358 | spin_lock(&dev->pending_lock); | 358 | spin_lock(&dev->pending_lock); |
359 | if (qp->timerwait.next == LIST_POISON1) | 359 | if (list_empty(&qp->timerwait)) |
360 | list_add_tail(&qp->timerwait, | 360 | list_add_tail(&qp->timerwait, |
361 | &dev->pending[dev->pending_index]); | 361 | &dev->pending[dev->pending_index]); |
362 | spin_unlock(&dev->pending_lock); | 362 | spin_unlock(&dev->pending_lock); |
@@ -726,8 +726,8 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc) | |||
726 | */ | 726 | */ |
727 | dev = to_idev(qp->ibqp.device); | 727 | dev = to_idev(qp->ibqp.device); |
728 | spin_lock(&dev->pending_lock); | 728 | spin_lock(&dev->pending_lock); |
729 | if (qp->timerwait.next != LIST_POISON1) | 729 | if (!list_empty(&qp->timerwait)) |
730 | list_del(&qp->timerwait); | 730 | list_del_init(&qp->timerwait); |
731 | spin_unlock(&dev->pending_lock); | 731 | spin_unlock(&dev->pending_lock); |
732 | 732 | ||
733 | if (wqe->wr.opcode == IB_WR_RDMA_READ) | 733 | if (wqe->wr.opcode == IB_WR_RDMA_READ) |
@@ -886,8 +886,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode) | |||
886 | * just won't find anything to restart if we ACK everything. | 886 | * just won't find anything to restart if we ACK everything. |
887 | */ | 887 | */ |
888 | spin_lock(&dev->pending_lock); | 888 | spin_lock(&dev->pending_lock); |
889 | if (qp->timerwait.next != LIST_POISON1) | 889 | if (!list_empty(&qp->timerwait)) |
890 | list_del(&qp->timerwait); | 890 | list_del_init(&qp->timerwait); |
891 | spin_unlock(&dev->pending_lock); | 891 | spin_unlock(&dev->pending_lock); |
892 | 892 | ||
893 | /* | 893 | /* |
@@ -1194,8 +1194,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, | |||
1194 | IB_WR_RDMA_READ)) | 1194 | IB_WR_RDMA_READ)) |
1195 | goto ack_done; | 1195 | goto ack_done; |
1196 | spin_lock(&dev->pending_lock); | 1196 | spin_lock(&dev->pending_lock); |
1197 | if (qp->s_rnr_timeout == 0 && | 1197 | if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait)) |
1198 | qp->timerwait.next != LIST_POISON1) | ||
1199 | list_move_tail(&qp->timerwait, | 1198 | list_move_tail(&qp->timerwait, |
1200 | &dev->pending[dev->pending_index]); | 1199 | &dev->pending[dev->pending_index]); |
1201 | spin_unlock(&dev->pending_lock); | 1200 | spin_unlock(&dev->pending_lock); |
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c index eb81424b3c5b..d38f4f3cfd1d 100644 --- a/drivers/infiniband/hw/ipath/ipath_ruc.c +++ b/drivers/infiniband/hw/ipath/ipath_ruc.c | |||
@@ -435,7 +435,7 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev) | |||
435 | unsigned long flags; | 435 | unsigned long flags; |
436 | 436 | ||
437 | spin_lock_irqsave(&dev->pending_lock, flags); | 437 | spin_lock_irqsave(&dev->pending_lock, flags); |
438 | if (qp->piowait.next == LIST_POISON1) | 438 | if (list_empty(&qp->piowait)) |
439 | list_add_tail(&qp->piowait, &dev->piowait); | 439 | list_add_tail(&qp->piowait, &dev->piowait); |
440 | spin_unlock_irqrestore(&dev->pending_lock, flags); | 440 | spin_unlock_irqrestore(&dev->pending_lock, flags); |
441 | /* | 441 | /* |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index cb9e387c301f..28fdbdaa789d 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -464,7 +464,7 @@ static void ipath_ib_timer(void *arg) | |||
464 | last = &dev->pending[dev->pending_index]; | 464 | last = &dev->pending[dev->pending_index]; |
465 | while (!list_empty(last)) { | 465 | while (!list_empty(last)) { |
466 | qp = list_entry(last->next, struct ipath_qp, timerwait); | 466 | qp = list_entry(last->next, struct ipath_qp, timerwait); |
467 | list_del(&qp->timerwait); | 467 | list_del_init(&qp->timerwait); |
468 | qp->timer_next = resend; | 468 | qp->timer_next = resend; |
469 | resend = qp; | 469 | resend = qp; |
470 | atomic_inc(&qp->refcount); | 470 | atomic_inc(&qp->refcount); |
@@ -474,7 +474,7 @@ static void ipath_ib_timer(void *arg) | |||
474 | qp = list_entry(last->next, struct ipath_qp, timerwait); | 474 | qp = list_entry(last->next, struct ipath_qp, timerwait); |
475 | if (--qp->s_rnr_timeout == 0) { | 475 | if (--qp->s_rnr_timeout == 0) { |
476 | do { | 476 | do { |
477 | list_del(&qp->timerwait); | 477 | list_del_init(&qp->timerwait); |
478 | tasklet_hi_schedule(&qp->s_task); | 478 | tasklet_hi_schedule(&qp->s_task); |
479 | if (list_empty(last)) | 479 | if (list_empty(last)) |
480 | break; | 480 | break; |
@@ -554,7 +554,7 @@ static int ipath_ib_piobufavail(void *arg) | |||
554 | while (!list_empty(&dev->piowait)) { | 554 | while (!list_empty(&dev->piowait)) { |
555 | qp = list_entry(dev->piowait.next, struct ipath_qp, | 555 | qp = list_entry(dev->piowait.next, struct ipath_qp, |
556 | piowait); | 556 | piowait); |
557 | list_del(&qp->piowait); | 557 | list_del_init(&qp->piowait); |
558 | tasklet_hi_schedule(&qp->s_task); | 558 | tasklet_hi_schedule(&qp->s_task); |
559 | } | 559 | } |
560 | spin_unlock_irqrestore(&dev->pending_lock, flags); | 560 | spin_unlock_irqrestore(&dev->pending_lock, flags); |
@@ -951,6 +951,7 @@ static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd) | |||
951 | idev->dd = dd; | 951 | idev->dd = dd; |
952 | 952 | ||
953 | strlcpy(dev->name, "ipath%d", IB_DEVICE_NAME_MAX); | 953 | strlcpy(dev->name, "ipath%d", IB_DEVICE_NAME_MAX); |
954 | dev->owner = THIS_MODULE; | ||
954 | dev->node_guid = ipath_layer_get_guid(dd); | 955 | dev->node_guid = ipath_layer_get_guid(dd); |
955 | dev->uverbs_abi_ver = IPATH_UVERBS_ABI_VERSION; | 956 | dev->uverbs_abi_ver = IPATH_UVERBS_ABI_VERSION; |
956 | dev->uverbs_cmd_mask = | 957 | dev->uverbs_cmd_mask = |
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index 1985b5dfa481..798e13e14faf 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -182,7 +182,7 @@ struct mthca_cmd_context { | |||
182 | u8 status; | 182 | u8 status; |
183 | }; | 183 | }; |
184 | 184 | ||
185 | static int fw_cmd_doorbell = 1; | 185 | static int fw_cmd_doorbell = 0; |
186 | module_param(fw_cmd_doorbell, int, 0644); | 186 | module_param(fw_cmd_doorbell, int, 0644); |
187 | MODULE_PARM_DESC(fw_cmd_doorbell, "post FW commands through doorbell page if nonzero " | 187 | MODULE_PARM_DESC(fw_cmd_doorbell, "post FW commands through doorbell page if nonzero " |
188 | "(and supported by FW)"); | 188 | "(and supported by FW)"); |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 19765f6f8d58..07c13be07a4a 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1727,23 +1727,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1727 | 1727 | ||
1728 | ind = qp->rq.next_ind; | 1728 | ind = qp->rq.next_ind; |
1729 | 1729 | ||
1730 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 1730 | for (nreq = 0; wr; wr = wr->next) { |
1731 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
1732 | nreq = 0; | ||
1733 | |||
1734 | doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); | ||
1735 | doorbell[1] = cpu_to_be32(qp->qpn << 8); | ||
1736 | |||
1737 | wmb(); | ||
1738 | |||
1739 | mthca_write64(doorbell, | ||
1740 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
1741 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
1742 | |||
1743 | qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB; | ||
1744 | size0 = 0; | ||
1745 | } | ||
1746 | |||
1747 | if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) { | 1731 | if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) { |
1748 | mthca_err(dev, "RQ %06x full (%u head, %u tail," | 1732 | mthca_err(dev, "RQ %06x full (%u head, %u tail," |
1749 | " %d max, %d nreq)\n", qp->qpn, | 1733 | " %d max, %d nreq)\n", qp->qpn, |
@@ -1797,6 +1781,23 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1797 | ++ind; | 1781 | ++ind; |
1798 | if (unlikely(ind >= qp->rq.max)) | 1782 | if (unlikely(ind >= qp->rq.max)) |
1799 | ind -= qp->rq.max; | 1783 | ind -= qp->rq.max; |
1784 | |||
1785 | ++nreq; | ||
1786 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
1787 | nreq = 0; | ||
1788 | |||
1789 | doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0); | ||
1790 | doorbell[1] = cpu_to_be32(qp->qpn << 8); | ||
1791 | |||
1792 | wmb(); | ||
1793 | |||
1794 | mthca_write64(doorbell, | ||
1795 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
1796 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
1797 | |||
1798 | qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB; | ||
1799 | size0 = 0; | ||
1800 | } | ||
1800 | } | 1801 | } |
1801 | 1802 | ||
1802 | out: | 1803 | out: |
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 1ea433291fa7..b292fefa3b41 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -490,26 +490,7 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
490 | 490 | ||
491 | first_ind = srq->first_free; | 491 | first_ind = srq->first_free; |
492 | 492 | ||
493 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 493 | for (nreq = 0; wr; wr = wr->next) { |
494 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
495 | nreq = 0; | ||
496 | |||
497 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | ||
498 | doorbell[1] = cpu_to_be32(srq->srqn << 8); | ||
499 | |||
500 | /* | ||
501 | * Make sure that descriptors are written | ||
502 | * before doorbell is rung. | ||
503 | */ | ||
504 | wmb(); | ||
505 | |||
506 | mthca_write64(doorbell, | ||
507 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
508 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
509 | |||
510 | first_ind = srq->first_free; | ||
511 | } | ||
512 | |||
513 | ind = srq->first_free; | 494 | ind = srq->first_free; |
514 | 495 | ||
515 | if (ind < 0) { | 496 | if (ind < 0) { |
@@ -569,6 +550,26 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
569 | 550 | ||
570 | srq->wrid[ind] = wr->wr_id; | 551 | srq->wrid[ind] = wr->wr_id; |
571 | srq->first_free = next_ind; | 552 | srq->first_free = next_ind; |
553 | |||
554 | ++nreq; | ||
555 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
556 | nreq = 0; | ||
557 | |||
558 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | ||
559 | doorbell[1] = cpu_to_be32(srq->srqn << 8); | ||
560 | |||
561 | /* | ||
562 | * Make sure that descriptors are written | ||
563 | * before doorbell is rung. | ||
564 | */ | ||
565 | wmb(); | ||
566 | |||
567 | mthca_write64(doorbell, | ||
568 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
569 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
570 | |||
571 | first_ind = srq->first_free; | ||
572 | } | ||
572 | } | 573 | } |
573 | 574 | ||
574 | if (likely(nreq)) { | 575 | if (likely(nreq)) { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index a54da42849ae..8406839b91cf 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -275,6 +275,7 @@ static void ipoib_ib_handle_wc(struct net_device *dev, | |||
275 | spin_lock_irqsave(&priv->tx_lock, flags); | 275 | spin_lock_irqsave(&priv->tx_lock, flags); |
276 | ++priv->tx_tail; | 276 | ++priv->tx_tail; |
277 | if (netif_queue_stopped(dev) && | 277 | if (netif_queue_stopped(dev) && |
278 | test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags) && | ||
278 | priv->tx_head - priv->tx_tail <= ipoib_sendq_size >> 1) | 279 | priv->tx_head - priv->tx_tail <= ipoib_sendq_size >> 1) |
279 | netif_wake_queue(dev); | 280 | netif_wake_queue(dev); |
280 | spin_unlock_irqrestore(&priv->tx_lock, flags); | 281 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index c32ce4348e1b..9cbdffa08dc2 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -340,7 +340,10 @@ static void srp_disconnect_target(struct srp_target_port *target) | |||
340 | /* XXX should send SRP_I_LOGOUT request */ | 340 | /* XXX should send SRP_I_LOGOUT request */ |
341 | 341 | ||
342 | init_completion(&target->done); | 342 | init_completion(&target->done); |
343 | ib_send_cm_dreq(target->cm_id, NULL, 0); | 343 | if (ib_send_cm_dreq(target->cm_id, NULL, 0)) { |
344 | printk(KERN_DEBUG PFX "Sending CM DREQ failed\n"); | ||
345 | return; | ||
346 | } | ||
344 | wait_for_completion(&target->done); | 347 | wait_for_completion(&target->done); |
345 | } | 348 | } |
346 | 349 | ||
@@ -351,7 +354,6 @@ static void srp_remove_work(void *target_ptr) | |||
351 | spin_lock_irq(target->scsi_host->host_lock); | 354 | spin_lock_irq(target->scsi_host->host_lock); |
352 | if (target->state != SRP_TARGET_DEAD) { | 355 | if (target->state != SRP_TARGET_DEAD) { |
353 | spin_unlock_irq(target->scsi_host->host_lock); | 356 | spin_unlock_irq(target->scsi_host->host_lock); |
354 | scsi_host_put(target->scsi_host); | ||
355 | return; | 357 | return; |
356 | } | 358 | } |
357 | target->state = SRP_TARGET_REMOVED; | 359 | target->state = SRP_TARGET_REMOVED; |
@@ -365,8 +367,6 @@ static void srp_remove_work(void *target_ptr) | |||
365 | ib_destroy_cm_id(target->cm_id); | 367 | ib_destroy_cm_id(target->cm_id); |
366 | srp_free_target_ib(target); | 368 | srp_free_target_ib(target); |
367 | scsi_host_put(target->scsi_host); | 369 | scsi_host_put(target->scsi_host); |
368 | /* And another put to really free the target port... */ | ||
369 | scsi_host_put(target->scsi_host); | ||
370 | } | 370 | } |
371 | 371 | ||
372 | static int srp_connect_target(struct srp_target_port *target) | 372 | static int srp_connect_target(struct srp_target_port *target) |
@@ -1241,7 +1241,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) | |||
1241 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) | 1241 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) |
1242 | if (req->scmnd->device == scmnd->device) { | 1242 | if (req->scmnd->device == scmnd->device) { |
1243 | req->scmnd->result = DID_RESET << 16; | 1243 | req->scmnd->result = DID_RESET << 16; |
1244 | scmnd->scsi_done(scmnd); | 1244 | req->scmnd->scsi_done(req->scmnd); |
1245 | srp_remove_req(target, req); | 1245 | srp_remove_req(target, req); |
1246 | } | 1246 | } |
1247 | 1247 | ||
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c index 2b2ec1057dee..95c0de7964a0 100644 --- a/drivers/input/joystick/sidewinder.c +++ b/drivers/input/joystick/sidewinder.c | |||
@@ -589,7 +589,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
589 | struct sw *sw; | 589 | struct sw *sw; |
590 | struct input_dev *input_dev; | 590 | struct input_dev *input_dev; |
591 | int i, j, k, l; | 591 | int i, j, k, l; |
592 | int err; | 592 | int err = 0; |
593 | unsigned char *buf = NULL; /* [SW_LENGTH] */ | 593 | unsigned char *buf = NULL; /* [SW_LENGTH] */ |
594 | unsigned char *idbuf = NULL; /* [SW_LENGTH] */ | 594 | unsigned char *idbuf = NULL; /* [SW_LENGTH] */ |
595 | unsigned char m = 1; | 595 | unsigned char m = 1; |
@@ -776,7 +776,10 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
776 | goto fail4; | 776 | goto fail4; |
777 | } | 777 | } |
778 | 778 | ||
779 | return 0; | 779 | out: kfree(buf); |
780 | kfree(idbuf); | ||
781 | |||
782 | return err; | ||
780 | 783 | ||
781 | fail4: input_free_device(sw->dev[i]); | 784 | fail4: input_free_device(sw->dev[i]); |
782 | fail3: while (--i >= 0) | 785 | fail3: while (--i >= 0) |
@@ -784,9 +787,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
784 | fail2: gameport_close(gameport); | 787 | fail2: gameport_close(gameport); |
785 | fail1: gameport_set_drvdata(gameport, NULL); | 788 | fail1: gameport_set_drvdata(gameport, NULL); |
786 | kfree(sw); | 789 | kfree(sw); |
787 | kfree(buf); | 790 | goto out; |
788 | kfree(idbuf); | ||
789 | return err; | ||
790 | } | 791 | } |
791 | 792 | ||
792 | static void sw_disconnect(struct gameport *gameport) | 793 | static void sw_disconnect(struct gameport *gameport) |
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index 96c6bf77248a..1f0e720267d7 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -245,9 +245,9 @@ static void corgikbd_hinge_timer(unsigned long data) | |||
245 | if (hinge_count >= HINGE_STABLE_COUNT) { | 245 | if (hinge_count >= HINGE_STABLE_COUNT) { |
246 | spin_lock_irqsave(&corgikbd_data->lock, flags); | 246 | spin_lock_irqsave(&corgikbd_data->lock, flags); |
247 | 247 | ||
248 | input_report_switch(corgikbd_data->input, SW_0, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0)); | 248 | input_report_switch(corgikbd_data->input, SW_LID, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0)); |
249 | input_report_switch(corgikbd_data->input, SW_1, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0)); | 249 | input_report_switch(corgikbd_data->input, SW_TABLET_MODE, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0)); |
250 | input_report_switch(corgikbd_data->input, SW_2, (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0)); | 250 | input_report_switch(corgikbd_data->input, SW_HEADPHONE_INSERT, (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0)); |
251 | input_sync(corgikbd_data->input); | 251 | input_sync(corgikbd_data->input); |
252 | 252 | ||
253 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); | 253 | spin_unlock_irqrestore(&corgikbd_data->lock, flags); |
@@ -340,9 +340,9 @@ static int __init corgikbd_probe(struct platform_device *pdev) | |||
340 | for (i = 0; i < ARRAY_SIZE(corgikbd_keycode); i++) | 340 | for (i = 0; i < ARRAY_SIZE(corgikbd_keycode); i++) |
341 | set_bit(corgikbd->keycode[i], input_dev->keybit); | 341 | set_bit(corgikbd->keycode[i], input_dev->keybit); |
342 | clear_bit(0, input_dev->keybit); | 342 | clear_bit(0, input_dev->keybit); |
343 | set_bit(SW_0, input_dev->swbit); | 343 | set_bit(SW_LID, input_dev->swbit); |
344 | set_bit(SW_1, input_dev->swbit); | 344 | set_bit(SW_TABLET_MODE, input_dev->swbit); |
345 | set_bit(SW_2, input_dev->swbit); | 345 | set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); |
346 | 346 | ||
347 | input_register_device(corgikbd->input); | 347 | input_register_device(corgikbd->input); |
348 | 348 | ||
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 1d238a9d52d6..c5d03fb77bcb 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -299,9 +299,9 @@ static void spitzkbd_hinge_timer(unsigned long data) | |||
299 | if (hinge_count >= HINGE_STABLE_COUNT) { | 299 | if (hinge_count >= HINGE_STABLE_COUNT) { |
300 | spin_lock_irqsave(&spitzkbd_data->lock, flags); | 300 | spin_lock_irqsave(&spitzkbd_data->lock, flags); |
301 | 301 | ||
302 | input_report_switch(spitzkbd_data->input, SW_0, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0)); | 302 | input_report_switch(spitzkbd_data->input, SW_LID, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0)); |
303 | input_report_switch(spitzkbd_data->input, SW_1, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0)); | 303 | input_report_switch(spitzkbd_data->input, SW_TABLET_MODE, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0)); |
304 | input_report_switch(spitzkbd_data->input, SW_2, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0)); | 304 | input_report_switch(spitzkbd_data->input, SW_HEADPHONE_INSERT, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0)); |
305 | input_sync(spitzkbd_data->input); | 305 | input_sync(spitzkbd_data->input); |
306 | 306 | ||
307 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); | 307 | spin_unlock_irqrestore(&spitzkbd_data->lock, flags); |
@@ -398,9 +398,9 @@ static int __init spitzkbd_probe(struct platform_device *dev) | |||
398 | for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++) | 398 | for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++) |
399 | set_bit(spitzkbd->keycode[i], input_dev->keybit); | 399 | set_bit(spitzkbd->keycode[i], input_dev->keybit); |
400 | clear_bit(0, input_dev->keybit); | 400 | clear_bit(0, input_dev->keybit); |
401 | set_bit(SW_0, input_dev->swbit); | 401 | set_bit(SW_LID, input_dev->swbit); |
402 | set_bit(SW_1, input_dev->swbit); | 402 | set_bit(SW_TABLET_MODE, input_dev->swbit); |
403 | set_bit(SW_2, input_dev->swbit); | 403 | set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); |
404 | 404 | ||
405 | input_register_device(input_dev); | 405 | input_register_device(input_dev); |
406 | 406 | ||
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 36cd2e07fce8..e4e5be111c96 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -318,6 +318,16 @@ static struct key_entry keymap_acer_travelmate_240[] = { | |||
318 | { KE_END, 0 } | 318 | { KE_END, 0 } |
319 | }; | 319 | }; |
320 | 320 | ||
321 | static struct key_entry keymap_aopen_1559as[] = { | ||
322 | { KE_KEY, 0x01, KEY_HELP }, | ||
323 | { KE_KEY, 0x06, KEY_PROG3 }, | ||
324 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
325 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
326 | { KE_WIFI, 0x30, 0 }, | ||
327 | { KE_KEY, 0x31, KEY_MAIL }, | ||
328 | { KE_KEY, 0x36, KEY_WWW }, | ||
329 | }; | ||
330 | |||
321 | /* | 331 | /* |
322 | * If your machine is not here (which is currently rather likely), please send | 332 | * If your machine is not here (which is currently rather likely), please send |
323 | * a list of buttons and their key codes (reported when loading this module | 333 | * a list of buttons and their key codes (reported when loading this module |
@@ -369,6 +379,15 @@ static struct dmi_system_id dmi_ids[] = { | |||
369 | }, | 379 | }, |
370 | .driver_data = keymap_acer_travelmate_240 | 380 | .driver_data = keymap_acer_travelmate_240 |
371 | }, | 381 | }, |
382 | { | ||
383 | .callback = dmi_matched, | ||
384 | .ident = "AOpen 1559AS", | ||
385 | .matches = { | ||
386 | DMI_MATCH(DMI_PRODUCT_NAME, "E2U"), | ||
387 | DMI_MATCH(DMI_BOARD_NAME, "E2U"), | ||
388 | }, | ||
389 | .driver_data = keymap_aopen_1559as | ||
390 | }, | ||
372 | { NULL, } | 391 | { NULL, } |
373 | }; | 392 | }; |
374 | 393 | ||
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 2141501e9f2e..a0e2e797c6d5 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -100,8 +100,8 @@ static void alps_process_packet(struct psmouse *psmouse, struct pt_regs *regs) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | if (priv->i->flags & ALPS_OLDPROTO) { | 102 | if (priv->i->flags & ALPS_OLDPROTO) { |
103 | left = packet[2] & 0x08; | 103 | left = packet[2] & 0x10; |
104 | right = packet[2] & 0x10; | 104 | right = packet[2] & 0x08; |
105 | middle = 0; | 105 | middle = 0; |
106 | x = packet[1] | ((packet[0] & 0x07) << 7); | 106 | x = packet[1] | ((packet[0] & 0x07) << 7); |
107 | y = packet[4] | ((packet[3] & 0x07) << 7); | 107 | y = packet[4] | ((packet[3] & 0x07) << 7); |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 5ccc3ef3b89e..c14395ba7980 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -22,12 +22,36 @@ | |||
22 | 22 | ||
23 | static struct dmi_system_id lifebook_dmi_table[] = { | 23 | static struct dmi_system_id lifebook_dmi_table[] = { |
24 | { | 24 | { |
25 | .ident = "LifeBook B", | ||
26 | .matches = { | ||
27 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), | ||
28 | }, | ||
29 | }, | ||
30 | { | ||
25 | .ident = "Lifebook B", | 31 | .ident = "Lifebook B", |
26 | .matches = { | 32 | .matches = { |
27 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), | 33 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), |
28 | }, | 34 | }, |
29 | }, | 35 | }, |
30 | { | 36 | { |
37 | .ident = "Lifebook B213x/B2150", | ||
38 | .matches = { | ||
39 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), | ||
40 | }, | ||
41 | }, | ||
42 | { | ||
43 | .ident = "Zephyr", | ||
44 | .matches = { | ||
45 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), | ||
46 | }, | ||
47 | }, | ||
48 | { | ||
49 | .ident = "CF-18", | ||
50 | .matches = { | ||
51 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), | ||
52 | }, | ||
53 | }, | ||
54 | { | ||
31 | .ident = "Lifebook B142", | 55 | .ident = "Lifebook B142", |
32 | .matches = { | 56 | .matches = { |
33 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), | 57 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 40333d61093c..2f0d28840810 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #define PS2PP_KIND_WHEEL 1 | 19 | #define PS2PP_KIND_WHEEL 1 |
20 | #define PS2PP_KIND_MX 2 | 20 | #define PS2PP_KIND_MX 2 |
21 | #define PS2PP_KIND_TP3 3 | 21 | #define PS2PP_KIND_TP3 3 |
22 | #define PS2PP_KIND_TRACKMAN 4 | ||
22 | 23 | ||
23 | /* Logitech mouse features */ | 24 | /* Logitech mouse features */ |
24 | #define PS2PP_WHEEL 0x01 | 25 | #define PS2PP_WHEEL 0x01 |
@@ -223,6 +224,7 @@ static struct ps2pp_info *get_model_info(unsigned char model) | |||
223 | { 73, 0, PS2PP_SIDE_BTN }, | 224 | { 73, 0, PS2PP_SIDE_BTN }, |
224 | { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 225 | { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
225 | { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 226 | { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
227 | { 79, PS2PP_KIND_TRACKMAN, PS2PP_WHEEL }, /* TrackMan with wheel */ | ||
226 | { 80, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, | 228 | { 80, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, |
227 | { 81, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 229 | { 81, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
228 | { 83, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 230 | { 83, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
@@ -298,6 +300,10 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse, struct ps2pp_inf | |||
298 | psmouse->name = "TouchPad 3"; | 300 | psmouse->name = "TouchPad 3"; |
299 | break; | 301 | break; |
300 | 302 | ||
303 | case PS2PP_KIND_TRACKMAN: | ||
304 | psmouse->name = "TrackMan"; | ||
305 | break; | ||
306 | |||
301 | default: | 307 | default: |
302 | /* | 308 | /* |
303 | * Set name to "Mouse" only when using PS2++, | 309 | * Set name to "Mouse" only when using PS2++, |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 1494175ac6fe..161afddd0f44 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -36,13 +36,10 @@ | |||
36 | 36 | ||
37 | 37 | ||
38 | /* | 38 | /* |
39 | * This code has been tested on an ads7846 / N770 device. | 39 | * This code has been heavily tested on a Nokia 770, and lightly |
40 | * tested on other ads7846 devices (OSK/Mistral, Lubbock). | ||
40 | * Support for ads7843 and ads7845 has only been stubbed in. | 41 | * Support for ads7843 and ads7845 has only been stubbed in. |
41 | * | 42 | * |
42 | * Not yet done: How accurate are the temperature and voltage | ||
43 | * readings? (System-specific calibration should support | ||
44 | * accuracy of 0.3 degrees C; otherwise it's 2.0 degrees.) | ||
45 | * | ||
46 | * IRQ handling needs a workaround because of a shortcoming in handling | 43 | * IRQ handling needs a workaround because of a shortcoming in handling |
47 | * edge triggered IRQs on some platforms like the OMAP1/2. These | 44 | * edge triggered IRQs on some platforms like the OMAP1/2. These |
48 | * platforms don't handle the ARM lazy IRQ disabling properly, thus we | 45 | * platforms don't handle the ARM lazy IRQ disabling properly, thus we |
@@ -248,10 +245,13 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
248 | 245 | ||
249 | if (req->msg.status) | 246 | if (req->msg.status) |
250 | status = req->msg.status; | 247 | status = req->msg.status; |
248 | |||
249 | /* on-wire is a must-ignore bit, a BE12 value, then padding */ | ||
251 | sample = be16_to_cpu(req->sample); | 250 | sample = be16_to_cpu(req->sample); |
252 | sample = sample >> 4; | 251 | sample = sample >> 3; |
253 | kfree(req); | 252 | sample &= 0x0fff; |
254 | 253 | ||
254 | kfree(req); | ||
255 | return status ? status : sample; | 255 | return status ? status : sample; |
256 | } | 256 | } |
257 | 257 | ||
@@ -336,13 +336,13 @@ static void ads7846_rx(void *ads) | |||
336 | u16 x, y, z1, z2; | 336 | u16 x, y, z1, z2; |
337 | unsigned long flags; | 337 | unsigned long flags; |
338 | 338 | ||
339 | /* adjust: 12 bit samples (left aligned), built from | 339 | /* adjust: on-wire is a must-ignore bit, a BE12 value, then padding; |
340 | * two 8 bit values writen msb-first. | 340 | * built from two 8 bit values written msb-first. |
341 | */ | 341 | */ |
342 | x = be16_to_cpu(ts->tc.x) >> 4; | 342 | x = (be16_to_cpu(ts->tc.x) >> 3) & 0x0fff; |
343 | y = be16_to_cpu(ts->tc.y) >> 4; | 343 | y = (be16_to_cpu(ts->tc.y) >> 3) & 0x0fff; |
344 | z1 = be16_to_cpu(ts->tc.z1) >> 4; | 344 | z1 = (be16_to_cpu(ts->tc.z1) >> 3) & 0x0fff; |
345 | z2 = be16_to_cpu(ts->tc.z2) >> 4; | 345 | z2 = (be16_to_cpu(ts->tc.z2) >> 3) & 0x0fff; |
346 | 346 | ||
347 | /* range filtering */ | 347 | /* range filtering */ |
348 | if (x == MAX_12BIT) | 348 | if (x == MAX_12BIT) |
@@ -420,7 +420,7 @@ static void ads7846_debounce(void *ads) | |||
420 | 420 | ||
421 | m = &ts->msg[ts->msg_idx]; | 421 | m = &ts->msg[ts->msg_idx]; |
422 | t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list); | 422 | t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list); |
423 | val = (*(u16 *)t->rx_buf) >> 3; | 423 | val = (be16_to_cpu(*(__be16 *)t->rx_buf) >> 3) & 0x0fff; |
424 | if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) { | 424 | if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) { |
425 | /* Repeat it, if this was the first read or the read | 425 | /* Repeat it, if this was the first read or the read |
426 | * wasn't consistent enough. */ | 426 | * wasn't consistent enough. */ |
@@ -469,7 +469,7 @@ static void ads7846_timer(unsigned long handle) | |||
469 | spin_lock_irq(&ts->lock); | 469 | spin_lock_irq(&ts->lock); |
470 | 470 | ||
471 | if (unlikely(ts->msg_idx && !ts->pendown)) { | 471 | if (unlikely(ts->msg_idx && !ts->pendown)) { |
472 | /* measurment cycle ended */ | 472 | /* measurement cycle ended */ |
473 | if (!device_suspended(&ts->spi->dev)) { | 473 | if (!device_suspended(&ts->spi->dev)) { |
474 | ts->irq_disabled = 0; | 474 | ts->irq_disabled = 0; |
475 | enable_irq(ts->spi->irq); | 475 | enable_irq(ts->spi->irq); |
@@ -495,11 +495,10 @@ static irqreturn_t ads7846_irq(int irq, void *handle, struct pt_regs *regs) | |||
495 | spin_lock_irqsave(&ts->lock, flags); | 495 | spin_lock_irqsave(&ts->lock, flags); |
496 | if (likely(ts->get_pendown_state())) { | 496 | if (likely(ts->get_pendown_state())) { |
497 | if (!ts->irq_disabled) { | 497 | if (!ts->irq_disabled) { |
498 | /* REVISIT irq logic for many ARM chips has cloned a | 498 | /* The ARM do_simple_IRQ() dispatcher doesn't act |
499 | * bug wherein disabling an irq in its handler won't | 499 | * like the other dispatchers: it will report IRQs |
500 | * work;(it's disabled lazily, and too late to work. | 500 | * even after they've been disabled. We work around |
501 | * until all their irq logic is fixed, we must shadow | 501 | * that here. (The "generic irq" framework may help...) |
502 | * that state here. | ||
503 | */ | 502 | */ |
504 | ts->irq_disabled = 1; | 503 | ts->irq_disabled = 1; |
505 | disable_irq(ts->spi->irq); | 504 | disable_irq(ts->spi->irq); |
@@ -609,16 +608,20 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
609 | return -EINVAL; | 608 | return -EINVAL; |
610 | } | 609 | } |
611 | 610 | ||
611 | /* REVISIT when the irq can be triggered active-low, or if for some | ||
612 | * reason the touchscreen isn't hooked up, we don't need to access | ||
613 | * the pendown state. | ||
614 | */ | ||
612 | if (pdata->get_pendown_state == NULL) { | 615 | if (pdata->get_pendown_state == NULL) { |
613 | dev_dbg(&spi->dev, "no get_pendown_state function?\n"); | 616 | dev_dbg(&spi->dev, "no get_pendown_state function?\n"); |
614 | return -EINVAL; | 617 | return -EINVAL; |
615 | } | 618 | } |
616 | 619 | ||
617 | /* We'd set the wordsize to 12 bits ... except that some controllers | 620 | /* We'd set TX wordsize 8 bits and RX wordsize to 13 bits ... except |
618 | * will then treat the 8 bit command words as 12 bits (and drop the | 621 | * that even if the hardware can do that, the SPI controller driver |
619 | * four MSBs of the 12 bit result). Result: inputs must be shifted | 622 | * may not. So we stick to very-portable 8 bit words, both RX and TX. |
620 | * to discard the four garbage LSBs. | ||
621 | */ | 623 | */ |
624 | spi->bits_per_word = 8; | ||
622 | 625 | ||
623 | ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL); | 626 | ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL); |
624 | input_dev = input_allocate_device(); | 627 | input_dev = input_allocate_device(); |
@@ -772,7 +775,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
772 | 775 | ||
773 | if (request_irq(spi->irq, ads7846_irq, | 776 | if (request_irq(spi->irq, ads7846_irq, |
774 | SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, | 777 | SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, |
775 | spi->dev.bus_id, ts)) { | 778 | spi->dev.driver->name, ts)) { |
776 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); | 779 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); |
777 | err = -EBUSY; | 780 | err = -EBUSY; |
778 | goto err_free_mem; | 781 | goto err_free_mem; |
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 9b493f0becc4..173c899a1fb4 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -1499,7 +1499,6 @@ static int __init capi_init(void) | |||
1499 | printk(KERN_ERR "capi20: unable to get major %d\n", capi_major); | 1499 | printk(KERN_ERR "capi20: unable to get major %d\n", capi_major); |
1500 | return major_ret; | 1500 | return major_ret; |
1501 | } | 1501 | } |
1502 | capi_major = major_ret; | ||
1503 | capi_class = class_create(THIS_MODULE, "capi"); | 1502 | capi_class = class_create(THIS_MODULE, "capi"); |
1504 | if (IS_ERR(capi_class)) { | 1503 | if (IS_ERR(capi_class)) { |
1505 | unregister_chrdev(capi_major, "capi20"); | 1504 | unregister_chrdev(capi_major, "capi20"); |
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index bfb73fd5077e..d86ab68114b0 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -710,8 +710,8 @@ static int gigaset_probe(struct usb_interface *interface, | |||
710 | retval = -ENODEV; //FIXME | 710 | retval = -ENODEV; //FIXME |
711 | 711 | ||
712 | /* See if the device offered us matches what we can accept */ | 712 | /* See if the device offered us matches what we can accept */ |
713 | if ((le16_to_cpu(udev->descriptor.idVendor != USB_M105_VENDOR_ID)) || | 713 | if ((le16_to_cpu(udev->descriptor.idVendor) != USB_M105_VENDOR_ID) || |
714 | (le16_to_cpu(udev->descriptor.idProduct != USB_M105_PRODUCT_ID))) | 714 | (le16_to_cpu(udev->descriptor.idProduct) != USB_M105_PRODUCT_ID)) |
715 | return -ENODEV; | 715 | return -ENODEV; |
716 | 716 | ||
717 | /* this starts to become ascii art... */ | 717 | /* this starts to become ascii art... */ |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 3585fb1f3344..2ac90242d263 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -2880,7 +2880,7 @@ isdn_tty_cmd_ATand(char **p, modem_info * info) | |||
2880 | p[0]++; | 2880 | p[0]++; |
2881 | i = 0; | 2881 | i = 0; |
2882 | while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) && | 2882 | while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) && |
2883 | (i < ISDN_LMSNLEN)) | 2883 | (i < ISDN_LMSNLEN - 1)) |
2884 | m->lmsn[i++] = *p[0]++; | 2884 | m->lmsn[i++] = *p[0]++; |
2885 | m->lmsn[i] = '\0'; | 2885 | m->lmsn[i] = '\0'; |
2886 | break; | 2886 | break; |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 3f5b64794542..626506234b76 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -4,8 +4,11 @@ menu "LED devices" | |||
4 | config NEW_LEDS | 4 | config NEW_LEDS |
5 | bool "LED Support" | 5 | bool "LED Support" |
6 | help | 6 | help |
7 | Say Y to enable Linux LED support. This is not related to standard | 7 | Say Y to enable Linux LED support. This allows control of supported |
8 | keyboard LEDs which are controlled via the input system. | 8 | LEDs from both userspace and optionally, by kernel events (triggers). |
9 | |||
10 | This is not related to standard keyboard LEDs which are controlled | ||
11 | via the input system. | ||
9 | 12 | ||
10 | config LEDS_CLASS | 13 | config LEDS_CLASS |
11 | tristate "LED Class Support" | 14 | tristate "LED Class Support" |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index b0b5d05fadd6..c75d0ef1609c 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/sysdev.h> | 19 | #include <linux/sysdev.h> |
20 | #include <linux/timer.h> | 20 | #include <linux/timer.h> |
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | #include <linux/ctype.h> | ||
22 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
23 | #include "leds.h" | 24 | #include "leds.h" |
24 | 25 | ||
@@ -43,9 +44,13 @@ static ssize_t led_brightness_store(struct class_device *dev, | |||
43 | ssize_t ret = -EINVAL; | 44 | ssize_t ret = -EINVAL; |
44 | char *after; | 45 | char *after; |
45 | unsigned long state = simple_strtoul(buf, &after, 10); | 46 | unsigned long state = simple_strtoul(buf, &after, 10); |
47 | size_t count = after - buf; | ||
46 | 48 | ||
47 | if (after - buf > 0) { | 49 | if (*after && isspace(*after)) |
48 | ret = after - buf; | 50 | count++; |
51 | |||
52 | if (count == size) { | ||
53 | ret = count; | ||
49 | led_set_brightness(led_cdev, state); | 54 | led_set_brightness(led_cdev, state); |
50 | } | 55 | } |
51 | 56 | ||
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index f484b5d6dbf8..fbf141ef46ec 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/sysdev.h> | 21 | #include <linux/sysdev.h> |
22 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
23 | #include <linux/ctype.h> | ||
23 | #include <linux/leds.h> | 24 | #include <linux/leds.h> |
24 | #include "leds.h" | 25 | #include "leds.h" |
25 | 26 | ||
@@ -69,11 +70,15 @@ static ssize_t led_delay_on_store(struct class_device *dev, const char *buf, | |||
69 | int ret = -EINVAL; | 70 | int ret = -EINVAL; |
70 | char *after; | 71 | char *after; |
71 | unsigned long state = simple_strtoul(buf, &after, 10); | 72 | unsigned long state = simple_strtoul(buf, &after, 10); |
73 | size_t count = after - buf; | ||
72 | 74 | ||
73 | if (after - buf > 0) { | 75 | if (*after && isspace(*after)) |
76 | count++; | ||
77 | |||
78 | if (count == size) { | ||
74 | timer_data->delay_on = state; | 79 | timer_data->delay_on = state; |
75 | mod_timer(&timer_data->timer, jiffies + 1); | 80 | mod_timer(&timer_data->timer, jiffies + 1); |
76 | ret = after - buf; | 81 | ret = count; |
77 | } | 82 | } |
78 | 83 | ||
79 | return ret; | 84 | return ret; |
@@ -97,11 +102,15 @@ static ssize_t led_delay_off_store(struct class_device *dev, const char *buf, | |||
97 | int ret = -EINVAL; | 102 | int ret = -EINVAL; |
98 | char *after; | 103 | char *after; |
99 | unsigned long state = simple_strtoul(buf, &after, 10); | 104 | unsigned long state = simple_strtoul(buf, &after, 10); |
105 | size_t count = after - buf; | ||
106 | |||
107 | if (*after && isspace(*after)) | ||
108 | count++; | ||
100 | 109 | ||
101 | if (after - buf > 0) { | 110 | if (count == size) { |
102 | timer_data->delay_off = state; | 111 | timer_data->delay_off = state; |
103 | mod_timer(&timer_data->timer, jiffies + 1); | 112 | mod_timer(&timer_data->timer, jiffies + 1); |
104 | ret = after - buf; | 113 | ret = count; |
105 | } | 114 | } |
106 | 115 | ||
107 | return ret; | 116 | return ret; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index d7316b829a62..f19b874753a9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -167,6 +167,15 @@ void md_new_event(mddev_t *mddev) | |||
167 | } | 167 | } |
168 | EXPORT_SYMBOL_GPL(md_new_event); | 168 | EXPORT_SYMBOL_GPL(md_new_event); |
169 | 169 | ||
170 | /* Alternate version that can be called from interrupts | ||
171 | * when calling sysfs_notify isn't needed. | ||
172 | */ | ||
173 | void md_new_event_inintr(mddev_t *mddev) | ||
174 | { | ||
175 | atomic_inc(&md_event_count); | ||
176 | wake_up(&md_event_waiters); | ||
177 | } | ||
178 | |||
170 | /* | 179 | /* |
171 | * Enables to iterate over all existing md arrays | 180 | * Enables to iterate over all existing md arrays |
172 | * all_mddevs_lock protects this list. | 181 | * all_mddevs_lock protects this list. |
@@ -2252,7 +2261,7 @@ action_store(mddev_t *mddev, const char *page, size_t len) | |||
2252 | } else { | 2261 | } else { |
2253 | if (cmd_match(page, "check")) | 2262 | if (cmd_match(page, "check")) |
2254 | set_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 2263 | set_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
2255 | else if (cmd_match(page, "repair")) | 2264 | else if (!cmd_match(page, "repair")) |
2256 | return -EINVAL; | 2265 | return -EINVAL; |
2257 | set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); | 2266 | set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); |
2258 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 2267 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
@@ -4149,7 +4158,7 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
4149 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 4158 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
4150 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 4159 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
4151 | md_wakeup_thread(mddev->thread); | 4160 | md_wakeup_thread(mddev->thread); |
4152 | md_new_event(mddev); | 4161 | md_new_event_inintr(mddev); |
4153 | } | 4162 | } |
4154 | 4163 | ||
4155 | /* seq_file implementation /proc/mdstat */ | 4164 | /* seq_file implementation /proc/mdstat */ |
@@ -5028,8 +5037,10 @@ static int md_notify_reboot(struct notifier_block *this, | |||
5028 | printk(KERN_INFO "md: stopping all md devices.\n"); | 5037 | printk(KERN_INFO "md: stopping all md devices.\n"); |
5029 | 5038 | ||
5030 | ITERATE_MDDEV(mddev,tmp) | 5039 | ITERATE_MDDEV(mddev,tmp) |
5031 | if (mddev_trylock(mddev)) | 5040 | if (mddev_trylock(mddev)) { |
5032 | do_md_stop (mddev, 1); | 5041 | do_md_stop (mddev, 1); |
5042 | mddev_unlock(mddev); | ||
5043 | } | ||
5033 | /* | 5044 | /* |
5034 | * certain more exotic SCSI devices are known to be | 5045 | * certain more exotic SCSI devices are known to be |
5035 | * volatile wrt too early system reboots. While the | 5046 | * volatile wrt too early system reboots. While the |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 678f4dbbea1d..cb8c6317e4e5 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -331,13 +331,14 @@ static int raid0_run (mddev_t *mddev) | |||
331 | goto out_free_conf; | 331 | goto out_free_conf; |
332 | size = conf->strip_zone[cur].size; | 332 | size = conf->strip_zone[cur].size; |
333 | 333 | ||
334 | for (i=0; i< nb_zone; i++) { | 334 | conf->hash_table[0] = conf->strip_zone + cur; |
335 | conf->hash_table[i] = conf->strip_zone + cur; | 335 | for (i=1; i< nb_zone; i++) { |
336 | while (size <= conf->hash_spacing) { | 336 | while (size <= conf->hash_spacing) { |
337 | cur++; | 337 | cur++; |
338 | size += conf->strip_zone[cur].size; | 338 | size += conf->strip_zone[cur].size; |
339 | } | 339 | } |
340 | size -= conf->hash_spacing; | 340 | size -= conf->hash_spacing; |
341 | conf->hash_table[i] = conf->strip_zone + cur; | ||
341 | } | 342 | } |
342 | if (conf->preshift) { | 343 | if (conf->preshift) { |
343 | conf->hash_spacing >>= conf->preshift; | 344 | conf->hash_spacing >>= conf->preshift; |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index fffc711c260c..344d83aae3ec 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -8,22 +8,54 @@ config VIDEO_DEV | |||
8 | tristate "Video For Linux" | 8 | tristate "Video For Linux" |
9 | ---help--- | 9 | ---help--- |
10 | Support for audio/video capture and overlay devices and FM radio | 10 | Support for audio/video capture and overlay devices and FM radio |
11 | cards. The exact capabilities of each device vary. User tools for | 11 | cards. The exact capabilities of each device vary. |
12 | this are available from | ||
13 | <ftp://ftp.uk.linux.org/pub/linux/video4linux/>. | ||
14 | 12 | ||
15 | This kernel includes support for the new Video for Linux Two API, | 13 | This kernel includes support for the new Video for Linux Two API, |
16 | (V4L2) as well as the original system. Drivers and applications | 14 | (V4L2) as well as the original system. Drivers and applications |
17 | need to be rewritten to use V4L2, but drivers for popular cards | 15 | need to be rewritten to use V4L2, but drivers for popular cards |
18 | and applications for most video capture functions already exist. | 16 | and applications for most video capture functions already exist. |
19 | 17 | ||
20 | Documentation for the original API is included in the file | 18 | Additional info and docs are available on the web at |
21 | <file:Documentation/video4linux/API.html>. Documentation for V4L2 is | 19 | <http://linuxtv.org> |
22 | available on the web at <http://bytesex.org/v4l/>. | 20 | |
21 | Documentation for V4L2 is also available on the web at | ||
22 | <http://bytesex.org/v4l/>. | ||
23 | 23 | ||
24 | To compile this driver as a module, choose M here: the | 24 | To compile this driver as a module, choose M here: the |
25 | module will be called videodev. | 25 | module will be called videodev. |
26 | 26 | ||
27 | config VIDEO_V4L1 | ||
28 | boolean "Enable Video For Linux API 1 (DEPRECATED)" | ||
29 | depends on VIDEO_DEV | ||
30 | select VIDEO_V4L1_COMPAT | ||
31 | default y | ||
32 | ---help--- | ||
33 | Enables a compatibility API used by most V4L2 devices to allow | ||
34 | its usage with legacy applications that supports only V4L1 api. | ||
35 | |||
36 | If you are unsure as to whether this is required, answer Y. | ||
37 | |||
38 | config VIDEO_V4L1_COMPAT | ||
39 | boolean "Enable Video For Linux API 1 compatible Layer" | ||
40 | depends on VIDEO_DEV | ||
41 | default y | ||
42 | ---help--- | ||
43 | This api were developed to be used at Kernel 2.2 and 2.4, but | ||
44 | lacks support for several video standards. There are several | ||
45 | drivers at kernel that still depends on it. | ||
46 | |||
47 | Documentation for the original API is included in the file | ||
48 | <Documentation/video4linux/API.html>. | ||
49 | |||
50 | User tools for this are available from | ||
51 | <ftp://ftp.uk.linux.org/pub/linux/video4linux/>. | ||
52 | |||
53 | If you are unsure as to whether this is required, answer Y. | ||
54 | |||
55 | config VIDEO_V4L2 | ||
56 | tristate | ||
57 | default y | ||
58 | |||
27 | source "drivers/media/video/Kconfig" | 59 | source "drivers/media/video/Kconfig" |
28 | 60 | ||
29 | source "drivers/media/radio/Kconfig" | 61 | source "drivers/media/radio/Kconfig" |
@@ -65,4 +97,3 @@ config USB_DABUSB | |||
65 | module will be called dabusb. | 97 | module will be called dabusb. |
66 | 98 | ||
67 | endmenu | 99 | endmenu |
68 | |||
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 6a901a0268e1..1a04db4552da 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig | |||
@@ -1,9 +1,10 @@ | |||
1 | config VIDEO_SAA7146 | 1 | config VIDEO_SAA7146 |
2 | tristate | 2 | tristate |
3 | select I2C | 3 | depends on I2C |
4 | 4 | ||
5 | config VIDEO_SAA7146_VV | 5 | config VIDEO_SAA7146_VV |
6 | tristate | 6 | tristate |
7 | select VIDEO_V4L2 | ||
7 | select VIDEO_BUF | 8 | select VIDEO_BUF |
8 | select VIDEO_VIDEOBUF | 9 | select VIDEO_VIDEOBUF |
9 | select VIDEO_SAA7146 | 10 | select VIDEO_SAA7146 |
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig index 3f0ec6be03ae..a97c8f5e9a5d 100644 --- a/drivers/media/dvb/Kconfig +++ b/drivers/media/dvb/Kconfig | |||
@@ -22,26 +22,26 @@ config DVB | |||
22 | source "drivers/media/dvb/dvb-core/Kconfig" | 22 | source "drivers/media/dvb/dvb-core/Kconfig" |
23 | 23 | ||
24 | comment "Supported SAA7146 based PCI Adapters" | 24 | comment "Supported SAA7146 based PCI Adapters" |
25 | depends on DVB_CORE && PCI | 25 | depends on DVB_CORE && PCI && I2C |
26 | source "drivers/media/dvb/ttpci/Kconfig" | 26 | source "drivers/media/dvb/ttpci/Kconfig" |
27 | 27 | ||
28 | comment "Supported USB Adapters" | 28 | comment "Supported USB Adapters" |
29 | depends on DVB_CORE && USB | 29 | depends on DVB_CORE && USB && I2C |
30 | source "drivers/media/dvb/dvb-usb/Kconfig" | 30 | source "drivers/media/dvb/dvb-usb/Kconfig" |
31 | source "drivers/media/dvb/ttusb-budget/Kconfig" | 31 | source "drivers/media/dvb/ttusb-budget/Kconfig" |
32 | source "drivers/media/dvb/ttusb-dec/Kconfig" | 32 | source "drivers/media/dvb/ttusb-dec/Kconfig" |
33 | source "drivers/media/dvb/cinergyT2/Kconfig" | 33 | source "drivers/media/dvb/cinergyT2/Kconfig" |
34 | 34 | ||
35 | comment "Supported FlexCopII (B2C2) Adapters" | 35 | comment "Supported FlexCopII (B2C2) Adapters" |
36 | depends on DVB_CORE && (PCI || USB) | 36 | depends on DVB_CORE && (PCI || USB) && I2C |
37 | source "drivers/media/dvb/b2c2/Kconfig" | 37 | source "drivers/media/dvb/b2c2/Kconfig" |
38 | 38 | ||
39 | comment "Supported BT878 Adapters" | 39 | comment "Supported BT878 Adapters" |
40 | depends on DVB_CORE && PCI | 40 | depends on DVB_CORE && PCI && I2C |
41 | source "drivers/media/dvb/bt8xx/Kconfig" | 41 | source "drivers/media/dvb/bt8xx/Kconfig" |
42 | 42 | ||
43 | comment "Supported Pluto2 Adapters" | 43 | comment "Supported Pluto2 Adapters" |
44 | depends on DVB_CORE && PCI | 44 | depends on DVB_CORE && PCI && I2C |
45 | source "drivers/media/dvb/pluto2/Kconfig" | 45 | source "drivers/media/dvb/pluto2/Kconfig" |
46 | 46 | ||
47 | comment "Supported DVB Frontends" | 47 | comment "Supported DVB Frontends" |
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig index 2963605c0ecc..d7f1fd5b7b02 100644 --- a/drivers/media/dvb/b2c2/Kconfig +++ b/drivers/media/dvb/b2c2/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DVB_B2C2_FLEXCOP | 1 | config DVB_B2C2_FLEXCOP |
2 | tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters" | 2 | tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters" |
3 | depends on DVB_CORE | 3 | depends on DVB_CORE && I2C |
4 | select DVB_STV0299 | 4 | select DVB_STV0299 |
5 | select DVB_MT352 | 5 | select DVB_MT352 |
6 | select DVB_MT312 | 6 | select DVB_MT312 |
@@ -16,7 +16,7 @@ config DVB_B2C2_FLEXCOP | |||
16 | 16 | ||
17 | config DVB_B2C2_FLEXCOP_PCI | 17 | config DVB_B2C2_FLEXCOP_PCI |
18 | tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI" | 18 | tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI" |
19 | depends on DVB_B2C2_FLEXCOP && PCI | 19 | depends on DVB_B2C2_FLEXCOP && PCI && I2C |
20 | help | 20 | help |
21 | Support for the Air/Sky/CableStar2 PCI card (DVB/ATSC) by Technisat/B2C2. | 21 | Support for the Air/Sky/CableStar2 PCI card (DVB/ATSC) by Technisat/B2C2. |
22 | 22 | ||
@@ -24,7 +24,7 @@ config DVB_B2C2_FLEXCOP_PCI | |||
24 | 24 | ||
25 | config DVB_B2C2_FLEXCOP_USB | 25 | config DVB_B2C2_FLEXCOP_USB |
26 | tristate "Technisat/B2C2 Air/Sky/Cable2PC USB" | 26 | tristate "Technisat/B2C2 Air/Sky/Cable2PC USB" |
27 | depends on DVB_B2C2_FLEXCOP && USB | 27 | depends on DVB_B2C2_FLEXCOP && USB && I2C |
28 | help | 28 | help |
29 | Support for the Air/Sky/Cable2PC USB1.1 box (DVB/ATSC) by Technisat/B2C2, | 29 | Support for the Air/Sky/Cable2PC USB1.1 box (DVB/ATSC) by Technisat/B2C2, |
30 | 30 | ||
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig index 376ca48f1d1d..f394002118f8 100644 --- a/drivers/media/dvb/bt8xx/Kconfig +++ b/drivers/media/dvb/bt8xx/Kconfig | |||
@@ -1,12 +1,13 @@ | |||
1 | config DVB_BT8XX | 1 | config DVB_BT8XX |
2 | tristate "BT8xx based PCI cards" | 2 | tristate "BT8xx based PCI cards" |
3 | depends on DVB_CORE && PCI && VIDEO_BT848 | 3 | depends on DVB_CORE && PCI && I2C && VIDEO_BT848 |
4 | select DVB_MT352 | 4 | select DVB_MT352 |
5 | select DVB_SP887X | 5 | select DVB_SP887X |
6 | select DVB_NXT6000 | 6 | select DVB_NXT6000 |
7 | select DVB_CX24110 | 7 | select DVB_CX24110 |
8 | select DVB_OR51211 | 8 | select DVB_OR51211 |
9 | select DVB_LGDT330X | 9 | select DVB_LGDT330X |
10 | select DVB_ZL10353 | ||
10 | select FW_LOADER | 11 | select FW_LOADER |
11 | help | 12 | help |
12 | Support for PCI cards based on the Bt8xx PCI bridge. Examples are | 13 | Support for PCI cards based on the Bt8xx PCI bridge. Examples are |
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index baa8227ef87c..ccc7b2eb4a2d 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c | |||
@@ -115,7 +115,7 @@ static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev) | |||
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev) | 118 | static struct bt878 __devinit *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev) |
119 | { | 119 | { |
120 | unsigned int card_nr; | 120 | unsigned int card_nr; |
121 | 121 | ||
@@ -709,7 +709,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
709 | } | 709 | } |
710 | } | 710 | } |
711 | 711 | ||
712 | static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | 712 | static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) |
713 | { | 713 | { |
714 | int result; | 714 | int result; |
715 | 715 | ||
@@ -794,7 +794,7 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | |||
794 | return 0; | 794 | return 0; |
795 | } | 795 | } |
796 | 796 | ||
797 | static int dvb_bt8xx_probe(struct bttv_sub_device *sub) | 797 | static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub) |
798 | { | 798 | { |
799 | struct dvb_bt8xx_card *card; | 799 | struct dvb_bt8xx_card *card; |
800 | struct pci_dev* bttv_pci_dev; | 800 | struct pci_dev* bttv_pci_dev; |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 71b575dc22bd..9325d039ea65 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -902,7 +902,10 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
902 | return -ENOMEM; | 902 | return -ENOMEM; |
903 | } | 903 | } |
904 | 904 | ||
905 | dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE); | 905 | if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE)) < 0) { |
906 | kfree(cinergyt2); | ||
907 | return err; | ||
908 | } | ||
906 | 909 | ||
907 | cinergyt2->demux.priv = cinergyt2; | 910 | cinergyt2->demux.priv = cinergyt2; |
908 | cinergyt2->demux.filternum = 256; | 911 | cinergyt2->demux.filternum = 256; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4f8f257e6795..a051790161b0 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -106,6 +106,8 @@ struct dvb_frontend_private { | |||
106 | unsigned long tune_mode_flags; | 106 | unsigned long tune_mode_flags; |
107 | unsigned int delay; | 107 | unsigned int delay; |
108 | unsigned int reinitialise; | 108 | unsigned int reinitialise; |
109 | int tone; | ||
110 | int voltage; | ||
109 | 111 | ||
110 | /* swzigzag values */ | 112 | /* swzigzag values */ |
111 | unsigned int state; | 113 | unsigned int state; |
@@ -537,6 +539,12 @@ static int dvb_frontend_thread(void *data) | |||
537 | 539 | ||
538 | if (fepriv->reinitialise) { | 540 | if (fepriv->reinitialise) { |
539 | dvb_frontend_init(fe); | 541 | dvb_frontend_init(fe); |
542 | if (fepriv->tone != -1) { | ||
543 | fe->ops->set_tone(fe, fepriv->tone); | ||
544 | } | ||
545 | if (fepriv->voltage != -1) { | ||
546 | fe->ops->set_voltage(fe, fepriv->voltage); | ||
547 | } | ||
540 | fepriv->reinitialise = 0; | 548 | fepriv->reinitialise = 0; |
541 | } | 549 | } |
542 | 550 | ||
@@ -788,6 +796,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
788 | case FE_SET_TONE: | 796 | case FE_SET_TONE: |
789 | if (fe->ops->set_tone) { | 797 | if (fe->ops->set_tone) { |
790 | err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg); | 798 | err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg); |
799 | fepriv->tone = (fe_sec_tone_mode_t) parg; | ||
791 | fepriv->state = FESTATE_DISEQC; | 800 | fepriv->state = FESTATE_DISEQC; |
792 | fepriv->status = 0; | 801 | fepriv->status = 0; |
793 | } | 802 | } |
@@ -796,6 +805,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
796 | case FE_SET_VOLTAGE: | 805 | case FE_SET_VOLTAGE: |
797 | if (fe->ops->set_voltage) { | 806 | if (fe->ops->set_voltage) { |
798 | err = fe->ops->set_voltage(fe, (fe_sec_voltage_t) parg); | 807 | err = fe->ops->set_voltage(fe, (fe_sec_voltage_t) parg); |
808 | fepriv->voltage = (fe_sec_voltage_t) parg; | ||
799 | fepriv->state = FESTATE_DISEQC; | 809 | fepriv->state = FESTATE_DISEQC; |
800 | fepriv->status = 0; | 810 | fepriv->status = 0; |
801 | } | 811 | } |
@@ -995,6 +1005,8 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) | |||
995 | 1005 | ||
996 | /* normal tune mode when opened R/W */ | 1006 | /* normal tune mode when opened R/W */ |
997 | fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; | 1007 | fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; |
1008 | fepriv->tone = -1; | ||
1009 | fepriv->voltage = -1; | ||
998 | } | 1010 | } |
999 | 1011 | ||
1000 | return ret; | 1012 | return ret; |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 96fe0ecae250..3852430d0260 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -219,8 +219,6 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
219 | return -ENOMEM; | 219 | return -ENOMEM; |
220 | } | 220 | } |
221 | 221 | ||
222 | mutex_unlock(&dvbdev_register_lock); | ||
223 | |||
224 | memcpy(dvbdev, template, sizeof(struct dvb_device)); | 222 | memcpy(dvbdev, template, sizeof(struct dvb_device)); |
225 | dvbdev->type = type; | 223 | dvbdev->type = type; |
226 | dvbdev->id = id; | 224 | dvbdev->id = id; |
@@ -231,6 +229,8 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
231 | 229 | ||
232 | list_add_tail (&dvbdev->list_head, &adap->device_list); | 230 | list_add_tail (&dvbdev->list_head, &adap->device_list); |
233 | 231 | ||
232 | mutex_unlock(&dvbdev_register_lock); | ||
233 | |||
234 | devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), | 234 | devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), |
235 | S_IFCHR | S_IRUSR | S_IWUSR, | 235 | S_IFCHR | S_IRUSR | S_IWUSR, |
236 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); | 236 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index d3df12039b06..e388fb1567d6 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DVB_USB | 1 | config DVB_USB |
2 | tristate "Support for various USB DVB devices" | 2 | tristate "Support for various USB DVB devices" |
3 | depends on DVB_CORE && USB | 3 | depends on DVB_CORE && USB && I2C |
4 | select FW_LOADER | 4 | select FW_LOADER |
5 | help | 5 | help |
6 | By enabling this you will be able to choose the various supported | 6 | By enabling this you will be able to choose the various supported |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 7edd6362b9cc..1f0d3e995c8d 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -150,6 +150,15 @@ static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
150 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); | 150 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); |
151 | } | 151 | } |
152 | 152 | ||
153 | static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
154 | { | ||
155 | u8 b = 0; | ||
156 | if (onoff) | ||
157 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); | ||
158 | else | ||
159 | return 0; | ||
160 | } | ||
161 | |||
153 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) | 162 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) |
154 | { | 163 | { |
155 | u8 buf[2] = { 0x03, 0x00 }; | 164 | u8 buf[2] = { 0x03, 0x00 }; |
@@ -544,7 +553,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { | |||
544 | .size_of_priv = sizeof(struct cxusb_state), | 553 | .size_of_priv = sizeof(struct cxusb_state), |
545 | 554 | ||
546 | .streaming_ctrl = cxusb_streaming_ctrl, | 555 | .streaming_ctrl = cxusb_streaming_ctrl, |
547 | .power_ctrl = cxusb_power_ctrl, | 556 | .power_ctrl = cxusb_bluebird_power_ctrl, |
548 | .frontend_attach = cxusb_lgdt3303_frontend_attach, | 557 | .frontend_attach = cxusb_lgdt3303_frontend_attach, |
549 | .tuner_attach = cxusb_lgh064f_tuner_attach, | 558 | .tuner_attach = cxusb_lgh064f_tuner_attach, |
550 | 559 | ||
@@ -589,7 +598,7 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { | |||
589 | .size_of_priv = sizeof(struct cxusb_state), | 598 | .size_of_priv = sizeof(struct cxusb_state), |
590 | 599 | ||
591 | .streaming_ctrl = cxusb_streaming_ctrl, | 600 | .streaming_ctrl = cxusb_streaming_ctrl, |
592 | .power_ctrl = cxusb_power_ctrl, | 601 | .power_ctrl = cxusb_bluebird_power_ctrl, |
593 | .frontend_attach = cxusb_dee1601_frontend_attach, | 602 | .frontend_attach = cxusb_dee1601_frontend_attach, |
594 | .tuner_attach = cxusb_dee1601_tuner_attach, | 603 | .tuner_attach = cxusb_dee1601_tuner_attach, |
595 | 604 | ||
@@ -638,7 +647,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = { | |||
638 | .size_of_priv = sizeof(struct cxusb_state), | 647 | .size_of_priv = sizeof(struct cxusb_state), |
639 | 648 | ||
640 | .streaming_ctrl = cxusb_streaming_ctrl, | 649 | .streaming_ctrl = cxusb_streaming_ctrl, |
641 | .power_ctrl = cxusb_power_ctrl, | 650 | .power_ctrl = cxusb_bluebird_power_ctrl, |
642 | .frontend_attach = cxusb_mt352_frontend_attach, | 651 | .frontend_attach = cxusb_mt352_frontend_attach, |
643 | .tuner_attach = cxusb_lgz201_tuner_attach, | 652 | .tuner_attach = cxusb_lgz201_tuner_attach, |
644 | 653 | ||
@@ -683,7 +692,7 @@ static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = { | |||
683 | .size_of_priv = sizeof(struct cxusb_state), | 692 | .size_of_priv = sizeof(struct cxusb_state), |
684 | 693 | ||
685 | .streaming_ctrl = cxusb_streaming_ctrl, | 694 | .streaming_ctrl = cxusb_streaming_ctrl, |
686 | .power_ctrl = cxusb_power_ctrl, | 695 | .power_ctrl = cxusb_bluebird_power_ctrl, |
687 | .frontend_attach = cxusb_mt352_frontend_attach, | 696 | .frontend_attach = cxusb_mt352_frontend_attach, |
688 | .tuner_attach = cxusb_dtt7579_tuner_attach, | 697 | .tuner_attach = cxusb_dtt7579_tuner_attach, |
689 | 698 | ||
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c index d661c6f9cbe5..691dc840dcc0 100644 --- a/drivers/media/dvb/frontends/cx24123.c +++ b/drivers/media/dvb/frontends/cx24123.c | |||
@@ -29,6 +29,9 @@ | |||
29 | #include "dvb_frontend.h" | 29 | #include "dvb_frontend.h" |
30 | #include "cx24123.h" | 30 | #include "cx24123.h" |
31 | 31 | ||
32 | #define XTAL 10111000 | ||
33 | |||
34 | static int force_band; | ||
32 | static int debug; | 35 | static int debug; |
33 | #define dprintk(args...) \ | 36 | #define dprintk(args...) \ |
34 | do { \ | 37 | do { \ |
@@ -52,6 +55,7 @@ struct cx24123_state | |||
52 | u32 VGAarg; | 55 | u32 VGAarg; |
53 | u32 bandselectarg; | 56 | u32 bandselectarg; |
54 | u32 pllarg; | 57 | u32 pllarg; |
58 | u32 FILTune; | ||
55 | 59 | ||
56 | /* The Demod/Tuner can't easily provide these, we cache them */ | 60 | /* The Demod/Tuner can't easily provide these, we cache them */ |
57 | u32 currentfreq; | 61 | u32 currentfreq; |
@@ -63,43 +67,33 @@ static struct | |||
63 | { | 67 | { |
64 | u32 symbolrate_low; | 68 | u32 symbolrate_low; |
65 | u32 symbolrate_high; | 69 | u32 symbolrate_high; |
66 | u32 VCAslope; | ||
67 | u32 VCAoffset; | ||
68 | u32 VGA1offset; | ||
69 | u32 VGA2offset; | ||
70 | u32 VCAprogdata; | 70 | u32 VCAprogdata; |
71 | u32 VGAprogdata; | 71 | u32 VGAprogdata; |
72 | u32 FILTune; | ||
72 | } cx24123_AGC_vals[] = | 73 | } cx24123_AGC_vals[] = |
73 | { | 74 | { |
74 | { | 75 | { |
75 | .symbolrate_low = 1000000, | 76 | .symbolrate_low = 1000000, |
76 | .symbolrate_high = 4999999, | 77 | .symbolrate_high = 4999999, |
77 | .VCAslope = 0x07, | 78 | /* the specs recommend other values for VGA offsets, |
78 | .VCAoffset = 0x0f, | 79 | but tests show they are wrong */ |
79 | .VGA1offset = 0x1f8, | 80 | .VGAprogdata = (1 << 19) | (0x180 << 9) | 0x1e0, |
80 | .VGA2offset = 0x1f8, | 81 | .VCAprogdata = (2 << 19) | (0x07 << 9) | 0x07, |
81 | .VGAprogdata = (2 << 18) | (0x1f8 << 9) | 0x1f8, | 82 | .FILTune = 0x27f /* 0.41 V */ |
82 | .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x07, | ||
83 | }, | 83 | }, |
84 | { | 84 | { |
85 | .symbolrate_low = 5000000, | 85 | .symbolrate_low = 5000000, |
86 | .symbolrate_high = 14999999, | 86 | .symbolrate_high = 14999999, |
87 | .VCAslope = 0x1f, | 87 | .VGAprogdata = (1 << 19) | (0x180 << 9) | 0x1e0, |
88 | .VCAoffset = 0x1f, | 88 | .VCAprogdata = (2 << 19) | (0x07 << 9) | 0x1f, |
89 | .VGA1offset = 0x1e0, | 89 | .FILTune = 0x317 /* 0.90 V */ |
90 | .VGA2offset = 0x180, | ||
91 | .VGAprogdata = (2 << 18) | (0x180 << 9) | 0x1e0, | ||
92 | .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x1f, | ||
93 | }, | 90 | }, |
94 | { | 91 | { |
95 | .symbolrate_low = 15000000, | 92 | .symbolrate_low = 15000000, |
96 | .symbolrate_high = 45000000, | 93 | .symbolrate_high = 45000000, |
97 | .VCAslope = 0x3f, | 94 | .VGAprogdata = (1 << 19) | (0x100 << 9) | 0x180, |
98 | .VCAoffset = 0x3f, | 95 | .VCAprogdata = (2 << 19) | (0x07 << 9) | 0x3f, |
99 | .VGA1offset = 0x180, | 96 | .FILTune = 0x145 /* 2.70 V */ |
100 | .VGA2offset = 0x100, | ||
101 | .VGAprogdata = (2 << 18) | (0x100 << 9) | 0x180, | ||
102 | .VCAprogdata = (4 << 18) | (0x07 << 9) | 0x3f, | ||
103 | }, | 97 | }, |
104 | }; | 98 | }; |
105 | 99 | ||
@@ -112,91 +106,80 @@ static struct | |||
112 | { | 106 | { |
113 | u32 freq_low; | 107 | u32 freq_low; |
114 | u32 freq_high; | 108 | u32 freq_high; |
115 | u32 bandselect; | ||
116 | u32 VCOdivider; | 109 | u32 VCOdivider; |
117 | u32 VCOnumber; | ||
118 | u32 progdata; | 110 | u32 progdata; |
119 | } cx24123_bandselect_vals[] = | 111 | } cx24123_bandselect_vals[] = |
120 | { | 112 | { |
113 | /* band 1 */ | ||
121 | { | 114 | { |
122 | .freq_low = 950000, | 115 | .freq_low = 950000, |
123 | .freq_high = 1018999, | ||
124 | .bandselect = 0x40, | ||
125 | .VCOdivider = 4, | ||
126 | .VCOnumber = 7, | ||
127 | .progdata = (0 << 18) | (0 << 9) | 0x40, | ||
128 | }, | ||
129 | { | ||
130 | .freq_low = 1019000, | ||
131 | .freq_high = 1074999, | 116 | .freq_high = 1074999, |
132 | .bandselect = 0x80, | ||
133 | .VCOdivider = 4, | 117 | .VCOdivider = 4, |
134 | .VCOnumber = 8, | 118 | .progdata = (0 << 19) | (0 << 9) | 0x40, |
135 | .progdata = (0 << 18) | (0 << 9) | 0x80, | ||
136 | }, | 119 | }, |
120 | |||
121 | /* band 2 */ | ||
137 | { | 122 | { |
138 | .freq_low = 1075000, | 123 | .freq_low = 1075000, |
139 | .freq_high = 1227999, | 124 | .freq_high = 1177999, |
140 | .bandselect = 0x01, | 125 | .VCOdivider = 4, |
141 | .VCOdivider = 2, | 126 | .progdata = (0 << 19) | (0 << 9) | 0x80, |
142 | .VCOnumber = 1, | ||
143 | .progdata = (0 << 18) | (1 << 9) | 0x01, | ||
144 | }, | 127 | }, |
128 | |||
129 | /* band 3 */ | ||
145 | { | 130 | { |
146 | .freq_low = 1228000, | 131 | .freq_low = 1178000, |
147 | .freq_high = 1349999, | 132 | .freq_high = 1295999, |
148 | .bandselect = 0x02, | ||
149 | .VCOdivider = 2, | 133 | .VCOdivider = 2, |
150 | .VCOnumber = 2, | 134 | .progdata = (0 << 19) | (1 << 9) | 0x01, |
151 | .progdata = (0 << 18) | (1 << 9) | 0x02, | ||
152 | }, | 135 | }, |
136 | |||
137 | /* band 4 */ | ||
153 | { | 138 | { |
154 | .freq_low = 1350000, | 139 | .freq_low = 1296000, |
155 | .freq_high = 1481999, | 140 | .freq_high = 1431999, |
156 | .bandselect = 0x04, | ||
157 | .VCOdivider = 2, | 141 | .VCOdivider = 2, |
158 | .VCOnumber = 3, | 142 | .progdata = (0 << 19) | (1 << 9) | 0x02, |
159 | .progdata = (0 << 18) | (1 << 9) | 0x04, | ||
160 | }, | 143 | }, |
144 | |||
145 | /* band 5 */ | ||
161 | { | 146 | { |
162 | .freq_low = 1482000, | 147 | .freq_low = 1432000, |
163 | .freq_high = 1595999, | 148 | .freq_high = 1575999, |
164 | .bandselect = 0x08, | ||
165 | .VCOdivider = 2, | 149 | .VCOdivider = 2, |
166 | .VCOnumber = 4, | 150 | .progdata = (0 << 19) | (1 << 9) | 0x04, |
167 | .progdata = (0 << 18) | (1 << 9) | 0x08, | ||
168 | }, | 151 | }, |
152 | |||
153 | /* band 6 */ | ||
169 | { | 154 | { |
170 | .freq_low = 1596000, | 155 | .freq_low = 1576000, |
171 | .freq_high = 1717999, | 156 | .freq_high = 1717999, |
172 | .bandselect = 0x10, | ||
173 | .VCOdivider = 2, | 157 | .VCOdivider = 2, |
174 | .VCOnumber = 5, | 158 | .progdata = (0 << 19) | (1 << 9) | 0x08, |
175 | .progdata = (0 << 18) | (1 << 9) | 0x10, | ||
176 | }, | 159 | }, |
160 | |||
161 | /* band 7 */ | ||
177 | { | 162 | { |
178 | .freq_low = 1718000, | 163 | .freq_low = 1718000, |
179 | .freq_high = 1855999, | 164 | .freq_high = 1855999, |
180 | .bandselect = 0x20, | ||
181 | .VCOdivider = 2, | 165 | .VCOdivider = 2, |
182 | .VCOnumber = 6, | 166 | .progdata = (0 << 19) | (1 << 9) | 0x10, |
183 | .progdata = (0 << 18) | (1 << 9) | 0x20, | ||
184 | }, | 167 | }, |
168 | |||
169 | /* band 8 */ | ||
185 | { | 170 | { |
186 | .freq_low = 1856000, | 171 | .freq_low = 1856000, |
187 | .freq_high = 2035999, | 172 | .freq_high = 2035999, |
188 | .bandselect = 0x40, | ||
189 | .VCOdivider = 2, | 173 | .VCOdivider = 2, |
190 | .VCOnumber = 7, | 174 | .progdata = (0 << 19) | (1 << 9) | 0x20, |
191 | .progdata = (0 << 18) | (1 << 9) | 0x40, | ||
192 | }, | 175 | }, |
176 | |||
177 | /* band 9 */ | ||
193 | { | 178 | { |
194 | .freq_low = 2036000, | 179 | .freq_low = 2036000, |
195 | .freq_high = 2149999, | 180 | .freq_high = 2150000, |
196 | .bandselect = 0x80, | ||
197 | .VCOdivider = 2, | 181 | .VCOdivider = 2, |
198 | .VCOnumber = 8, | 182 | .progdata = (0 << 19) | (1 << 9) | 0x40, |
199 | .progdata = (0 << 18) | (1 << 9) | 0x80, | ||
200 | }, | 183 | }, |
201 | }; | 184 | }; |
202 | 185 | ||
@@ -207,49 +190,44 @@ static struct { | |||
207 | { | 190 | { |
208 | {0x00, 0x03}, /* Reset system */ | 191 | {0x00, 0x03}, /* Reset system */ |
209 | {0x00, 0x00}, /* Clear reset */ | 192 | {0x00, 0x00}, /* Clear reset */ |
210 | {0x01, 0x3b}, /* Apply sensible defaults, from an i2c sniffer */ | 193 | {0x03, 0x07}, /* QPSK, DVB, Auto Acquisition (default) */ |
211 | {0x03, 0x07}, | 194 | {0x04, 0x10}, /* MPEG */ |
212 | {0x04, 0x10}, | 195 | {0x05, 0x04}, /* MPEG */ |
213 | {0x05, 0x04}, | 196 | {0x06, 0x31}, /* MPEG (default) */ |
214 | {0x06, 0x31}, | 197 | {0x0b, 0x00}, /* Freq search start point (default) */ |
215 | {0x0d, 0x02}, | 198 | {0x0c, 0x00}, /* Demodulator sample gain (default) */ |
216 | {0x0e, 0x03}, | 199 | {0x0d, 0x02}, /* Frequency search range = Fsymbol / 4 (default) */ |
217 | {0x0f, 0xfe}, | 200 | {0x0e, 0x03}, /* Default non-inverted, FEC 3/4 (default) */ |
218 | {0x10, 0x01}, | 201 | {0x0f, 0xfe}, /* FEC search mask (all supported codes) */ |
219 | {0x14, 0x01}, | 202 | {0x10, 0x01}, /* Default search inversion, no repeat (default) */ |
220 | {0x15, 0x98}, | 203 | {0x16, 0x00}, /* Enable reading of frequency */ |
221 | {0x16, 0x00}, | 204 | {0x17, 0x01}, /* Enable EsNO Ready Counter */ |
222 | {0x17, 0x01}, | 205 | {0x1c, 0x80}, /* Enable error counter */ |
223 | {0x1b, 0x05}, | 206 | {0x20, 0x00}, /* Tuner burst clock rate = 500KHz */ |
224 | {0x1c, 0x80}, | 207 | {0x21, 0x15}, /* Tuner burst mode, word length = 0x15 */ |
225 | {0x1d, 0x00}, | 208 | {0x28, 0x00}, /* Enable FILTERV with positive pol., DiSEqC 2.x off */ |
226 | {0x1e, 0x00}, | 209 | {0x29, 0x00}, /* DiSEqC LNB_DC off */ |
227 | {0x20, 0x41}, | 210 | {0x2a, 0xb0}, /* DiSEqC Parameters (default) */ |
228 | {0x21, 0x15}, | 211 | {0x2b, 0x73}, /* DiSEqC Tone Frequency (default) */ |
229 | {0x27, 0x14}, | 212 | {0x2c, 0x00}, /* DiSEqC Message (0x2c - 0x31) */ |
230 | {0x28, 0x46}, | ||
231 | {0x29, 0x00}, | ||
232 | {0x2a, 0xb0}, | ||
233 | {0x2b, 0x73}, | ||
234 | {0x2c, 0x00}, | ||
235 | {0x2d, 0x00}, | 213 | {0x2d, 0x00}, |
236 | {0x2e, 0x00}, | 214 | {0x2e, 0x00}, |
237 | {0x2f, 0x00}, | 215 | {0x2f, 0x00}, |
238 | {0x30, 0x00}, | 216 | {0x30, 0x00}, |
239 | {0x31, 0x00}, | 217 | {0x31, 0x00}, |
240 | {0x32, 0x8c}, | 218 | {0x32, 0x8c}, /* DiSEqC Parameters (default) */ |
241 | {0x33, 0x00}, | 219 | {0x33, 0x00}, /* Interrupts off (0x33 - 0x34) */ |
242 | {0x34, 0x00}, | 220 | {0x34, 0x00}, |
243 | {0x35, 0x03}, | 221 | {0x35, 0x03}, /* DiSEqC Tone Amplitude (default) */ |
244 | {0x36, 0x02}, | 222 | {0x36, 0x02}, /* DiSEqC Parameters (default) */ |
245 | {0x37, 0x3a}, | 223 | {0x37, 0x3a}, /* DiSEqC Parameters (default) */ |
246 | {0x3a, 0x00}, /* Enable AGC accumulator */ | 224 | {0x3a, 0x00}, /* Enable AGC accumulator (for signal strength) */ |
247 | {0x44, 0x00}, | 225 | {0x44, 0x00}, /* Constellation (default) */ |
248 | {0x45, 0x00}, | 226 | {0x45, 0x00}, /* Symbol count (default) */ |
249 | {0x46, 0x05}, | 227 | {0x46, 0x0d}, /* Symbol rate estimator on (default) */ |
250 | {0x56, 0x41}, | 228 | {0x56, 0x41}, /* Various (default) */ |
251 | {0x57, 0xff}, | 229 | {0x57, 0xff}, /* Error Counter Window (default) */ |
252 | {0x67, 0x83}, | 230 | {0x67, 0x83}, /* Non-DCII symbol clock */ |
253 | }; | 231 | }; |
254 | 232 | ||
255 | static int cx24123_writereg(struct cx24123_state* state, int reg, int data) | 233 | static int cx24123_writereg(struct cx24123_state* state, int reg, int data) |
@@ -258,6 +236,10 @@ static int cx24123_writereg(struct cx24123_state* state, int reg, int data) | |||
258 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; | 236 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; |
259 | int err; | 237 | int err; |
260 | 238 | ||
239 | if (debug>1) | ||
240 | printk("cx24123: %s: write reg 0x%02x, value 0x%02x\n", | ||
241 | __FUNCTION__,reg, data); | ||
242 | |||
261 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 243 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
262 | printk("%s: writereg error(err == %i, reg == 0x%02x," | 244 | printk("%s: writereg error(err == %i, reg == 0x%02x," |
263 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 245 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); |
@@ -274,6 +256,10 @@ static int cx24123_writelnbreg(struct cx24123_state* state, int reg, int data) | |||
274 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 }; | 256 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 }; |
275 | int err; | 257 | int err; |
276 | 258 | ||
259 | if (debug>1) | ||
260 | printk("cx24123: %s: writeln addr=0x08, reg 0x%02x, value 0x%02x\n", | ||
261 | __FUNCTION__,reg, data); | ||
262 | |||
277 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 263 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
278 | printk("%s: writelnbreg error (err == %i, reg == 0x%02x," | 264 | printk("%s: writelnbreg error (err == %i, reg == 0x%02x," |
279 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 265 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); |
@@ -303,6 +289,9 @@ static int cx24123_readreg(struct cx24123_state* state, u8 reg) | |||
303 | return ret; | 289 | return ret; |
304 | } | 290 | } |
305 | 291 | ||
292 | if (debug>1) | ||
293 | printk("cx24123: read reg 0x%02x, value 0x%02x\n",reg, ret); | ||
294 | |||
306 | return b1[0]; | 295 | return b1[0]; |
307 | } | 296 | } |
308 | 297 | ||
@@ -313,17 +302,23 @@ static int cx24123_readlnbreg(struct cx24123_state* state, u8 reg) | |||
313 | 302 | ||
314 | static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) | 303 | static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) |
315 | { | 304 | { |
305 | u8 nom_reg = cx24123_readreg(state, 0x0e); | ||
306 | u8 auto_reg = cx24123_readreg(state, 0x10); | ||
307 | |||
316 | switch (inversion) { | 308 | switch (inversion) { |
317 | case INVERSION_OFF: | 309 | case INVERSION_OFF: |
318 | cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) & 0x7f); | 310 | dprintk("%s: inversion off\n",__FUNCTION__); |
319 | cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80); | 311 | cx24123_writereg(state, 0x0e, nom_reg & ~0x80); |
312 | cx24123_writereg(state, 0x10, auto_reg | 0x80); | ||
320 | break; | 313 | break; |
321 | case INVERSION_ON: | 314 | case INVERSION_ON: |
322 | cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) | 0x80); | 315 | dprintk("%s: inversion on\n",__FUNCTION__); |
323 | cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80); | 316 | cx24123_writereg(state, 0x0e, nom_reg | 0x80); |
317 | cx24123_writereg(state, 0x10, auto_reg | 0x80); | ||
324 | break; | 318 | break; |
325 | case INVERSION_AUTO: | 319 | case INVERSION_AUTO: |
326 | cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) & 0x7f); | 320 | dprintk("%s: inversion auto\n",__FUNCTION__); |
321 | cx24123_writereg(state, 0x10, auto_reg & ~0x80); | ||
327 | break; | 322 | break; |
328 | default: | 323 | default: |
329 | return -EINVAL; | 324 | return -EINVAL; |
@@ -338,92 +333,191 @@ static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_invers | |||
338 | 333 | ||
339 | val = cx24123_readreg(state, 0x1b) >> 7; | 334 | val = cx24123_readreg(state, 0x1b) >> 7; |
340 | 335 | ||
341 | if (val == 0) | 336 | if (val == 0) { |
337 | dprintk("%s: read inversion off\n",__FUNCTION__); | ||
342 | *inversion = INVERSION_OFF; | 338 | *inversion = INVERSION_OFF; |
343 | else | 339 | } else { |
340 | dprintk("%s: read inversion on\n",__FUNCTION__); | ||
344 | *inversion = INVERSION_ON; | 341 | *inversion = INVERSION_ON; |
342 | } | ||
345 | 343 | ||
346 | return 0; | 344 | return 0; |
347 | } | 345 | } |
348 | 346 | ||
349 | static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec) | 347 | static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec) |
350 | { | 348 | { |
349 | u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07; | ||
350 | |||
351 | if ( (fec < FEC_NONE) || (fec > FEC_AUTO) ) | 351 | if ( (fec < FEC_NONE) || (fec > FEC_AUTO) ) |
352 | fec = FEC_AUTO; | 352 | fec = FEC_AUTO; |
353 | 353 | ||
354 | /* Hardware has 5/11 and 3/5 but are never unused */ | ||
355 | switch (fec) { | 354 | switch (fec) { |
356 | case FEC_NONE: | ||
357 | return cx24123_writereg(state, 0x0f, 0x01); | ||
358 | case FEC_1_2: | 355 | case FEC_1_2: |
359 | return cx24123_writereg(state, 0x0f, 0x02); | 356 | dprintk("%s: set FEC to 1/2\n",__FUNCTION__); |
357 | cx24123_writereg(state, 0x0e, nom_reg | 0x01); | ||
358 | cx24123_writereg(state, 0x0f, 0x02); | ||
359 | break; | ||
360 | case FEC_2_3: | 360 | case FEC_2_3: |
361 | return cx24123_writereg(state, 0x0f, 0x04); | 361 | dprintk("%s: set FEC to 2/3\n",__FUNCTION__); |
362 | cx24123_writereg(state, 0x0e, nom_reg | 0x02); | ||
363 | cx24123_writereg(state, 0x0f, 0x04); | ||
364 | break; | ||
362 | case FEC_3_4: | 365 | case FEC_3_4: |
363 | return cx24123_writereg(state, 0x0f, 0x08); | 366 | dprintk("%s: set FEC to 3/4\n",__FUNCTION__); |
367 | cx24123_writereg(state, 0x0e, nom_reg | 0x03); | ||
368 | cx24123_writereg(state, 0x0f, 0x08); | ||
369 | break; | ||
370 | case FEC_4_5: | ||
371 | dprintk("%s: set FEC to 4/5\n",__FUNCTION__); | ||
372 | cx24123_writereg(state, 0x0e, nom_reg | 0x04); | ||
373 | cx24123_writereg(state, 0x0f, 0x10); | ||
374 | break; | ||
364 | case FEC_5_6: | 375 | case FEC_5_6: |
365 | return cx24123_writereg(state, 0x0f, 0x20); | 376 | dprintk("%s: set FEC to 5/6\n",__FUNCTION__); |
377 | cx24123_writereg(state, 0x0e, nom_reg | 0x05); | ||
378 | cx24123_writereg(state, 0x0f, 0x20); | ||
379 | break; | ||
380 | case FEC_6_7: | ||
381 | dprintk("%s: set FEC to 6/7\n",__FUNCTION__); | ||
382 | cx24123_writereg(state, 0x0e, nom_reg | 0x06); | ||
383 | cx24123_writereg(state, 0x0f, 0x40); | ||
384 | break; | ||
366 | case FEC_7_8: | 385 | case FEC_7_8: |
367 | return cx24123_writereg(state, 0x0f, 0x80); | 386 | dprintk("%s: set FEC to 7/8\n",__FUNCTION__); |
387 | cx24123_writereg(state, 0x0e, nom_reg | 0x07); | ||
388 | cx24123_writereg(state, 0x0f, 0x80); | ||
389 | break; | ||
368 | case FEC_AUTO: | 390 | case FEC_AUTO: |
369 | return cx24123_writereg(state, 0x0f, 0xae); | 391 | dprintk("%s: set FEC to auto\n",__FUNCTION__); |
392 | cx24123_writereg(state, 0x0f, 0xfe); | ||
393 | break; | ||
370 | default: | 394 | default: |
371 | return -EOPNOTSUPP; | 395 | return -EOPNOTSUPP; |
372 | } | 396 | } |
397 | |||
398 | return 0; | ||
373 | } | 399 | } |
374 | 400 | ||
375 | static int cx24123_get_fec(struct cx24123_state* state, fe_code_rate_t *fec) | 401 | static int cx24123_get_fec(struct cx24123_state* state, fe_code_rate_t *fec) |
376 | { | 402 | { |
377 | int ret; | 403 | int ret; |
378 | u8 val; | ||
379 | 404 | ||
380 | ret = cx24123_readreg (state, 0x1b); | 405 | ret = cx24123_readreg (state, 0x1b); |
381 | if (ret < 0) | 406 | if (ret < 0) |
382 | return ret; | 407 | return ret; |
383 | val = ret & 0x07; | 408 | ret = ret & 0x07; |
384 | switch (val) { | 409 | |
410 | switch (ret) { | ||
385 | case 1: | 411 | case 1: |
386 | *fec = FEC_1_2; | 412 | *fec = FEC_1_2; |
387 | break; | 413 | break; |
388 | case 3: | 414 | case 2: |
389 | *fec = FEC_2_3; | 415 | *fec = FEC_2_3; |
390 | break; | 416 | break; |
391 | case 4: | 417 | case 3: |
392 | *fec = FEC_3_4; | 418 | *fec = FEC_3_4; |
393 | break; | 419 | break; |
394 | case 5: | 420 | case 4: |
395 | *fec = FEC_4_5; | 421 | *fec = FEC_4_5; |
396 | break; | 422 | break; |
397 | case 6: | 423 | case 5: |
398 | *fec = FEC_5_6; | 424 | *fec = FEC_5_6; |
399 | break; | 425 | break; |
426 | case 6: | ||
427 | *fec = FEC_6_7; | ||
428 | break; | ||
400 | case 7: | 429 | case 7: |
401 | *fec = FEC_7_8; | 430 | *fec = FEC_7_8; |
402 | break; | 431 | break; |
403 | case 2: /* *fec = FEC_3_5; break; */ | ||
404 | case 0: /* *fec = FEC_5_11; break; */ | ||
405 | *fec = FEC_AUTO; | ||
406 | break; | ||
407 | default: | 432 | default: |
408 | *fec = FEC_NONE; // can't happen | 433 | /* this can happen when there's no lock */ |
434 | *fec = FEC_NONE; | ||
409 | } | 435 | } |
410 | 436 | ||
411 | return 0; | 437 | return 0; |
412 | } | 438 | } |
413 | 439 | ||
414 | /* fixme: Symbol rates < 3MSps may not work because of precision loss */ | 440 | /* Approximation of closest integer of log2(a/b). It actually gives the |
441 | lowest integer i such that 2^i >= round(a/b) */ | ||
442 | static u32 cx24123_int_log2(u32 a, u32 b) | ||
443 | { | ||
444 | u32 exp, nearest = 0; | ||
445 | u32 div = a / b; | ||
446 | if(a % b >= b / 2) ++div; | ||
447 | if(div < (1 << 31)) | ||
448 | { | ||
449 | for(exp = 1; div > exp; nearest++) | ||
450 | exp += exp; | ||
451 | } | ||
452 | return nearest; | ||
453 | } | ||
454 | |||
415 | static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) | 455 | static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) |
416 | { | 456 | { |
417 | u32 val; | 457 | u32 tmp, sample_rate, ratio, sample_gain; |
458 | u8 pll_mult; | ||
459 | |||
460 | /* check if symbol rate is within limits */ | ||
461 | if ((srate > state->ops.info.symbol_rate_max) || | ||
462 | (srate < state->ops.info.symbol_rate_min)) | ||
463 | return -EOPNOTSUPP;; | ||
464 | |||
465 | /* choose the sampling rate high enough for the required operation, | ||
466 | while optimizing the power consumed by the demodulator */ | ||
467 | if (srate < (XTAL*2)/2) | ||
468 | pll_mult = 2; | ||
469 | else if (srate < (XTAL*3)/2) | ||
470 | pll_mult = 3; | ||
471 | else if (srate < (XTAL*4)/2) | ||
472 | pll_mult = 4; | ||
473 | else if (srate < (XTAL*5)/2) | ||
474 | pll_mult = 5; | ||
475 | else if (srate < (XTAL*6)/2) | ||
476 | pll_mult = 6; | ||
477 | else if (srate < (XTAL*7)/2) | ||
478 | pll_mult = 7; | ||
479 | else if (srate < (XTAL*8)/2) | ||
480 | pll_mult = 8; | ||
481 | else | ||
482 | pll_mult = 9; | ||
483 | |||
484 | |||
485 | sample_rate = pll_mult * XTAL; | ||
486 | |||
487 | /* | ||
488 | SYSSymbolRate[21:0] = (srate << 23) / sample_rate | ||
489 | |||
490 | We have to use 32 bit unsigned arithmetic without precision loss. | ||
491 | The maximum srate is 45000000 or 0x02AEA540. This number has | ||
492 | only 6 clear bits on top, hence we can shift it left only 6 bits | ||
493 | at a time. Borrowed from cx24110.c | ||
494 | */ | ||
495 | |||
496 | tmp = srate << 6; | ||
497 | ratio = tmp / sample_rate; | ||
498 | |||
499 | tmp = (tmp % sample_rate) << 6; | ||
500 | ratio = (ratio << 6) + (tmp / sample_rate); | ||
501 | |||
502 | tmp = (tmp % sample_rate) << 6; | ||
503 | ratio = (ratio << 6) + (tmp / sample_rate); | ||
504 | |||
505 | tmp = (tmp % sample_rate) << 5; | ||
506 | ratio = (ratio << 5) + (tmp / sample_rate); | ||
507 | |||
508 | |||
509 | cx24123_writereg(state, 0x01, pll_mult * 6); | ||
418 | 510 | ||
419 | val = (srate / 1185) * 100; | 511 | cx24123_writereg(state, 0x08, (ratio >> 16) & 0x3f ); |
512 | cx24123_writereg(state, 0x09, (ratio >> 8) & 0xff ); | ||
513 | cx24123_writereg(state, 0x0a, (ratio ) & 0xff ); | ||
420 | 514 | ||
421 | /* Compensate for scaling up, by removing 17 symbols per 1Msps */ | 515 | /* also set the demodulator sample gain */ |
422 | val = val - (17 * (srate / 1000000)); | 516 | sample_gain = cx24123_int_log2(sample_rate, srate); |
517 | tmp = cx24123_readreg(state, 0x0c) & ~0xe0; | ||
518 | cx24123_writereg(state, 0x0c, tmp | sample_gain << 5); | ||
423 | 519 | ||
424 | cx24123_writereg(state, 0x08, (val >> 16) & 0xff ); | 520 | dprintk("%s: srate=%d, ratio=0x%08x, sample_rate=%i sample_gain=%d\n", __FUNCTION__, srate, ratio, sample_rate, sample_gain); |
425 | cx24123_writereg(state, 0x09, (val >> 8) & 0xff ); | ||
426 | cx24123_writereg(state, 0x0a, (val ) & 0xff ); | ||
427 | 521 | ||
428 | return 0; | 522 | return 0; |
429 | } | 523 | } |
@@ -437,6 +531,9 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
437 | struct cx24123_state *state = fe->demodulator_priv; | 531 | struct cx24123_state *state = fe->demodulator_priv; |
438 | u32 ndiv = 0, adiv = 0, vco_div = 0; | 532 | u32 ndiv = 0, adiv = 0, vco_div = 0; |
439 | int i = 0; | 533 | int i = 0; |
534 | int pump = 2; | ||
535 | int band = 0; | ||
536 | int num_bands = sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]); | ||
440 | 537 | ||
441 | /* Defaults for low freq, low rate */ | 538 | /* Defaults for low freq, low rate */ |
442 | state->VCAarg = cx24123_AGC_vals[0].VCAprogdata; | 539 | state->VCAarg = cx24123_AGC_vals[0].VCAprogdata; |
@@ -444,38 +541,49 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
444 | state->bandselectarg = cx24123_bandselect_vals[0].progdata; | 541 | state->bandselectarg = cx24123_bandselect_vals[0].progdata; |
445 | vco_div = cx24123_bandselect_vals[0].VCOdivider; | 542 | vco_div = cx24123_bandselect_vals[0].VCOdivider; |
446 | 543 | ||
447 | /* For the given symbolerate, determine the VCA and VGA programming bits */ | 544 | /* For the given symbol rate, determine the VCA, VGA and FILTUNE programming bits */ |
448 | for (i = 0; i < sizeof(cx24123_AGC_vals) / sizeof(cx24123_AGC_vals[0]); i++) | 545 | for (i = 0; i < sizeof(cx24123_AGC_vals) / sizeof(cx24123_AGC_vals[0]); i++) |
449 | { | 546 | { |
450 | if ((cx24123_AGC_vals[i].symbolrate_low <= p->u.qpsk.symbol_rate) && | 547 | if ((cx24123_AGC_vals[i].symbolrate_low <= p->u.qpsk.symbol_rate) && |
451 | (cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) { | 548 | (cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) { |
452 | state->VCAarg = cx24123_AGC_vals[i].VCAprogdata; | 549 | state->VCAarg = cx24123_AGC_vals[i].VCAprogdata; |
453 | state->VGAarg = cx24123_AGC_vals[i].VGAprogdata; | 550 | state->VGAarg = cx24123_AGC_vals[i].VGAprogdata; |
551 | state->FILTune = cx24123_AGC_vals[i].FILTune; | ||
454 | } | 552 | } |
455 | } | 553 | } |
456 | 554 | ||
457 | /* For the given frequency, determine the bandselect programming bits */ | 555 | /* determine the band to use */ |
458 | for (i = 0; i < sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]); i++) | 556 | if(force_band < 1 || force_band > num_bands) |
459 | { | 557 | { |
460 | if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) && | 558 | for (i = 0; i < num_bands; i++) |
461 | (cx24123_bandselect_vals[i].freq_high >= p->frequency) ) { | 559 | { |
462 | state->bandselectarg = cx24123_bandselect_vals[i].progdata; | 560 | if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) && |
463 | vco_div = cx24123_bandselect_vals[i].VCOdivider; | 561 | (cx24123_bandselect_vals[i].freq_high >= p->frequency) ) |
562 | band = i; | ||
464 | } | 563 | } |
465 | } | 564 | } |
565 | else | ||
566 | band = force_band - 1; | ||
567 | |||
568 | state->bandselectarg = cx24123_bandselect_vals[band].progdata; | ||
569 | vco_div = cx24123_bandselect_vals[band].VCOdivider; | ||
570 | |||
571 | /* determine the charge pump current */ | ||
572 | if ( p->frequency < (cx24123_bandselect_vals[band].freq_low + cx24123_bandselect_vals[band].freq_high)/2 ) | ||
573 | pump = 0x01; | ||
574 | else | ||
575 | pump = 0x02; | ||
466 | 576 | ||
467 | /* Determine the N/A dividers for the requested lband freq (in kHz). */ | 577 | /* Determine the N/A dividers for the requested lband freq (in kHz). */ |
468 | /* Note: 10111 (kHz) is the Crystal Freq and divider of 10. */ | 578 | /* Note: the reference divider R=10, frequency is in KHz, XTAL is in Hz */ |
469 | ndiv = ( ((p->frequency * vco_div) / (10111 / 10) / 2) / 32) & 0x1ff; | 579 | ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff; |
470 | adiv = ( ((p->frequency * vco_div) / (10111 / 10) / 2) % 32) & 0x1f; | 580 | adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f; |
471 | 581 | ||
472 | if (adiv == 0) | 582 | if (adiv == 0) |
473 | adiv++; | 583 | ndiv++; |
474 | 584 | ||
475 | /* determine the correct pll frequency values. */ | 585 | /* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */ |
476 | /* Command 11, refdiv 11, cpump polarity 1, cpump current 3mA 10. */ | 586 | state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv; |
477 | state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (2 << 14); | ||
478 | state->pllarg |= (ndiv << 5) | adiv; | ||
479 | 587 | ||
480 | return 0; | 588 | return 0; |
481 | } | 589 | } |
@@ -489,6 +597,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
489 | struct cx24123_state *state = fe->demodulator_priv; | 597 | struct cx24123_state *state = fe->demodulator_priv; |
490 | unsigned long timeout; | 598 | unsigned long timeout; |
491 | 599 | ||
600 | dprintk("%s: pll writereg called, data=0x%08x\n",__FUNCTION__,data); | ||
601 | |||
492 | /* align the 21 bytes into to bit23 boundary */ | 602 | /* align the 21 bytes into to bit23 boundary */ |
493 | data = data << 3; | 603 | data = data << 3; |
494 | 604 | ||
@@ -538,6 +648,9 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
538 | static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 648 | static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
539 | { | 649 | { |
540 | struct cx24123_state *state = fe->demodulator_priv; | 650 | struct cx24123_state *state = fe->demodulator_priv; |
651 | u8 val; | ||
652 | |||
653 | dprintk("frequency=%i\n", p->frequency); | ||
541 | 654 | ||
542 | if (cx24123_pll_calculate(fe, p) != 0) { | 655 | if (cx24123_pll_calculate(fe, p) != 0) { |
543 | printk("%s: cx24123_pll_calcutate failed\n",__FUNCTION__); | 656 | printk("%s: cx24123_pll_calcutate failed\n",__FUNCTION__); |
@@ -552,6 +665,14 @@ static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
552 | cx24123_pll_writereg(fe, p, state->bandselectarg); | 665 | cx24123_pll_writereg(fe, p, state->bandselectarg); |
553 | cx24123_pll_writereg(fe, p, state->pllarg); | 666 | cx24123_pll_writereg(fe, p, state->pllarg); |
554 | 667 | ||
668 | /* set the FILTUNE voltage */ | ||
669 | val = cx24123_readreg(state, 0x28) & ~0x3; | ||
670 | cx24123_writereg(state, 0x27, state->FILTune >> 2); | ||
671 | cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3)); | ||
672 | |||
673 | dprintk("%s: pll tune VCA=%d, band=%d, pll=%d\n",__FUNCTION__,state->VCAarg, | ||
674 | state->bandselectarg,state->pllarg); | ||
675 | |||
555 | return 0; | 676 | return 0; |
556 | } | 677 | } |
557 | 678 | ||
@@ -560,6 +681,8 @@ static int cx24123_initfe(struct dvb_frontend* fe) | |||
560 | struct cx24123_state *state = fe->demodulator_priv; | 681 | struct cx24123_state *state = fe->demodulator_priv; |
561 | int i; | 682 | int i; |
562 | 683 | ||
684 | dprintk("%s: init frontend\n",__FUNCTION__); | ||
685 | |||
563 | /* Configure the demod to a good set of defaults */ | 686 | /* Configure the demod to a good set of defaults */ |
564 | for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++) | 687 | for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++) |
565 | cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); | 688 | cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); |
@@ -587,10 +710,13 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage | |||
587 | 710 | ||
588 | switch (voltage) { | 711 | switch (voltage) { |
589 | case SEC_VOLTAGE_13: | 712 | case SEC_VOLTAGE_13: |
713 | dprintk("%s: isl6421 voltage = 13V\n",__FUNCTION__); | ||
590 | return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */ | 714 | return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */ |
591 | case SEC_VOLTAGE_18: | 715 | case SEC_VOLTAGE_18: |
716 | dprintk("%s: isl6421 voltage = 18V\n",__FUNCTION__); | ||
592 | return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */ | 717 | return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */ |
593 | case SEC_VOLTAGE_OFF: | 718 | case SEC_VOLTAGE_OFF: |
719 | dprintk("%s: isl5421 voltage off\n",__FUNCTION__); | ||
594 | return cx24123_writelnbreg(state, 0x0, val & 0x30); | 720 | return cx24123_writelnbreg(state, 0x0, val & 0x30); |
595 | default: | 721 | default: |
596 | return -EINVAL; | 722 | return -EINVAL; |
@@ -624,13 +750,93 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage | |||
624 | return 0; | 750 | return 0; |
625 | } | 751 | } |
626 | 752 | ||
627 | static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, | 753 | /* wait for diseqc queue to become ready (or timeout) */ |
628 | struct dvb_diseqc_master_cmd *cmd) | 754 | static void cx24123_wait_for_diseqc(struct cx24123_state *state) |
755 | { | ||
756 | unsigned long timeout = jiffies + msecs_to_jiffies(200); | ||
757 | while (!(cx24123_readreg(state, 0x29) & 0x40)) { | ||
758 | if(time_after(jiffies, timeout)) { | ||
759 | printk("%s: diseqc queue not ready, command may be lost.\n", __FUNCTION__); | ||
760 | break; | ||
761 | } | ||
762 | msleep(10); | ||
763 | } | ||
764 | } | ||
765 | |||
766 | static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) | ||
629 | { | 767 | { |
630 | /* fixme: Implement diseqc */ | 768 | struct cx24123_state *state = fe->demodulator_priv; |
631 | printk("%s: No support yet\n",__FUNCTION__); | 769 | int i, val; |
770 | |||
771 | dprintk("%s:\n",__FUNCTION__); | ||
772 | |||
773 | /* check if continuous tone has been stopped */ | ||
774 | if (state->config->use_isl6421) | ||
775 | val = cx24123_readlnbreg(state, 0x00) & 0x10; | ||
776 | else | ||
777 | val = cx24123_readreg(state, 0x29) & 0x10; | ||
632 | 778 | ||
633 | return -ENOTSUPP; | 779 | |
780 | if (val) { | ||
781 | printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__); | ||
782 | return -ENOTSUPP; | ||
783 | } | ||
784 | |||
785 | /* wait for diseqc queue ready */ | ||
786 | cx24123_wait_for_diseqc(state); | ||
787 | |||
788 | /* select tone mode */ | ||
789 | cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xf8); | ||
790 | |||
791 | for (i = 0; i < cmd->msg_len; i++) | ||
792 | cx24123_writereg(state, 0x2C + i, cmd->msg[i]); | ||
793 | |||
794 | val = cx24123_readreg(state, 0x29); | ||
795 | cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3)); | ||
796 | |||
797 | /* wait for diseqc message to finish sending */ | ||
798 | cx24123_wait_for_diseqc(state); | ||
799 | |||
800 | return 0; | ||
801 | } | ||
802 | |||
803 | static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | ||
804 | { | ||
805 | struct cx24123_state *state = fe->demodulator_priv; | ||
806 | int val; | ||
807 | |||
808 | dprintk("%s:\n", __FUNCTION__); | ||
809 | |||
810 | /* check if continuous tone has been stoped */ | ||
811 | if (state->config->use_isl6421) | ||
812 | val = cx24123_readlnbreg(state, 0x00) & 0x10; | ||
813 | else | ||
814 | val = cx24123_readreg(state, 0x29) & 0x10; | ||
815 | |||
816 | |||
817 | if (val) { | ||
818 | printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__); | ||
819 | return -ENOTSUPP; | ||
820 | } | ||
821 | |||
822 | cx24123_wait_for_diseqc(state); | ||
823 | |||
824 | /* select tone mode */ | ||
825 | val = cx24123_readreg(state, 0x2a) & 0xf8; | ||
826 | cx24123_writereg(state, 0x2a, val | 0x04); | ||
827 | |||
828 | val = cx24123_readreg(state, 0x29); | ||
829 | |||
830 | if (burst == SEC_MINI_A) | ||
831 | cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40 | 0x00)); | ||
832 | else if (burst == SEC_MINI_B) | ||
833 | cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40 | 0x08)); | ||
834 | else | ||
835 | return -EINVAL; | ||
836 | |||
837 | cx24123_wait_for_diseqc(state); | ||
838 | |||
839 | return 0; | ||
634 | } | 840 | } |
635 | 841 | ||
636 | static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) | 842 | static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) |
@@ -642,13 +848,15 @@ static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
642 | 848 | ||
643 | *status = 0; | 849 | *status = 0; |
644 | if (lock & 0x01) | 850 | if (lock & 0x01) |
645 | *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL; | 851 | *status |= FE_HAS_SIGNAL; |
852 | if (sync & 0x02) | ||
853 | *status |= FE_HAS_CARRIER; | ||
646 | if (sync & 0x04) | 854 | if (sync & 0x04) |
647 | *status |= FE_HAS_VITERBI; | 855 | *status |= FE_HAS_VITERBI; |
648 | if (sync & 0x08) | 856 | if (sync & 0x08) |
649 | *status |= FE_HAS_CARRIER; | 857 | *status |= FE_HAS_SYNC; |
650 | if (sync & 0x80) | 858 | if (sync & 0x80) |
651 | *status |= FE_HAS_SYNC | FE_HAS_LOCK; | 859 | *status |= FE_HAS_LOCK; |
652 | 860 | ||
653 | return 0; | 861 | return 0; |
654 | } | 862 | } |
@@ -681,6 +889,8 @@ static int cx24123_read_ber(struct dvb_frontend* fe, u32* ber) | |||
681 | else | 889 | else |
682 | state->snr = 0; | 890 | state->snr = 0; |
683 | 891 | ||
892 | dprintk("%s: BER = %d, S/N index = %d\n",__FUNCTION__,state->lastber, state->snr); | ||
893 | |||
684 | *ber = state->lastber; | 894 | *ber = state->lastber; |
685 | 895 | ||
686 | return 0; | 896 | return 0; |
@@ -691,6 +901,8 @@ static int cx24123_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
691 | struct cx24123_state *state = fe->demodulator_priv; | 901 | struct cx24123_state *state = fe->demodulator_priv; |
692 | *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ | 902 | *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ |
693 | 903 | ||
904 | dprintk("%s: Signal strength = %d\n",__FUNCTION__,*signal_strength); | ||
905 | |||
694 | return 0; | 906 | return 0; |
695 | } | 907 | } |
696 | 908 | ||
@@ -699,6 +911,8 @@ static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr) | |||
699 | struct cx24123_state *state = fe->demodulator_priv; | 911 | struct cx24123_state *state = fe->demodulator_priv; |
700 | *snr = state->snr; | 912 | *snr = state->snr; |
701 | 913 | ||
914 | dprintk("%s: read S/N index = %d\n",__FUNCTION__,*snr); | ||
915 | |||
702 | return 0; | 916 | return 0; |
703 | } | 917 | } |
704 | 918 | ||
@@ -707,6 +921,8 @@ static int cx24123_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
707 | struct cx24123_state *state = fe->demodulator_priv; | 921 | struct cx24123_state *state = fe->demodulator_priv; |
708 | *ucblocks = state->lastber; | 922 | *ucblocks = state->lastber; |
709 | 923 | ||
924 | dprintk("%s: ucblocks (ber) = %d\n",__FUNCTION__,*ucblocks); | ||
925 | |||
710 | return 0; | 926 | return 0; |
711 | } | 927 | } |
712 | 928 | ||
@@ -714,6 +930,8 @@ static int cx24123_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
714 | { | 930 | { |
715 | struct cx24123_state *state = fe->demodulator_priv; | 931 | struct cx24123_state *state = fe->demodulator_priv; |
716 | 932 | ||
933 | dprintk("%s: set_frontend\n",__FUNCTION__); | ||
934 | |||
717 | if (state->config->set_ts_params) | 935 | if (state->config->set_ts_params) |
718 | state->config->set_ts_params(fe, 0); | 936 | state->config->set_ts_params(fe, 0); |
719 | 937 | ||
@@ -737,6 +955,8 @@ static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
737 | { | 955 | { |
738 | struct cx24123_state *state = fe->demodulator_priv; | 956 | struct cx24123_state *state = fe->demodulator_priv; |
739 | 957 | ||
958 | dprintk("%s: get_frontend\n",__FUNCTION__); | ||
959 | |||
740 | if (cx24123_get_inversion(state, &p->inversion) != 0) { | 960 | if (cx24123_get_inversion(state, &p->inversion) != 0) { |
741 | printk("%s: Failed to get inversion status\n",__FUNCTION__); | 961 | printk("%s: Failed to get inversion status\n",__FUNCTION__); |
742 | return -EREMOTEIO; | 962 | return -EREMOTEIO; |
@@ -763,8 +983,10 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
763 | 983 | ||
764 | switch (tone) { | 984 | switch (tone) { |
765 | case SEC_TONE_ON: | 985 | case SEC_TONE_ON: |
986 | dprintk("%s: isl6421 sec tone on\n",__FUNCTION__); | ||
766 | return cx24123_writelnbreg(state, 0x0, val | 0x10); | 987 | return cx24123_writelnbreg(state, 0x0, val | 0x10); |
767 | case SEC_TONE_OFF: | 988 | case SEC_TONE_OFF: |
989 | dprintk("%s: isl6421 sec tone off\n",__FUNCTION__); | ||
768 | return cx24123_writelnbreg(state, 0x0, val & 0x2f); | 990 | return cx24123_writelnbreg(state, 0x0, val & 0x2f); |
769 | default: | 991 | default: |
770 | printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); | 992 | printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); |
@@ -855,12 +1077,13 @@ static struct dvb_frontend_ops cx24123_ops = { | |||
855 | .frequency_min = 950000, | 1077 | .frequency_min = 950000, |
856 | .frequency_max = 2150000, | 1078 | .frequency_max = 2150000, |
857 | .frequency_stepsize = 1011, /* kHz for QPSK frontends */ | 1079 | .frequency_stepsize = 1011, /* kHz for QPSK frontends */ |
858 | .frequency_tolerance = 29500, | 1080 | .frequency_tolerance = 5000, |
859 | .symbol_rate_min = 1000000, | 1081 | .symbol_rate_min = 1000000, |
860 | .symbol_rate_max = 45000000, | 1082 | .symbol_rate_max = 45000000, |
861 | .caps = FE_CAN_INVERSION_AUTO | | 1083 | .caps = FE_CAN_INVERSION_AUTO | |
862 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | 1084 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | |
863 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | 1085 | FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | |
1086 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
864 | FE_CAN_QPSK | FE_CAN_RECOVER | 1087 | FE_CAN_QPSK | FE_CAN_RECOVER |
865 | }, | 1088 | }, |
866 | 1089 | ||
@@ -875,12 +1098,16 @@ static struct dvb_frontend_ops cx24123_ops = { | |||
875 | .read_snr = cx24123_read_snr, | 1098 | .read_snr = cx24123_read_snr, |
876 | .read_ucblocks = cx24123_read_ucblocks, | 1099 | .read_ucblocks = cx24123_read_ucblocks, |
877 | .diseqc_send_master_cmd = cx24123_send_diseqc_msg, | 1100 | .diseqc_send_master_cmd = cx24123_send_diseqc_msg, |
1101 | .diseqc_send_burst = cx24123_diseqc_send_burst, | ||
878 | .set_tone = cx24123_set_tone, | 1102 | .set_tone = cx24123_set_tone, |
879 | .set_voltage = cx24123_set_voltage, | 1103 | .set_voltage = cx24123_set_voltage, |
880 | }; | 1104 | }; |
881 | 1105 | ||
882 | module_param(debug, int, 0644); | 1106 | module_param(debug, int, 0644); |
883 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 1107 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); |
1108 | |||
1109 | module_param(force_band, int, 0644); | ||
1110 | MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off)."); | ||
884 | 1111 | ||
885 | MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware"); | 1112 | MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware"); |
886 | MODULE_AUTHOR("Steven Toth"); | 1113 | MODULE_AUTHOR("Steven Toth"); |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index b6e2c387a04c..791706ec1da3 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -235,8 +235,8 @@ struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { | |||
235 | .max = 863000000, | 235 | .max = 863000000, |
236 | .count = 3, | 236 | .count = 3, |
237 | .entries = { | 237 | .entries = { |
238 | { 160000000, 44000000, 62500, 0xce, 0x01 }, | 238 | { 165000000, 44000000, 62500, 0xce, 0x01 }, |
239 | { 455000000, 44000000, 62500, 0xce, 0x02 }, | 239 | { 450000000, 44000000, 62500, 0xce, 0x02 }, |
240 | { 999999999, 44000000, 62500, 0xce, 0x04 }, | 240 | { 999999999, 44000000, 62500, 0xce, 0x04 }, |
241 | }, | 241 | }, |
242 | }; | 242 | }; |
diff --git a/drivers/media/dvb/pluto2/Kconfig b/drivers/media/dvb/pluto2/Kconfig index 84f8f9f52869..7d8e6e87bdbb 100644 --- a/drivers/media/dvb/pluto2/Kconfig +++ b/drivers/media/dvb/pluto2/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | config DVB_PLUTO2 | 1 | config DVB_PLUTO2 |
2 | tristate "Pluto2 cards" | 2 | tristate "Pluto2 cards" |
3 | depends on DVB_CORE && PCI | 3 | depends on DVB_CORE && PCI && I2C |
4 | select I2C | ||
5 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
6 | select DVB_TDA1004X | 5 | select DVB_TDA1004X |
7 | help | 6 | help |
diff --git a/drivers/media/dvb/pluto2/Makefile b/drivers/media/dvb/pluto2/Makefile index 86ca84b2be6e..ce6a9aaf937e 100644 --- a/drivers/media/dvb/pluto2/Makefile +++ b/drivers/media/dvb/pluto2/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | obj-$(CONFIG_DVB_PLUTO2) = pluto2.o | 1 | obj-$(CONFIG_DVB_PLUTO2) += pluto2.o |
2 | 2 | ||
3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 5b2aadb8385c..b5ac7dfde52f 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig | |||
@@ -1,8 +1,7 @@ | |||
1 | config DVB_AV7110 | 1 | config DVB_AV7110 |
2 | tristate "AV7110 cards" | 2 | tristate "AV7110 cards" |
3 | depends on DVB_CORE && PCI | 3 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
4 | select FW_LOADER | 4 | select FW_LOADER |
5 | select VIDEO_DEV | ||
6 | select VIDEO_SAA7146_VV | 5 | select VIDEO_SAA7146_VV |
7 | select DVB_VES1820 | 6 | select DVB_VES1820 |
8 | select DVB_VES1X93 | 7 | select DVB_VES1X93 |
@@ -59,7 +58,7 @@ config DVB_AV7110_OSD | |||
59 | 58 | ||
60 | config DVB_BUDGET | 59 | config DVB_BUDGET |
61 | tristate "Budget cards" | 60 | tristate "Budget cards" |
62 | depends on DVB_CORE && PCI | 61 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
63 | select VIDEO_SAA7146 | 62 | select VIDEO_SAA7146 |
64 | select DVB_STV0299 | 63 | select DVB_STV0299 |
65 | select DVB_VES1X93 | 64 | select DVB_VES1X93 |
@@ -80,7 +79,7 @@ config DVB_BUDGET | |||
80 | 79 | ||
81 | config DVB_BUDGET_CI | 80 | config DVB_BUDGET_CI |
82 | tristate "Budget cards with onboard CI connector" | 81 | tristate "Budget cards with onboard CI connector" |
83 | depends on DVB_CORE && PCI | 82 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
84 | select VIDEO_SAA7146 | 83 | select VIDEO_SAA7146 |
85 | select DVB_STV0297 | 84 | select DVB_STV0297 |
86 | select DVB_STV0299 | 85 | select DVB_STV0299 |
@@ -100,8 +99,7 @@ config DVB_BUDGET_CI | |||
100 | 99 | ||
101 | config DVB_BUDGET_AV | 100 | config DVB_BUDGET_AV |
102 | tristate "Budget cards with analog video inputs" | 101 | tristate "Budget cards with analog video inputs" |
103 | depends on DVB_CORE && PCI | 102 | depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 |
104 | select VIDEO_DEV | ||
105 | select VIDEO_SAA7146_VV | 103 | select VIDEO_SAA7146_VV |
106 | select DVB_STV0299 | 104 | select DVB_STV0299 |
107 | select DVB_TDA1004X | 105 | select DVB_TDA1004X |
@@ -119,7 +117,7 @@ config DVB_BUDGET_AV | |||
119 | 117 | ||
120 | config DVB_BUDGET_PATCH | 118 | config DVB_BUDGET_PATCH |
121 | tristate "AV7110 cards with Budget Patch" | 119 | tristate "AV7110 cards with Budget Patch" |
122 | depends on DVB_CORE && DVB_BUDGET | 120 | depends on DVB_CORE && DVB_BUDGET && VIDEO_V4L1 |
123 | select DVB_AV7110 | 121 | select DVB_AV7110 |
124 | select DVB_STV0299 | 122 | select DVB_STV0299 |
125 | select DVB_VES1X93 | 123 | select DVB_VES1X93 |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 8efe3ce5f66c..8a7cd7d505cf 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -1190,8 +1190,6 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1190 | SAA7146_HPS_SYNC_PORT_A); | 1190 | SAA7146_HPS_SYNC_PORT_A); |
1191 | 1191 | ||
1192 | saa7113_setinput(budget_av, 0); | 1192 | saa7113_setinput(budget_av, 0); |
1193 | } else { | ||
1194 | ciintf_init(budget_av); | ||
1195 | } | 1193 | } |
1196 | 1194 | ||
1197 | /* fixme: find some sane values here... */ | 1195 | /* fixme: find some sane values here... */ |
@@ -1211,6 +1209,10 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1211 | budget_av->budget.dvb_adapter.priv = budget_av; | 1209 | budget_av->budget.dvb_adapter.priv = budget_av; |
1212 | frontend_init(budget_av); | 1210 | frontend_init(budget_av); |
1213 | 1211 | ||
1212 | if (!budget_av->has_saa7113) { | ||
1213 | ciintf_init(budget_av); | ||
1214 | } | ||
1215 | |||
1214 | return 0; | 1216 | return 0; |
1215 | } | 1217 | } |
1216 | 1218 | ||
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 5f91036f5b87..e64a609cf4ff 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -71,6 +71,7 @@ struct budget_ci { | |||
71 | struct tasklet_struct msp430_irq_tasklet; | 71 | struct tasklet_struct msp430_irq_tasklet; |
72 | struct tasklet_struct ciintf_irq_tasklet; | 72 | struct tasklet_struct ciintf_irq_tasklet; |
73 | int slot_status; | 73 | int slot_status; |
74 | int ci_irq; | ||
74 | struct dvb_ca_en50221 ca; | 75 | struct dvb_ca_en50221 ca; |
75 | char ir_dev_name[50]; | 76 | char ir_dev_name[50]; |
76 | u8 tuner_pll_address; /* used for philips_tdm1316l configs */ | 77 | u8 tuner_pll_address; /* used for philips_tdm1316l configs */ |
@@ -276,8 +277,10 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) | |||
276 | if (slot != 0) | 277 | if (slot != 0) |
277 | return -EINVAL; | 278 | return -EINVAL; |
278 | 279 | ||
279 | // trigger on RISING edge during reset so we know when READY is re-asserted | 280 | if (budget_ci->ci_irq) { |
280 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | 281 | // trigger on RISING edge during reset so we know when READY is re-asserted |
282 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | ||
283 | } | ||
281 | budget_ci->slot_status = SLOTSTATUS_RESET; | 284 | budget_ci->slot_status = SLOTSTATUS_RESET; |
282 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); | 285 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); |
283 | msleep(1); | 286 | msleep(1); |
@@ -370,11 +373,50 @@ static void ciintf_interrupt(unsigned long data) | |||
370 | } | 373 | } |
371 | } | 374 | } |
372 | 375 | ||
376 | static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open) | ||
377 | { | ||
378 | struct budget_ci *budget_ci = (struct budget_ci *) ca->data; | ||
379 | unsigned int flags; | ||
380 | |||
381 | // ensure we don't get spurious IRQs during initialisation | ||
382 | if (!budget_ci->budget.ci_present) | ||
383 | return -EINVAL; | ||
384 | |||
385 | // read the CAM status | ||
386 | flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); | ||
387 | if (flags & CICONTROL_CAMDETECT) { | ||
388 | // mark it as present if it wasn't before | ||
389 | if (budget_ci->slot_status & SLOTSTATUS_NONE) { | ||
390 | budget_ci->slot_status = SLOTSTATUS_PRESENT; | ||
391 | } | ||
392 | |||
393 | // during a RESET, we check if we can read from IO memory to see when CAM is ready | ||
394 | if (budget_ci->slot_status & SLOTSTATUS_RESET) { | ||
395 | if (ciintf_read_attribute_mem(ca, slot, 0) == 0x1d) { | ||
396 | budget_ci->slot_status = SLOTSTATUS_READY; | ||
397 | } | ||
398 | } | ||
399 | } else { | ||
400 | budget_ci->slot_status = SLOTSTATUS_NONE; | ||
401 | } | ||
402 | |||
403 | if (budget_ci->slot_status != SLOTSTATUS_NONE) { | ||
404 | if (budget_ci->slot_status & SLOTSTATUS_READY) { | ||
405 | return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY; | ||
406 | } | ||
407 | return DVB_CA_EN50221_POLL_CAM_PRESENT; | ||
408 | } | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
373 | static int ciintf_init(struct budget_ci *budget_ci) | 413 | static int ciintf_init(struct budget_ci *budget_ci) |
374 | { | 414 | { |
375 | struct saa7146_dev *saa = budget_ci->budget.dev; | 415 | struct saa7146_dev *saa = budget_ci->budget.dev; |
376 | int flags; | 416 | int flags; |
377 | int result; | 417 | int result; |
418 | int ci_version; | ||
419 | int ca_flags; | ||
378 | 420 | ||
379 | memset(&budget_ci->ca, 0, sizeof(struct dvb_ca_en50221)); | 421 | memset(&budget_ci->ca, 0, sizeof(struct dvb_ca_en50221)); |
380 | 422 | ||
@@ -382,16 +424,29 @@ static int ciintf_init(struct budget_ci *budget_ci) | |||
382 | saa7146_write(saa, MC1, saa7146_read(saa, MC1) | (0x800 << 16) | 0x800); | 424 | saa7146_write(saa, MC1, saa7146_read(saa, MC1) | (0x800 << 16) | 0x800); |
383 | 425 | ||
384 | // test if it is there | 426 | // test if it is there |
385 | if ((ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0) & 0xa0) != 0xa0) { | 427 | ci_version = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0); |
428 | if ((ci_version & 0xa0) != 0xa0) { | ||
386 | result = -ENODEV; | 429 | result = -ENODEV; |
387 | goto error; | 430 | goto error; |
388 | } | 431 | } |
432 | |||
389 | // determine whether a CAM is present or not | 433 | // determine whether a CAM is present or not |
390 | flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); | 434 | flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0); |
391 | budget_ci->slot_status = SLOTSTATUS_NONE; | 435 | budget_ci->slot_status = SLOTSTATUS_NONE; |
392 | if (flags & CICONTROL_CAMDETECT) | 436 | if (flags & CICONTROL_CAMDETECT) |
393 | budget_ci->slot_status = SLOTSTATUS_PRESENT; | 437 | budget_ci->slot_status = SLOTSTATUS_PRESENT; |
394 | 438 | ||
439 | // version 0xa2 of the CI firmware doesn't generate interrupts | ||
440 | if (ci_version == 0xa2) { | ||
441 | ca_flags = 0; | ||
442 | budget_ci->ci_irq = 0; | ||
443 | } else { | ||
444 | ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE | | ||
445 | DVB_CA_EN50221_FLAG_IRQ_FR | | ||
446 | DVB_CA_EN50221_FLAG_IRQ_DA; | ||
447 | budget_ci->ci_irq = 1; | ||
448 | } | ||
449 | |||
395 | // register CI interface | 450 | // register CI interface |
396 | budget_ci->ca.owner = THIS_MODULE; | 451 | budget_ci->ca.owner = THIS_MODULE; |
397 | budget_ci->ca.read_attribute_mem = ciintf_read_attribute_mem; | 452 | budget_ci->ca.read_attribute_mem = ciintf_read_attribute_mem; |
@@ -401,23 +456,27 @@ static int ciintf_init(struct budget_ci *budget_ci) | |||
401 | budget_ci->ca.slot_reset = ciintf_slot_reset; | 456 | budget_ci->ca.slot_reset = ciintf_slot_reset; |
402 | budget_ci->ca.slot_shutdown = ciintf_slot_shutdown; | 457 | budget_ci->ca.slot_shutdown = ciintf_slot_shutdown; |
403 | budget_ci->ca.slot_ts_enable = ciintf_slot_ts_enable; | 458 | budget_ci->ca.slot_ts_enable = ciintf_slot_ts_enable; |
459 | budget_ci->ca.poll_slot_status = ciintf_poll_slot_status; | ||
404 | budget_ci->ca.data = budget_ci; | 460 | budget_ci->ca.data = budget_ci; |
405 | if ((result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter, | 461 | if ((result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter, |
406 | &budget_ci->ca, | 462 | &budget_ci->ca, |
407 | DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE | | 463 | ca_flags, 1)) != 0) { |
408 | DVB_CA_EN50221_FLAG_IRQ_FR | | ||
409 | DVB_CA_EN50221_FLAG_IRQ_DA, 1)) != 0) { | ||
410 | printk("budget_ci: CI interface detected, but initialisation failed.\n"); | 464 | printk("budget_ci: CI interface detected, but initialisation failed.\n"); |
411 | goto error; | 465 | goto error; |
412 | } | 466 | } |
467 | |||
413 | // Setup CI slot IRQ | 468 | // Setup CI slot IRQ |
414 | tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci); | 469 | if (budget_ci->ci_irq) { |
415 | if (budget_ci->slot_status != SLOTSTATUS_NONE) { | 470 | tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci); |
416 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO); | 471 | if (budget_ci->slot_status != SLOTSTATUS_NONE) { |
417 | } else { | 472 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO); |
418 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | 473 | } else { |
474 | saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI); | ||
475 | } | ||
476 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03); | ||
419 | } | 477 | } |
420 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03); | 478 | |
479 | // enable interface | ||
421 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, | 480 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, |
422 | CICONTROL_RESET, 1, 0); | 481 | CICONTROL_RESET, 1, 0); |
423 | 482 | ||
@@ -426,10 +485,12 @@ static int ciintf_init(struct budget_ci *budget_ci) | |||
426 | budget_ci->budget.ci_present = 1; | 485 | budget_ci->budget.ci_present = 1; |
427 | 486 | ||
428 | // forge a fake CI IRQ so the CAM state is setup correctly | 487 | // forge a fake CI IRQ so the CAM state is setup correctly |
429 | flags = DVB_CA_EN50221_CAMCHANGE_REMOVED; | 488 | if (budget_ci->ci_irq) { |
430 | if (budget_ci->slot_status != SLOTSTATUS_NONE) | 489 | flags = DVB_CA_EN50221_CAMCHANGE_REMOVED; |
431 | flags = DVB_CA_EN50221_CAMCHANGE_INSERTED; | 490 | if (budget_ci->slot_status != SLOTSTATUS_NONE) |
432 | dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags); | 491 | flags = DVB_CA_EN50221_CAMCHANGE_INSERTED; |
492 | dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags); | ||
493 | } | ||
433 | 494 | ||
434 | return 0; | 495 | return 0; |
435 | 496 | ||
@@ -443,9 +504,13 @@ static void ciintf_deinit(struct budget_ci *budget_ci) | |||
443 | struct saa7146_dev *saa = budget_ci->budget.dev; | 504 | struct saa7146_dev *saa = budget_ci->budget.dev; |
444 | 505 | ||
445 | // disable CI interrupts | 506 | // disable CI interrupts |
446 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_03); | 507 | if (budget_ci->ci_irq) { |
447 | saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT); | 508 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_03); |
448 | tasklet_kill(&budget_ci->ciintf_irq_tasklet); | 509 | saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT); |
510 | tasklet_kill(&budget_ci->ciintf_irq_tasklet); | ||
511 | } | ||
512 | |||
513 | // reset interface | ||
449 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); | 514 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0); |
450 | msleep(1); | 515 | msleep(1); |
451 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, | 516 | ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, |
@@ -473,7 +538,7 @@ static void budget_ci_irq(struct saa7146_dev *dev, u32 * isr) | |||
473 | if (*isr & MASK_10) | 538 | if (*isr & MASK_10) |
474 | ttpci_budget_irq10_handler(dev, isr); | 539 | ttpci_budget_irq10_handler(dev, isr); |
475 | 540 | ||
476 | if ((*isr & MASK_03) && (budget_ci->budget.ci_present)) | 541 | if ((*isr & MASK_03) && (budget_ci->budget.ci_present) && (budget_ci->ci_irq)) |
477 | tasklet_schedule(&budget_ci->ciintf_irq_tasklet); | 542 | tasklet_schedule(&budget_ci->ciintf_irq_tasklet); |
478 | } | 543 | } |
479 | 544 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 248fdc7accfb..6ceae38125c7 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1507,7 +1507,11 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1507 | 1507 | ||
1508 | mutex_unlock(&ttusb->semi2c); | 1508 | mutex_unlock(&ttusb->semi2c); |
1509 | 1509 | ||
1510 | dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE); | 1510 | if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE)) < 0) { |
1511 | ttusb_free_iso_urbs(ttusb); | ||
1512 | kfree(ttusb); | ||
1513 | return result; | ||
1514 | } | ||
1511 | ttusb->adapter.priv = ttusb; | 1515 | ttusb->adapter.priv = ttusb; |
1512 | 1516 | ||
1513 | /* i2c */ | 1517 | /* i2c */ |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index d318be383de6..3fff75763693 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -7,7 +7,7 @@ menu "Radio Adapters" | |||
7 | 7 | ||
8 | config RADIO_CADET | 8 | config RADIO_CADET |
9 | tristate "ADS Cadet AM/FM Tuner" | 9 | tristate "ADS Cadet AM/FM Tuner" |
10 | depends on ISA && VIDEO_DEV | 10 | depends on ISA && VIDEO_V4L1 |
11 | ---help--- | 11 | ---help--- |
12 | Choose Y here if you have one of these AM/FM radio cards, and then | 12 | Choose Y here if you have one of these AM/FM radio cards, and then |
13 | fill in the port address below. | 13 | fill in the port address below. |
@@ -25,7 +25,7 @@ config RADIO_CADET | |||
25 | 25 | ||
26 | config RADIO_RTRACK | 26 | config RADIO_RTRACK |
27 | tristate "AIMSlab RadioTrack (aka RadioReveal) support" | 27 | tristate "AIMSlab RadioTrack (aka RadioReveal) support" |
28 | depends on ISA && VIDEO_DEV | 28 | depends on ISA && VIDEO_V4L1 |
29 | ---help--- | 29 | ---help--- |
30 | Choose Y here if you have one of these FM radio cards, and then fill | 30 | Choose Y here if you have one of these FM radio cards, and then fill |
31 | in the port address below. | 31 | in the port address below. |
@@ -59,7 +59,7 @@ config RADIO_RTRACK_PORT | |||
59 | 59 | ||
60 | config RADIO_RTRACK2 | 60 | config RADIO_RTRACK2 |
61 | tristate "AIMSlab RadioTrack II support" | 61 | tristate "AIMSlab RadioTrack II support" |
62 | depends on ISA && VIDEO_DEV | 62 | depends on ISA && VIDEO_V4L1 |
63 | ---help--- | 63 | ---help--- |
64 | Choose Y here if you have this FM radio card, and then fill in the | 64 | Choose Y here if you have this FM radio card, and then fill in the |
65 | port address below. | 65 | port address below. |
@@ -82,7 +82,7 @@ config RADIO_RTRACK2_PORT | |||
82 | 82 | ||
83 | config RADIO_AZTECH | 83 | config RADIO_AZTECH |
84 | tristate "Aztech/Packard Bell Radio" | 84 | tristate "Aztech/Packard Bell Radio" |
85 | depends on ISA && VIDEO_DEV | 85 | depends on ISA && VIDEO_V4L1 |
86 | ---help--- | 86 | ---help--- |
87 | Choose Y here if you have one of these FM radio cards, and then fill | 87 | Choose Y here if you have one of these FM radio cards, and then fill |
88 | in the port address below. | 88 | in the port address below. |
@@ -106,7 +106,7 @@ config RADIO_AZTECH_PORT | |||
106 | 106 | ||
107 | config RADIO_GEMTEK | 107 | config RADIO_GEMTEK |
108 | tristate "GemTek Radio Card support" | 108 | tristate "GemTek Radio Card support" |
109 | depends on ISA && VIDEO_DEV | 109 | depends on ISA && VIDEO_V4L1 |
110 | ---help--- | 110 | ---help--- |
111 | Choose Y here if you have this FM radio card, and then fill in the | 111 | Choose Y here if you have this FM radio card, and then fill in the |
112 | port address below. | 112 | port address below. |
@@ -131,7 +131,7 @@ config RADIO_GEMTEK_PORT | |||
131 | 131 | ||
132 | config RADIO_GEMTEK_PCI | 132 | config RADIO_GEMTEK_PCI |
133 | tristate "GemTek PCI Radio Card support" | 133 | tristate "GemTek PCI Radio Card support" |
134 | depends on VIDEO_DEV && PCI | 134 | depends on VIDEO_V4L1 && PCI |
135 | ---help--- | 135 | ---help--- |
136 | Choose Y here if you have this PCI FM radio card. | 136 | Choose Y here if you have this PCI FM radio card. |
137 | 137 | ||
@@ -145,7 +145,7 @@ config RADIO_GEMTEK_PCI | |||
145 | 145 | ||
146 | config RADIO_MAXIRADIO | 146 | config RADIO_MAXIRADIO |
147 | tristate "Guillemot MAXI Radio FM 2000 radio" | 147 | tristate "Guillemot MAXI Radio FM 2000 radio" |
148 | depends on VIDEO_DEV && PCI | 148 | depends on VIDEO_V4L1 && PCI |
149 | ---help--- | 149 | ---help--- |
150 | Choose Y here if you have this radio card. This card may also be | 150 | Choose Y here if you have this radio card. This card may also be |
151 | found as Gemtek PCI FM. | 151 | found as Gemtek PCI FM. |
@@ -160,7 +160,7 @@ config RADIO_MAXIRADIO | |||
160 | 160 | ||
161 | config RADIO_MAESTRO | 161 | config RADIO_MAESTRO |
162 | tristate "Maestro on board radio" | 162 | tristate "Maestro on board radio" |
163 | depends on VIDEO_DEV | 163 | depends on VIDEO_V4L1 |
164 | ---help--- | 164 | ---help--- |
165 | Say Y here to directly support the on-board radio tuner on the | 165 | Say Y here to directly support the on-board radio tuner on the |
166 | Maestro 2 or 2E sound card. | 166 | Maestro 2 or 2E sound card. |
@@ -175,7 +175,7 @@ config RADIO_MAESTRO | |||
175 | 175 | ||
176 | config RADIO_MIROPCM20 | 176 | config RADIO_MIROPCM20 |
177 | tristate "miroSOUND PCM20 radio" | 177 | tristate "miroSOUND PCM20 radio" |
178 | depends on ISA && VIDEO_DEV && SOUND_ACI_MIXER | 178 | depends on ISA && VIDEO_V4L1 && SOUND_ACI_MIXER |
179 | ---help--- | 179 | ---help--- |
180 | Choose Y here if you have this FM radio card. You also need to say Y | 180 | Choose Y here if you have this FM radio card. You also need to say Y |
181 | to "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20 radio)" (in "Sound") | 181 | to "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20 radio)" (in "Sound") |
@@ -208,7 +208,7 @@ config RADIO_MIROPCM20_RDS | |||
208 | 208 | ||
209 | config RADIO_SF16FMI | 209 | config RADIO_SF16FMI |
210 | tristate "SF16FMI Radio" | 210 | tristate "SF16FMI Radio" |
211 | depends on ISA && VIDEO_DEV | 211 | depends on ISA && VIDEO_V4L1 |
212 | ---help--- | 212 | ---help--- |
213 | Choose Y here if you have one of these FM radio cards. If you | 213 | Choose Y here if you have one of these FM radio cards. If you |
214 | compile the driver into the kernel and your card is not PnP one, you | 214 | compile the driver into the kernel and your card is not PnP one, you |
@@ -225,7 +225,7 @@ config RADIO_SF16FMI | |||
225 | 225 | ||
226 | config RADIO_SF16FMR2 | 226 | config RADIO_SF16FMR2 |
227 | tristate "SF16FMR2 Radio" | 227 | tristate "SF16FMR2 Radio" |
228 | depends on ISA && VIDEO_DEV | 228 | depends on ISA && VIDEO_V4L1 |
229 | ---help--- | 229 | ---help--- |
230 | Choose Y here if you have one of these FM radio cards. | 230 | Choose Y here if you have one of these FM radio cards. |
231 | 231 | ||
@@ -239,7 +239,7 @@ config RADIO_SF16FMR2 | |||
239 | 239 | ||
240 | config RADIO_TERRATEC | 240 | config RADIO_TERRATEC |
241 | tristate "TerraTec ActiveRadio ISA Standalone" | 241 | tristate "TerraTec ActiveRadio ISA Standalone" |
242 | depends on ISA && VIDEO_DEV | 242 | depends on ISA && VIDEO_V4L1 |
243 | ---help--- | 243 | ---help--- |
244 | Choose Y here if you have this FM radio card, and then fill in the | 244 | Choose Y here if you have this FM radio card, and then fill in the |
245 | port address below. (TODO) | 245 | port address below. (TODO) |
@@ -268,7 +268,7 @@ config RADIO_TERRATEC_PORT | |||
268 | 268 | ||
269 | config RADIO_TRUST | 269 | config RADIO_TRUST |
270 | tristate "Trust FM radio card" | 270 | tristate "Trust FM radio card" |
271 | depends on ISA && VIDEO_DEV | 271 | depends on ISA && VIDEO_V4L1 |
272 | help | 272 | help |
273 | This is a driver for the Trust FM radio cards. Say Y if you have | 273 | This is a driver for the Trust FM radio cards. Say Y if you have |
274 | such a card and want to use it under Linux. | 274 | such a card and want to use it under Linux. |
@@ -286,7 +286,7 @@ config RADIO_TRUST_PORT | |||
286 | 286 | ||
287 | config RADIO_TYPHOON | 287 | config RADIO_TYPHOON |
288 | tristate "Typhoon Radio (a.k.a. EcoRadio)" | 288 | tristate "Typhoon Radio (a.k.a. EcoRadio)" |
289 | depends on ISA && VIDEO_DEV | 289 | depends on ISA && VIDEO_V4L1 |
290 | ---help--- | 290 | ---help--- |
291 | Choose Y here if you have one of these FM radio cards, and then fill | 291 | Choose Y here if you have one of these FM radio cards, and then fill |
292 | in the port address and the frequency used for muting below. | 292 | in the port address and the frequency used for muting below. |
@@ -330,7 +330,7 @@ config RADIO_TYPHOON_MUTEFREQ | |||
330 | 330 | ||
331 | config RADIO_ZOLTRIX | 331 | config RADIO_ZOLTRIX |
332 | tristate "Zoltrix Radio" | 332 | tristate "Zoltrix Radio" |
333 | depends on ISA && VIDEO_DEV | 333 | depends on ISA && VIDEO_V4L1 |
334 | ---help--- | 334 | ---help--- |
335 | Choose Y here if you have one of these FM radio cards, and then fill | 335 | Choose Y here if you have one of these FM radio cards, and then fill |
336 | in the port address below. | 336 | in the port address below. |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 85888a8a93c9..6b4197018561 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -2,10 +2,10 @@ | |||
2 | # Multimedia Video device configuration | 2 | # Multimedia Video device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menu "Video For Linux" | 5 | menu "Video Capture Adapters" |
6 | depends on VIDEO_DEV | 6 | depends on VIDEO_DEV |
7 | 7 | ||
8 | comment "Video Adapters" | 8 | comment "Video Capture Adapters" |
9 | 9 | ||
10 | config VIDEO_ADV_DEBUG | 10 | config VIDEO_ADV_DEBUG |
11 | bool "Enable advanced debug functionality" | 11 | bool "Enable advanced debug functionality" |
@@ -16,11 +16,23 @@ config VIDEO_ADV_DEBUG | |||
16 | V4L devices. | 16 | V4L devices. |
17 | In doubt, say N. | 17 | In doubt, say N. |
18 | 18 | ||
19 | config VIDEO_VIVI | ||
20 | tristate "Virtual Video Driver" | ||
21 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 | ||
22 | select VIDEO_BUF | ||
23 | default n | ||
24 | ---help--- | ||
25 | Enables a virtual video driver. This device shows a color bar | ||
26 | and a timestamp, as a real device would generate by using V4L2 | ||
27 | api. | ||
28 | Say Y here if you want to test video apps or debug V4L devices. | ||
29 | In doubt, say N. | ||
30 | |||
19 | source "drivers/media/video/bt8xx/Kconfig" | 31 | source "drivers/media/video/bt8xx/Kconfig" |
20 | 32 | ||
21 | config VIDEO_SAA6588 | 33 | config VIDEO_SAA6588 |
22 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" | 34 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" |
23 | depends on VIDEO_DEV && I2C && VIDEO_BT848 | 35 | depends on I2C && VIDEO_BT848 |
24 | 36 | ||
25 | help | 37 | help |
26 | Support for Radio Data System (RDS) decoder. This allows seeing | 38 | Support for Radio Data System (RDS) decoder. This allows seeing |
@@ -32,7 +44,7 @@ config VIDEO_SAA6588 | |||
32 | 44 | ||
33 | config VIDEO_PMS | 45 | config VIDEO_PMS |
34 | tristate "Mediavision Pro Movie Studio Video For Linux" | 46 | tristate "Mediavision Pro Movie Studio Video For Linux" |
35 | depends on VIDEO_DEV && ISA | 47 | depends on ISA && VIDEO_V4L1 |
36 | help | 48 | help |
37 | Say Y if you have such a thing. | 49 | Say Y if you have such a thing. |
38 | 50 | ||
@@ -41,7 +53,7 @@ config VIDEO_PMS | |||
41 | 53 | ||
42 | config VIDEO_PLANB | 54 | config VIDEO_PLANB |
43 | tristate "PlanB Video-In on PowerMac" | 55 | tristate "PlanB Video-In on PowerMac" |
44 | depends on PPC_PMAC && VIDEO_DEV && BROKEN | 56 | depends on PPC_PMAC && VIDEO_V4L1 && BROKEN |
45 | help | 57 | help |
46 | PlanB is the V4L driver for the PowerMac 7x00/8x00 series video | 58 | PlanB is the V4L driver for the PowerMac 7x00/8x00 series video |
47 | input hardware. If you want to experiment with this, say Y. | 59 | input hardware. If you want to experiment with this, say Y. |
@@ -52,7 +64,7 @@ config VIDEO_PLANB | |||
52 | 64 | ||
53 | config VIDEO_BWQCAM | 65 | config VIDEO_BWQCAM |
54 | tristate "Quickcam BW Video For Linux" | 66 | tristate "Quickcam BW Video For Linux" |
55 | depends on VIDEO_DEV && PARPORT | 67 | depends on PARPORT && VIDEO_V4L1 |
56 | help | 68 | help |
57 | Say Y have if you the black and white version of the QuickCam | 69 | Say Y have if you the black and white version of the QuickCam |
58 | camera. See the next option for the color version. | 70 | camera. See the next option for the color version. |
@@ -62,7 +74,7 @@ config VIDEO_BWQCAM | |||
62 | 74 | ||
63 | config VIDEO_CQCAM | 75 | config VIDEO_CQCAM |
64 | tristate "QuickCam Colour Video For Linux (EXPERIMENTAL)" | 76 | tristate "QuickCam Colour Video For Linux (EXPERIMENTAL)" |
65 | depends on EXPERIMENTAL && VIDEO_DEV && PARPORT | 77 | depends on EXPERIMENTAL && PARPORT && VIDEO_V4L1 |
66 | help | 78 | help |
67 | This is the video4linux driver for the colour version of the | 79 | This is the video4linux driver for the colour version of the |
68 | Connectix QuickCam. If you have one of these cameras, say Y here, | 80 | Connectix QuickCam. If you have one of these cameras, say Y here, |
@@ -73,7 +85,7 @@ config VIDEO_CQCAM | |||
73 | 85 | ||
74 | config VIDEO_W9966 | 86 | config VIDEO_W9966 |
75 | tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux" | 87 | tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux" |
76 | depends on PARPORT_1284 && VIDEO_DEV && PARPORT | 88 | depends on PARPORT_1284 && PARPORT && VIDEO_V4L1 |
77 | help | 89 | help |
78 | Video4linux driver for Winbond's w9966 based Webcams. | 90 | Video4linux driver for Winbond's w9966 based Webcams. |
79 | Currently tested with the LifeView FlyCam Supra. | 91 | Currently tested with the LifeView FlyCam Supra. |
@@ -86,7 +98,7 @@ config VIDEO_W9966 | |||
86 | 98 | ||
87 | config VIDEO_CPIA | 99 | config VIDEO_CPIA |
88 | tristate "CPiA Video For Linux" | 100 | tristate "CPiA Video For Linux" |
89 | depends on VIDEO_DEV | 101 | depends on VIDEO_V4L1 |
90 | ---help--- | 102 | ---help--- |
91 | This is the video4linux driver for cameras based on Vision's CPiA | 103 | This is the video4linux driver for cameras based on Vision's CPiA |
92 | (Colour Processor Interface ASIC), such as the Creative Labs Video | 104 | (Colour Processor Interface ASIC), such as the Creative Labs Video |
@@ -123,7 +135,7 @@ source "drivers/media/video/cpia2/Kconfig" | |||
123 | 135 | ||
124 | config VIDEO_SAA5246A | 136 | config VIDEO_SAA5246A |
125 | tristate "SAA5246A, SAA5281 Teletext processor" | 137 | tristate "SAA5246A, SAA5281 Teletext processor" |
126 | depends on VIDEO_DEV && I2C | 138 | depends on I2C && VIDEO_V4L1 |
127 | help | 139 | help |
128 | Support for I2C bus based teletext using the SAA5246A or SAA5281 | 140 | Support for I2C bus based teletext using the SAA5246A or SAA5281 |
129 | chip. Useful only if you live in Europe. | 141 | chip. Useful only if you live in Europe. |
@@ -150,7 +162,7 @@ config TUNER_3036 | |||
150 | 162 | ||
151 | config VIDEO_VINO | 163 | config VIDEO_VINO |
152 | tristate "SGI Vino Video For Linux (EXPERIMENTAL)" | 164 | tristate "SGI Vino Video For Linux (EXPERIMENTAL)" |
153 | depends on VIDEO_DEV && I2C && SGI_IP22 && EXPERIMENTAL | 165 | depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L1 |
154 | select I2C_ALGO_SGI | 166 | select I2C_ALGO_SGI |
155 | help | 167 | help |
156 | Say Y here to build in support for the Vino video input system found | 168 | Say Y here to build in support for the Vino video input system found |
@@ -158,7 +170,7 @@ config VIDEO_VINO | |||
158 | 170 | ||
159 | config VIDEO_STRADIS | 171 | config VIDEO_STRADIS |
160 | tristate "Stradis 4:2:2 MPEG-2 video driver (EXPERIMENTAL)" | 172 | tristate "Stradis 4:2:2 MPEG-2 video driver (EXPERIMENTAL)" |
161 | depends on EXPERIMENTAL && VIDEO_DEV && PCI | 173 | depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && !PPC64 |
162 | help | 174 | help |
163 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video | 175 | Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video |
164 | driver for PCI. There is a product page at | 176 | driver for PCI. There is a product page at |
@@ -166,7 +178,7 @@ config VIDEO_STRADIS | |||
166 | 178 | ||
167 | config VIDEO_ZORAN | 179 | config VIDEO_ZORAN |
168 | tristate "Zoran ZR36057/36067 Video For Linux" | 180 | tristate "Zoran ZR36057/36067 Video For Linux" |
169 | depends on VIDEO_DEV && PCI && I2C_ALGOBIT | 181 | depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64 |
170 | help | 182 | help |
171 | Say Y for support for MJPEG capture cards based on the Zoran | 183 | Say Y for support for MJPEG capture cards based on the Zoran |
172 | 36057/36067 PCI controller chipset. This includes the Iomega | 184 | 36057/36067 PCI controller chipset. This includes the Iomega |
@@ -214,7 +226,7 @@ config VIDEO_ZORAN_LML33R10 | |||
214 | 226 | ||
215 | config VIDEO_ZR36120 | 227 | config VIDEO_ZR36120 |
216 | tristate "Zoran ZR36120/36125 Video For Linux" | 228 | tristate "Zoran ZR36120/36125 Video For Linux" |
217 | depends on VIDEO_DEV && PCI && I2C && BROKEN | 229 | depends on PCI && I2C && VIDEO_V4L1 && BROKEN |
218 | help | 230 | help |
219 | Support for ZR36120/ZR36125 based frame grabber/overlay boards. | 231 | Support for ZR36120/ZR36125 based frame grabber/overlay boards. |
220 | This includes the Victor II, WaveWatcher, Video Wonder, Maxi-TV, | 232 | This includes the Victor II, WaveWatcher, Video Wonder, Maxi-TV, |
@@ -226,7 +238,7 @@ config VIDEO_ZR36120 | |||
226 | 238 | ||
227 | config VIDEO_MEYE | 239 | config VIDEO_MEYE |
228 | tristate "Sony Vaio Picturebook Motion Eye Video For Linux" | 240 | tristate "Sony Vaio Picturebook Motion Eye Video For Linux" |
229 | depends on VIDEO_DEV && PCI && SONYPI | 241 | depends on PCI && SONYPI && VIDEO_V4L1 |
230 | ---help--- | 242 | ---help--- |
231 | This is the video4linux driver for the Motion Eye camera found | 243 | This is the video4linux driver for the Motion Eye camera found |
232 | in the Vaio Picturebook laptops. Please read the material in | 244 | in the Vaio Picturebook laptops. Please read the material in |
@@ -242,7 +254,7 @@ source "drivers/media/video/saa7134/Kconfig" | |||
242 | 254 | ||
243 | config VIDEO_MXB | 255 | config VIDEO_MXB |
244 | tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" | 256 | tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" |
245 | depends on VIDEO_DEV && PCI | 257 | depends on PCI && VIDEO_V4L1 |
246 | select VIDEO_SAA7146_VV | 258 | select VIDEO_SAA7146_VV |
247 | select VIDEO_TUNER | 259 | select VIDEO_TUNER |
248 | ---help--- | 260 | ---help--- |
@@ -254,8 +266,9 @@ config VIDEO_MXB | |||
254 | 266 | ||
255 | config VIDEO_DPC | 267 | config VIDEO_DPC |
256 | tristate "Philips-Semiconductors 'dpc7146 demonstration board'" | 268 | tristate "Philips-Semiconductors 'dpc7146 demonstration board'" |
257 | depends on VIDEO_DEV && PCI | 269 | depends on PCI && VIDEO_V4L1 |
258 | select VIDEO_SAA7146_VV | 270 | select VIDEO_SAA7146_VV |
271 | select VIDEO_V4L2 | ||
259 | ---help--- | 272 | ---help--- |
260 | This is a video4linux driver for the 'dpc7146 demonstration | 273 | This is a video4linux driver for the 'dpc7146 demonstration |
261 | board' by Philips-Semiconductors. It's the reference design | 274 | board' by Philips-Semiconductors. It's the reference design |
@@ -268,8 +281,9 @@ config VIDEO_DPC | |||
268 | 281 | ||
269 | config VIDEO_HEXIUM_ORION | 282 | config VIDEO_HEXIUM_ORION |
270 | tristate "Hexium HV-PCI6 and Orion frame grabber" | 283 | tristate "Hexium HV-PCI6 and Orion frame grabber" |
271 | depends on VIDEO_DEV && PCI | 284 | depends on PCI && VIDEO_V4L1 |
272 | select VIDEO_SAA7146_VV | 285 | select VIDEO_SAA7146_VV |
286 | select VIDEO_V4L2 | ||
273 | ---help--- | 287 | ---help--- |
274 | This is a video4linux driver for the Hexium HV-PCI6 and | 288 | This is a video4linux driver for the Hexium HV-PCI6 and |
275 | Orion frame grabber cards by Hexium. | 289 | Orion frame grabber cards by Hexium. |
@@ -279,8 +293,9 @@ config VIDEO_HEXIUM_ORION | |||
279 | 293 | ||
280 | config VIDEO_HEXIUM_GEMINI | 294 | config VIDEO_HEXIUM_GEMINI |
281 | tristate "Hexium Gemini frame grabber" | 295 | tristate "Hexium Gemini frame grabber" |
282 | depends on VIDEO_DEV && PCI | 296 | depends on PCI && VIDEO_V4L1 |
283 | select VIDEO_SAA7146_VV | 297 | select VIDEO_SAA7146_VV |
298 | select VIDEO_V4L2 | ||
284 | ---help--- | 299 | ---help--- |
285 | This is a video4linux driver for the Hexium Gemini frame | 300 | This is a video4linux driver for the Hexium Gemini frame |
286 | grabber card by Hexium. Please note that the Gemini Dual | 301 | grabber card by Hexium. Please note that the Gemini Dual |
@@ -293,7 +308,7 @@ source "drivers/media/video/cx88/Kconfig" | |||
293 | 308 | ||
294 | config VIDEO_OVCAMCHIP | 309 | config VIDEO_OVCAMCHIP |
295 | tristate "OmniVision Camera Chip support" | 310 | tristate "OmniVision Camera Chip support" |
296 | depends on VIDEO_DEV && I2C | 311 | depends on I2C && VIDEO_V4L1 |
297 | ---help--- | 312 | ---help--- |
298 | Support for the OmniVision OV6xxx and OV7xxx series of camera chips. | 313 | Support for the OmniVision OV6xxx and OV7xxx series of camera chips. |
299 | This driver is intended to be used with the ov511 and w9968cf USB | 314 | This driver is intended to be used with the ov511 and w9968cf USB |
@@ -304,7 +319,7 @@ config VIDEO_OVCAMCHIP | |||
304 | 319 | ||
305 | config VIDEO_M32R_AR | 320 | config VIDEO_M32R_AR |
306 | tristate "AR devices" | 321 | tristate "AR devices" |
307 | depends on M32R | 322 | depends on M32R && VIDEO_V4L1 |
308 | ---help--- | 323 | ---help--- |
309 | This is a video4linux driver for the Renesas AR (Artificial Retina) | 324 | This is a video4linux driver for the Renesas AR (Artificial Retina) |
310 | camera module. | 325 | camera module. |
@@ -365,17 +380,17 @@ config VIDEO_WM8739 | |||
365 | source "drivers/media/video/cx25840/Kconfig" | 380 | source "drivers/media/video/cx25840/Kconfig" |
366 | 381 | ||
367 | config VIDEO_SAA711X | 382 | config VIDEO_SAA711X |
368 | tristate "Philips SAA7113/4/5 video decoders" | 383 | tristate "Philips SAA7113/4/5 video decoders (OBSOLETED)" |
369 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 384 | depends on VIDEO_V4L1 && I2C && EXPERIMENTAL |
370 | ---help--- | 385 | ---help--- |
371 | Support for the Philips SAA7113/4/5 video decoders. | 386 | Old support for the Philips SAA7113/4 video decoders. |
372 | 387 | ||
373 | To compile this driver as a module, choose M here: the | 388 | To compile this driver as a module, choose M here: the |
374 | module will be called saa7115. | 389 | module will be called saa7115. |
375 | 390 | ||
376 | config VIDEO_SAA7127 | 391 | config VIDEO_SAA7127 |
377 | tristate "Philips SAA7127/9 digital video encoders" | 392 | tristate "Philips SAA7127/9 digital video encoders" |
378 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 393 | depends on VIDEO_V4L2 && I2C && EXPERIMENTAL |
379 | ---help--- | 394 | ---help--- |
380 | Support for the Philips SAA7127/9 digital video encoders. | 395 | Support for the Philips SAA7127/9 digital video encoders. |
381 | 396 | ||
@@ -384,7 +399,7 @@ config VIDEO_SAA7127 | |||
384 | 399 | ||
385 | config VIDEO_UPD64031A | 400 | config VIDEO_UPD64031A |
386 | tristate "NEC Electronics uPD64031A Ghost Reduction" | 401 | tristate "NEC Electronics uPD64031A Ghost Reduction" |
387 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 402 | depends on VIDEO_V4L2 && I2C && EXPERIMENTAL |
388 | ---help--- | 403 | ---help--- |
389 | Support for the NEC Electronics uPD64031A Ghost Reduction | 404 | Support for the NEC Electronics uPD64031A Ghost Reduction |
390 | video chip. It is most often found in NTSC TV cards made for | 405 | video chip. It is most often found in NTSC TV cards made for |
@@ -396,7 +411,7 @@ config VIDEO_UPD64031A | |||
396 | 411 | ||
397 | config VIDEO_UPD64083 | 412 | config VIDEO_UPD64083 |
398 | tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation" | 413 | tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation" |
399 | depends on VIDEO_DEV && I2C && EXPERIMENTAL | 414 | depends on VIDEO_V4L2 && I2C && EXPERIMENTAL |
400 | ---help--- | 415 | ---help--- |
401 | Support for the NEC Electronics uPD64083 3-Dimensional Y/C | 416 | Support for the NEC Electronics uPD64083 3-Dimensional Y/C |
402 | separation video chip. It is used to improve the quality of | 417 | separation video chip. It is used to improve the quality of |
@@ -418,7 +433,7 @@ source "drivers/media/video/em28xx/Kconfig" | |||
418 | 433 | ||
419 | config USB_DSBR | 434 | config USB_DSBR |
420 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | 435 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" |
421 | depends on USB && VIDEO_DEV && EXPERIMENTAL | 436 | depends on USB && VIDEO_V4L1 && EXPERIMENTAL |
422 | ---help--- | 437 | ---help--- |
423 | Say Y here if you want to connect this type of radio to your | 438 | Say Y here if you want to connect this type of radio to your |
424 | computer's USB port. Note that the audio is not digital, and | 439 | computer's USB port. Note that the audio is not digital, and |
@@ -434,7 +449,7 @@ source "drivers/media/video/et61x251/Kconfig" | |||
434 | 449 | ||
435 | config USB_OV511 | 450 | config USB_OV511 |
436 | tristate "USB OV511 Camera support" | 451 | tristate "USB OV511 Camera support" |
437 | depends on USB && VIDEO_DEV | 452 | depends on USB && VIDEO_V4L1 |
438 | ---help--- | 453 | ---help--- |
439 | Say Y here if you want to connect this type of camera to your | 454 | Say Y here if you want to connect this type of camera to your |
440 | computer's USB port. See <file:Documentation/video4linux/ov511.txt> | 455 | computer's USB port. See <file:Documentation/video4linux/ov511.txt> |
@@ -445,7 +460,7 @@ config USB_OV511 | |||
445 | 460 | ||
446 | config USB_SE401 | 461 | config USB_SE401 |
447 | tristate "USB SE401 Camera support" | 462 | tristate "USB SE401 Camera support" |
448 | depends on USB && VIDEO_DEV | 463 | depends on USB && VIDEO_V4L1 |
449 | ---help--- | 464 | ---help--- |
450 | Say Y here if you want to connect this type of camera to your | 465 | Say Y here if you want to connect this type of camera to your |
451 | computer's USB port. See <file:Documentation/video4linux/se401.txt> | 466 | computer's USB port. See <file:Documentation/video4linux/se401.txt> |
@@ -458,7 +473,7 @@ source "drivers/media/video/sn9c102/Kconfig" | |||
458 | 473 | ||
459 | config USB_STV680 | 474 | config USB_STV680 |
460 | tristate "USB STV680 (Pencam) Camera support" | 475 | tristate "USB STV680 (Pencam) Camera support" |
461 | depends on USB && VIDEO_DEV | 476 | depends on USB && VIDEO_V4L1 |
462 | ---help--- | 477 | ---help--- |
463 | Say Y here if you want to connect this type of camera to your | 478 | Say Y here if you want to connect this type of camera to your |
464 | computer's USB port. This includes the Pencam line of cameras. | 479 | computer's USB port. This includes the Pencam line of cameras. |
@@ -470,7 +485,7 @@ config USB_STV680 | |||
470 | 485 | ||
471 | config USB_W9968CF | 486 | config USB_W9968CF |
472 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" | 487 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" |
473 | depends on USB && VIDEO_DEV && I2C | 488 | depends on USB && VIDEO_V4L1 && I2C |
474 | select VIDEO_OVCAMCHIP | 489 | select VIDEO_OVCAMCHIP |
475 | ---help--- | 490 | ---help--- |
476 | Say Y here if you want support for cameras based on OV681 or | 491 | Say Y here if you want support for cameras based on OV681 or |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index b3ea2d63db9b..e5bf2687b76d 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -10,7 +10,11 @@ tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \ | |||
10 | 10 | ||
11 | msp3400-objs := msp3400-driver.o msp3400-kthreads.o | 11 | msp3400-objs := msp3400-driver.o msp3400-kthreads.o |
12 | 12 | ||
13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o | 13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o |
14 | |||
15 | ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) | ||
16 | obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o | ||
17 | endif | ||
14 | 18 | ||
15 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ | 19 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ |
16 | obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o | 20 | obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o |
@@ -84,4 +88,8 @@ obj-$(CONFIG_USB_IBMCAM) += usbvideo/ | |||
84 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ | 88 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ |
85 | obj-$(CONFIG_USB_VICAM) += usbvideo/ | 89 | obj-$(CONFIG_USB_VICAM) += usbvideo/ |
86 | 90 | ||
91 | obj-$(CONFIG_VIDEO_VIVI) += vivi.o | ||
92 | |||
87 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 93 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
94 | extra-cflags-$(CONFIG_VIDEO_V4L1_COMPAT) += -DCONFIG_VIDEO_V4L1_COMPAT | ||
95 | |||
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig index 085477c12612..153f6a4a96c9 100644 --- a/drivers/media/video/bt8xx/Kconfig +++ b/drivers/media/video/bt8xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_BT848 | 1 | config VIDEO_BT848 |
2 | tristate "BT848 Video For Linux" | 2 | tristate "BT848 Video For Linux" |
3 | depends on VIDEO_DEV && PCI && I2C | 3 | depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 |
4 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select VIDEO_BTCX | 6 | select VIDEO_BTCX |
diff --git a/drivers/media/video/bt8xx/Makefile b/drivers/media/video/bt8xx/Makefile index db641a36b197..a096a03418aa 100644 --- a/drivers/media/video/bt8xx/Makefile +++ b/drivers/media/video/bt8xx/Makefile | |||
@@ -8,5 +8,5 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | |||
8 | 8 | ||
9 | obj-$(CONFIG_VIDEO_BT848) += bttv.o | 9 | obj-$(CONFIG_VIDEO_BT848) += bttv.o |
10 | 10 | ||
11 | EXTRA_CFLAGS += -I$(src)/.. | 11 | EXTRA_CFLAGS += -Idrivers/media/video |
12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index f209a7492051..2b64aa835b42 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -2991,13 +2991,13 @@ void __devinit bttv_idcard(struct bttv *btv) | |||
2991 | 2991 | ||
2992 | if (UNSET != audiomux[0]) { | 2992 | if (UNSET != audiomux[0]) { |
2993 | gpiobits = 0; | 2993 | gpiobits = 0; |
2994 | for (i = 0; i < 5; i++) { | 2994 | for (i = 0; i < 4; i++) { |
2995 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; | 2995 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; |
2996 | gpiobits |= audiomux[i]; | 2996 | gpiobits |= audiomux[i]; |
2997 | } | 2997 | } |
2998 | } else { | 2998 | } else { |
2999 | gpiobits = audioall; | 2999 | gpiobits = audioall; |
3000 | for (i = 0; i < 5; i++) { | 3000 | for (i = 0; i < 4; i++) { |
3001 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; | 3001 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; |
3002 | } | 3002 | } |
3003 | } | 3003 | } |
diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c index 16323a5d68ac..afcfe71e3792 100644 --- a/drivers/media/video/bt8xx/bttv-risc.c +++ b/drivers/media/video/bt8xx/bttv-risc.c | |||
@@ -233,7 +233,7 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, | |||
233 | const struct bttv_format *fmt, struct bttv_overlay *ov, | 233 | const struct bttv_format *fmt, struct bttv_overlay *ov, |
234 | int skip_even, int skip_odd) | 234 | int skip_even, int skip_odd) |
235 | { | 235 | { |
236 | int instructions,rc,line,maxy,start,end,skip,nskips; | 236 | int dwords,rc,line,maxy,start,end,skip,nskips; |
237 | struct btcx_skiplist *skips; | 237 | struct btcx_skiplist *skips; |
238 | u32 *rp,ri,ra; | 238 | u32 *rp,ri,ra; |
239 | u32 addr; | 239 | u32 addr; |
@@ -242,12 +242,12 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, | |||
242 | if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL))) | 242 | if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL))) |
243 | return -ENOMEM; | 243 | return -ENOMEM; |
244 | 244 | ||
245 | /* estimate risc mem: worst case is (clip+1) * lines instructions | 245 | /* estimate risc mem: worst case is (1.5*clip+1) * lines instructions |
246 | + sync + jump (all 2 dwords) */ | 246 | + sync + jump (all 2 dwords) */ |
247 | instructions = (ov->nclips + 1) * | 247 | dwords = (3 * ov->nclips + 2) * |
248 | ((skip_even || skip_odd) ? ov->w.height>>1 : ov->w.height); | 248 | ((skip_even || skip_odd) ? (ov->w.height+1)>>1 : ov->w.height); |
249 | instructions += 2; | 249 | dwords += 4; |
250 | if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0) { | 250 | if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,dwords*4)) < 0) { |
251 | kfree(skips); | 251 | kfree(skips); |
252 | return rc; | 252 | return rc; |
253 | } | 253 | } |
@@ -276,8 +276,6 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, | |||
276 | if (line > maxy) | 276 | if (line > maxy) |
277 | btcx_calc_skips(line, ov->w.width, &maxy, | 277 | btcx_calc_skips(line, ov->w.width, &maxy, |
278 | skips, &nskips, ov->clips, ov->nclips); | 278 | skips, &nskips, ov->clips, ov->nclips); |
279 | else | ||
280 | nskips = 0; | ||
281 | 279 | ||
282 | /* write out risc code */ | 280 | /* write out risc code */ |
283 | for (start = 0, skip = 0; start < ov->w.width; start = end) { | 281 | for (start = 0, skip = 0; start < ov->w.width; start = end) { |
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c index f59ced181c55..1958d4016ea1 100644 --- a/drivers/media/video/cx25840/cx25840-firmware.c +++ b/drivers/media/video/cx25840/cx25840-firmware.c | |||
@@ -39,29 +39,12 @@ | |||
39 | 39 | ||
40 | #define FWDEV(x) &((x)->adapter->dev) | 40 | #define FWDEV(x) &((x)->adapter->dev) |
41 | 41 | ||
42 | static int fastfw = 1; | ||
43 | static char *firmware = FWFILE; | 42 | static char *firmware = FWFILE; |
44 | 43 | ||
45 | module_param(fastfw, bool, 0444); | ||
46 | module_param(firmware, charp, 0444); | 44 | module_param(firmware, charp, 0444); |
47 | 45 | ||
48 | MODULE_PARM_DESC(fastfw, "Load firmware fast [0=100MHz 1=333MHz (default)]"); | ||
49 | MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); | 46 | MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); |
50 | 47 | ||
51 | static void set_i2c_delay(struct i2c_client *client, int delay) | ||
52 | { | ||
53 | struct i2c_algo_bit_data *algod = client->adapter->algo_data; | ||
54 | |||
55 | /* We aren't guaranteed to be using algo_bit, | ||
56 | * so avoid the null pointer dereference | ||
57 | * and disable the 'fast firmware load' */ | ||
58 | if (algod) { | ||
59 | algod->udelay = delay; | ||
60 | } else { | ||
61 | fastfw = 0; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static void start_fw_load(struct i2c_client *client) | 48 | static void start_fw_load(struct i2c_client *client) |
66 | { | 49 | { |
67 | /* DL_ADDR_LB=0 DL_ADDR_HB=0 */ | 50 | /* DL_ADDR_LB=0 DL_ADDR_HB=0 */ |
@@ -71,16 +54,10 @@ static void start_fw_load(struct i2c_client *client) | |||
71 | cx25840_write(client, 0x803, 0x0b); | 54 | cx25840_write(client, 0x803, 0x0b); |
72 | /* AUTO_INC_DIS=1 */ | 55 | /* AUTO_INC_DIS=1 */ |
73 | cx25840_write(client, 0x000, 0x20); | 56 | cx25840_write(client, 0x000, 0x20); |
74 | |||
75 | if (fastfw) | ||
76 | set_i2c_delay(client, 3); | ||
77 | } | 57 | } |
78 | 58 | ||
79 | static void end_fw_load(struct i2c_client *client) | 59 | static void end_fw_load(struct i2c_client *client) |
80 | { | 60 | { |
81 | if (fastfw) | ||
82 | set_i2c_delay(client, 10); | ||
83 | |||
84 | /* AUTO_INC_DIS=0 */ | 61 | /* AUTO_INC_DIS=0 */ |
85 | cx25840_write(client, 0x000, 0x00); | 62 | cx25840_write(client, 0x000, 0x00); |
86 | /* DL_ENABLE=0 */ | 63 | /* DL_ENABLE=0 */ |
@@ -107,30 +84,8 @@ static int fw_write(struct i2c_client *client, u8 * data, int size) | |||
107 | int sent; | 84 | int sent; |
108 | 85 | ||
109 | if ((sent = i2c_master_send(client, data, size)) < size) { | 86 | if ((sent = i2c_master_send(client, data, size)) < size) { |
110 | 87 | v4l_err(client, "firmware load i2c failure\n"); | |
111 | if (fastfw) { | 88 | return -ENOSYS; |
112 | v4l_err(client, "333MHz i2c firmware load failed\n"); | ||
113 | fastfw = 0; | ||
114 | set_i2c_delay(client, 10); | ||
115 | |||
116 | if (sent > 2) { | ||
117 | u16 dl_addr = cx25840_read(client, 0x801) << 8; | ||
118 | dl_addr |= cx25840_read(client, 0x800); | ||
119 | dl_addr -= sent - 2; | ||
120 | cx25840_write(client, 0x801, dl_addr >> 8); | ||
121 | cx25840_write(client, 0x800, dl_addr & 0xff); | ||
122 | } | ||
123 | |||
124 | if (i2c_master_send(client, data, size) < size) { | ||
125 | v4l_err(client, "100MHz i2c firmware load failed\n"); | ||
126 | return -ENOSYS; | ||
127 | } | ||
128 | |||
129 | } else { | ||
130 | v4l_err(client, "firmware load i2c failure\n"); | ||
131 | return -ENOSYS; | ||
132 | } | ||
133 | |||
134 | } | 89 | } |
135 | 90 | ||
136 | return 0; | 91 | return 0; |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index c7042cf41231..f80154b87d22 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -564,7 +564,7 @@ struct cx88_board cx88_boards[] = { | |||
564 | }, | 564 | }, |
565 | [CX88_BOARD_PCHDTV_HD3000] = { | 565 | [CX88_BOARD_PCHDTV_HD3000] = { |
566 | .name = "pcHDTV HD3000 HDTV", | 566 | .name = "pcHDTV HD3000 HDTV", |
567 | .tuner_type = TUNER_THOMSON_DTT7610, | 567 | .tuner_type = TUNER_THOMSON_DTT761X, |
568 | .radio_type = UNSET, | 568 | .radio_type = UNSET, |
569 | .tuner_addr = ADDR_UNSET, | 569 | .tuner_addr = ADDR_UNSET, |
570 | .radio_addr = ADDR_UNSET, | 570 | .radio_addr = ADDR_UNSET, |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 2c3d9f1999be..e1092d5d4628 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -146,9 +146,11 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
146 | fields++; | 146 | fields++; |
147 | 147 | ||
148 | /* estimate risc mem: worst case is one write per page border + | 148 | /* estimate risc mem: worst case is one write per page border + |
149 | one write per scan line + syncs + jump (all 2 dwords) */ | 149 | one write per scan line + syncs + jump (all 2 dwords). Padding |
150 | instructions = (bpl * lines * fields) / PAGE_SIZE + lines * fields; | 150 | can cause next bpl to start close to a page border. First DMA |
151 | instructions += 3 + 4; | 151 | region may be smaller than PAGE_SIZE */ |
152 | instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); | ||
153 | instructions += 2; | ||
152 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) | 154 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) |
153 | return rc; | 155 | return rc; |
154 | 156 | ||
@@ -176,9 +178,11 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
176 | int rc; | 178 | int rc; |
177 | 179 | ||
178 | /* estimate risc mem: worst case is one write per page border + | 180 | /* estimate risc mem: worst case is one write per page border + |
179 | one write per scan line + syncs + jump (all 2 dwords) */ | 181 | one write per scan line + syncs + jump (all 2 dwords). Here |
180 | instructions = (bpl * lines) / PAGE_SIZE + lines; | 182 | there is no padding and no sync. First DMA region may be smaller |
181 | instructions += 3 + 4; | 183 | than PAGE_SIZE */ |
184 | instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; | ||
185 | instructions += 1; | ||
182 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) | 186 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) |
183 | return rc; | 187 | return rc; |
184 | 188 | ||
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index f0ea9b5cdbc2..3619a449aefd 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -372,7 +372,7 @@ static int or51132_set_ts_param(struct dvb_frontend* fe, | |||
372 | static struct or51132_config pchdtv_hd3000 = { | 372 | static struct or51132_config pchdtv_hd3000 = { |
373 | .demod_address = 0x15, | 373 | .demod_address = 0x15, |
374 | .pll_address = 0x61, | 374 | .pll_address = 0x61, |
375 | .pll_desc = &dvb_pll_thomson_dtt7610, | 375 | .pll_desc = &dvb_pll_thomson_dtt761x, |
376 | .set_ts_params = or51132_set_ts_param, | 376 | .set_ts_params = or51132_set_ts_param, |
377 | }; | 377 | }; |
378 | #endif | 378 | #endif |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 72a417b31745..694d1d80ff3f 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -35,8 +35,10 @@ | |||
35 | #include "cx88.h" | 35 | #include "cx88.h" |
36 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
37 | 37 | ||
38 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
38 | /* Include V4L1 specific functions. Should be removed soon */ | 39 | /* Include V4L1 specific functions. Should be removed soon */ |
39 | #include <linux/videodev.h> | 40 | #include <linux/videodev.h> |
41 | #endif | ||
40 | 42 | ||
41 | MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); | 43 | MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); |
42 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 44 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 5a793ae7cc23..dfb15bfb83dc 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_EM28XX | 1 | config VIDEO_EM28XX |
2 | tristate "Empia EM2800/2820/2840 USB video capture support" | 2 | tristate "Empia EM2800/2820/2840 USB video capture support" |
3 | depends on VIDEO_DEV && USB && I2C | 3 | depends on VIDEO_V4L1 && USB && I2C |
4 | select VIDEO_BUF | 4 | select VIDEO_BUF |
5 | select VIDEO_TUNER | 5 | select VIDEO_TUNER |
6 | select VIDEO_TVEEPROM | 6 | select VIDEO_TVEEPROM |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index ddc92cbb5276..cf7cdf9ef617 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -1576,8 +1576,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1576 | errCode = em28xx_config(dev); | 1576 | errCode = em28xx_config(dev); |
1577 | if (errCode) { | 1577 | if (errCode) { |
1578 | em28xx_errdev("error configuring device\n"); | 1578 | em28xx_errdev("error configuring device\n"); |
1579 | kfree(dev); | ||
1580 | em28xx_devused&=~(1<<dev->devno); | 1579 | em28xx_devused&=~(1<<dev->devno); |
1580 | kfree(dev); | ||
1581 | return -ENOMEM; | 1581 | return -ENOMEM; |
1582 | } | 1582 | } |
1583 | 1583 | ||
@@ -1603,8 +1603,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1603 | dev->vdev = video_device_alloc(); | 1603 | dev->vdev = video_device_alloc(); |
1604 | if (NULL == dev->vdev) { | 1604 | if (NULL == dev->vdev) { |
1605 | em28xx_errdev("cannot allocate video_device.\n"); | 1605 | em28xx_errdev("cannot allocate video_device.\n"); |
1606 | kfree(dev); | ||
1607 | em28xx_devused&=~(1<<dev->devno); | 1606 | em28xx_devused&=~(1<<dev->devno); |
1607 | kfree(dev); | ||
1608 | return -ENOMEM; | 1608 | return -ENOMEM; |
1609 | } | 1609 | } |
1610 | 1610 | ||
@@ -1612,8 +1612,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1612 | if (NULL == dev->vbi_dev) { | 1612 | if (NULL == dev->vbi_dev) { |
1613 | em28xx_errdev("cannot allocate video_device.\n"); | 1613 | em28xx_errdev("cannot allocate video_device.\n"); |
1614 | kfree(dev->vdev); | 1614 | kfree(dev->vdev); |
1615 | kfree(dev); | ||
1616 | em28xx_devused&=~(1<<dev->devno); | 1615 | em28xx_devused&=~(1<<dev->devno); |
1616 | kfree(dev); | ||
1617 | return -ENOMEM; | 1617 | return -ENOMEM; |
1618 | } | 1618 | } |
1619 | 1619 | ||
@@ -1650,8 +1650,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1650 | mutex_unlock(&dev->lock); | 1650 | mutex_unlock(&dev->lock); |
1651 | list_del(&dev->devlist); | 1651 | list_del(&dev->devlist); |
1652 | video_device_release(dev->vdev); | 1652 | video_device_release(dev->vdev); |
1653 | kfree(dev); | ||
1654 | em28xx_devused&=~(1<<dev->devno); | 1653 | em28xx_devused&=~(1<<dev->devno); |
1654 | kfree(dev); | ||
1655 | return -ENODEV; | 1655 | return -ENODEV; |
1656 | } | 1656 | } |
1657 | 1657 | ||
@@ -1662,8 +1662,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1662 | list_del(&dev->devlist); | 1662 | list_del(&dev->devlist); |
1663 | video_device_release(dev->vbi_dev); | 1663 | video_device_release(dev->vbi_dev); |
1664 | video_device_release(dev->vdev); | 1664 | video_device_release(dev->vdev); |
1665 | kfree(dev); | ||
1666 | em28xx_devused&=~(1<<dev->devno); | 1665 | em28xx_devused&=~(1<<dev->devno); |
1666 | kfree(dev); | ||
1667 | return -ENODEV; | 1667 | return -ENODEV; |
1668 | } else { | 1668 | } else { |
1669 | printk("registered VBI\n"); | 1669 | printk("registered VBI\n"); |
diff --git a/drivers/media/video/et61x251/Kconfig b/drivers/media/video/et61x251/Kconfig index 6c43a90c6569..c6bff705688d 100644 --- a/drivers/media/video/et61x251/Kconfig +++ b/drivers/media/video/et61x251/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_ET61X251 | 1 | config USB_ET61X251 |
2 | tristate "USB ET61X[12]51 PC Camera Controller support" | 2 | tristate "USB ET61X[12]51 PC Camera Controller support" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on Etoms ET61X151 | 5 | Say Y here if you want support for cameras based on Etoms ET61X151 |
6 | or ET61X251 PC Camera Controllers. | 6 | or ET61X251 PC Camera Controllers. |
diff --git a/drivers/media/video/pwc/Kconfig b/drivers/media/video/pwc/Kconfig index 86376556f108..53cbc950f95c 100644 --- a/drivers/media/video/pwc/Kconfig +++ b/drivers/media/video/pwc/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_PWC | 1 | config USB_PWC |
2 | tristate "USB Philips Cameras" | 2 | tristate "USB Philips Cameras" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y or M here if you want to use one of these Philips & OEM | 5 | Say Y or M here if you want to use one of these Philips & OEM |
6 | webcams: | 6 | webcams: |
diff --git a/drivers/media/video/pwc/Makefile b/drivers/media/video/pwc/Makefile index 8326684f49f3..33d60126c024 100644 --- a/drivers/media/video/pwc/Makefile +++ b/drivers/media/video/pwc/Makefile | |||
@@ -1,20 +1,3 @@ | |||
1 | ifneq ($(KERNELRELEASE),) | ||
2 | |||
3 | pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o pwc-timon.o pwc-kiara.o | 1 | pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o pwc-timon.o pwc-kiara.o |
4 | 2 | ||
5 | obj-$(CONFIG_USB_PWC) += pwc.o | 3 | obj-$(CONFIG_USB_PWC) += pwc.o |
6 | |||
7 | else | ||
8 | |||
9 | KDIR := /lib/modules/$(shell uname -r)/build | ||
10 | PWD := $(shell pwd) | ||
11 | |||
12 | default: | ||
13 | $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules | ||
14 | |||
15 | endif | ||
16 | |||
17 | clean: | ||
18 | rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c | ||
19 | rm -rf .tmp_versions | ||
20 | |||
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 133f9e5252fe..c271e2e14105 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -142,6 +142,7 @@ struct i2c_reg_value { | |||
142 | static const struct i2c_reg_value saa7129_init_config_extra[] = { | 142 | static const struct i2c_reg_value saa7129_init_config_extra[] = { |
143 | { SAA7127_REG_OUTPUT_PORT_CONTROL, 0x38 }, | 143 | { SAA7127_REG_OUTPUT_PORT_CONTROL, 0x38 }, |
144 | { SAA7127_REG_VTRIG, 0xfa }, | 144 | { SAA7127_REG_VTRIG, 0xfa }, |
145 | { 0, 0 } | ||
145 | }; | 146 | }; |
146 | 147 | ||
147 | static const struct i2c_reg_value saa7127_init_config_common[] = { | 148 | static const struct i2c_reg_value saa7127_init_config_common[] = { |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index e666a4465ca4..86eae3528330 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -3504,6 +3504,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
3504 | /* power-up tuner chip */ | 3504 | /* power-up tuner chip */ |
3505 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); | 3505 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); |
3506 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); | 3506 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); |
3507 | break; | ||
3507 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 3508 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
3508 | /* this turns the remote control chip off to work around a bug in it */ | 3509 | /* this turns the remote control chip off to work around a bug in it */ |
3509 | saa_writeb(SAA7134_GPIO_GPMODE1, 0x80); | 3510 | saa_writeb(SAA7134_GPIO_GPMODE1, 0x80); |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 13de05532e0a..f0c2111f14ad 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -548,6 +548,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
548 | if (report & SAA7134_IRQ_REPORT_GPIO16) { | 548 | if (report & SAA7134_IRQ_REPORT_GPIO16) { |
549 | switch (dev->has_remote) { | 549 | switch (dev->has_remote) { |
550 | case SAA7134_REMOTE_GPIO: | 550 | case SAA7134_REMOTE_GPIO: |
551 | if (!dev->remote) | ||
552 | break; | ||
551 | if (dev->remote->mask_keydown & 0x10000) { | 553 | if (dev->remote->mask_keydown & 0x10000) { |
552 | saa7134_input_irq(dev); | 554 | saa7134_input_irq(dev); |
553 | } | 555 | } |
@@ -564,6 +566,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
564 | if (report & SAA7134_IRQ_REPORT_GPIO18) { | 566 | if (report & SAA7134_IRQ_REPORT_GPIO18) { |
565 | switch (dev->has_remote) { | 567 | switch (dev->has_remote) { |
566 | case SAA7134_REMOTE_GPIO: | 568 | case SAA7134_REMOTE_GPIO: |
569 | if (!dev->remote) | ||
570 | break; | ||
567 | if ((dev->remote->mask_keydown & 0x40000) || | 571 | if ((dev->remote->mask_keydown & 0x40000) || |
568 | (dev->remote->mask_keyup & 0x40000)) { | 572 | (dev->remote->mask_keyup & 0x40000)) { |
569 | saa7134_input_irq(dev); | 573 | saa7134_input_irq(dev); |
@@ -676,7 +680,7 @@ static int saa7134_hwinit2(struct saa7134_dev *dev) | |||
676 | SAA7134_IRQ2_INTE_PE | | 680 | SAA7134_IRQ2_INTE_PE | |
677 | SAA7134_IRQ2_INTE_AR; | 681 | SAA7134_IRQ2_INTE_AR; |
678 | 682 | ||
679 | if (dev->has_remote == SAA7134_REMOTE_GPIO) { | 683 | if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) { |
680 | if (dev->remote->mask_keydown & 0x10000) | 684 | if (dev->remote->mask_keydown & 0x10000) |
681 | irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; | 685 | irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; |
682 | else if (dev->remote->mask_keydown & 0x40000) | 686 | else if (dev->remote->mask_keydown & 0x40000) |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index aeef80f88a6b..e4156ec9c6d7 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -31,8 +31,10 @@ | |||
31 | #include "saa7134.h" | 31 | #include "saa7134.h" |
32 | #include <media/v4l2-common.h> | 32 | #include <media/v4l2-common.h> |
33 | 33 | ||
34 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
34 | /* Include V4L1 specific functions. Should be removed soon */ | 35 | /* Include V4L1 specific functions. Should be removed soon */ |
35 | #include <linux/videodev.h> | 36 | #include <linux/videodev.h> |
37 | #endif | ||
36 | 38 | ||
37 | /* ------------------------------------------------------------------ */ | 39 | /* ------------------------------------------------------------------ */ |
38 | 40 | ||
diff --git a/drivers/media/video/sn9c102/Kconfig b/drivers/media/video/sn9c102/Kconfig index 55f2bc11964b..cf552e6b8ecf 100644 --- a/drivers/media/video/sn9c102/Kconfig +++ b/drivers/media/video/sn9c102/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_SN9C102 | 1 | config USB_SN9C102 |
2 | tristate "USB SN9C10x PC Camera Controller support" | 2 | tristate "USB SN9C10x PC Camera Controller support" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on SONiX SN9C101, | 5 | Say Y here if you want support for cameras based on SONiX SN9C101, |
6 | SN9C102 or SN9C103 PC Camera Controllers. | 6 | SN9C102 or SN9C103 PC Camera Controllers. |
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c index 72e0f01db563..a1ae036b44ec 100644 --- a/drivers/media/video/tuner-types.c +++ b/drivers/media/video/tuner-types.c | |||
@@ -877,8 +877,8 @@ static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = { | |||
877 | /* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */ | 877 | /* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */ |
878 | 878 | ||
879 | static struct tuner_range tuner_tua6034_ntsc_ranges[] = { | 879 | static struct tuner_range tuner_tua6034_ntsc_ranges[] = { |
880 | { 16 * 160.00 /*MHz*/, 0x8e, 0x01 }, | 880 | { 16 * 165.00 /*MHz*/, 0x8e, 0x01 }, |
881 | { 16 * 455.00 /*MHz*/, 0x8e, 0x02 }, | 881 | { 16 * 450.00 /*MHz*/, 0x8e, 0x02 }, |
882 | { 16 * 999.99 , 0x8e, 0x04 }, | 882 | { 16 * 999.99 , 0x8e, 0x04 }, |
883 | }; | 883 | }; |
884 | 884 | ||
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 431c3e2f6c42..b463e996961a 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -218,7 +218,7 @@ hauppauge_tuner[] = | |||
218 | /* 110-119 */ | 218 | /* 110-119 */ |
219 | { TUNER_ABSENT, "Thompson DTT75105"}, | 219 | { TUNER_ABSENT, "Thompson DTT75105"}, |
220 | { TUNER_ABSENT, "Conexant_CX24109"}, | 220 | { TUNER_ABSENT, "Conexant_CX24109"}, |
221 | { TUNER_ABSENT, "TCL M2523_5N_E"}, | 221 | { TUNER_TCL_2002N, "TCL M2523_5N_E"}, |
222 | { TUNER_ABSENT, "TCL M2523_3DB_E"}, | 222 | { TUNER_ABSENT, "TCL M2523_3DB_E"}, |
223 | { TUNER_ABSENT, "Philips 8275A"}, | 223 | { TUNER_ABSENT, "Philips 8275A"}, |
224 | { TUNER_ABSENT, "Microtune MT2060"}, | 224 | { TUNER_ABSENT, "Microtune MT2060"}, |
diff --git a/drivers/media/video/usbvideo/Kconfig b/drivers/media/video/usbvideo/Kconfig index 08a5d20bb2c0..39269a2c5635 100644 --- a/drivers/media/video/usbvideo/Kconfig +++ b/drivers/media/video/usbvideo/Kconfig | |||
@@ -3,7 +3,7 @@ config VIDEO_USBVIDEO | |||
3 | 3 | ||
4 | config USB_VICAM | 4 | config USB_VICAM |
5 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" | 5 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" |
6 | depends on USB && VIDEO_DEV && EXPERIMENTAL | 6 | depends on USB && VIDEO_V4L1 && EXPERIMENTAL |
7 | select VIDEO_USBVIDEO | 7 | select VIDEO_USBVIDEO |
8 | ---help--- | 8 | ---help--- |
9 | Say Y here if you have 3com homeconnect camera (vicam). | 9 | Say Y here if you have 3com homeconnect camera (vicam). |
@@ -13,7 +13,7 @@ config USB_VICAM | |||
13 | 13 | ||
14 | config USB_IBMCAM | 14 | config USB_IBMCAM |
15 | tristate "USB IBM (Xirlink) C-it Camera support" | 15 | tristate "USB IBM (Xirlink) C-it Camera support" |
16 | depends on USB && VIDEO_DEV | 16 | depends on USB && VIDEO_V4L1 |
17 | select VIDEO_USBVIDEO | 17 | select VIDEO_USBVIDEO |
18 | ---help--- | 18 | ---help--- |
19 | Say Y here if you want to connect a IBM "C-It" camera, also known as | 19 | Say Y here if you want to connect a IBM "C-It" camera, also known as |
@@ -28,7 +28,7 @@ config USB_IBMCAM | |||
28 | 28 | ||
29 | config USB_KONICAWC | 29 | config USB_KONICAWC |
30 | tristate "USB Konica Webcam support" | 30 | tristate "USB Konica Webcam support" |
31 | depends on USB && VIDEO_DEV | 31 | depends on USB && VIDEO_V4L1 |
32 | select VIDEO_USBVIDEO | 32 | select VIDEO_USBVIDEO |
33 | ---help--- | 33 | ---help--- |
34 | Say Y here if you want support for webcams based on a Konica | 34 | Say Y here if you want support for webcams based on a Konica |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 5e813404d068..779db26771c0 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -26,6 +26,11 @@ | |||
26 | #include <linux/random.h> | 26 | #include <linux/random.h> |
27 | #include <linux/version.h> | 27 | #include <linux/version.h> |
28 | #include <linux/videodev2.h> | 28 | #include <linux/videodev2.h> |
29 | #include <linux/dma-mapping.h> | ||
30 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
31 | /* Include V4L1 specific functions. Should be removed soon */ | ||
32 | #include <linux/videodev.h> | ||
33 | #endif | ||
29 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
30 | #include <media/video-buf.h> | 35 | #include <media/video-buf.h> |
31 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
diff --git a/drivers/media/video/zc0301/Kconfig b/drivers/media/video/zc0301/Kconfig index c3bf886b80cd..115833e4f4dd 100644 --- a/drivers/media/video/zc0301/Kconfig +++ b/drivers/media/video/zc0301/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config USB_ZC0301 | 1 | config USB_ZC0301 |
2 | tristate "USB ZC0301 Image Processor and Control Chip support" | 2 | tristate "USB ZC0301 Image Processor and Control Chip support" |
3 | depends on USB && VIDEO_DEV | 3 | depends on USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | Say Y here if you want support for cameras based on the ZC0301 | 5 | Say Y here if you want support for cameras based on the ZC0301 |
6 | Image Processor and Control Chip. | 6 | Image Processor and Control Chip. |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 9080853fe283..a30084076ac8 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -1605,6 +1605,21 @@ mpt_resume(struct pci_dev *pdev) | |||
1605 | } | 1605 | } |
1606 | #endif | 1606 | #endif |
1607 | 1607 | ||
1608 | static int | ||
1609 | mpt_signal_reset(int index, MPT_ADAPTER *ioc, int reset_phase) | ||
1610 | { | ||
1611 | if ((MptDriverClass[index] == MPTSPI_DRIVER && | ||
1612 | ioc->bus_type != SPI) || | ||
1613 | (MptDriverClass[index] == MPTFC_DRIVER && | ||
1614 | ioc->bus_type != FC) || | ||
1615 | (MptDriverClass[index] == MPTSAS_DRIVER && | ||
1616 | ioc->bus_type != SAS)) | ||
1617 | /* make sure we only call the relevant reset handler | ||
1618 | * for the bus */ | ||
1619 | return 0; | ||
1620 | return (MptResetHandlers[index])(ioc, reset_phase); | ||
1621 | } | ||
1622 | |||
1608 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1623 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1609 | /* | 1624 | /* |
1610 | * mpt_do_ioc_recovery - Initialize or recover MPT adapter. | 1625 | * mpt_do_ioc_recovery - Initialize or recover MPT adapter. |
@@ -1885,14 +1900,14 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1885 | if ((ret == 0) && MptResetHandlers[ii]) { | 1900 | if ((ret == 0) && MptResetHandlers[ii]) { |
1886 | dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n", | 1901 | dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n", |
1887 | ioc->name, ii)); | 1902 | ioc->name, ii)); |
1888 | rc += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_POST_RESET); | 1903 | rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET); |
1889 | handlers++; | 1904 | handlers++; |
1890 | } | 1905 | } |
1891 | 1906 | ||
1892 | if (alt_ioc_ready && MptResetHandlers[ii]) { | 1907 | if (alt_ioc_ready && MptResetHandlers[ii]) { |
1893 | drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", | 1908 | drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", |
1894 | ioc->name, ioc->alt_ioc->name, ii)); | 1909 | ioc->name, ioc->alt_ioc->name, ii)); |
1895 | rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET); | 1910 | rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET); |
1896 | handlers++; | 1911 | handlers++; |
1897 | } | 1912 | } |
1898 | } | 1913 | } |
@@ -3267,11 +3282,11 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag) | |||
3267 | if (MptResetHandlers[ii]) { | 3282 | if (MptResetHandlers[ii]) { |
3268 | dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n", | 3283 | dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n", |
3269 | ioc->name, ii)); | 3284 | ioc->name, ii)); |
3270 | r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_PRE_RESET); | 3285 | r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET); |
3271 | if (ioc->alt_ioc) { | 3286 | if (ioc->alt_ioc) { |
3272 | dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n", | 3287 | dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n", |
3273 | ioc->name, ioc->alt_ioc->name, ii)); | 3288 | ioc->name, ioc->alt_ioc->name, ii)); |
3274 | r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_PRE_RESET); | 3289 | r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET); |
3275 | } | 3290 | } |
3276 | } | 3291 | } |
3277 | } | 3292 | } |
@@ -5706,11 +5721,11 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) | |||
5706 | if (MptResetHandlers[ii]) { | 5721 | if (MptResetHandlers[ii]) { |
5707 | dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n", | 5722 | dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n", |
5708 | ioc->name, ii)); | 5723 | ioc->name, ii)); |
5709 | r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_SETUP_RESET); | 5724 | r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET); |
5710 | if (ioc->alt_ioc) { | 5725 | if (ioc->alt_ioc) { |
5711 | dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n", | 5726 | dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n", |
5712 | ioc->name, ioc->alt_ioc->name, ii)); | 5727 | ioc->name, ioc->alt_ioc->name, ii)); |
5713 | r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_SETUP_RESET); | 5728 | r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET); |
5714 | } | 5729 | } |
5715 | } | 5730 | } |
5716 | } | 5731 | } |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index f2a4d382ea19..3201de053943 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -831,6 +831,7 @@ mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
831 | return rc; | 831 | return rc; |
832 | } | 832 | } |
833 | 833 | ||
834 | #ifdef CONFIG_PM | ||
834 | /* | 835 | /* |
835 | * spi module resume handler | 836 | * spi module resume handler |
836 | */ | 837 | */ |
@@ -846,6 +847,7 @@ mptspi_resume(struct pci_dev *pdev) | |||
846 | 847 | ||
847 | return rc; | 848 | return rc; |
848 | } | 849 | } |
850 | #endif | ||
849 | 851 | ||
850 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 852 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
851 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 853 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index 5ea133c59afb..7bd4d85d0b42 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c | |||
@@ -55,6 +55,7 @@ struct i2o_exec_wait { | |||
55 | u32 m; /* message id */ | 55 | u32 m; /* message id */ |
56 | struct i2o_message *msg; /* pointer to the reply message */ | 56 | struct i2o_message *msg; /* pointer to the reply message */ |
57 | struct list_head list; /* node in global wait list */ | 57 | struct list_head list; /* node in global wait list */ |
58 | spinlock_t lock; /* lock before modifying */ | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | /* Work struct needed to handle LCT NOTIFY replies */ | 61 | /* Work struct needed to handle LCT NOTIFY replies */ |
@@ -87,6 +88,7 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void) | |||
87 | return NULL; | 88 | return NULL; |
88 | 89 | ||
89 | INIT_LIST_HEAD(&wait->list); | 90 | INIT_LIST_HEAD(&wait->list); |
91 | spin_lock_init(&wait->lock); | ||
90 | 92 | ||
91 | return wait; | 93 | return wait; |
92 | }; | 94 | }; |
@@ -125,6 +127,7 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, | |||
125 | DECLARE_WAIT_QUEUE_HEAD(wq); | 127 | DECLARE_WAIT_QUEUE_HEAD(wq); |
126 | struct i2o_exec_wait *wait; | 128 | struct i2o_exec_wait *wait; |
127 | static u32 tcntxt = 0x80000000; | 129 | static u32 tcntxt = 0x80000000; |
130 | long flags; | ||
128 | int rc = 0; | 131 | int rc = 0; |
129 | 132 | ||
130 | wait = i2o_exec_wait_alloc(); | 133 | wait = i2o_exec_wait_alloc(); |
@@ -146,33 +149,28 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, | |||
146 | wait->tcntxt = tcntxt++; | 149 | wait->tcntxt = tcntxt++; |
147 | msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt); | 150 | msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt); |
148 | 151 | ||
152 | wait->wq = &wq; | ||
153 | /* | ||
154 | * we add elements to the head, because if a entry in the list will | ||
155 | * never be removed, we have to iterate over it every time | ||
156 | */ | ||
157 | list_add(&wait->list, &i2o_exec_wait_list); | ||
158 | |||
149 | /* | 159 | /* |
150 | * Post the message to the controller. At some point later it will | 160 | * Post the message to the controller. At some point later it will |
151 | * return. If we time out before it returns then complete will be zero. | 161 | * return. If we time out before it returns then complete will be zero. |
152 | */ | 162 | */ |
153 | i2o_msg_post(c, msg); | 163 | i2o_msg_post(c, msg); |
154 | 164 | ||
155 | if (!wait->complete) { | 165 | wait_event_interruptible_timeout(wq, wait->complete, timeout * HZ); |
156 | wait->wq = &wq; | ||
157 | /* | ||
158 | * we add elements add the head, because if a entry in the list | ||
159 | * will never be removed, we have to iterate over it every time | ||
160 | */ | ||
161 | list_add(&wait->list, &i2o_exec_wait_list); | ||
162 | |||
163 | wait_event_interruptible_timeout(wq, wait->complete, | ||
164 | timeout * HZ); | ||
165 | 166 | ||
166 | wait->wq = NULL; | 167 | spin_lock_irqsave(&wait->lock, flags); |
167 | } | ||
168 | 168 | ||
169 | barrier(); | 169 | wait->wq = NULL; |
170 | 170 | ||
171 | if (wait->complete) { | 171 | if (wait->complete) |
172 | rc = le32_to_cpu(wait->msg->body[0]) >> 24; | 172 | rc = le32_to_cpu(wait->msg->body[0]) >> 24; |
173 | i2o_flush_reply(c, wait->m); | 173 | else { |
174 | i2o_exec_wait_free(wait); | ||
175 | } else { | ||
176 | /* | 174 | /* |
177 | * We cannot remove it now. This is important. When it does | 175 | * We cannot remove it now. This is important. When it does |
178 | * terminate (which it must do if the controller has not | 176 | * terminate (which it must do if the controller has not |
@@ -186,6 +184,13 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg, | |||
186 | rc = -ETIMEDOUT; | 184 | rc = -ETIMEDOUT; |
187 | } | 185 | } |
188 | 186 | ||
187 | spin_unlock_irqrestore(&wait->lock, flags); | ||
188 | |||
189 | if (rc != -ETIMEDOUT) { | ||
190 | i2o_flush_reply(c, wait->m); | ||
191 | i2o_exec_wait_free(wait); | ||
192 | } | ||
193 | |||
189 | return rc; | 194 | return rc; |
190 | }; | 195 | }; |
191 | 196 | ||
@@ -213,7 +218,6 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, | |||
213 | { | 218 | { |
214 | struct i2o_exec_wait *wait, *tmp; | 219 | struct i2o_exec_wait *wait, *tmp; |
215 | unsigned long flags; | 220 | unsigned long flags; |
216 | static spinlock_t lock = SPIN_LOCK_UNLOCKED; | ||
217 | int rc = 1; | 221 | int rc = 1; |
218 | 222 | ||
219 | /* | 223 | /* |
@@ -223,23 +227,24 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, | |||
223 | * already expired. Not much we can do about that except log it for | 227 | * already expired. Not much we can do about that except log it for |
224 | * debug purposes, increase timeout, and recompile. | 228 | * debug purposes, increase timeout, and recompile. |
225 | */ | 229 | */ |
226 | spin_lock_irqsave(&lock, flags); | ||
227 | list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) { | 230 | list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) { |
228 | if (wait->tcntxt == context) { | 231 | if (wait->tcntxt == context) { |
229 | list_del(&wait->list); | 232 | spin_lock_irqsave(&wait->lock, flags); |
230 | 233 | ||
231 | spin_unlock_irqrestore(&lock, flags); | 234 | list_del(&wait->list); |
232 | 235 | ||
233 | wait->m = m; | 236 | wait->m = m; |
234 | wait->msg = msg; | 237 | wait->msg = msg; |
235 | wait->complete = 1; | 238 | wait->complete = 1; |
236 | 239 | ||
237 | barrier(); | 240 | if (wait->wq) |
238 | |||
239 | if (wait->wq) { | ||
240 | wake_up_interruptible(wait->wq); | ||
241 | rc = 0; | 241 | rc = 0; |
242 | } else { | 242 | else |
243 | rc = -1; | ||
244 | |||
245 | spin_unlock_irqrestore(&wait->lock, flags); | ||
246 | |||
247 | if (rc) { | ||
243 | struct device *dev; | 248 | struct device *dev; |
244 | 249 | ||
245 | dev = &c->pdev->dev; | 250 | dev = &c->pdev->dev; |
@@ -248,15 +253,13 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, | |||
248 | c->name); | 253 | c->name); |
249 | i2o_dma_free(dev, &wait->dma); | 254 | i2o_dma_free(dev, &wait->dma); |
250 | i2o_exec_wait_free(wait); | 255 | i2o_exec_wait_free(wait); |
251 | rc = -1; | 256 | } else |
252 | } | 257 | wake_up_interruptible(wait->wq); |
253 | 258 | ||
254 | return rc; | 259 | return rc; |
255 | } | 260 | } |
256 | } | 261 | } |
257 | 262 | ||
258 | spin_unlock_irqrestore(&lock, flags); | ||
259 | |||
260 | osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name, | 263 | osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name, |
261 | context); | 264 | context); |
262 | 265 | ||
@@ -322,14 +325,9 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL); | |||
322 | static int i2o_exec_probe(struct device *dev) | 325 | static int i2o_exec_probe(struct device *dev) |
323 | { | 326 | { |
324 | struct i2o_device *i2o_dev = to_i2o_device(dev); | 327 | struct i2o_device *i2o_dev = to_i2o_device(dev); |
325 | struct i2o_controller *c = i2o_dev->iop; | ||
326 | 328 | ||
327 | i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); | 329 | i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); |
328 | 330 | ||
329 | c->exec = i2o_dev; | ||
330 | |||
331 | i2o_exec_lct_notify(c, c->lct->change_ind + 1); | ||
332 | |||
333 | device_create_file(dev, &dev_attr_vendor_id); | 331 | device_create_file(dev, &dev_attr_vendor_id); |
334 | device_create_file(dev, &dev_attr_product_id); | 332 | device_create_file(dev, &dev_attr_product_id); |
335 | 333 | ||
@@ -523,6 +521,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) | |||
523 | struct device *dev; | 521 | struct device *dev; |
524 | struct i2o_message *msg; | 522 | struct i2o_message *msg; |
525 | 523 | ||
524 | down(&c->lct_lock); | ||
525 | |||
526 | dev = &c->pdev->dev; | 526 | dev = &c->pdev->dev; |
527 | 527 | ||
528 | if (i2o_dma_realloc | 528 | if (i2o_dma_realloc |
@@ -545,6 +545,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) | |||
545 | 545 | ||
546 | i2o_msg_post(c, msg); | 546 | i2o_msg_post(c, msg); |
547 | 547 | ||
548 | up(&c->lct_lock); | ||
549 | |||
548 | return 0; | 550 | return 0; |
549 | }; | 551 | }; |
550 | 552 | ||
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 492167446936..febbdd4e0605 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c | |||
@@ -804,8 +804,6 @@ void i2o_iop_remove(struct i2o_controller *c) | |||
804 | 804 | ||
805 | /* Ask the IOP to switch to RESET state */ | 805 | /* Ask the IOP to switch to RESET state */ |
806 | i2o_iop_reset(c); | 806 | i2o_iop_reset(c); |
807 | |||
808 | put_device(&c->device); | ||
809 | } | 807 | } |
810 | 808 | ||
811 | /** | 809 | /** |
@@ -1059,7 +1057,7 @@ struct i2o_controller *i2o_iop_alloc(void) | |||
1059 | 1057 | ||
1060 | snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name); | 1058 | snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name); |
1061 | if (i2o_pool_alloc | 1059 | if (i2o_pool_alloc |
1062 | (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4, | 1060 | (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32), |
1063 | I2O_MSG_INPOOL_MIN)) { | 1061 | I2O_MSG_INPOOL_MIN)) { |
1064 | kfree(c); | 1062 | kfree(c); |
1065 | return ERR_PTR(-ENOMEM); | 1063 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 003b077c2324..45bcf098e762 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig | |||
@@ -84,7 +84,7 @@ config MMC_WBSD | |||
84 | 84 | ||
85 | config MMC_AU1X | 85 | config MMC_AU1X |
86 | tristate "Alchemy AU1XX0 MMC Card Interface support" | 86 | tristate "Alchemy AU1XX0 MMC Card Interface support" |
87 | depends on SOC_AU1X00 && MMC | 87 | depends on MMC && SOC_AU1200 |
88 | help | 88 | help |
89 | This selects the AMD Alchemy(R) Multimedia card interface. | 89 | This selects the AMD Alchemy(R) Multimedia card interface. |
90 | If you have a Alchemy platform with a MMC slot, say Y or M here. | 90 | If you have a Alchemy platform with a MMC slot, say Y or M here. |
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index 914d62b24064..5dc4bee7abeb 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c | |||
@@ -310,7 +310,7 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) | |||
310 | } | 310 | } |
311 | else | 311 | else |
312 | data->bytes_xfered = | 312 | data->bytes_xfered = |
313 | (data->blocks * (1 << data->blksz_bits)) - | 313 | (data->blocks * data->blksz) - |
314 | host->pio.len; | 314 | host->pio.len; |
315 | } | 315 | } |
316 | 316 | ||
@@ -575,7 +575,7 @@ static int | |||
575 | au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) | 575 | au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) |
576 | { | 576 | { |
577 | 577 | ||
578 | int datalen = data->blocks * (1 << data->blksz_bits); | 578 | int datalen = data->blocks * data->blksz; |
579 | 579 | ||
580 | if (dma != 0) | 580 | if (dma != 0) |
581 | host->flags |= HOST_F_DMA; | 581 | host->flags |= HOST_F_DMA; |
@@ -596,7 +596,7 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data) | |||
596 | if (host->dma.len == 0) | 596 | if (host->dma.len == 0) |
597 | return MMC_ERR_TIMEOUT; | 597 | return MMC_ERR_TIMEOUT; |
598 | 598 | ||
599 | au_writel((1 << data->blksz_bits) - 1, HOST_BLKSIZE(host)); | 599 | au_writel(data->blksz - 1, HOST_BLKSIZE(host)); |
600 | 600 | ||
601 | if (host->flags & HOST_F_DMA) { | 601 | if (host->flags & HOST_F_DMA) { |
602 | int i; | 602 | int i; |
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c index 79358e223f57..a4eb1d0e7a71 100644 --- a/drivers/mmc/imxmmc.c +++ b/drivers/mmc/imxmmc.c | |||
@@ -218,8 +218,10 @@ static int imxmci_busy_wait_for_status(struct imxmci_host *host, | |||
218 | if(!loops) | 218 | if(!loops) |
219 | return 0; | 219 | return 0; |
220 | 220 | ||
221 | dev_info(mmc_dev(host->mmc), "busy wait for %d usec in %s, STATUS = 0x%x (0x%x)\n", | 221 | /* The busy-wait is expected there for clock <8MHz due to SDHC hardware flaws */ |
222 | loops, where, *pstat, stat_mask); | 222 | if(!(stat_mask & STATUS_END_CMD_RESP) || (host->mmc->ios.clock>=8000000)) |
223 | dev_info(mmc_dev(host->mmc), "busy wait for %d usec in %s, STATUS = 0x%x (0x%x)\n", | ||
224 | loops, where, *pstat, stat_mask); | ||
223 | return loops; | 225 | return loops; |
224 | } | 226 | } |
225 | 227 | ||
@@ -333,6 +335,9 @@ static void imxmci_start_cmd(struct imxmci_host *host, struct mmc_command *cmd, | |||
333 | WARN_ON(host->cmd != NULL); | 335 | WARN_ON(host->cmd != NULL); |
334 | host->cmd = cmd; | 336 | host->cmd = cmd; |
335 | 337 | ||
338 | /* Ensure, that clock are stopped else command programming and start fails */ | ||
339 | imxmci_stop_clock(host); | ||
340 | |||
336 | if (cmd->flags & MMC_RSP_BUSY) | 341 | if (cmd->flags & MMC_RSP_BUSY) |
337 | cmdat |= CMD_DAT_CONT_BUSY; | 342 | cmdat |= CMD_DAT_CONT_BUSY; |
338 | 343 | ||
@@ -553,7 +558,7 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
553 | int trans_done = 0; | 558 | int trans_done = 0; |
554 | unsigned int stat = *pstat; | 559 | unsigned int stat = *pstat; |
555 | 560 | ||
556 | if(host->actual_bus_width == MMC_BUS_WIDTH_4) | 561 | if(host->actual_bus_width != MMC_BUS_WIDTH_4) |
557 | burst_len = 16; | 562 | burst_len = 16; |
558 | else | 563 | else |
559 | burst_len = 64; | 564 | burst_len = 64; |
@@ -591,8 +596,7 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
591 | stat = MMC_STATUS; | 596 | stat = MMC_STATUS; |
592 | 597 | ||
593 | /* Flush extra bytes from FIFO */ | 598 | /* Flush extra bytes from FIFO */ |
594 | while(flush_len >= 2){ | 599 | while(flush_len && !(stat & STATUS_DATA_TRANS_DONE)){ |
595 | flush_len -= 2; | ||
596 | i = MMC_BUFFER_ACCESS; | 600 | i = MMC_BUFFER_ACCESS; |
597 | stat = MMC_STATUS; | 601 | stat = MMC_STATUS; |
598 | stat &= ~STATUS_CRC_READ_ERR; /* Stupid but required there */ | 602 | stat &= ~STATUS_CRC_READ_ERR; /* Stupid but required there */ |
@@ -746,10 +750,6 @@ static void imxmci_tasklet_fnc(unsigned long data) | |||
746 | data_dir_mask = STATUS_DATA_TRANS_DONE; | 750 | data_dir_mask = STATUS_DATA_TRANS_DONE; |
747 | } | 751 | } |
748 | 752 | ||
749 | imxmci_busy_wait_for_status(host, &stat, | ||
750 | data_dir_mask, | ||
751 | 50, "imxmci_tasklet_fnc data"); | ||
752 | |||
753 | if(stat & data_dir_mask) { | 753 | if(stat & data_dir_mask) { |
754 | clear_bit(IMXMCI_PEND_DMA_END_b, &host->pending_events); | 754 | clear_bit(IMXMCI_PEND_DMA_END_b, &host->pending_events); |
755 | imxmci_data_done(host, stat); | 755 | imxmci_data_done(host, stat); |
@@ -865,7 +865,11 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
865 | 865 | ||
866 | imxmci_stop_clock(host); | 866 | imxmci_stop_clock(host); |
867 | MMC_CLK_RATE = (prescaler<<3) | clk; | 867 | MMC_CLK_RATE = (prescaler<<3) | clk; |
868 | imxmci_start_clock(host); | 868 | /* |
869 | * Under my understanding, clock should not be started there, because it would | ||
870 | * initiate SDHC sequencer and send last or random command into card | ||
871 | */ | ||
872 | /*imxmci_start_clock(host);*/ | ||
869 | 873 | ||
870 | dev_dbg(mmc_dev(host->mmc), "MMC_CLK_RATE: 0x%08x\n", MMC_CLK_RATE); | 874 | dev_dbg(mmc_dev(host->mmc), "MMC_CLK_RATE: 0x%08x\n", MMC_CLK_RATE); |
871 | } else { | 875 | } else { |
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 1ca2c8b9c9b5..6201f3086a02 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -951,6 +951,7 @@ static void mmc_read_scrs(struct mmc_host *host) | |||
951 | data.timeout_ns = card->csd.tacc_ns * 10; | 951 | data.timeout_ns = card->csd.tacc_ns * 10; |
952 | data.timeout_clks = card->csd.tacc_clks * 10; | 952 | data.timeout_clks = card->csd.tacc_clks * 10; |
953 | data.blksz_bits = 3; | 953 | data.blksz_bits = 3; |
954 | data.blksz = 1 << 3; | ||
954 | data.blocks = 1; | 955 | data.blocks = 1; |
955 | data.flags = MMC_DATA_READ; | 956 | data.flags = MMC_DATA_READ; |
956 | data.sg = &sg; | 957 | data.sg = &sg; |
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index 06bd1f4cb9b1..587458b370b9 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -175,6 +175,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
175 | brq.data.timeout_ns = card->csd.tacc_ns * 10; | 175 | brq.data.timeout_ns = card->csd.tacc_ns * 10; |
176 | brq.data.timeout_clks = card->csd.tacc_clks * 10; | 176 | brq.data.timeout_clks = card->csd.tacc_clks * 10; |
177 | brq.data.blksz_bits = md->block_bits; | 177 | brq.data.blksz_bits = md->block_bits; |
178 | brq.data.blksz = 1 << md->block_bits; | ||
178 | brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); | 179 | brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); |
179 | brq.stop.opcode = MMC_STOP_TRANSMISSION; | 180 | brq.stop.opcode = MMC_STOP_TRANSMISSION; |
180 | brq.stop.arg = 0; | 181 | brq.stop.arg = 0; |
@@ -352,7 +353,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) | |||
352 | */ | 353 | */ |
353 | printk(KERN_ERR "%s: unable to select block size for " | 354 | printk(KERN_ERR "%s: unable to select block size for " |
354 | "writing (rb%u wb%u rp%u wp%u)\n", | 355 | "writing (rb%u wb%u rp%u wp%u)\n", |
355 | md->disk->disk_name, | 356 | mmc_card_id(card), |
356 | 1 << card->csd.read_blkbits, | 357 | 1 << card->csd.read_blkbits, |
357 | 1 << card->csd.write_blkbits, | 358 | 1 << card->csd.write_blkbits, |
358 | card->csd.read_partial, | 359 | card->csd.read_partial, |
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index f97b472085cb..b49368fd96b8 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c | |||
@@ -119,7 +119,7 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) | |||
119 | nob = 0xffff; | 119 | nob = 0xffff; |
120 | 120 | ||
121 | writel(nob, host->base + MMC_NOB); | 121 | writel(nob, host->base + MMC_NOB); |
122 | writel(1 << data->blksz_bits, host->base + MMC_BLKLEN); | 122 | writel(data->blksz, host->base + MMC_BLKLEN); |
123 | 123 | ||
124 | clks = (unsigned long long)data->timeout_ns * CLOCKRATE; | 124 | clks = (unsigned long long)data->timeout_ns * CLOCKRATE; |
125 | do_div(clks, 1000000000UL); | 125 | do_div(clks, 1000000000UL); |
@@ -283,7 +283,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat) | |||
283 | * data blocks as being in error. | 283 | * data blocks as being in error. |
284 | */ | 284 | */ |
285 | if (data->error == MMC_ERR_NONE) | 285 | if (data->error == MMC_ERR_NONE) |
286 | data->bytes_xfered = data->blocks << data->blksz_bits; | 286 | data->bytes_xfered = data->blocks * data->blksz; |
287 | else | 287 | else |
288 | data->bytes_xfered = 0; | 288 | data->bytes_xfered = 0; |
289 | 289 | ||
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index 39b3d97f891e..8167332d4013 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -662,14 +662,14 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) | |||
662 | unsigned long dmaflags; | 662 | unsigned long dmaflags; |
663 | 663 | ||
664 | DBGF("blksz %04x blks %04x flags %08x\n", | 664 | DBGF("blksz %04x blks %04x flags %08x\n", |
665 | 1 << data->blksz_bits, data->blocks, data->flags); | 665 | data->blksz, data->blocks, data->flags); |
666 | DBGF("tsac %d ms nsac %d clk\n", | 666 | DBGF("tsac %d ms nsac %d clk\n", |
667 | data->timeout_ns / 1000000, data->timeout_clks); | 667 | data->timeout_ns / 1000000, data->timeout_clks); |
668 | 668 | ||
669 | /* | 669 | /* |
670 | * Calculate size. | 670 | * Calculate size. |
671 | */ | 671 | */ |
672 | host->size = data->blocks << data->blksz_bits; | 672 | host->size = data->blocks * data->blksz; |
673 | 673 | ||
674 | /* | 674 | /* |
675 | * Check timeout values for overflow. | 675 | * Check timeout values for overflow. |
@@ -696,12 +696,12 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data) | |||
696 | * Two bytes are needed for each data line. | 696 | * Two bytes are needed for each data line. |
697 | */ | 697 | */ |
698 | if (host->bus_width == MMC_BUS_WIDTH_1) { | 698 | if (host->bus_width == MMC_BUS_WIDTH_1) { |
699 | blksize = (1 << data->blksz_bits) + 2; | 699 | blksize = data->blksz + 2; |
700 | 700 | ||
701 | wbsd_write_index(host, WBSD_IDX_PBSMSB, (blksize >> 4) & 0xF0); | 701 | wbsd_write_index(host, WBSD_IDX_PBSMSB, (blksize >> 4) & 0xF0); |
702 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); | 702 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); |
703 | } else if (host->bus_width == MMC_BUS_WIDTH_4) { | 703 | } else if (host->bus_width == MMC_BUS_WIDTH_4) { |
704 | blksize = (1 << data->blksz_bits) + 2 * 4; | 704 | blksize = data->blksz + 2 * 4; |
705 | 705 | ||
706 | wbsd_write_index(host, WBSD_IDX_PBSMSB, | 706 | wbsd_write_index(host, WBSD_IDX_PBSMSB, |
707 | ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); | 707 | ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH); |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 3d306681919e..d8233e0b7899 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -650,9 +650,11 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
650 | 650 | ||
651 | /* Hardware bug work-around, the chip is unable to do PCI DMA | 651 | /* Hardware bug work-around, the chip is unable to do PCI DMA |
652 | to/from anything above 1GB :-( */ | 652 | to/from anything above 1GB :-( */ |
653 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { | 653 | if (dma_mapping_error(mapping) || |
654 | mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { | ||
654 | /* Sigh... */ | 655 | /* Sigh... */ |
655 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 656 | if (!dma_mapping_error(mapping)) |
657 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | ||
656 | dev_kfree_skb_any(skb); | 658 | dev_kfree_skb_any(skb); |
657 | skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA); | 659 | skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA); |
658 | if (skb == NULL) | 660 | if (skb == NULL) |
@@ -660,8 +662,10 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
660 | mapping = pci_map_single(bp->pdev, skb->data, | 662 | mapping = pci_map_single(bp->pdev, skb->data, |
661 | RX_PKT_BUF_SZ, | 663 | RX_PKT_BUF_SZ, |
662 | PCI_DMA_FROMDEVICE); | 664 | PCI_DMA_FROMDEVICE); |
663 | if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { | 665 | if (dma_mapping_error(mapping) || |
664 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | 666 | mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { |
667 | if (!dma_mapping_error(mapping)) | ||
668 | pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); | ||
665 | dev_kfree_skb_any(skb); | 669 | dev_kfree_skb_any(skb); |
666 | return -ENOMEM; | 670 | return -ENOMEM; |
667 | } | 671 | } |
@@ -967,9 +971,10 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
967 | } | 971 | } |
968 | 972 | ||
969 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); | 973 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); |
970 | if (mapping + len > B44_DMA_MASK) { | 974 | if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) { |
971 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ | 975 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ |
972 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); | 976 | if (!dma_mapping_error(mapping)) |
977 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); | ||
973 | 978 | ||
974 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, | 979 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, |
975 | GFP_ATOMIC|GFP_DMA); | 980 | GFP_ATOMIC|GFP_DMA); |
@@ -978,8 +983,9 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
978 | 983 | ||
979 | mapping = pci_map_single(bp->pdev, bounce_skb->data, | 984 | mapping = pci_map_single(bp->pdev, bounce_skb->data, |
980 | len, PCI_DMA_TODEVICE); | 985 | len, PCI_DMA_TODEVICE); |
981 | if (mapping + len > B44_DMA_MASK) { | 986 | if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) { |
982 | pci_unmap_single(bp->pdev, mapping, | 987 | if (!dma_mapping_error(mapping)) |
988 | pci_unmap_single(bp->pdev, mapping, | ||
983 | len, PCI_DMA_TODEVICE); | 989 | len, PCI_DMA_TODEVICE); |
984 | dev_kfree_skb_any(bounce_skb); | 990 | dev_kfree_skb_any(bounce_skb); |
985 | goto err_out; | 991 | goto err_out; |
@@ -1203,7 +1209,8 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1203 | DMA_TABLE_BYTES, | 1209 | DMA_TABLE_BYTES, |
1204 | DMA_BIDIRECTIONAL); | 1210 | DMA_BIDIRECTIONAL); |
1205 | 1211 | ||
1206 | if (rx_ring_dma + size > B44_DMA_MASK) { | 1212 | if (dma_mapping_error(rx_ring_dma) || |
1213 | rx_ring_dma + size > B44_DMA_MASK) { | ||
1207 | kfree(rx_ring); | 1214 | kfree(rx_ring); |
1208 | goto out_err; | 1215 | goto out_err; |
1209 | } | 1216 | } |
@@ -1229,7 +1236,8 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1229 | DMA_TABLE_BYTES, | 1236 | DMA_TABLE_BYTES, |
1230 | DMA_TO_DEVICE); | 1237 | DMA_TO_DEVICE); |
1231 | 1238 | ||
1232 | if (tx_ring_dma + size > B44_DMA_MASK) { | 1239 | if (dma_mapping_error(tx_ring_dma) || |
1240 | tx_ring_dma + size > B44_DMA_MASK) { | ||
1233 | kfree(tx_ring); | 1241 | kfree(tx_ring); |
1234 | goto out_err; | 1242 | goto out_err; |
1235 | } | 1243 | } |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 5ca99e26660a..54161aef3cac 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -55,8 +55,8 @@ | |||
55 | 55 | ||
56 | #define DRV_MODULE_NAME "bnx2" | 56 | #define DRV_MODULE_NAME "bnx2" |
57 | #define PFX DRV_MODULE_NAME ": " | 57 | #define PFX DRV_MODULE_NAME ": " |
58 | #define DRV_MODULE_VERSION "1.4.39" | 58 | #define DRV_MODULE_VERSION "1.4.40" |
59 | #define DRV_MODULE_RELDATE "March 22, 2006" | 59 | #define DRV_MODULE_RELDATE "May 22, 2006" |
60 | 60 | ||
61 | #define RUN_AT(x) (jiffies + (x)) | 61 | #define RUN_AT(x) (jiffies + (x)) |
62 | 62 | ||
@@ -2945,7 +2945,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
2945 | int buf_size) | 2945 | int buf_size) |
2946 | { | 2946 | { |
2947 | u32 written, offset32, len32; | 2947 | u32 written, offset32, len32; |
2948 | u8 *buf, start[4], end[4]; | 2948 | u8 *buf, start[4], end[4], *flash_buffer = NULL; |
2949 | int rc = 0; | 2949 | int rc = 0; |
2950 | int align_start, align_end; | 2950 | int align_start, align_end; |
2951 | 2951 | ||
@@ -2985,12 +2985,19 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
2985 | memcpy(buf + align_start, data_buf, buf_size); | 2985 | memcpy(buf + align_start, data_buf, buf_size); |
2986 | } | 2986 | } |
2987 | 2987 | ||
2988 | if (bp->flash_info->buffered == 0) { | ||
2989 | flash_buffer = kmalloc(264, GFP_KERNEL); | ||
2990 | if (flash_buffer == NULL) { | ||
2991 | rc = -ENOMEM; | ||
2992 | goto nvram_write_end; | ||
2993 | } | ||
2994 | } | ||
2995 | |||
2988 | written = 0; | 2996 | written = 0; |
2989 | while ((written < len32) && (rc == 0)) { | 2997 | while ((written < len32) && (rc == 0)) { |
2990 | u32 page_start, page_end, data_start, data_end; | 2998 | u32 page_start, page_end, data_start, data_end; |
2991 | u32 addr, cmd_flags; | 2999 | u32 addr, cmd_flags; |
2992 | int i; | 3000 | int i; |
2993 | u8 flash_buffer[264]; | ||
2994 | 3001 | ||
2995 | /* Find the page_start addr */ | 3002 | /* Find the page_start addr */ |
2996 | page_start = offset32 + written; | 3003 | page_start = offset32 + written; |
@@ -3061,7 +3068,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3061 | } | 3068 | } |
3062 | 3069 | ||
3063 | /* Loop to write the new data from data_start to data_end */ | 3070 | /* Loop to write the new data from data_start to data_end */ |
3064 | for (addr = data_start; addr < data_end; addr += 4, i++) { | 3071 | for (addr = data_start; addr < data_end; addr += 4, i += 4) { |
3065 | if ((addr == page_end - 4) || | 3072 | if ((addr == page_end - 4) || |
3066 | ((bp->flash_info->buffered) && | 3073 | ((bp->flash_info->buffered) && |
3067 | (addr == data_end - 4))) { | 3074 | (addr == data_end - 4))) { |
@@ -3109,6 +3116,9 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
3109 | } | 3116 | } |
3110 | 3117 | ||
3111 | nvram_write_end: | 3118 | nvram_write_end: |
3119 | if (bp->flash_info->buffered == 0) | ||
3120 | kfree(flash_buffer); | ||
3121 | |||
3112 | if (align_start || align_end) | 3122 | if (align_start || align_end) |
3113 | kfree(buf); | 3123 | kfree(buf); |
3114 | return rc; | 3124 | return rc; |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 1ddefd281213..038447fb5c5e 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #define DRV_VERSION "v1.17b" | 53 | #define DRV_VERSION "v1.17b" |
54 | #define DRV_RELDATE "2006/03/10" | 54 | #define DRV_RELDATE "2006/03/10" |
55 | #include "dl2k.h" | 55 | #include "dl2k.h" |
56 | #include <linux/dma-mapping.h> | ||
56 | 57 | ||
57 | static char version[] __devinitdata = | 58 | static char version[] __devinitdata = |
58 | KERN_INFO DRV_NAME " " DRV_VERSION " " DRV_RELDATE "\n"; | 59 | KERN_INFO DRV_NAME " " DRV_VERSION " " DRV_RELDATE "\n"; |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index ecccca35c6f4..d1c705b412c2 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -870,13 +870,16 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) | |||
870 | *data = 0; | 870 | *data = 0; |
871 | 871 | ||
872 | /* Hook up test interrupt handler just for this test */ | 872 | /* Hook up test interrupt handler just for this test */ |
873 | if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { | 873 | if (!request_irq(irq, &e1000_test_intr, SA_PROBEIRQ, netdev->name, |
874 | netdev)) { | ||
874 | shared_int = FALSE; | 875 | shared_int = FALSE; |
875 | } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, | 876 | } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, |
876 | netdev->name, netdev)){ | 877 | netdev->name, netdev)){ |
877 | *data = 1; | 878 | *data = 1; |
878 | return -1; | 879 | return -1; |
879 | } | 880 | } |
881 | DPRINTK(PROBE,INFO, "testing %s interrupt\n", | ||
882 | (shared_int ? "shared" : "unshared")); | ||
880 | 883 | ||
881 | /* Disable all the interrupts */ | 884 | /* Disable all the interrupts */ |
882 | E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); | 885 | E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index c99e87838f92..97e71a4fe8eb 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -220,6 +220,7 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter); | |||
220 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); | 220 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); |
221 | static int e1000_resume(struct pci_dev *pdev); | 221 | static int e1000_resume(struct pci_dev *pdev); |
222 | #endif | 222 | #endif |
223 | static void e1000_shutdown(struct pci_dev *pdev); | ||
223 | 224 | ||
224 | #ifdef CONFIG_NET_POLL_CONTROLLER | 225 | #ifdef CONFIG_NET_POLL_CONTROLLER |
225 | /* for netdump / net console */ | 226 | /* for netdump / net console */ |
@@ -235,8 +236,9 @@ static struct pci_driver e1000_driver = { | |||
235 | /* Power Managment Hooks */ | 236 | /* Power Managment Hooks */ |
236 | #ifdef CONFIG_PM | 237 | #ifdef CONFIG_PM |
237 | .suspend = e1000_suspend, | 238 | .suspend = e1000_suspend, |
238 | .resume = e1000_resume | 239 | .resume = e1000_resume, |
239 | #endif | 240 | #endif |
241 | .shutdown = e1000_shutdown | ||
240 | }; | 242 | }; |
241 | 243 | ||
242 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); | 244 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
@@ -3517,7 +3519,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3517 | buffer_info = &rx_ring->buffer_info[i]; | 3519 | buffer_info = &rx_ring->buffer_info[i]; |
3518 | 3520 | ||
3519 | while (rx_desc->status & E1000_RXD_STAT_DD) { | 3521 | while (rx_desc->status & E1000_RXD_STAT_DD) { |
3520 | struct sk_buff *skb, *next_skb; | 3522 | struct sk_buff *skb; |
3521 | u8 status; | 3523 | u8 status; |
3522 | #ifdef CONFIG_E1000_NAPI | 3524 | #ifdef CONFIG_E1000_NAPI |
3523 | if (*work_done >= work_to_do) | 3525 | if (*work_done >= work_to_do) |
@@ -3535,8 +3537,6 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3535 | prefetch(next_rxd); | 3537 | prefetch(next_rxd); |
3536 | 3538 | ||
3537 | next_buffer = &rx_ring->buffer_info[i]; | 3539 | next_buffer = &rx_ring->buffer_info[i]; |
3538 | next_skb = next_buffer->skb; | ||
3539 | prefetch(next_skb->data - NET_IP_ALIGN); | ||
3540 | 3540 | ||
3541 | cleaned = TRUE; | 3541 | cleaned = TRUE; |
3542 | cleaned_count++; | 3542 | cleaned_count++; |
@@ -3666,7 +3666,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3666 | struct e1000_buffer *buffer_info, *next_buffer; | 3666 | struct e1000_buffer *buffer_info, *next_buffer; |
3667 | struct e1000_ps_page *ps_page; | 3667 | struct e1000_ps_page *ps_page; |
3668 | struct e1000_ps_page_dma *ps_page_dma; | 3668 | struct e1000_ps_page_dma *ps_page_dma; |
3669 | struct sk_buff *skb, *next_skb; | 3669 | struct sk_buff *skb; |
3670 | unsigned int i, j; | 3670 | unsigned int i, j; |
3671 | uint32_t length, staterr; | 3671 | uint32_t length, staterr; |
3672 | int cleaned_count = 0; | 3672 | int cleaned_count = 0; |
@@ -3695,8 +3695,6 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3695 | prefetch(next_rxd); | 3695 | prefetch(next_rxd); |
3696 | 3696 | ||
3697 | next_buffer = &rx_ring->buffer_info[i]; | 3697 | next_buffer = &rx_ring->buffer_info[i]; |
3698 | next_skb = next_buffer->skb; | ||
3699 | prefetch(next_skb->data - NET_IP_ALIGN); | ||
3700 | 3698 | ||
3701 | cleaned = TRUE; | 3699 | cleaned = TRUE; |
3702 | cleaned_count++; | 3700 | cleaned_count++; |
@@ -4611,6 +4609,12 @@ e1000_resume(struct pci_dev *pdev) | |||
4611 | return 0; | 4609 | return 0; |
4612 | } | 4610 | } |
4613 | #endif | 4611 | #endif |
4612 | |||
4613 | static void e1000_shutdown(struct pci_dev *pdev) | ||
4614 | { | ||
4615 | e1000_suspend(pdev, PMSG_SUSPEND); | ||
4616 | } | ||
4617 | |||
4614 | #ifdef CONFIG_NET_POLL_CONTROLLER | 4618 | #ifdef CONFIG_NET_POLL_CONTROLLER |
4615 | /* | 4619 | /* |
4616 | * Polling 'interrupt' - used by things like netconsole to send skbs | 4620 | * Polling 'interrupt' - used by things like netconsole to send skbs |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index f7235c9bc421..feb5b223cd60 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -2615,6 +2615,18 @@ static int nv_nway_reset(struct net_device *dev) | |||
2615 | return ret; | 2615 | return ret; |
2616 | } | 2616 | } |
2617 | 2617 | ||
2618 | #ifdef NETIF_F_TSO | ||
2619 | static int nv_set_tso(struct net_device *dev, u32 value) | ||
2620 | { | ||
2621 | struct fe_priv *np = netdev_priv(dev); | ||
2622 | |||
2623 | if ((np->driver_data & DEV_HAS_CHECKSUM)) | ||
2624 | return ethtool_op_set_tso(dev, value); | ||
2625 | else | ||
2626 | return value ? -EOPNOTSUPP : 0; | ||
2627 | } | ||
2628 | #endif | ||
2629 | |||
2618 | static struct ethtool_ops ops = { | 2630 | static struct ethtool_ops ops = { |
2619 | .get_drvinfo = nv_get_drvinfo, | 2631 | .get_drvinfo = nv_get_drvinfo, |
2620 | .get_link = ethtool_op_get_link, | 2632 | .get_link = ethtool_op_get_link, |
@@ -2626,6 +2638,10 @@ static struct ethtool_ops ops = { | |||
2626 | .get_regs = nv_get_regs, | 2638 | .get_regs = nv_get_regs, |
2627 | .nway_reset = nv_nway_reset, | 2639 | .nway_reset = nv_nway_reset, |
2628 | .get_perm_addr = ethtool_op_get_perm_addr, | 2640 | .get_perm_addr = ethtool_op_get_perm_addr, |
2641 | #ifdef NETIF_F_TSO | ||
2642 | .get_tso = ethtool_op_get_tso, | ||
2643 | .set_tso = nv_set_tso | ||
2644 | #endif | ||
2629 | }; | 2645 | }; |
2630 | 2646 | ||
2631 | static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | 2647 | static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) |
@@ -2891,78 +2907,6 @@ static int nv_open(struct net_device *dev) | |||
2891 | goto out_drain; | 2907 | goto out_drain; |
2892 | } | 2908 | } |
2893 | 2909 | ||
2894 | if (np->msi_flags & NV_MSI_X_CAPABLE) { | ||
2895 | for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) { | ||
2896 | np->msi_x_entry[i].entry = i; | ||
2897 | } | ||
2898 | if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) { | ||
2899 | np->msi_flags |= NV_MSI_X_ENABLED; | ||
2900 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) { | ||
2901 | /* Request irq for rx handling */ | ||
2902 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) { | ||
2903 | printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret); | ||
2904 | pci_disable_msix(np->pci_dev); | ||
2905 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2906 | goto out_drain; | ||
2907 | } | ||
2908 | /* Request irq for tx handling */ | ||
2909 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) { | ||
2910 | printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret); | ||
2911 | pci_disable_msix(np->pci_dev); | ||
2912 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2913 | goto out_drain; | ||
2914 | } | ||
2915 | /* Request irq for link and timer handling */ | ||
2916 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) { | ||
2917 | printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret); | ||
2918 | pci_disable_msix(np->pci_dev); | ||
2919 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2920 | goto out_drain; | ||
2921 | } | ||
2922 | |||
2923 | /* map interrupts to their respective vector */ | ||
2924 | writel(0, base + NvRegMSIXMap0); | ||
2925 | writel(0, base + NvRegMSIXMap1); | ||
2926 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL); | ||
2927 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL); | ||
2928 | set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER); | ||
2929 | } else { | ||
2930 | /* Request irq for all interrupts */ | ||
2931 | if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { | ||
2932 | printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); | ||
2933 | pci_disable_msix(np->pci_dev); | ||
2934 | np->msi_flags &= ~NV_MSI_X_ENABLED; | ||
2935 | goto out_drain; | ||
2936 | } | ||
2937 | |||
2938 | /* map interrupts to vector 0 */ | ||
2939 | writel(0, base + NvRegMSIXMap0); | ||
2940 | writel(0, base + NvRegMSIXMap1); | ||
2941 | } | ||
2942 | } | ||
2943 | } | ||
2944 | if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { | ||
2945 | if ((ret = pci_enable_msi(np->pci_dev)) == 0) { | ||
2946 | np->msi_flags |= NV_MSI_ENABLED; | ||
2947 | if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) { | ||
2948 | printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); | ||
2949 | pci_disable_msi(np->pci_dev); | ||
2950 | np->msi_flags &= ~NV_MSI_ENABLED; | ||
2951 | goto out_drain; | ||
2952 | } | ||
2953 | |||
2954 | /* map interrupts to vector 0 */ | ||
2955 | writel(0, base + NvRegMSIMap0); | ||
2956 | writel(0, base + NvRegMSIMap1); | ||
2957 | /* enable msi vector 0 */ | ||
2958 | writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask); | ||
2959 | } | ||
2960 | } | ||
2961 | if (ret != 0) { | ||
2962 | if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) | ||
2963 | goto out_drain; | ||
2964 | } | ||
2965 | |||
2966 | /* ask for interrupts */ | 2910 | /* ask for interrupts */ |
2967 | nv_enable_hw_interrupts(dev, np->irqmask); | 2911 | nv_enable_hw_interrupts(dev, np->irqmask); |
2968 | 2912 | ||
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index 5e6d00752990..cff8598aa800 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig | |||
@@ -33,7 +33,7 @@ config DONGLE | |||
33 | 33 | ||
34 | config ESI_DONGLE | 34 | config ESI_DONGLE |
35 | tristate "ESI JetEye PC dongle" | 35 | tristate "ESI JetEye PC dongle" |
36 | depends on DONGLE && IRDA | 36 | depends on IRTTY_SIR && DONGLE && IRDA |
37 | help | 37 | help |
38 | Say Y here if you want to build support for the Extended Systems | 38 | Say Y here if you want to build support for the Extended Systems |
39 | JetEye PC dongle. To compile it as a module, choose M here. The ESI | 39 | JetEye PC dongle. To compile it as a module, choose M here. The ESI |
@@ -44,7 +44,7 @@ config ESI_DONGLE | |||
44 | 44 | ||
45 | config ACTISYS_DONGLE | 45 | config ACTISYS_DONGLE |
46 | tristate "ACTiSYS IR-220L and IR220L+ dongle" | 46 | tristate "ACTiSYS IR-220L and IR220L+ dongle" |
47 | depends on DONGLE && IRDA | 47 | depends on IRTTY_SIR && DONGLE && IRDA |
48 | help | 48 | help |
49 | Say Y here if you want to build support for the ACTiSYS IR-220L and | 49 | Say Y here if you want to build support for the ACTiSYS IR-220L and |
50 | IR220L+ dongles. To compile it as a module, choose M here. The | 50 | IR220L+ dongles. To compile it as a module, choose M here. The |
@@ -55,7 +55,7 @@ config ACTISYS_DONGLE | |||
55 | 55 | ||
56 | config TEKRAM_DONGLE | 56 | config TEKRAM_DONGLE |
57 | tristate "Tekram IrMate 210B dongle" | 57 | tristate "Tekram IrMate 210B dongle" |
58 | depends on DONGLE && IRDA | 58 | depends on IRTTY_SIR && DONGLE && IRDA |
59 | help | 59 | help |
60 | Say Y here if you want to build support for the Tekram IrMate 210B | 60 | Say Y here if you want to build support for the Tekram IrMate 210B |
61 | dongle. To compile it as a module, choose M here. The Tekram dongle | 61 | dongle. To compile it as a module, choose M here. The Tekram dongle |
@@ -66,7 +66,7 @@ config TEKRAM_DONGLE | |||
66 | 66 | ||
67 | config TOIM3232_DONGLE | 67 | config TOIM3232_DONGLE |
68 | tristate "TOIM3232 IrDa dongle" | 68 | tristate "TOIM3232 IrDa dongle" |
69 | depends on DONGLE && IRDA | 69 | depends on IRTTY_SIR && DONGLE && IRDA |
70 | help | 70 | help |
71 | Say Y here if you want to build support for the Vishay/Temic | 71 | Say Y here if you want to build support for the Vishay/Temic |
72 | TOIM3232 and TOIM4232 based dongles. | 72 | TOIM3232 and TOIM4232 based dongles. |
@@ -74,7 +74,7 @@ config TOIM3232_DONGLE | |||
74 | 74 | ||
75 | config LITELINK_DONGLE | 75 | config LITELINK_DONGLE |
76 | tristate "Parallax LiteLink dongle" | 76 | tristate "Parallax LiteLink dongle" |
77 | depends on DONGLE && IRDA | 77 | depends on IRTTY_SIR && DONGLE && IRDA |
78 | help | 78 | help |
79 | Say Y here if you want to build support for the Parallax Litelink | 79 | Say Y here if you want to build support for the Parallax Litelink |
80 | dongle. To compile it as a module, choose M here. The Parallax | 80 | dongle. To compile it as a module, choose M here. The Parallax |
@@ -85,7 +85,7 @@ config LITELINK_DONGLE | |||
85 | 85 | ||
86 | config MA600_DONGLE | 86 | config MA600_DONGLE |
87 | tristate "Mobile Action MA600 dongle" | 87 | tristate "Mobile Action MA600 dongle" |
88 | depends on DONGLE && IRDA && EXPERIMENTAL | 88 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
89 | help | 89 | help |
90 | Say Y here if you want to build support for the Mobile Action MA600 | 90 | Say Y here if you want to build support for the Mobile Action MA600 |
91 | dongle. To compile it as a module, choose M here. The MA600 dongle | 91 | dongle. To compile it as a module, choose M here. The MA600 dongle |
@@ -98,7 +98,7 @@ config MA600_DONGLE | |||
98 | 98 | ||
99 | config GIRBIL_DONGLE | 99 | config GIRBIL_DONGLE |
100 | tristate "Greenwich GIrBIL dongle" | 100 | tristate "Greenwich GIrBIL dongle" |
101 | depends on DONGLE && IRDA && EXPERIMENTAL | 101 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
102 | help | 102 | help |
103 | Say Y here if you want to build support for the Greenwich GIrBIL | 103 | Say Y here if you want to build support for the Greenwich GIrBIL |
104 | dongle. If you want to compile it as a module, choose M here. | 104 | dongle. If you want to compile it as a module, choose M here. |
@@ -109,7 +109,7 @@ config GIRBIL_DONGLE | |||
109 | 109 | ||
110 | config MCP2120_DONGLE | 110 | config MCP2120_DONGLE |
111 | tristate "Microchip MCP2120" | 111 | tristate "Microchip MCP2120" |
112 | depends on DONGLE && IRDA && EXPERIMENTAL | 112 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
113 | help | 113 | help |
114 | Say Y here if you want to build support for the Microchip MCP2120 | 114 | Say Y here if you want to build support for the Microchip MCP2120 |
115 | dongle. If you want to compile it as a module, choose M here. | 115 | dongle. If you want to compile it as a module, choose M here. |
@@ -123,7 +123,7 @@ config MCP2120_DONGLE | |||
123 | 123 | ||
124 | config OLD_BELKIN_DONGLE | 124 | config OLD_BELKIN_DONGLE |
125 | tristate "Old Belkin dongle" | 125 | tristate "Old Belkin dongle" |
126 | depends on DONGLE && IRDA && EXPERIMENTAL | 126 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
127 | help | 127 | help |
128 | Say Y here if you want to build support for the Adaptec Airport 1000 | 128 | Say Y here if you want to build support for the Adaptec Airport 1000 |
129 | and 2000 dongles. If you want to compile it as a module, choose | 129 | and 2000 dongles. If you want to compile it as a module, choose |
@@ -132,7 +132,7 @@ config OLD_BELKIN_DONGLE | |||
132 | 132 | ||
133 | config ACT200L_DONGLE | 133 | config ACT200L_DONGLE |
134 | tristate "ACTiSYS IR-200L dongle" | 134 | tristate "ACTiSYS IR-200L dongle" |
135 | depends on DONGLE && IRDA && EXPERIMENTAL | 135 | depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL |
136 | help | 136 | help |
137 | Say Y here if you want to build support for the ACTiSYS IR-200L | 137 | Say Y here if you want to build support for the ACTiSYS IR-200L |
138 | dongle. If you want to compile it as a module, choose M here. | 138 | dongle. If you want to compile it as a module, choose M here. |
diff --git a/drivers/net/ixp2000/enp2611.c b/drivers/net/ixp2000/enp2611.c index 6f7dce8eba51..b67f586d7392 100644 --- a/drivers/net/ixp2000/enp2611.c +++ b/drivers/net/ixp2000/enp2611.c | |||
@@ -149,6 +149,8 @@ static void enp2611_check_link_status(unsigned long __dummy) | |||
149 | int status; | 149 | int status; |
150 | 150 | ||
151 | dev = nds[i]; | 151 | dev = nds[i]; |
152 | if (dev == NULL) | ||
153 | continue; | ||
152 | 154 | ||
153 | status = pm3386_is_link_up(i); | 155 | status = pm3386_is_link_up(i); |
154 | if (status && !netif_carrier_ok(dev)) { | 156 | if (status && !netif_carrier_ok(dev)) { |
@@ -191,6 +193,7 @@ static void enp2611_set_port_admin_status(int port, int up) | |||
191 | 193 | ||
192 | static int __init enp2611_init_module(void) | 194 | static int __init enp2611_init_module(void) |
193 | { | 195 | { |
196 | int ports; | ||
194 | int i; | 197 | int i; |
195 | 198 | ||
196 | if (!machine_is_enp2611()) | 199 | if (!machine_is_enp2611()) |
@@ -199,7 +202,8 @@ static int __init enp2611_init_module(void) | |||
199 | caleb_reset(); | 202 | caleb_reset(); |
200 | pm3386_reset(); | 203 | pm3386_reset(); |
201 | 204 | ||
202 | for (i = 0; i < 3; i++) { | 205 | ports = pm3386_port_count(); |
206 | for (i = 0; i < ports; i++) { | ||
203 | nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv)); | 207 | nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv)); |
204 | if (nds[i] == NULL) { | 208 | if (nds[i] == NULL) { |
205 | while (--i >= 0) | 209 | while (--i >= 0) |
@@ -215,9 +219,10 @@ static int __init enp2611_init_module(void) | |||
215 | 219 | ||
216 | ixp2400_msf_init(&enp2611_msf_parameters); | 220 | ixp2400_msf_init(&enp2611_msf_parameters); |
217 | 221 | ||
218 | if (ixpdev_init(3, nds, enp2611_set_port_admin_status)) { | 222 | if (ixpdev_init(ports, nds, enp2611_set_port_admin_status)) { |
219 | for (i = 0; i < 3; i++) | 223 | for (i = 0; i < ports; i++) |
220 | free_netdev(nds[i]); | 224 | if (nds[i]) |
225 | free_netdev(nds[i]); | ||
221 | return -EINVAL; | 226 | return -EINVAL; |
222 | } | 227 | } |
223 | 228 | ||
diff --git a/drivers/net/ixp2000/pm3386.c b/drivers/net/ixp2000/pm3386.c index 5c7ab7564053..5224651c9aac 100644 --- a/drivers/net/ixp2000/pm3386.c +++ b/drivers/net/ixp2000/pm3386.c | |||
@@ -86,40 +86,53 @@ static void pm3386_port_reg_write(int port, int _reg, int spacing, u16 value) | |||
86 | pm3386_reg_write(port >> 1, reg, value); | 86 | pm3386_reg_write(port >> 1, reg, value); |
87 | } | 87 | } |
88 | 88 | ||
89 | int pm3386_secondary_present(void) | ||
90 | { | ||
91 | return pm3386_reg_read(1, 0) == 0x3386; | ||
92 | } | ||
89 | 93 | ||
90 | void pm3386_reset(void) | 94 | void pm3386_reset(void) |
91 | { | 95 | { |
92 | u8 mac[3][6]; | 96 | u8 mac[3][6]; |
97 | int secondary; | ||
98 | |||
99 | secondary = pm3386_secondary_present(); | ||
93 | 100 | ||
94 | /* Save programmed MAC addresses. */ | 101 | /* Save programmed MAC addresses. */ |
95 | pm3386_get_mac(0, mac[0]); | 102 | pm3386_get_mac(0, mac[0]); |
96 | pm3386_get_mac(1, mac[1]); | 103 | pm3386_get_mac(1, mac[1]); |
97 | pm3386_get_mac(2, mac[2]); | 104 | if (secondary) |
105 | pm3386_get_mac(2, mac[2]); | ||
98 | 106 | ||
99 | /* Assert analog and digital reset. */ | 107 | /* Assert analog and digital reset. */ |
100 | pm3386_reg_write(0, 0x002, 0x0060); | 108 | pm3386_reg_write(0, 0x002, 0x0060); |
101 | pm3386_reg_write(1, 0x002, 0x0060); | 109 | if (secondary) |
110 | pm3386_reg_write(1, 0x002, 0x0060); | ||
102 | mdelay(1); | 111 | mdelay(1); |
103 | 112 | ||
104 | /* Deassert analog reset. */ | 113 | /* Deassert analog reset. */ |
105 | pm3386_reg_write(0, 0x002, 0x0062); | 114 | pm3386_reg_write(0, 0x002, 0x0062); |
106 | pm3386_reg_write(1, 0x002, 0x0062); | 115 | if (secondary) |
116 | pm3386_reg_write(1, 0x002, 0x0062); | ||
107 | mdelay(10); | 117 | mdelay(10); |
108 | 118 | ||
109 | /* Deassert digital reset. */ | 119 | /* Deassert digital reset. */ |
110 | pm3386_reg_write(0, 0x002, 0x0063); | 120 | pm3386_reg_write(0, 0x002, 0x0063); |
111 | pm3386_reg_write(1, 0x002, 0x0063); | 121 | if (secondary) |
122 | pm3386_reg_write(1, 0x002, 0x0063); | ||
112 | mdelay(10); | 123 | mdelay(10); |
113 | 124 | ||
114 | /* Restore programmed MAC addresses. */ | 125 | /* Restore programmed MAC addresses. */ |
115 | pm3386_set_mac(0, mac[0]); | 126 | pm3386_set_mac(0, mac[0]); |
116 | pm3386_set_mac(1, mac[1]); | 127 | pm3386_set_mac(1, mac[1]); |
117 | pm3386_set_mac(2, mac[2]); | 128 | if (secondary) |
129 | pm3386_set_mac(2, mac[2]); | ||
118 | 130 | ||
119 | /* Disable carrier on all ports. */ | 131 | /* Disable carrier on all ports. */ |
120 | pm3386_set_carrier(0, 0); | 132 | pm3386_set_carrier(0, 0); |
121 | pm3386_set_carrier(1, 0); | 133 | pm3386_set_carrier(1, 0); |
122 | pm3386_set_carrier(2, 0); | 134 | if (secondary) |
135 | pm3386_set_carrier(2, 0); | ||
123 | } | 136 | } |
124 | 137 | ||
125 | static u16 swaph(u16 x) | 138 | static u16 swaph(u16 x) |
@@ -127,6 +140,11 @@ static u16 swaph(u16 x) | |||
127 | return ((x << 8) | (x >> 8)) & 0xffff; | 140 | return ((x << 8) | (x >> 8)) & 0xffff; |
128 | } | 141 | } |
129 | 142 | ||
143 | int pm3386_port_count(void) | ||
144 | { | ||
145 | return 2 + pm3386_secondary_present(); | ||
146 | } | ||
147 | |||
130 | void pm3386_init_port(int port) | 148 | void pm3386_init_port(int port) |
131 | { | 149 | { |
132 | int pm = port >> 1; | 150 | int pm = port >> 1; |
diff --git a/drivers/net/ixp2000/pm3386.h b/drivers/net/ixp2000/pm3386.h index fe92bb056ac4..cc4183dca911 100644 --- a/drivers/net/ixp2000/pm3386.h +++ b/drivers/net/ixp2000/pm3386.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define __PM3386_H | 13 | #define __PM3386_H |
14 | 14 | ||
15 | void pm3386_reset(void); | 15 | void pm3386_reset(void); |
16 | int pm3386_port_count(void); | ||
16 | void pm3386_init_port(int port); | 17 | void pm3386_init_port(int port); |
17 | void pm3386_get_mac(int port, u8 *mac); | 18 | void pm3386_get_mac(int port, u8 *mac); |
18 | void pm3386_set_mac(int port, u8 *mac); | 19 | void pm3386_set_mac(int port, u8 *mac); |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 66e74f740261..bf58db29e2ed 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -107,7 +107,7 @@ static int init_netconsole(void) | |||
107 | 107 | ||
108 | if(!configured) { | 108 | if(!configured) { |
109 | printk("netconsole: not configured, aborting\n"); | 109 | printk("netconsole: not configured, aborting\n"); |
110 | return -EINVAL; | 110 | return 0; |
111 | } | 111 | } |
112 | 112 | ||
113 | if(netpoll_setup(&np)) | 113 | if(netpoll_setup(&np)) |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 448a09488529..2ea66aca648b 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -1691,17 +1691,6 @@ static void do_set_multicast_list(struct net_device *dev) | |||
1691 | memset(ei_local->mcfilter, 0xFF, 8); | 1691 | memset(ei_local->mcfilter, 0xFF, 8); |
1692 | } | 1692 | } |
1693 | 1693 | ||
1694 | /* | ||
1695 | * DP8390 manuals don't specify any magic sequence for altering | ||
1696 | * the multicast regs on an already running card. To be safe, we | ||
1697 | * ensure multicast mode is off prior to loading up the new hash | ||
1698 | * table. If this proves to be not enough, we can always resort | ||
1699 | * to stopping the NIC, loading the table and then restarting. | ||
1700 | */ | ||
1701 | |||
1702 | if (netif_running(dev)) | ||
1703 | outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR); | ||
1704 | |||
1705 | outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD); | 1694 | outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD); |
1706 | for(i = 0; i < 8; i++) | 1695 | for(i = 0; i < 8; i++) |
1707 | { | 1696 | { |
@@ -1715,6 +1704,8 @@ static void do_set_multicast_list(struct net_device *dev) | |||
1715 | outb_p(E8390_RXCONFIG | 0x48, e8390_base + EN0_RXCR); | 1704 | outb_p(E8390_RXCONFIG | 0x48, e8390_base + EN0_RXCR); |
1716 | else | 1705 | else |
1717 | outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR); | 1706 | outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR); |
1707 | |||
1708 | outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD); | ||
1718 | } | 1709 | } |
1719 | 1710 | ||
1720 | /* | 1711 | /* |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 4260c2128f47..a8f6bfc96fd2 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1204,7 +1204,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1204 | 1204 | ||
1205 | dev->last_rx = jiffies; | 1205 | dev->last_rx = jiffies; |
1206 | lp->linux_stats.rx_packets++; | 1206 | lp->linux_stats.rx_packets++; |
1207 | lp->linux_stats.rx_bytes += skb->len; | 1207 | lp->linux_stats.rx_bytes += pkt_len; |
1208 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ | 1208 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ |
1209 | continue; | 1209 | continue; |
1210 | } else { | 1210 | } else { |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 07c31f19c6ba..fc08c4af506c 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -1774,8 +1774,6 @@ static int pcnet32_open(struct net_device *dev) | |||
1774 | lp->rx_dma_addr[i] = 0; | 1774 | lp->rx_dma_addr[i] = 0; |
1775 | } | 1775 | } |
1776 | 1776 | ||
1777 | pcnet32_free_ring(dev); | ||
1778 | |||
1779 | /* | 1777 | /* |
1780 | * Switch back to 16bit mode to avoid problems with dumb | 1778 | * Switch back to 16bit mode to avoid problems with dumb |
1781 | * DOS packet driver after a warm reboot | 1779 | * DOS packet driver after a warm reboot |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 475dc930380f..0d101a18026a 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -861,6 +861,9 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
861 | * give dev_queue_xmit something it can free. | 861 | * give dev_queue_xmit something it can free. |
862 | */ | 862 | */ |
863 | skb2 = skb_clone(skb, GFP_ATOMIC); | 863 | skb2 = skb_clone(skb, GFP_ATOMIC); |
864 | |||
865 | if (skb2 == NULL) | ||
866 | goto abort; | ||
864 | } | 867 | } |
865 | 868 | ||
866 | ph = (struct pppoe_hdr *) skb_push(skb2, sizeof(struct pppoe_hdr)); | 869 | ph = (struct pppoe_hdr *) skb_push(skb2, sizeof(struct pppoe_hdr)); |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index a70c2b0cc104..5ca5a1b546a1 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -78,8 +78,7 @@ static const struct pci_device_id skge_id_table[] = { | |||
78 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, | 78 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, |
79 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, | 79 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, |
80 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, | 80 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, |
81 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, | 81 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) }, /* DGE-530T */ |
82 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) }, | ||
83 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, | 82 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, |
84 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ | 83 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ |
85 | { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) }, | 84 | { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) }, |
@@ -402,7 +401,7 @@ static int skge_set_ring_param(struct net_device *dev, | |||
402 | int err; | 401 | int err; |
403 | 402 | ||
404 | if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE || | 403 | if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE || |
405 | p->tx_pending == 0 || p->tx_pending > MAX_TX_RING_SIZE) | 404 | p->tx_pending < MAX_SKB_FRAGS+1 || p->tx_pending > MAX_TX_RING_SIZE) |
406 | return -EINVAL; | 405 | return -EINVAL; |
407 | 406 | ||
408 | skge->rx_ring.count = p->rx_pending; | 407 | skge->rx_ring.count = p->rx_pending; |
@@ -2717,8 +2716,7 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
2717 | if (control & BMU_OWN) | 2716 | if (control & BMU_OWN) |
2718 | break; | 2717 | break; |
2719 | 2718 | ||
2720 | skb = skge_rx_get(skge, e, control, rd->status, | 2719 | skb = skge_rx_get(skge, e, control, rd->status, rd->csum2); |
2721 | le16_to_cpu(rd->csum2)); | ||
2722 | if (likely(skb)) { | 2720 | if (likely(skb)) { |
2723 | dev->last_rx = jiffies; | 2721 | dev->last_rx = jiffies; |
2724 | netif_receive_skb(skb); | 2722 | netif_receive_skb(skb); |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index ffd267fab21d..97fe95666f3b 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include "sky2.h" | 51 | #include "sky2.h" |
52 | 52 | ||
53 | #define DRV_NAME "sky2" | 53 | #define DRV_NAME "sky2" |
54 | #define DRV_VERSION "1.3" | 54 | #define DRV_VERSION "1.4" |
55 | #define PFX DRV_NAME " " | 55 | #define PFX DRV_NAME " " |
56 | 56 | ||
57 | /* | 57 | /* |
@@ -105,6 +105,7 @@ MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms) | |||
105 | static const struct pci_device_id sky2_id_table[] = { | 105 | static const struct pci_device_id sky2_id_table[] = { |
106 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, | 106 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, |
107 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, | 107 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, |
108 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, /* DGE-560T */ | ||
108 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, | 109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, |
109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, | 110 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, |
110 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, | 111 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, |
@@ -186,12 +187,11 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) | |||
186 | return v; | 187 | return v; |
187 | } | 188 | } |
188 | 189 | ||
189 | static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | 190 | static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) |
190 | { | 191 | { |
191 | u16 power_control; | 192 | u16 power_control; |
192 | u32 reg1; | 193 | u32 reg1; |
193 | int vaux; | 194 | int vaux; |
194 | int ret = 0; | ||
195 | 195 | ||
196 | pr_debug("sky2_set_power_state %d\n", state); | 196 | pr_debug("sky2_set_power_state %d\n", state); |
197 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 197 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
@@ -235,6 +235,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
235 | } | 235 | } |
236 | 236 | ||
237 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { | 237 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { |
238 | sky2_write16(hw, B0_CTST, Y2_HW_WOL_ON); | ||
238 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); | 239 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
239 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); | 240 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); |
240 | reg1 &= P_ASPM_CONTROL_MSK; | 241 | reg1 &= P_ASPM_CONTROL_MSK; |
@@ -273,12 +274,10 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
273 | break; | 274 | break; |
274 | default: | 275 | default: |
275 | printk(KERN_ERR PFX "Unknown power state %d\n", state); | 276 | printk(KERN_ERR PFX "Unknown power state %d\n", state); |
276 | ret = -1; | ||
277 | } | 277 | } |
278 | 278 | ||
279 | sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); | 279 | sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); |
280 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 280 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
281 | return ret; | ||
282 | } | 281 | } |
283 | 282 | ||
284 | static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) | 283 | static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) |
@@ -306,7 +305,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
306 | u16 ctrl, ct1000, adv, pg, ledctrl, ledover; | 305 | u16 ctrl, ct1000, adv, pg, ledctrl, ledover; |
307 | 306 | ||
308 | if (sky2->autoneg == AUTONEG_ENABLE && | 307 | if (sky2->autoneg == AUTONEG_ENABLE && |
309 | (hw->chip_id != CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) { | 308 | !(hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) { |
310 | u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); | 309 | u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); |
311 | 310 | ||
312 | ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | | 311 | ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | |
@@ -977,6 +976,7 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
977 | struct sky2_hw *hw = sky2->hw; | 976 | struct sky2_hw *hw = sky2->hw; |
978 | unsigned rxq = rxqaddr[sky2->port]; | 977 | unsigned rxq = rxqaddr[sky2->port]; |
979 | int i; | 978 | int i; |
979 | unsigned thresh; | ||
980 | 980 | ||
981 | sky2->rx_put = sky2->rx_next = 0; | 981 | sky2->rx_put = sky2->rx_next = 0; |
982 | sky2_qset(hw, rxq); | 982 | sky2_qset(hw, rxq); |
@@ -1001,9 +1001,21 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
1001 | sky2_rx_add(sky2, re->mapaddr); | 1001 | sky2_rx_add(sky2, re->mapaddr); |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* Truncate oversize frames */ | 1004 | |
1005 | sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), sky2->rx_bufsize - 8); | 1005 | /* |
1006 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON); | 1006 | * The receiver hangs if it receives frames larger than the |
1007 | * packet buffer. As a workaround, truncate oversize frames, but | ||
1008 | * the register is limited to 9 bits, so if you do frames > 2052 | ||
1009 | * you better get the MTU right! | ||
1010 | */ | ||
1011 | thresh = (sky2->rx_bufsize - 8) / sizeof(u32); | ||
1012 | if (thresh > 0x1ff) | ||
1013 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_OFF); | ||
1014 | else { | ||
1015 | sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), thresh); | ||
1016 | sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON); | ||
1017 | } | ||
1018 | |||
1007 | 1019 | ||
1008 | /* Tell chip about available buffers */ | 1020 | /* Tell chip about available buffers */ |
1009 | sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put); | 1021 | sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put); |
@@ -1020,7 +1032,25 @@ static int sky2_up(struct net_device *dev) | |||
1020 | struct sky2_hw *hw = sky2->hw; | 1032 | struct sky2_hw *hw = sky2->hw; |
1021 | unsigned port = sky2->port; | 1033 | unsigned port = sky2->port; |
1022 | u32 ramsize, rxspace, imask; | 1034 | u32 ramsize, rxspace, imask; |
1023 | int err = -ENOMEM; | 1035 | int cap, err = -ENOMEM; |
1036 | struct net_device *otherdev = hw->dev[sky2->port^1]; | ||
1037 | |||
1038 | /* | ||
1039 | * On dual port PCI-X card, there is an problem where status | ||
1040 | * can be received out of order due to split transactions | ||
1041 | */ | ||
1042 | if (otherdev && netif_running(otherdev) && | ||
1043 | (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) { | ||
1044 | struct sky2_port *osky2 = netdev_priv(otherdev); | ||
1045 | u16 cmd; | ||
1046 | |||
1047 | cmd = sky2_pci_read16(hw, cap + PCI_X_CMD); | ||
1048 | cmd &= ~PCI_X_CMD_MAX_SPLIT; | ||
1049 | sky2_pci_write16(hw, cap + PCI_X_CMD, cmd); | ||
1050 | |||
1051 | sky2->rx_csum = 0; | ||
1052 | osky2->rx_csum = 0; | ||
1053 | } | ||
1024 | 1054 | ||
1025 | if (netif_msg_ifup(sky2)) | 1055 | if (netif_msg_ifup(sky2)) |
1026 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); | 1056 | printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); |
@@ -1899,6 +1929,12 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
1899 | } | 1929 | } |
1900 | } | 1930 | } |
1901 | 1931 | ||
1932 | /* Is status ring empty or is there more to do? */ | ||
1933 | static inline int sky2_more_work(const struct sky2_hw *hw) | ||
1934 | { | ||
1935 | return (hw->st_idx != sky2_read16(hw, STAT_PUT_IDX)); | ||
1936 | } | ||
1937 | |||
1902 | /* Process status response ring */ | 1938 | /* Process status response ring */ |
1903 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) | 1939 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) |
1904 | { | 1940 | { |
@@ -2125,6 +2161,13 @@ static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port, | |||
2125 | /* If idle then force a fake soft NAPI poll once a second | 2161 | /* If idle then force a fake soft NAPI poll once a second |
2126 | * to work around cases where sharing an edge triggered interrupt. | 2162 | * to work around cases where sharing an edge triggered interrupt. |
2127 | */ | 2163 | */ |
2164 | static inline void sky2_idle_start(struct sky2_hw *hw) | ||
2165 | { | ||
2166 | if (idle_timeout > 0) | ||
2167 | mod_timer(&hw->idle_timer, | ||
2168 | jiffies + msecs_to_jiffies(idle_timeout)); | ||
2169 | } | ||
2170 | |||
2128 | static void sky2_idle(unsigned long arg) | 2171 | static void sky2_idle(unsigned long arg) |
2129 | { | 2172 | { |
2130 | struct sky2_hw *hw = (struct sky2_hw *) arg; | 2173 | struct sky2_hw *hw = (struct sky2_hw *) arg; |
@@ -2144,6 +2187,9 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
2144 | int work_done = 0; | 2187 | int work_done = 0; |
2145 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); | 2188 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); |
2146 | 2189 | ||
2190 | if (!~status) | ||
2191 | goto out; | ||
2192 | |||
2147 | if (status & Y2_IS_HW_ERR) | 2193 | if (status & Y2_IS_HW_ERR) |
2148 | sky2_hw_intr(hw); | 2194 | sky2_hw_intr(hw); |
2149 | 2195 | ||
@@ -2171,19 +2217,19 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
2171 | if (status & Y2_IS_CHK_TXA2) | 2217 | if (status & Y2_IS_CHK_TXA2) |
2172 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); | 2218 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); |
2173 | 2219 | ||
2174 | if (status & Y2_IS_STAT_BMU) | ||
2175 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); | ||
2176 | |||
2177 | work_done = sky2_status_intr(hw, work_limit); | 2220 | work_done = sky2_status_intr(hw, work_limit); |
2178 | *budget -= work_done; | 2221 | *budget -= work_done; |
2179 | dev0->quota -= work_done; | 2222 | dev0->quota -= work_done; |
2180 | 2223 | ||
2181 | if (work_done >= work_limit) | 2224 | if (status & Y2_IS_STAT_BMU) |
2182 | return 1; | 2225 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); |
2183 | 2226 | ||
2227 | if (sky2_more_work(hw)) | ||
2228 | return 1; | ||
2229 | out: | ||
2184 | netif_rx_complete(dev0); | 2230 | netif_rx_complete(dev0); |
2185 | 2231 | ||
2186 | status = sky2_read32(hw, B0_Y2_SP_LISR); | 2232 | sky2_read32(hw, B0_Y2_SP_LISR); |
2187 | return 0; | 2233 | return 0; |
2188 | } | 2234 | } |
2189 | 2235 | ||
@@ -3067,12 +3113,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
3067 | sky2->duplex = -1; | 3113 | sky2->duplex = -1; |
3068 | sky2->speed = -1; | 3114 | sky2->speed = -1; |
3069 | sky2->advertising = sky2_supported_modes(hw); | 3115 | sky2->advertising = sky2_supported_modes(hw); |
3070 | 3116 | sky2->rx_csum = 1; | |
3071 | /* Receive checksum disabled for Yukon XL | ||
3072 | * because of observed problems with incorrect | ||
3073 | * values when multiple packets are received in one interrupt | ||
3074 | */ | ||
3075 | sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); | ||
3076 | 3117 | ||
3077 | spin_lock_init(&sky2->phy_lock); | 3118 | spin_lock_init(&sky2->phy_lock); |
3078 | sky2->tx_pending = TX_DEF_PENDING; | 3119 | sky2->tx_pending = TX_DEF_PENDING; |
@@ -3316,9 +3357,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3316 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 3357 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
3317 | 3358 | ||
3318 | setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); | 3359 | setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); |
3319 | if (idle_timeout > 0) | 3360 | sky2_idle_start(hw); |
3320 | mod_timer(&hw->idle_timer, | ||
3321 | jiffies + msecs_to_jiffies(idle_timeout)); | ||
3322 | 3361 | ||
3323 | pci_set_drvdata(pdev, hw); | 3362 | pci_set_drvdata(pdev, hw); |
3324 | 3363 | ||
@@ -3391,8 +3430,14 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3391 | { | 3430 | { |
3392 | struct sky2_hw *hw = pci_get_drvdata(pdev); | 3431 | struct sky2_hw *hw = pci_get_drvdata(pdev); |
3393 | int i; | 3432 | int i; |
3433 | pci_power_t pstate = pci_choose_state(pdev, state); | ||
3434 | |||
3435 | if (!(pstate == PCI_D3hot || pstate == PCI_D3cold)) | ||
3436 | return -EINVAL; | ||
3437 | |||
3438 | del_timer_sync(&hw->idle_timer); | ||
3394 | 3439 | ||
3395 | for (i = 0; i < 2; i++) { | 3440 | for (i = 0; i < hw->ports; i++) { |
3396 | struct net_device *dev = hw->dev[i]; | 3441 | struct net_device *dev = hw->dev[i]; |
3397 | 3442 | ||
3398 | if (dev) { | 3443 | if (dev) { |
@@ -3404,7 +3449,10 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3404 | } | 3449 | } |
3405 | } | 3450 | } |
3406 | 3451 | ||
3407 | return sky2_set_power_state(hw, pci_choose_state(pdev, state)); | 3452 | sky2_write32(hw, B0_IMSK, 0); |
3453 | pci_save_state(pdev); | ||
3454 | sky2_set_power_state(hw, pstate); | ||
3455 | return 0; | ||
3408 | } | 3456 | } |
3409 | 3457 | ||
3410 | static int sky2_resume(struct pci_dev *pdev) | 3458 | static int sky2_resume(struct pci_dev *pdev) |
@@ -3414,15 +3462,15 @@ static int sky2_resume(struct pci_dev *pdev) | |||
3414 | 3462 | ||
3415 | pci_restore_state(pdev); | 3463 | pci_restore_state(pdev); |
3416 | pci_enable_wake(pdev, PCI_D0, 0); | 3464 | pci_enable_wake(pdev, PCI_D0, 0); |
3417 | err = sky2_set_power_state(hw, PCI_D0); | 3465 | sky2_set_power_state(hw, PCI_D0); |
3418 | if (err) | ||
3419 | goto out; | ||
3420 | 3466 | ||
3421 | err = sky2_reset(hw); | 3467 | err = sky2_reset(hw); |
3422 | if (err) | 3468 | if (err) |
3423 | goto out; | 3469 | goto out; |
3424 | 3470 | ||
3425 | for (i = 0; i < 2; i++) { | 3471 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
3472 | |||
3473 | for (i = 0; i < hw->ports; i++) { | ||
3426 | struct net_device *dev = hw->dev[i]; | 3474 | struct net_device *dev = hw->dev[i]; |
3427 | if (dev && netif_running(dev)) { | 3475 | if (dev && netif_running(dev)) { |
3428 | netif_device_attach(dev); | 3476 | netif_device_attach(dev); |
@@ -3431,10 +3479,12 @@ static int sky2_resume(struct pci_dev *pdev) | |||
3431 | printk(KERN_ERR PFX "%s: could not up: %d\n", | 3479 | printk(KERN_ERR PFX "%s: could not up: %d\n", |
3432 | dev->name, err); | 3480 | dev->name, err); |
3433 | dev_close(dev); | 3481 | dev_close(dev); |
3434 | break; | 3482 | goto out; |
3435 | } | 3483 | } |
3436 | } | 3484 | } |
3437 | } | 3485 | } |
3486 | |||
3487 | sky2_idle_start(hw); | ||
3438 | out: | 3488 | out: |
3439 | return err; | 3489 | return err; |
3440 | } | 3490 | } |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 8012994c9b93..8a0bc5525f0a 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -214,6 +214,8 @@ enum csr_regs { | |||
214 | enum { | 214 | enum { |
215 | Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */ | 215 | Y2_VMAIN_AVAIL = 1<<17,/* VMAIN available (YUKON-2 only) */ |
216 | Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */ | 216 | Y2_VAUX_AVAIL = 1<<16,/* VAUX available (YUKON-2 only) */ |
217 | Y2_HW_WOL_ON = 1<<15,/* HW WOL On (Yukon-EC Ultra A1 only) */ | ||
218 | Y2_HW_WOL_OFF = 1<<14,/* HW WOL On (Yukon-EC Ultra A1 only) */ | ||
217 | Y2_ASF_ENABLE = 1<<13,/* ASF Unit Enable (YUKON-2 only) */ | 219 | Y2_ASF_ENABLE = 1<<13,/* ASF Unit Enable (YUKON-2 only) */ |
218 | Y2_ASF_DISABLE = 1<<12,/* ASF Unit Disable (YUKON-2 only) */ | 220 | Y2_ASF_DISABLE = 1<<12,/* ASF Unit Disable (YUKON-2 only) */ |
219 | Y2_CLK_RUN_ENA = 1<<11,/* CLK_RUN Enable (YUKON-2 only) */ | 221 | Y2_CLK_RUN_ENA = 1<<11,/* CLK_RUN Enable (YUKON-2 only) */ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 2bd9592b75cd..862c226dbbe2 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -69,8 +69,8 @@ | |||
69 | 69 | ||
70 | #define DRV_MODULE_NAME "tg3" | 70 | #define DRV_MODULE_NAME "tg3" |
71 | #define PFX DRV_MODULE_NAME ": " | 71 | #define PFX DRV_MODULE_NAME ": " |
72 | #define DRV_MODULE_VERSION "3.57" | 72 | #define DRV_MODULE_VERSION "3.59" |
73 | #define DRV_MODULE_RELDATE "Apr 28, 2006" | 73 | #define DRV_MODULE_RELDATE "June 8, 2006" |
74 | 74 | ||
75 | #define TG3_DEF_MAC_MODE 0 | 75 | #define TG3_DEF_MAC_MODE 0 |
76 | #define TG3_DEF_RX_MODE 0 | 76 | #define TG3_DEF_RX_MODE 0 |
@@ -4485,9 +4485,8 @@ static void tg3_disable_nvram_access(struct tg3 *tp) | |||
4485 | /* tp->lock is held. */ | 4485 | /* tp->lock is held. */ |
4486 | static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) | 4486 | static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) |
4487 | { | 4487 | { |
4488 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) | 4488 | tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, |
4489 | tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, | 4489 | NIC_SRAM_FIRMWARE_MBOX_MAGIC1); |
4490 | NIC_SRAM_FIRMWARE_MBOX_MAGIC1); | ||
4491 | 4490 | ||
4492 | if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) { | 4491 | if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) { |
4493 | switch (kind) { | 4492 | switch (kind) { |
@@ -4568,13 +4567,12 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4568 | void (*write_op)(struct tg3 *, u32, u32); | 4567 | void (*write_op)(struct tg3 *, u32, u32); |
4569 | int i; | 4568 | int i; |
4570 | 4569 | ||
4571 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { | 4570 | tg3_nvram_lock(tp); |
4572 | tg3_nvram_lock(tp); | 4571 | |
4573 | /* No matching tg3_nvram_unlock() after this because | 4572 | /* No matching tg3_nvram_unlock() after this because |
4574 | * chip reset below will undo the nvram lock. | 4573 | * chip reset below will undo the nvram lock. |
4575 | */ | 4574 | */ |
4576 | tp->nvram_lock_cnt = 0; | 4575 | tp->nvram_lock_cnt = 0; |
4577 | } | ||
4578 | 4576 | ||
4579 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || | 4577 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || |
4580 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 4578 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
@@ -4727,20 +4725,25 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4727 | tw32_f(MAC_MODE, 0); | 4725 | tw32_f(MAC_MODE, 0); |
4728 | udelay(40); | 4726 | udelay(40); |
4729 | 4727 | ||
4730 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { | 4728 | /* Wait for firmware initialization to complete. */ |
4731 | /* Wait for firmware initialization to complete. */ | 4729 | for (i = 0; i < 100000; i++) { |
4732 | for (i = 0; i < 100000; i++) { | 4730 | tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); |
4733 | tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); | 4731 | if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) |
4734 | if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) | 4732 | break; |
4735 | break; | 4733 | udelay(10); |
4736 | udelay(10); | 4734 | } |
4737 | } | 4735 | |
4738 | if (i >= 100000) { | 4736 | /* Chip might not be fitted with firmare. Some Sun onboard |
4739 | printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, " | 4737 | * parts are configured like that. So don't signal the timeout |
4740 | "firmware will not restart magic=%08x\n", | 4738 | * of the above loop as an error, but do report the lack of |
4741 | tp->dev->name, val); | 4739 | * running firmware once. |
4742 | return -ENODEV; | 4740 | */ |
4743 | } | 4741 | if (i >= 100000 && |
4742 | !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) { | ||
4743 | tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED; | ||
4744 | |||
4745 | printk(KERN_INFO PFX "%s: No firmware running.\n", | ||
4746 | tp->dev->name); | ||
4744 | } | 4747 | } |
4745 | 4748 | ||
4746 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && | 4749 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && |
@@ -6488,6 +6491,10 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp) | |||
6488 | TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG); | 6491 | TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG); |
6489 | TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS); | 6492 | TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS); |
6490 | TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE); | 6493 | TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE); |
6494 | |||
6495 | TG3_STAT_ADD32(&sp->rxbds_empty, RCVLPC_NO_RCV_BD_CNT); | ||
6496 | TG3_STAT_ADD32(&sp->rx_discards, RCVLPC_IN_DISCARDS_CNT); | ||
6497 | TG3_STAT_ADD32(&sp->rx_errors, RCVLPC_IN_ERRORS_CNT); | ||
6491 | } | 6498 | } |
6492 | 6499 | ||
6493 | static void tg3_timer(unsigned long __opaque) | 6500 | static void tg3_timer(unsigned long __opaque) |
@@ -7653,21 +7660,23 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
7653 | cmd->supported |= (SUPPORTED_1000baseT_Half | | 7660 | cmd->supported |= (SUPPORTED_1000baseT_Half | |
7654 | SUPPORTED_1000baseT_Full); | 7661 | SUPPORTED_1000baseT_Full); |
7655 | 7662 | ||
7656 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) | 7663 | if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) { |
7657 | cmd->supported |= (SUPPORTED_100baseT_Half | | 7664 | cmd->supported |= (SUPPORTED_100baseT_Half | |
7658 | SUPPORTED_100baseT_Full | | 7665 | SUPPORTED_100baseT_Full | |
7659 | SUPPORTED_10baseT_Half | | 7666 | SUPPORTED_10baseT_Half | |
7660 | SUPPORTED_10baseT_Full | | 7667 | SUPPORTED_10baseT_Full | |
7661 | SUPPORTED_MII); | 7668 | SUPPORTED_MII); |
7662 | else | 7669 | cmd->port = PORT_TP; |
7670 | } else { | ||
7663 | cmd->supported |= SUPPORTED_FIBRE; | 7671 | cmd->supported |= SUPPORTED_FIBRE; |
7672 | cmd->port = PORT_FIBRE; | ||
7673 | } | ||
7664 | 7674 | ||
7665 | cmd->advertising = tp->link_config.advertising; | 7675 | cmd->advertising = tp->link_config.advertising; |
7666 | if (netif_running(dev)) { | 7676 | if (netif_running(dev)) { |
7667 | cmd->speed = tp->link_config.active_speed; | 7677 | cmd->speed = tp->link_config.active_speed; |
7668 | cmd->duplex = tp->link_config.active_duplex; | 7678 | cmd->duplex = tp->link_config.active_duplex; |
7669 | } | 7679 | } |
7670 | cmd->port = 0; | ||
7671 | cmd->phy_address = PHY_ADDR; | 7680 | cmd->phy_address = PHY_ADDR; |
7672 | cmd->transceiver = 0; | 7681 | cmd->transceiver = 0; |
7673 | cmd->autoneg = tp->link_config.autoneg; | 7682 | cmd->autoneg = tp->link_config.autoneg; |
@@ -9069,9 +9078,6 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) | |||
9069 | { | 9078 | { |
9070 | int j; | 9079 | int j; |
9071 | 9080 | ||
9072 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) | ||
9073 | return; | ||
9074 | |||
9075 | tw32_f(GRC_EEPROM_ADDR, | 9081 | tw32_f(GRC_EEPROM_ADDR, |
9076 | (EEPROM_ADDR_FSM_RESET | | 9082 | (EEPROM_ADDR_FSM_RESET | |
9077 | (EEPROM_DEFAULT_CLOCK_PERIOD << | 9083 | (EEPROM_DEFAULT_CLOCK_PERIOD << |
@@ -9204,11 +9210,6 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) | |||
9204 | { | 9210 | { |
9205 | int ret; | 9211 | int ret; |
9206 | 9212 | ||
9207 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | ||
9208 | printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 570X\n"); | ||
9209 | return -EINVAL; | ||
9210 | } | ||
9211 | |||
9212 | if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) | 9213 | if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) |
9213 | return tg3_nvram_read_using_eeprom(tp, offset, val); | 9214 | return tg3_nvram_read_using_eeprom(tp, offset, val); |
9214 | 9215 | ||
@@ -9441,11 +9442,6 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf) | |||
9441 | { | 9442 | { |
9442 | int ret; | 9443 | int ret; |
9443 | 9444 | ||
9444 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | ||
9445 | printk(KERN_ERR PFX "Attempt to do nvram_write on Sun 570X\n"); | ||
9446 | return -EINVAL; | ||
9447 | } | ||
9448 | |||
9449 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { | 9445 | if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) { |
9450 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl & | 9446 | tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl & |
9451 | ~GRC_LCLCTRL_GPIO_OUTPUT1); | 9447 | ~GRC_LCLCTRL_GPIO_OUTPUT1); |
@@ -9572,15 +9568,19 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
9572 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, | 9568 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, |
9573 | tp->misc_host_ctrl); | 9569 | tp->misc_host_ctrl); |
9574 | 9570 | ||
9571 | /* The memory arbiter has to be enabled in order for SRAM accesses | ||
9572 | * to succeed. Normally on powerup the tg3 chip firmware will make | ||
9573 | * sure it is enabled, but other entities such as system netboot | ||
9574 | * code might disable it. | ||
9575 | */ | ||
9576 | val = tr32(MEMARB_MODE); | ||
9577 | tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); | ||
9578 | |||
9575 | tp->phy_id = PHY_ID_INVALID; | 9579 | tp->phy_id = PHY_ID_INVALID; |
9576 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; | 9580 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; |
9577 | 9581 | ||
9578 | /* Do not even try poking around in here on Sun parts. */ | 9582 | /* Assume an onboard device by default. */ |
9579 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | 9583 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
9580 | /* All SUN chips are built-in LOMs. */ | ||
9581 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | ||
9582 | return; | ||
9583 | } | ||
9584 | 9584 | ||
9585 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); | 9585 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); |
9586 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { | 9586 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { |
@@ -9680,6 +9680,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
9680 | 9680 | ||
9681 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) | 9681 | if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) |
9682 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 9682 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
9683 | else | ||
9684 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | ||
9683 | 9685 | ||
9684 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { | 9686 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { |
9685 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; | 9687 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; |
@@ -9828,16 +9830,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
9828 | int i; | 9830 | int i; |
9829 | u32 magic; | 9831 | u32 magic; |
9830 | 9832 | ||
9831 | if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) { | ||
9832 | /* Sun decided not to put the necessary bits in the | ||
9833 | * NVRAM of their onboard tg3 parts :( | ||
9834 | */ | ||
9835 | strcpy(tp->board_part_number, "Sun 570X"); | ||
9836 | return; | ||
9837 | } | ||
9838 | |||
9839 | if (tg3_nvram_read_swab(tp, 0x0, &magic)) | 9833 | if (tg3_nvram_read_swab(tp, 0x0, &magic)) |
9840 | return; | 9834 | goto out_not_found; |
9841 | 9835 | ||
9842 | if (magic == TG3_EEPROM_MAGIC) { | 9836 | if (magic == TG3_EEPROM_MAGIC) { |
9843 | for (i = 0; i < 256; i += 4) { | 9837 | for (i = 0; i < 256; i += 4) { |
@@ -9868,6 +9862,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
9868 | break; | 9862 | break; |
9869 | msleep(1); | 9863 | msleep(1); |
9870 | } | 9864 | } |
9865 | if (!(tmp16 & 0x8000)) | ||
9866 | goto out_not_found; | ||
9867 | |||
9871 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, | 9868 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, |
9872 | &tmp); | 9869 | &tmp); |
9873 | tmp = cpu_to_le32(tmp); | 9870 | tmp = cpu_to_le32(tmp); |
@@ -9959,37 +9956,6 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
9959 | } | 9956 | } |
9960 | } | 9957 | } |
9961 | 9958 | ||
9962 | #ifdef CONFIG_SPARC64 | ||
9963 | static int __devinit tg3_is_sun_570X(struct tg3 *tp) | ||
9964 | { | ||
9965 | struct pci_dev *pdev = tp->pdev; | ||
9966 | struct pcidev_cookie *pcp = pdev->sysdata; | ||
9967 | |||
9968 | if (pcp != NULL) { | ||
9969 | int node = pcp->prom_node; | ||
9970 | u32 venid; | ||
9971 | int err; | ||
9972 | |||
9973 | err = prom_getproperty(node, "subsystem-vendor-id", | ||
9974 | (char *) &venid, sizeof(venid)); | ||
9975 | if (err == 0 || err == -1) | ||
9976 | return 0; | ||
9977 | if (venid == PCI_VENDOR_ID_SUN) | ||
9978 | return 1; | ||
9979 | |||
9980 | /* TG3 chips onboard the SunBlade-2500 don't have the | ||
9981 | * subsystem-vendor-id set to PCI_VENDOR_ID_SUN but they | ||
9982 | * are distinguishable from non-Sun variants by being | ||
9983 | * named "network" by the firmware. Non-Sun cards will | ||
9984 | * show up as being named "ethernet". | ||
9985 | */ | ||
9986 | if (!strcmp(pcp->prom_name, "network")) | ||
9987 | return 1; | ||
9988 | } | ||
9989 | return 0; | ||
9990 | } | ||
9991 | #endif | ||
9992 | |||
9993 | static int __devinit tg3_get_invariants(struct tg3 *tp) | 9959 | static int __devinit tg3_get_invariants(struct tg3 *tp) |
9994 | { | 9960 | { |
9995 | static struct pci_device_id write_reorder_chipsets[] = { | 9961 | static struct pci_device_id write_reorder_chipsets[] = { |
@@ -10006,11 +9972,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10006 | u16 pci_cmd; | 9972 | u16 pci_cmd; |
10007 | int err; | 9973 | int err; |
10008 | 9974 | ||
10009 | #ifdef CONFIG_SPARC64 | ||
10010 | if (tg3_is_sun_570X(tp)) | ||
10011 | tp->tg3_flags2 |= TG3_FLG2_SUN_570X; | ||
10012 | #endif | ||
10013 | |||
10014 | /* Force memory write invalidate off. If we leave it on, | 9975 | /* Force memory write invalidate off. If we leave it on, |
10015 | * then on 5700_BX chips we have to enable a workaround. | 9976 | * then on 5700_BX chips we have to enable a workaround. |
10016 | * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary | 9977 | * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary |
@@ -10306,8 +10267,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10306 | if (tp->write32 == tg3_write_indirect_reg32 || | 10267 | if (tp->write32 == tg3_write_indirect_reg32 || |
10307 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && | 10268 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && |
10308 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || | 10269 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || |
10309 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) || | 10270 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701))) |
10310 | (tp->tg3_flags2 & TG3_FLG2_SUN_570X)) | ||
10311 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; | 10271 | tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG; |
10312 | 10272 | ||
10313 | /* Get eeprom hw config before calling tg3_set_power_state(). | 10273 | /* Get eeprom hw config before calling tg3_set_power_state(). |
@@ -10588,8 +10548,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
10588 | #endif | 10548 | #endif |
10589 | 10549 | ||
10590 | mac_offset = 0x7c; | 10550 | mac_offset = 0x7c; |
10591 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && | 10551 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || |
10592 | !(tp->tg3_flags & TG3_FLG2_SUN_570X)) || | ||
10593 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { | 10552 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) { |
10594 | if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) | 10553 | if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) |
10595 | mac_offset = 0xcc; | 10554 | mac_offset = 0xcc; |
@@ -10616,8 +10575,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
10616 | } | 10575 | } |
10617 | if (!addr_ok) { | 10576 | if (!addr_ok) { |
10618 | /* Next, try NVRAM. */ | 10577 | /* Next, try NVRAM. */ |
10619 | if (!(tp->tg3_flags & TG3_FLG2_SUN_570X) && | 10578 | if (!tg3_nvram_read(tp, mac_offset + 0, &hi) && |
10620 | !tg3_nvram_read(tp, mac_offset + 0, &hi) && | ||
10621 | !tg3_nvram_read(tp, mac_offset + 4, &lo)) { | 10579 | !tg3_nvram_read(tp, mac_offset + 4, &lo)) { |
10622 | dev->dev_addr[0] = ((hi >> 16) & 0xff); | 10580 | dev->dev_addr[0] = ((hi >> 16) & 0xff); |
10623 | dev->dev_addr[1] = ((hi >> 24) & 0xff); | 10581 | dev->dev_addr[1] = ((hi >> 24) & 0xff); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 0e29b885d449..ff0faab94bd5 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2184,7 +2184,7 @@ struct tg3 { | |||
2184 | #define TG3_FLAG_INIT_COMPLETE 0x80000000 | 2184 | #define TG3_FLAG_INIT_COMPLETE 0x80000000 |
2185 | u32 tg3_flags2; | 2185 | u32 tg3_flags2; |
2186 | #define TG3_FLG2_RESTART_TIMER 0x00000001 | 2186 | #define TG3_FLG2_RESTART_TIMER 0x00000001 |
2187 | #define TG3_FLG2_SUN_570X 0x00000002 | 2187 | /* 0x00000002 available */ |
2188 | #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 | 2188 | #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 |
2189 | #define TG3_FLG2_IS_5788 0x00000008 | 2189 | #define TG3_FLG2_IS_5788 0x00000008 |
2190 | #define TG3_FLG2_MAX_RXPEND_64 0x00000010 | 2190 | #define TG3_FLG2_MAX_RXPEND_64 0x00000010 |
@@ -2216,6 +2216,7 @@ struct tg3 { | |||
2216 | #define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2) | 2216 | #define TG3_FLG2_HW_TSO (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2) |
2217 | #define TG3_FLG2_1SHOT_MSI 0x10000000 | 2217 | #define TG3_FLG2_1SHOT_MSI 0x10000000 |
2218 | #define TG3_FLG2_PHY_JITTER_BUG 0x20000000 | 2218 | #define TG3_FLG2_PHY_JITTER_BUG 0x20000000 |
2219 | #define TG3_FLG2_NO_FWARE_REPORTED 0x40000000 | ||
2219 | 2220 | ||
2220 | u32 split_mode_max_reqs; | 2221 | u32 split_mode_max_reqs; |
2221 | #define SPLIT_MODE_5704_MAX_REQ 3 | 2222 | #define SPLIT_MODE_5704_MAX_REQ 3 |
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index ba05dedf29d3..136a70c4d5e4 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -850,7 +850,7 @@ static void init_rxtx_rings(struct net_device *dev) | |||
850 | break; | 850 | break; |
851 | skb->dev = dev; /* Mark as being used by this device. */ | 851 | skb->dev = dev; /* Mark as being used by this device. */ |
852 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, | 852 | np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data, |
853 | skb->len,PCI_DMA_FROMDEVICE); | 853 | np->rx_buf_sz,PCI_DMA_FROMDEVICE); |
854 | 854 | ||
855 | np->rx_ring[i].buffer1 = np->rx_addr[i]; | 855 | np->rx_ring[i].buffer1 = np->rx_addr[i]; |
856 | np->rx_ring[i].status = DescOwn; | 856 | np->rx_ring[i].status = DescOwn; |
@@ -1316,7 +1316,7 @@ static int netdev_rx(struct net_device *dev) | |||
1316 | skb->dev = dev; /* Mark as being used by this device. */ | 1316 | skb->dev = dev; /* Mark as being used by this device. */ |
1317 | np->rx_addr[entry] = pci_map_single(np->pci_dev, | 1317 | np->rx_addr[entry] = pci_map_single(np->pci_dev, |
1318 | skb->data, | 1318 | skb->data, |
1319 | skb->len, PCI_DMA_FROMDEVICE); | 1319 | np->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1320 | np->rx_ring[entry].buffer1 = np->rx_addr[entry]; | 1320 | np->rx_ring[entry].buffer1 = np->rx_addr[entry]; |
1321 | } | 1321 | } |
1322 | wmb(); | 1322 | wmb(); |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index a6dc53b4250d..fdc21037f6dc 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -491,8 +491,6 @@ struct rhine_private { | |||
491 | u8 tx_thresh, rx_thresh; | 491 | u8 tx_thresh, rx_thresh; |
492 | 492 | ||
493 | struct mii_if_info mii_if; | 493 | struct mii_if_info mii_if; |
494 | struct work_struct tx_timeout_task; | ||
495 | struct work_struct check_media_task; | ||
496 | void __iomem *base; | 494 | void __iomem *base; |
497 | }; | 495 | }; |
498 | 496 | ||
@@ -500,8 +498,6 @@ static int mdio_read(struct net_device *dev, int phy_id, int location); | |||
500 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); | 498 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); |
501 | static int rhine_open(struct net_device *dev); | 499 | static int rhine_open(struct net_device *dev); |
502 | static void rhine_tx_timeout(struct net_device *dev); | 500 | static void rhine_tx_timeout(struct net_device *dev); |
503 | static void rhine_tx_timeout_task(struct net_device *dev); | ||
504 | static void rhine_check_media_task(struct net_device *dev); | ||
505 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); | 501 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); |
506 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); | 502 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); |
507 | static void rhine_tx(struct net_device *dev); | 503 | static void rhine_tx(struct net_device *dev); |
@@ -856,12 +852,6 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
856 | if (rp->quirks & rqRhineI) | 852 | if (rp->quirks & rqRhineI) |
857 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; | 853 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; |
858 | 854 | ||
859 | INIT_WORK(&rp->tx_timeout_task, | ||
860 | (void (*)(void *))rhine_tx_timeout_task, dev); | ||
861 | |||
862 | INIT_WORK(&rp->check_media_task, | ||
863 | (void (*)(void *))rhine_check_media_task, dev); | ||
864 | |||
865 | /* dev->name not defined before register_netdev()! */ | 855 | /* dev->name not defined before register_netdev()! */ |
866 | rc = register_netdev(dev); | 856 | rc = register_netdev(dev); |
867 | if (rc) | 857 | if (rc) |
@@ -1108,11 +1098,6 @@ static void rhine_set_carrier(struct mii_if_info *mii) | |||
1108 | netif_carrier_ok(mii->dev)); | 1098 | netif_carrier_ok(mii->dev)); |
1109 | } | 1099 | } |
1110 | 1100 | ||
1111 | static void rhine_check_media_task(struct net_device *dev) | ||
1112 | { | ||
1113 | rhine_check_media(dev, 0); | ||
1114 | } | ||
1115 | |||
1116 | static void init_registers(struct net_device *dev) | 1101 | static void init_registers(struct net_device *dev) |
1117 | { | 1102 | { |
1118 | struct rhine_private *rp = netdev_priv(dev); | 1103 | struct rhine_private *rp = netdev_priv(dev); |
@@ -1166,8 +1151,8 @@ static void rhine_disable_linkmon(void __iomem *ioaddr, u32 quirks) | |||
1166 | if (quirks & rqRhineI) { | 1151 | if (quirks & rqRhineI) { |
1167 | iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR | 1152 | iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR |
1168 | 1153 | ||
1169 | /* Do not call from ISR! */ | 1154 | /* Can be called from ISR. Evil. */ |
1170 | msleep(1); | 1155 | mdelay(1); |
1171 | 1156 | ||
1172 | /* 0x80 must be set immediately before turning it off */ | 1157 | /* 0x80 must be set immediately before turning it off */ |
1173 | iowrite8(0x80, ioaddr + MIICmd); | 1158 | iowrite8(0x80, ioaddr + MIICmd); |
@@ -1257,16 +1242,6 @@ static int rhine_open(struct net_device *dev) | |||
1257 | static void rhine_tx_timeout(struct net_device *dev) | 1242 | static void rhine_tx_timeout(struct net_device *dev) |
1258 | { | 1243 | { |
1259 | struct rhine_private *rp = netdev_priv(dev); | 1244 | struct rhine_private *rp = netdev_priv(dev); |
1260 | |||
1261 | /* | ||
1262 | * Move bulk of work outside of interrupt context | ||
1263 | */ | ||
1264 | schedule_work(&rp->tx_timeout_task); | ||
1265 | } | ||
1266 | |||
1267 | static void rhine_tx_timeout_task(struct net_device *dev) | ||
1268 | { | ||
1269 | struct rhine_private *rp = netdev_priv(dev); | ||
1270 | void __iomem *ioaddr = rp->base; | 1245 | void __iomem *ioaddr = rp->base; |
1271 | 1246 | ||
1272 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | 1247 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " |
@@ -1677,7 +1652,7 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
1677 | spin_lock(&rp->lock); | 1652 | spin_lock(&rp->lock); |
1678 | 1653 | ||
1679 | if (intr_status & IntrLinkChange) | 1654 | if (intr_status & IntrLinkChange) |
1680 | schedule_work(&rp->check_media_task); | 1655 | rhine_check_media(dev, 0); |
1681 | if (intr_status & IntrStatsMax) { | 1656 | if (intr_status & IntrStatsMax) { |
1682 | rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); | 1657 | rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); |
1683 | rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); | 1658 | rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); |
@@ -1927,9 +1902,6 @@ static int rhine_close(struct net_device *dev) | |||
1927 | spin_unlock_irq(&rp->lock); | 1902 | spin_unlock_irq(&rp->lock); |
1928 | 1903 | ||
1929 | free_irq(rp->pdev->irq, dev); | 1904 | free_irq(rp->pdev->irq, dev); |
1930 | |||
1931 | flush_scheduled_work(); | ||
1932 | |||
1933 | free_rbufs(dev); | 1905 | free_rbufs(dev); |
1934 | free_tbufs(dev); | 1906 | free_tbufs(dev); |
1935 | free_ring(dev); | 1907 | free_ring(dev); |
diff --git a/drivers/net/wireless/arlan-main.c b/drivers/net/wireless/arlan-main.c index 0e1ac338cac1..bed6823d9809 100644 --- a/drivers/net/wireless/arlan-main.c +++ b/drivers/net/wireless/arlan-main.c | |||
@@ -1838,7 +1838,7 @@ struct net_device * __init arlan_probe(int unit) | |||
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | #ifdef MODULE | 1840 | #ifdef MODULE |
1841 | int init_module(void) | 1841 | int __init init_module(void) |
1842 | { | 1842 | { |
1843 | int i = 0; | 1843 | int i = 0; |
1844 | 1844 | ||
@@ -1860,7 +1860,7 @@ int init_module(void) | |||
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | 1862 | ||
1863 | void cleanup_module(void) | 1863 | void __exit cleanup_module(void) |
1864 | { | 1864 | { |
1865 | int i = 0; | 1865 | int i = 0; |
1866 | struct net_device *dev; | 1866 | struct net_device *dev; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c index bbecba02e697..d0318e525ba7 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c | |||
@@ -624,25 +624,28 @@ err_destroy_tx0: | |||
624 | static u16 generate_cookie(struct bcm43xx_dmaring *ring, | 624 | static u16 generate_cookie(struct bcm43xx_dmaring *ring, |
625 | int slot) | 625 | int slot) |
626 | { | 626 | { |
627 | u16 cookie = 0x0000; | 627 | u16 cookie = 0xF000; |
628 | 628 | ||
629 | /* Use the upper 4 bits of the cookie as | 629 | /* Use the upper 4 bits of the cookie as |
630 | * DMA controller ID and store the slot number | 630 | * DMA controller ID and store the slot number |
631 | * in the lower 12 bits | 631 | * in the lower 12 bits. |
632 | * Note that the cookie must never be 0, as this | ||
633 | * is a special value used in RX path. | ||
632 | */ | 634 | */ |
633 | switch (ring->mmio_base) { | 635 | switch (ring->mmio_base) { |
634 | default: | 636 | default: |
635 | assert(0); | 637 | assert(0); |
636 | case BCM43xx_MMIO_DMA1_BASE: | 638 | case BCM43xx_MMIO_DMA1_BASE: |
639 | cookie = 0xA000; | ||
637 | break; | 640 | break; |
638 | case BCM43xx_MMIO_DMA2_BASE: | 641 | case BCM43xx_MMIO_DMA2_BASE: |
639 | cookie = 0x1000; | 642 | cookie = 0xB000; |
640 | break; | 643 | break; |
641 | case BCM43xx_MMIO_DMA3_BASE: | 644 | case BCM43xx_MMIO_DMA3_BASE: |
642 | cookie = 0x2000; | 645 | cookie = 0xC000; |
643 | break; | 646 | break; |
644 | case BCM43xx_MMIO_DMA4_BASE: | 647 | case BCM43xx_MMIO_DMA4_BASE: |
645 | cookie = 0x3000; | 648 | cookie = 0xD000; |
646 | break; | 649 | break; |
647 | } | 650 | } |
648 | assert(((u16)slot & 0xF000) == 0x0000); | 651 | assert(((u16)slot & 0xF000) == 0x0000); |
@@ -660,16 +663,16 @@ struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm, | |||
660 | struct bcm43xx_dmaring *ring = NULL; | 663 | struct bcm43xx_dmaring *ring = NULL; |
661 | 664 | ||
662 | switch (cookie & 0xF000) { | 665 | switch (cookie & 0xF000) { |
663 | case 0x0000: | 666 | case 0xA000: |
664 | ring = dma->tx_ring0; | 667 | ring = dma->tx_ring0; |
665 | break; | 668 | break; |
666 | case 0x1000: | 669 | case 0xB000: |
667 | ring = dma->tx_ring1; | 670 | ring = dma->tx_ring1; |
668 | break; | 671 | break; |
669 | case 0x2000: | 672 | case 0xC000: |
670 | ring = dma->tx_ring2; | 673 | ring = dma->tx_ring2; |
671 | break; | 674 | break; |
672 | case 0x3000: | 675 | case 0xD000: |
673 | ring = dma->tx_ring3; | 676 | ring = dma->tx_ring3; |
674 | break; | 677 | break; |
675 | default: | 678 | default: |
@@ -839,8 +842,18 @@ static void dma_rx(struct bcm43xx_dmaring *ring, | |||
839 | /* We received an xmit status. */ | 842 | /* We received an xmit status. */ |
840 | struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data; | 843 | struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data; |
841 | struct bcm43xx_xmitstatus stat; | 844 | struct bcm43xx_xmitstatus stat; |
845 | int i = 0; | ||
842 | 846 | ||
843 | stat.cookie = le16_to_cpu(hw->cookie); | 847 | stat.cookie = le16_to_cpu(hw->cookie); |
848 | while (stat.cookie == 0) { | ||
849 | if (unlikely(++i >= 10000)) { | ||
850 | assert(0); | ||
851 | break; | ||
852 | } | ||
853 | udelay(2); | ||
854 | barrier(); | ||
855 | stat.cookie = le16_to_cpu(hw->cookie); | ||
856 | } | ||
844 | stat.flags = hw->flags; | 857 | stat.flags = hw->flags; |
845 | stat.cnt1 = hw->cnt1; | 858 | stat.cnt1 = hw->cnt1; |
846 | stat.cnt2 = hw->cnt2; | 859 | stat.cnt2 = hw->cnt2; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index e2982a83ae42..7ed18cad29f7 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -3271,6 +3271,9 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm) | |||
3271 | bcm43xx_sysfs_register(bcm); | 3271 | bcm43xx_sysfs_register(bcm); |
3272 | //FIXME: check for bcm43xx_sysfs_register failure. This function is a bit messy regarding unwinding, though... | 3272 | //FIXME: check for bcm43xx_sysfs_register failure. This function is a bit messy regarding unwinding, though... |
3273 | 3273 | ||
3274 | /*FIXME: This should be handled by softmac instead. */ | ||
3275 | schedule_work(&bcm->softmac->associnfo.work); | ||
3276 | |||
3274 | assert(err == 0); | 3277 | assert(err == 0); |
3275 | out: | 3278 | out: |
3276 | return err; | 3279 | return err; |
@@ -3946,9 +3949,6 @@ static int bcm43xx_resume(struct pci_dev *pdev) | |||
3946 | 3949 | ||
3947 | netif_device_attach(net_dev); | 3950 | netif_device_attach(net_dev); |
3948 | 3951 | ||
3949 | /*FIXME: This should be handled by softmac instead. */ | ||
3950 | schedule_work(&bcm->softmac->associnfo.work); | ||
3951 | |||
3952 | dprintk(KERN_INFO PFX "Device resumed.\n"); | 3952 | dprintk(KERN_INFO PFX "Device resumed.\n"); |
3953 | 3953 | ||
3954 | return 0; | 3954 | return 0; |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 06523e2a8471..c2d0b09e0418 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -812,7 +812,6 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
812 | if (datalen > IEEE80211_DATA_LEN + 12) { | 812 | if (datalen > IEEE80211_DATA_LEN + 12) { |
813 | printk(KERN_DEBUG "%s: oversized monitor frame, " | 813 | printk(KERN_DEBUG "%s: oversized monitor frame, " |
814 | "data length = %d\n", dev->name, datalen); | 814 | "data length = %d\n", dev->name, datalen); |
815 | err = -EIO; | ||
816 | stats->rx_length_errors++; | 815 | stats->rx_length_errors++; |
817 | goto update_stats; | 816 | goto update_stats; |
818 | } | 817 | } |
@@ -821,8 +820,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
821 | if (!skb) { | 820 | if (!skb) { |
822 | printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n", | 821 | printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n", |
823 | dev->name); | 822 | dev->name); |
824 | err = -ENOMEM; | 823 | goto update_stats; |
825 | goto drop; | ||
826 | } | 824 | } |
827 | 825 | ||
828 | /* Copy the 802.11 header to the skb */ | 826 | /* Copy the 802.11 header to the skb */ |
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index ff192e96268a..dade4b903579 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -4306,7 +4306,7 @@ out: | |||
4306 | * Insertion of the module | 4306 | * Insertion of the module |
4307 | * I'm now quite proud of the multi-device support. | 4307 | * I'm now quite proud of the multi-device support. |
4308 | */ | 4308 | */ |
4309 | int init_module(void) | 4309 | int __init init_module(void) |
4310 | { | 4310 | { |
4311 | int ret = -EIO; /* Return error if no cards found */ | 4311 | int ret = -EIO; /* Return error if no cards found */ |
4312 | int i; | 4312 | int i; |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 6917c6cb0912..c2ecae5ff0c1 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -33,13 +33,10 @@ acpi_query_osc ( | |||
33 | acpi_status status; | 33 | acpi_status status; |
34 | struct acpi_object_list input; | 34 | struct acpi_object_list input; |
35 | union acpi_object in_params[4]; | 35 | union acpi_object in_params[4]; |
36 | struct acpi_buffer output; | 36 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; |
37 | union acpi_object out_obj; | 37 | union acpi_object *out_obj; |
38 | u32 osc_dw0; | 38 | u32 osc_dw0; |
39 | 39 | ||
40 | /* Setting up output buffer */ | ||
41 | output.length = sizeof(out_obj) + 3*sizeof(u32); | ||
42 | output.pointer = &out_obj; | ||
43 | 40 | ||
44 | /* Setting up input parameters */ | 41 | /* Setting up input parameters */ |
45 | input.count = 4; | 42 | input.count = 4; |
@@ -61,12 +58,15 @@ acpi_query_osc ( | |||
61 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); | 58 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); |
62 | return status; | 59 | return status; |
63 | } | 60 | } |
64 | if (out_obj.type != ACPI_TYPE_BUFFER) { | 61 | out_obj = output.pointer; |
62 | |||
63 | if (out_obj->type != ACPI_TYPE_BUFFER) { | ||
65 | printk(KERN_DEBUG | 64 | printk(KERN_DEBUG |
66 | "Evaluate _OSC returns wrong type\n"); | 65 | "Evaluate _OSC returns wrong type\n"); |
67 | return AE_TYPE; | 66 | status = AE_TYPE; |
67 | goto query_osc_out; | ||
68 | } | 68 | } |
69 | osc_dw0 = *((u32 *) out_obj.buffer.pointer); | 69 | osc_dw0 = *((u32 *) out_obj->buffer.pointer); |
70 | if (osc_dw0) { | 70 | if (osc_dw0) { |
71 | if (osc_dw0 & OSC_REQUEST_ERROR) | 71 | if (osc_dw0 & OSC_REQUEST_ERROR) |
72 | printk(KERN_DEBUG "_OSC request fails\n"); | 72 | printk(KERN_DEBUG "_OSC request fails\n"); |
@@ -76,15 +76,21 @@ acpi_query_osc ( | |||
76 | printk(KERN_DEBUG "_OSC invalid revision\n"); | 76 | printk(KERN_DEBUG "_OSC invalid revision\n"); |
77 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { | 77 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { |
78 | /* Update Global Control Set */ | 78 | /* Update Global Control Set */ |
79 | global_ctrlsets = *((u32 *)(out_obj.buffer.pointer+8)); | 79 | global_ctrlsets = *((u32 *)(out_obj->buffer.pointer+8)); |
80 | return AE_OK; | 80 | status = AE_OK; |
81 | goto query_osc_out; | ||
81 | } | 82 | } |
82 | return AE_ERROR; | 83 | status = AE_ERROR; |
84 | goto query_osc_out; | ||
83 | } | 85 | } |
84 | 86 | ||
85 | /* Update Global Control Set */ | 87 | /* Update Global Control Set */ |
86 | global_ctrlsets = *((u32 *)(out_obj.buffer.pointer + 8)); | 88 | global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8)); |
87 | return AE_OK; | 89 | status = AE_OK; |
90 | |||
91 | query_osc_out: | ||
92 | kfree(output.pointer); | ||
93 | return status; | ||
88 | } | 94 | } |
89 | 95 | ||
90 | 96 | ||
@@ -96,14 +102,10 @@ acpi_run_osc ( | |||
96 | acpi_status status; | 102 | acpi_status status; |
97 | struct acpi_object_list input; | 103 | struct acpi_object_list input; |
98 | union acpi_object in_params[4]; | 104 | union acpi_object in_params[4]; |
99 | struct acpi_buffer output; | 105 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; |
100 | union acpi_object out_obj; | 106 | union acpi_object *out_obj; |
101 | u32 osc_dw0; | 107 | u32 osc_dw0; |
102 | 108 | ||
103 | /* Setting up output buffer */ | ||
104 | output.length = sizeof(out_obj) + 3*sizeof(u32); | ||
105 | output.pointer = &out_obj; | ||
106 | |||
107 | /* Setting up input parameters */ | 109 | /* Setting up input parameters */ |
108 | input.count = 4; | 110 | input.count = 4; |
109 | input.pointer = in_params; | 111 | input.pointer = in_params; |
@@ -124,12 +126,14 @@ acpi_run_osc ( | |||
124 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); | 126 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); |
125 | return status; | 127 | return status; |
126 | } | 128 | } |
127 | if (out_obj.type != ACPI_TYPE_BUFFER) { | 129 | out_obj = output.pointer; |
130 | if (out_obj->type != ACPI_TYPE_BUFFER) { | ||
128 | printk(KERN_DEBUG | 131 | printk(KERN_DEBUG |
129 | "Evaluate _OSC returns wrong type\n"); | 132 | "Evaluate _OSC returns wrong type\n"); |
130 | return AE_TYPE; | 133 | status = AE_TYPE; |
134 | goto run_osc_out; | ||
131 | } | 135 | } |
132 | osc_dw0 = *((u32 *) out_obj.buffer.pointer); | 136 | osc_dw0 = *((u32 *) out_obj->buffer.pointer); |
133 | if (osc_dw0) { | 137 | if (osc_dw0) { |
134 | if (osc_dw0 & OSC_REQUEST_ERROR) | 138 | if (osc_dw0 & OSC_REQUEST_ERROR) |
135 | printk(KERN_DEBUG "_OSC request fails\n"); | 139 | printk(KERN_DEBUG "_OSC request fails\n"); |
@@ -139,11 +143,17 @@ acpi_run_osc ( | |||
139 | printk(KERN_DEBUG "_OSC invalid revision\n"); | 143 | printk(KERN_DEBUG "_OSC invalid revision\n"); |
140 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { | 144 | if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { |
141 | printk(KERN_DEBUG "_OSC FW not grant req. control\n"); | 145 | printk(KERN_DEBUG "_OSC FW not grant req. control\n"); |
142 | return AE_SUPPORT; | 146 | status = AE_SUPPORT; |
147 | goto run_osc_out; | ||
143 | } | 148 | } |
144 | return AE_ERROR; | 149 | status = AE_ERROR; |
150 | goto run_osc_out; | ||
145 | } | 151 | } |
146 | return AE_OK; | 152 | status = AE_OK; |
153 | |||
154 | run_osc_out: | ||
155 | kfree(output.pointer); | ||
156 | return status; | ||
147 | } | 157 | } |
148 | 158 | ||
149 | /** | 159 | /** |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 1456759936c5..10e1a905c144 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state) | |||
285 | * Default resume method for devices that have no driver provided resume, | 285 | * Default resume method for devices that have no driver provided resume, |
286 | * or not even a driver at all. | 286 | * or not even a driver at all. |
287 | */ | 287 | */ |
288 | static void pci_default_resume(struct pci_dev *pci_dev) | 288 | static int pci_default_resume(struct pci_dev *pci_dev) |
289 | { | 289 | { |
290 | int retval; | 290 | int retval = 0; |
291 | 291 | ||
292 | /* restore the PCI config space */ | 292 | /* restore the PCI config space */ |
293 | pci_restore_state(pci_dev); | 293 | pci_restore_state(pci_dev); |
@@ -297,18 +297,21 @@ static void pci_default_resume(struct pci_dev *pci_dev) | |||
297 | /* if the device was busmaster before the suspend, make it busmaster again */ | 297 | /* if the device was busmaster before the suspend, make it busmaster again */ |
298 | if (pci_dev->is_busmaster) | 298 | if (pci_dev->is_busmaster) |
299 | pci_set_master(pci_dev); | 299 | pci_set_master(pci_dev); |
300 | |||
301 | return retval; | ||
300 | } | 302 | } |
301 | 303 | ||
302 | static int pci_device_resume(struct device * dev) | 304 | static int pci_device_resume(struct device * dev) |
303 | { | 305 | { |
306 | int error; | ||
304 | struct pci_dev * pci_dev = to_pci_dev(dev); | 307 | struct pci_dev * pci_dev = to_pci_dev(dev); |
305 | struct pci_driver * drv = pci_dev->driver; | 308 | struct pci_driver * drv = pci_dev->driver; |
306 | 309 | ||
307 | if (drv && drv->resume) | 310 | if (drv && drv->resume) |
308 | drv->resume(pci_dev); | 311 | error = drv->resume(pci_dev); |
309 | else | 312 | else |
310 | pci_default_resume(pci_dev); | 313 | error = pci_default_resume(pci_dev); |
311 | return 0; | 314 | return error; |
312 | } | 315 | } |
313 | 316 | ||
314 | static void pci_device_shutdown(struct device *dev) | 317 | static void pci_device_shutdown(struct device *dev) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 2329f941a0dc..12286275b1c8 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -461,9 +461,23 @@ int | |||
461 | pci_restore_state(struct pci_dev *dev) | 461 | pci_restore_state(struct pci_dev *dev) |
462 | { | 462 | { |
463 | int i; | 463 | int i; |
464 | int val; | ||
464 | 465 | ||
465 | for (i = 0; i < 16; i++) | 466 | /* |
466 | pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); | 467 | * The Base Address register should be programmed before the command |
468 | * register(s) | ||
469 | */ | ||
470 | for (i = 15; i >= 0; i--) { | ||
471 | pci_read_config_dword(dev, i * 4, &val); | ||
472 | if (val != dev->saved_config_space[i]) { | ||
473 | printk(KERN_DEBUG "PM: Writing back config space on " | ||
474 | "device %s at offset %x (was %x, writing %x)\n", | ||
475 | pci_name(dev), i, | ||
476 | val, (int)dev->saved_config_space[i]); | ||
477 | pci_write_config_dword(dev,i * 4, | ||
478 | dev->saved_config_space[i]); | ||
479 | } | ||
480 | } | ||
467 | pci_restore_msi_state(dev); | 481 | pci_restore_msi_state(dev); |
468 | pci_restore_msix_state(dev); | 482 | pci_restore_msix_state(dev); |
469 | return 0; | 483 | return 0; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 19e2b174d33c..d378478612fb 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -634,6 +634,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vi | |||
634 | * non-x86 architectures (yes Via exists on PPC among other places), | 634 | * non-x86 architectures (yes Via exists on PPC among other places), |
635 | * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get | 635 | * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get |
636 | * interrupts delivered properly. | 636 | * interrupts delivered properly. |
637 | * | ||
638 | * Some of the on-chip devices are actually '586 devices' so they are | ||
639 | * listed here. | ||
637 | */ | 640 | */ |
638 | static void quirk_via_irq(struct pci_dev *dev) | 641 | static void quirk_via_irq(struct pci_dev *dev) |
639 | { | 642 | { |
@@ -648,6 +651,10 @@ static void quirk_via_irq(struct pci_dev *dev) | |||
648 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); | 651 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); |
649 | } | 652 | } |
650 | } | 653 | } |
654 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq); | ||
655 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq); | ||
656 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq); | ||
657 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq); | ||
651 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq); | 658 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq); |
652 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq); | 659 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq); |
653 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq); | 660 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq); |
@@ -895,6 +902,7 @@ static void __init k8t_sound_hostbridge(struct pci_dev *dev) | |||
895 | } | 902 | } |
896 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); | 903 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); |
897 | 904 | ||
905 | #ifndef CONFIG_ACPI_SLEEP | ||
898 | /* | 906 | /* |
899 | * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge | 907 | * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge |
900 | * is not activated. The myth is that Asus said that they do not want the | 908 | * is not activated. The myth is that Asus said that they do not want the |
@@ -906,8 +914,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho | |||
906 | * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it | 914 | * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it |
907 | * becomes necessary to do this tweak in two steps -- I've chosen the Host | 915 | * becomes necessary to do this tweak in two steps -- I've chosen the Host |
908 | * bridge as trigger. | 916 | * bridge as trigger. |
917 | * | ||
918 | * Actually, leaving it unhidden and not redoing the quirk over suspend2ram | ||
919 | * will cause thermal management to break down, and causing machine to | ||
920 | * overheat. | ||
909 | */ | 921 | */ |
910 | static int __initdata asus_hides_smbus = 0; | 922 | static int __initdata asus_hides_smbus; |
911 | 923 | ||
912 | static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | 924 | static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) |
913 | { | 925 | { |
@@ -1050,6 +1062,8 @@ static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev) | |||
1050 | } | 1062 | } |
1051 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); | 1063 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); |
1052 | 1064 | ||
1065 | #endif | ||
1066 | |||
1053 | /* | 1067 | /* |
1054 | * SiS 96x south bridge: BIOS typically hides SMBus device... | 1068 | * SiS 96x south bridge: BIOS typically hides SMBus device... |
1055 | */ | 1069 | */ |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 48d3b3d30c21..74b3124e8247 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -1143,6 +1143,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1143 | { | 1143 | { |
1144 | struct pcmcia_socket *s = pcmcia_get_socket(skt); | 1144 | struct pcmcia_socket *s = pcmcia_get_socket(skt); |
1145 | 1145 | ||
1146 | if (!s) { | ||
1147 | printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ | ||
1148 | "failed, event 0x%x lost!\n", skt, event); | ||
1149 | return -ENODEV; | ||
1150 | } | ||
1151 | |||
1146 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", | 1152 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", |
1147 | event, priority, skt); | 1153 | event, priority, skt); |
1148 | 1154 | ||
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index c53db7ceda5e..738b1ef595a3 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -426,7 +426,7 @@ static int ds_open(struct inode *inode, struct file *file) | |||
426 | 426 | ||
427 | if (!warning_printed) { | 427 | if (!warning_printed) { |
428 | printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " | 428 | printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " |
429 | "usage.\n"); | 429 | "usage from process: %s.\n", current->comm); |
430 | printk(KERN_INFO "pcmcia: This interface will soon be removed from " | 430 | printk(KERN_INFO "pcmcia: This interface will soon be removed from " |
431 | "the kernel; please expect breakage unless you upgrade " | 431 | "the kernel; please expect breakage unless you upgrade " |
432 | "to new tools.\n"); | 432 | "to new tools.\n"); |
@@ -601,8 +601,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
601 | ret = CS_BAD_ARGS; | 601 | ret = CS_BAD_ARGS; |
602 | else { | 602 | else { |
603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); | 603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); |
604 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | 604 | if (p_dev == NULL) |
605 | pcmcia_put_dev(p_dev); | 605 | ret = CS_BAD_ARGS; |
606 | else { | ||
607 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | ||
608 | pcmcia_put_dev(p_dev); | ||
609 | } | ||
606 | } | 610 | } |
607 | break; | 611 | break; |
608 | case DS_GET_FIRST_TUPLE: | 612 | case DS_GET_FIRST_TUPLE: |
@@ -632,8 +636,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
632 | ret = CS_BAD_ARGS; | 636 | ret = CS_BAD_ARGS; |
633 | else { | 637 | else { |
634 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); | 638 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); |
635 | ret = pccard_get_status(s, p_dev, &buf->status); | 639 | if (p_dev == NULL) |
636 | pcmcia_put_dev(p_dev); | 640 | ret = CS_BAD_ARGS; |
641 | else { | ||
642 | ret = pccard_get_status(s, p_dev, &buf->status); | ||
643 | pcmcia_put_dev(p_dev); | ||
644 | } | ||
637 | } | 645 | } |
638 | break; | 646 | break; |
639 | case DS_VALIDATE_CIS: | 647 | case DS_VALIDATE_CIS: |
@@ -665,9 +673,10 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
665 | if (!(buf->conf_reg.Function && | 673 | if (!(buf->conf_reg.Function && |
666 | (buf->conf_reg.Function >= s->functions))) { | 674 | (buf->conf_reg.Function >= s->functions))) { |
667 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); | 675 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); |
668 | if (p_dev) | 676 | if (p_dev) { |
669 | ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); | 677 | ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); |
670 | pcmcia_put_dev(p_dev); | 678 | pcmcia_put_dev(p_dev); |
679 | } | ||
671 | } | 680 | } |
672 | break; | 681 | break; |
673 | case DS_GET_FIRST_REGION: | 682 | case DS_GET_FIRST_REGION: |
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 16d1ea7b0a18..247ab837f841 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -589,7 +589,7 @@ static int pd6729_check_irq(int irq, int flags) | |||
589 | return 0; | 589 | return 0; |
590 | } | 590 | } |
591 | 591 | ||
592 | static u_int __init pd6729_isa_scan(void) | 592 | static u_int __devinit pd6729_isa_scan(void) |
593 | { | 593 | { |
594 | u_int mask0, mask = 0; | 594 | u_int mask0, mask = 0; |
595 | int i; | 595 | int i; |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 407b4eaddcbf..3a4a644c2686 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -36,13 +36,13 @@ static int irq_flags(int triggering, int polarity) | |||
36 | { | 36 | { |
37 | int flag; | 37 | int flag; |
38 | if (triggering == ACPI_LEVEL_SENSITIVE) { | 38 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
39 | if(polarity == ACPI_ACTIVE_LOW) | 39 | if (polarity == ACPI_ACTIVE_LOW) |
40 | flag = IORESOURCE_IRQ_LOWLEVEL; | 40 | flag = IORESOURCE_IRQ_LOWLEVEL; |
41 | else | 41 | else |
42 | flag = IORESOURCE_IRQ_HIGHLEVEL; | 42 | flag = IORESOURCE_IRQ_HIGHLEVEL; |
43 | } | 43 | } |
44 | else { | 44 | else { |
45 | if(polarity == ACPI_ACTIVE_LOW) | 45 | if (polarity == ACPI_ACTIVE_LOW) |
46 | flag = IORESOURCE_IRQ_LOWEDGE; | 46 | flag = IORESOURCE_IRQ_LOWEDGE; |
47 | else | 47 | else |
48 | flag = IORESOURCE_IRQ_HIGHEDGE; | 48 | flag = IORESOURCE_IRQ_HIGHEDGE; |
@@ -57,7 +57,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
57 | *triggering = ACPI_LEVEL_SENSITIVE; | 57 | *triggering = ACPI_LEVEL_SENSITIVE; |
58 | *polarity = ACPI_ACTIVE_LOW; | 58 | *polarity = ACPI_ACTIVE_LOW; |
59 | break; | 59 | break; |
60 | case IORESOURCE_IRQ_HIGHLEVEL: | 60 | case IORESOURCE_IRQ_HIGHLEVEL: |
61 | *triggering = ACPI_LEVEL_SENSITIVE; | 61 | *triggering = ACPI_LEVEL_SENSITIVE; |
62 | *polarity = ACPI_ACTIVE_HIGH; | 62 | *polarity = ACPI_ACTIVE_HIGH; |
63 | break; | 63 | break; |
@@ -73,7 +73,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | static void | 75 | static void |
76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | 76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, |
77 | int triggering, int polarity) | 77 | int triggering, int polarity) |
78 | { | 78 | { |
79 | int i = 0; | 79 | int i = 0; |
@@ -101,7 +101,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | |||
101 | } | 101 | } |
102 | 102 | ||
103 | static void | 103 | static void |
104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | 104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) |
105 | { | 105 | { |
106 | int i = 0; | 106 | int i = 0; |
107 | while (i < PNP_MAX_DMA && | 107 | while (i < PNP_MAX_DMA && |
@@ -119,8 +119,8 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | static void | 121 | static void |
122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | 122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, |
123 | u32 io, u32 len) | 123 | u64 io, u64 len) |
124 | { | 124 | { |
125 | int i = 0; | 125 | int i = 0; |
126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && |
@@ -138,7 +138,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | |||
138 | } | 138 | } |
139 | 139 | ||
140 | static void | 140 | static void |
141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | 141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, |
142 | u64 mem, u64 len) | 142 | u64 mem, u64 len) |
143 | { | 143 | { |
144 | int i = 0; | 144 | int i = 0; |
@@ -156,11 +156,32 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | static void | ||
160 | pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | ||
161 | struct acpi_resource *res) | ||
162 | { | ||
163 | struct acpi_resource_address64 addr, *p = &addr; | ||
164 | acpi_status status; | ||
165 | |||
166 | status = acpi_resource_to_address64(res, p); | ||
167 | if (!ACPI_SUCCESS(status)) { | ||
168 | pnp_warn("PnPACPI: failed to convert resource type %d", | ||
169 | res->type); | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | if (p->resource_type == ACPI_MEMORY_RANGE) | ||
174 | pnpacpi_parse_allocated_memresource(res_table, | ||
175 | p->minimum, p->address_length); | ||
176 | else if (p->resource_type == ACPI_IO_RANGE) | ||
177 | pnpacpi_parse_allocated_ioresource(res_table, | ||
178 | p->minimum, p->address_length); | ||
179 | } | ||
159 | 180 | ||
160 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 181 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
161 | void *data) | 182 | void *data) |
162 | { | 183 | { |
163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; | 184 | struct pnp_resource_table *res_table = (struct pnp_resource_table *)data; |
164 | int i; | 185 | int i; |
165 | 186 | ||
166 | switch (res->type) { | 187 | switch (res->type) { |
@@ -221,19 +242,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
221 | res->data.fixed_memory32.address_length); | 242 | res->data.fixed_memory32.address_length); |
222 | break; | 243 | break; |
223 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 244 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
224 | pnpacpi_parse_allocated_memresource(res_table, | ||
225 | res->data.address16.minimum, | ||
226 | res->data.address16.address_length); | ||
227 | break; | ||
228 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 245 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
229 | pnpacpi_parse_allocated_memresource(res_table, | ||
230 | res->data.address32.minimum, | ||
231 | res->data.address32.address_length); | ||
232 | break; | ||
233 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 246 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
234 | pnpacpi_parse_allocated_memresource(res_table, | 247 | pnpacpi_parse_allocated_address_space(res_table, res); |
235 | res->data.address64.minimum, | ||
236 | res->data.address64.address_length); | ||
237 | break; | 248 | break; |
238 | 249 | ||
239 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 250 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |
@@ -255,11 +266,11 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
255 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 266 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
256 | return AE_ERROR; | 267 | return AE_ERROR; |
257 | } | 268 | } |
258 | 269 | ||
259 | return AE_OK; | 270 | return AE_OK; |
260 | } | 271 | } |
261 | 272 | ||
262 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table * res) | 273 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res) |
263 | { | 274 | { |
264 | /* Blank the resource table values */ | 275 | /* Blank the resource table values */ |
265 | pnp_init_resource_table(res); | 276 | pnp_init_resource_table(res); |
@@ -317,17 +328,17 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
317 | pnp_err("Invalid DMA transfer type"); | 328 | pnp_err("Invalid DMA transfer type"); |
318 | } | 329 | } |
319 | 330 | ||
320 | pnp_register_dma_resource(option,dma); | 331 | pnp_register_dma_resource(option, dma); |
321 | return; | 332 | return; |
322 | } | 333 | } |
323 | 334 | ||
324 | 335 | ||
325 | static void pnpacpi_parse_irq_option(struct pnp_option *option, | 336 | static void pnpacpi_parse_irq_option(struct pnp_option *option, |
326 | struct acpi_resource_irq *p) | 337 | struct acpi_resource_irq *p) |
327 | { | 338 | { |
328 | int i; | 339 | int i; |
329 | struct pnp_irq * irq; | 340 | struct pnp_irq *irq; |
330 | 341 | ||
331 | if (p->interrupt_count == 0) | 342 | if (p->interrupt_count == 0) |
332 | return; | 343 | return; |
333 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 344 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
@@ -347,7 +358,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | |||
347 | struct acpi_resource_extended_irq *p) | 358 | struct acpi_resource_extended_irq *p) |
348 | { | 359 | { |
349 | int i; | 360 | int i; |
350 | struct pnp_irq * irq; | 361 | struct pnp_irq *irq; |
351 | 362 | ||
352 | if (p->interrupt_count == 0) | 363 | if (p->interrupt_count == 0) |
353 | return; | 364 | return; |
@@ -368,7 +379,7 @@ static void | |||
368 | pnpacpi_parse_port_option(struct pnp_option *option, | 379 | pnpacpi_parse_port_option(struct pnp_option *option, |
369 | struct acpi_resource_io *io) | 380 | struct acpi_resource_io *io) |
370 | { | 381 | { |
371 | struct pnp_port * port; | 382 | struct pnp_port *port; |
372 | 383 | ||
373 | if (io->address_length == 0) | 384 | if (io->address_length == 0) |
374 | return; | 385 | return; |
@@ -381,7 +392,7 @@ pnpacpi_parse_port_option(struct pnp_option *option, | |||
381 | port->size = io->address_length; | 392 | port->size = io->address_length; |
382 | port->flags = ACPI_DECODE_16 == io->io_decode ? | 393 | port->flags = ACPI_DECODE_16 == io->io_decode ? |
383 | PNP_PORT_FLAG_16BITADDR : 0; | 394 | PNP_PORT_FLAG_16BITADDR : 0; |
384 | pnp_register_port_resource(option,port); | 395 | pnp_register_port_resource(option, port); |
385 | return; | 396 | return; |
386 | } | 397 | } |
387 | 398 | ||
@@ -389,7 +400,7 @@ static void | |||
389 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, | 400 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, |
390 | struct acpi_resource_fixed_io *io) | 401 | struct acpi_resource_fixed_io *io) |
391 | { | 402 | { |
392 | struct pnp_port * port; | 403 | struct pnp_port *port; |
393 | 404 | ||
394 | if (io->address_length == 0) | 405 | if (io->address_length == 0) |
395 | return; | 406 | return; |
@@ -400,7 +411,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
400 | port->size = io->address_length; | 411 | port->size = io->address_length; |
401 | port->align = 0; | 412 | port->align = 0; |
402 | port->flags = PNP_PORT_FLAG_FIXED; | 413 | port->flags = PNP_PORT_FLAG_FIXED; |
403 | pnp_register_port_resource(option,port); | 414 | pnp_register_port_resource(option, port); |
404 | return; | 415 | return; |
405 | } | 416 | } |
406 | 417 | ||
@@ -408,7 +419,7 @@ static void | |||
408 | pnpacpi_parse_mem24_option(struct pnp_option *option, | 419 | pnpacpi_parse_mem24_option(struct pnp_option *option, |
409 | struct acpi_resource_memory24 *p) | 420 | struct acpi_resource_memory24 *p) |
410 | { | 421 | { |
411 | struct pnp_mem * mem; | 422 | struct pnp_mem *mem; |
412 | 423 | ||
413 | if (p->address_length == 0) | 424 | if (p->address_length == 0) |
414 | return; | 425 | return; |
@@ -423,7 +434,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, | |||
423 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 434 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
424 | IORESOURCE_MEM_WRITEABLE : 0; | 435 | IORESOURCE_MEM_WRITEABLE : 0; |
425 | 436 | ||
426 | pnp_register_mem_resource(option,mem); | 437 | pnp_register_mem_resource(option, mem); |
427 | return; | 438 | return; |
428 | } | 439 | } |
429 | 440 | ||
@@ -431,7 +442,7 @@ static void | |||
431 | pnpacpi_parse_mem32_option(struct pnp_option *option, | 442 | pnpacpi_parse_mem32_option(struct pnp_option *option, |
432 | struct acpi_resource_memory32 *p) | 443 | struct acpi_resource_memory32 *p) |
433 | { | 444 | { |
434 | struct pnp_mem * mem; | 445 | struct pnp_mem *mem; |
435 | 446 | ||
436 | if (p->address_length == 0) | 447 | if (p->address_length == 0) |
437 | return; | 448 | return; |
@@ -446,7 +457,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, | |||
446 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 457 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
447 | IORESOURCE_MEM_WRITEABLE : 0; | 458 | IORESOURCE_MEM_WRITEABLE : 0; |
448 | 459 | ||
449 | pnp_register_mem_resource(option,mem); | 460 | pnp_register_mem_resource(option, mem); |
450 | return; | 461 | return; |
451 | } | 462 | } |
452 | 463 | ||
@@ -454,7 +465,7 @@ static void | |||
454 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | 465 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, |
455 | struct acpi_resource_fixed_memory32 *p) | 466 | struct acpi_resource_fixed_memory32 *p) |
456 | { | 467 | { |
457 | struct pnp_mem * mem; | 468 | struct pnp_mem *mem; |
458 | 469 | ||
459 | if (p->address_length == 0) | 470 | if (p->address_length == 0) |
460 | return; | 471 | return; |
@@ -468,7 +479,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | |||
468 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 479 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
469 | IORESOURCE_MEM_WRITEABLE : 0; | 480 | IORESOURCE_MEM_WRITEABLE : 0; |
470 | 481 | ||
471 | pnp_register_mem_resource(option,mem); | 482 | pnp_register_mem_resource(option, mem); |
472 | return; | 483 | return; |
473 | } | 484 | } |
474 | 485 | ||
@@ -477,8 +488,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
477 | { | 488 | { |
478 | struct acpi_resource_address64 addr, *p = &addr; | 489 | struct acpi_resource_address64 addr, *p = &addr; |
479 | acpi_status status; | 490 | acpi_status status; |
480 | struct pnp_mem * mem; | 491 | struct pnp_mem *mem; |
481 | struct pnp_port * port; | 492 | struct pnp_port *port; |
482 | 493 | ||
483 | status = acpi_resource_to_address64(r, p); | 494 | status = acpi_resource_to_address64(r, p); |
484 | if (!ACPI_SUCCESS(status)) { | 495 | if (!ACPI_SUCCESS(status)) { |
@@ -498,7 +509,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
498 | mem->align = 0; | 509 | mem->align = 0; |
499 | mem->flags = (p->info.mem.write_protect == | 510 | mem->flags = (p->info.mem.write_protect == |
500 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | 511 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; |
501 | pnp_register_mem_resource(option,mem); | 512 | pnp_register_mem_resource(option, mem); |
502 | } else if (p->resource_type == ACPI_IO_RANGE) { | 513 | } else if (p->resource_type == ACPI_IO_RANGE) { |
503 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 514 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
504 | if (!port) | 515 | if (!port) |
@@ -507,7 +518,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
507 | port->size = p->address_length; | 518 | port->size = p->address_length; |
508 | port->align = 0; | 519 | port->align = 0; |
509 | port->flags = PNP_PORT_FLAG_FIXED; | 520 | port->flags = PNP_PORT_FLAG_FIXED; |
510 | pnp_register_port_resource(option,port); | 521 | pnp_register_port_resource(option, port); |
511 | } | 522 | } |
512 | } | 523 | } |
513 | 524 | ||
@@ -531,7 +542,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
531 | break; | 542 | break; |
532 | 543 | ||
533 | case ACPI_RESOURCE_TYPE_DMA: | 544 | case ACPI_RESOURCE_TYPE_DMA: |
534 | pnpacpi_parse_dma_option(option, &res->data.dma); | 545 | pnpacpi_parse_dma_option(option, &res->data.dma); |
535 | break; | 546 | break; |
536 | 547 | ||
537 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 548 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -539,7 +550,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
539 | case ACPI_GOOD_CONFIGURATION: | 550 | case ACPI_GOOD_CONFIGURATION: |
540 | priority = PNP_RES_PRIORITY_PREFERRED; | 551 | priority = PNP_RES_PRIORITY_PREFERRED; |
541 | break; | 552 | break; |
542 | 553 | ||
543 | case ACPI_ACCEPTABLE_CONFIGURATION: | 554 | case ACPI_ACCEPTABLE_CONFIGURATION: |
544 | priority = PNP_RES_PRIORITY_ACCEPTABLE; | 555 | priority = PNP_RES_PRIORITY_ACCEPTABLE; |
545 | break; | 556 | break; |
@@ -555,7 +566,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
555 | option = pnp_register_dependent_option(dev, priority); | 566 | option = pnp_register_dependent_option(dev, priority); |
556 | if (!option) | 567 | if (!option) |
557 | return AE_ERROR; | 568 | return AE_ERROR; |
558 | parse_data->option = option; | 569 | parse_data->option = option; |
559 | break; | 570 | break; |
560 | 571 | ||
561 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | 572 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: |
@@ -615,7 +626,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
615 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 626 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
616 | return AE_ERROR; | 627 | return AE_ERROR; |
617 | } | 628 | } |
618 | 629 | ||
619 | return AE_OK; | 630 | return AE_OK; |
620 | } | 631 | } |
621 | 632 | ||
@@ -636,13 +647,8 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
636 | return status; | 647 | return status; |
637 | } | 648 | } |
638 | 649 | ||
639 | /* | 650 | static int pnpacpi_supported_resource(struct acpi_resource *res) |
640 | * Set resource | ||
641 | */ | ||
642 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
643 | void *data) | ||
644 | { | 651 | { |
645 | int *res_cnt = (int *)data; | ||
646 | switch (res->type) { | 652 | switch (res->type) { |
647 | case ACPI_RESOURCE_TYPE_IRQ: | 653 | case ACPI_RESOURCE_TYPE_IRQ: |
648 | case ACPI_RESOURCE_TYPE_DMA: | 654 | case ACPI_RESOURCE_TYPE_DMA: |
@@ -655,43 +661,32 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
655 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 661 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
656 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 662 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
657 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 663 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
658 | (*res_cnt) ++; | 664 | return 1; |
659 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
660 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
661 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
662 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
663 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
664 | default: | ||
665 | return AE_OK; | ||
666 | } | 665 | } |
667 | return AE_OK; | 666 | return 0; |
668 | } | 667 | } |
669 | 668 | ||
670 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | 669 | /* |
670 | * Set resource | ||
671 | */ | ||
672 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
671 | void *data) | 673 | void *data) |
672 | { | 674 | { |
673 | struct acpi_resource **resource = (struct acpi_resource **)data; | 675 | int *res_cnt = (int *)data; |
674 | switch (res->type) { | 676 | |
675 | case ACPI_RESOURCE_TYPE_IRQ: | 677 | if (pnpacpi_supported_resource(res)) |
676 | case ACPI_RESOURCE_TYPE_DMA: | 678 | (*res_cnt)++; |
677 | case ACPI_RESOURCE_TYPE_IO: | 679 | return AE_OK; |
678 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 680 | } |
679 | case ACPI_RESOURCE_TYPE_MEMORY24: | 681 | |
680 | case ACPI_RESOURCE_TYPE_MEMORY32: | 682 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) |
681 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 683 | { |
682 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 684 | struct acpi_resource **resource = (struct acpi_resource **)data; |
683 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 685 | |
684 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 686 | if (pnpacpi_supported_resource(res)) { |
685 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
686 | (*resource)->type = res->type; | 687 | (*resource)->type = res->type; |
688 | (*resource)->length = sizeof(struct acpi_resource); | ||
687 | (*resource)++; | 689 | (*resource)++; |
688 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
689 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
690 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
691 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
692 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
693 | default: | ||
694 | return AE_OK; | ||
695 | } | 690 | } |
696 | 691 | ||
697 | return AE_OK; | 692 | return AE_OK; |
@@ -735,11 +730,8 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, | |||
735 | struct resource *p) | 730 | struct resource *p) |
736 | { | 731 | { |
737 | int triggering, polarity; | 732 | int triggering, polarity; |
738 | 733 | ||
739 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 734 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
740 | &polarity); | ||
741 | resource->type = ACPI_RESOURCE_TYPE_IRQ; | ||
742 | resource->length = sizeof(struct acpi_resource); | ||
743 | resource->data.irq.triggering = triggering; | 735 | resource->data.irq.triggering = triggering; |
744 | resource->data.irq.polarity = polarity; | 736 | resource->data.irq.polarity = polarity; |
745 | if (triggering == ACPI_EDGE_SENSITIVE) | 737 | if (triggering == ACPI_EDGE_SENSITIVE) |
@@ -754,11 +746,8 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
754 | struct resource *p) | 746 | struct resource *p) |
755 | { | 747 | { |
756 | int triggering, polarity; | 748 | int triggering, polarity; |
757 | 749 | ||
758 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 750 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
759 | &polarity); | ||
760 | resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; | ||
761 | resource->length = sizeof(struct acpi_resource); | ||
762 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; | 751 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; |
763 | resource->data.extended_irq.triggering = triggering; | 752 | resource->data.extended_irq.triggering = triggering; |
764 | resource->data.extended_irq.polarity = polarity; | 753 | resource->data.extended_irq.polarity = polarity; |
@@ -773,8 +762,6 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
773 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 762 | static void pnpacpi_encode_dma(struct acpi_resource *resource, |
774 | struct resource *p) | 763 | struct resource *p) |
775 | { | 764 | { |
776 | resource->type = ACPI_RESOURCE_TYPE_DMA; | ||
777 | resource->length = sizeof(struct acpi_resource); | ||
778 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ | 765 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ |
779 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) | 766 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) |
780 | resource->data.dma.type = ACPI_COMPATIBILITY; | 767 | resource->data.dma.type = ACPI_COMPATIBILITY; |
@@ -798,8 +785,6 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
798 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 785 | static void pnpacpi_encode_io(struct acpi_resource *resource, |
799 | struct resource *p) | 786 | struct resource *p) |
800 | { | 787 | { |
801 | resource->type = ACPI_RESOURCE_TYPE_IO; | ||
802 | resource->length = sizeof(struct acpi_resource); | ||
803 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ | 788 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ |
804 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? | 789 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? |
805 | ACPI_DECODE_16 : ACPI_DECODE_10; | 790 | ACPI_DECODE_16 : ACPI_DECODE_10; |
@@ -812,8 +797,6 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, | |||
812 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 797 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, |
813 | struct resource *p) | 798 | struct resource *p) |
814 | { | 799 | { |
815 | resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; | ||
816 | resource->length = sizeof(struct acpi_resource); | ||
817 | resource->data.fixed_io.address = p->start; | 800 | resource->data.fixed_io.address = p->start; |
818 | resource->data.fixed_io.address_length = p->end - p->start + 1; | 801 | resource->data.fixed_io.address_length = p->end - p->start + 1; |
819 | } | 802 | } |
@@ -821,8 +804,6 @@ static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | |||
821 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 804 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, |
822 | struct resource *p) | 805 | struct resource *p) |
823 | { | 806 | { |
824 | resource->type = ACPI_RESOURCE_TYPE_MEMORY24; | ||
825 | resource->length = sizeof(struct acpi_resource); | ||
826 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ | 807 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ |
827 | resource->data.memory24.write_protect = | 808 | resource->data.memory24.write_protect = |
828 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 809 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
@@ -836,8 +817,6 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, | |||
836 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 817 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, |
837 | struct resource *p) | 818 | struct resource *p) |
838 | { | 819 | { |
839 | resource->type = ACPI_RESOURCE_TYPE_MEMORY32; | ||
840 | resource->length = sizeof(struct acpi_resource); | ||
841 | resource->data.memory32.write_protect = | 820 | resource->data.memory32.write_protect = |
842 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 821 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
843 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 822 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
@@ -850,8 +829,6 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, | |||
850 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 829 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, |
851 | struct resource *p) | 830 | struct resource *p) |
852 | { | 831 | { |
853 | resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; | ||
854 | resource->length = sizeof(struct acpi_resource); | ||
855 | resource->data.fixed_memory32.write_protect = | 832 | resource->data.fixed_memory32.write_protect = |
856 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 833 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
857 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 834 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
@@ -882,37 +859,37 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
882 | pnp_dbg("Encode dma"); | 859 | pnp_dbg("Encode dma"); |
883 | pnpacpi_encode_dma(resource, | 860 | pnpacpi_encode_dma(resource, |
884 | &res_table->dma_resource[dma]); | 861 | &res_table->dma_resource[dma]); |
885 | dma ++; | 862 | dma++; |
886 | break; | 863 | break; |
887 | case ACPI_RESOURCE_TYPE_IO: | 864 | case ACPI_RESOURCE_TYPE_IO: |
888 | pnp_dbg("Encode io"); | 865 | pnp_dbg("Encode io"); |
889 | pnpacpi_encode_io(resource, | 866 | pnpacpi_encode_io(resource, |
890 | &res_table->port_resource[port]); | 867 | &res_table->port_resource[port]); |
891 | port ++; | 868 | port++; |
892 | break; | 869 | break; |
893 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 870 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
894 | pnp_dbg("Encode fixed io"); | 871 | pnp_dbg("Encode fixed io"); |
895 | pnpacpi_encode_fixed_io(resource, | 872 | pnpacpi_encode_fixed_io(resource, |
896 | &res_table->port_resource[port]); | 873 | &res_table->port_resource[port]); |
897 | port ++; | 874 | port++; |
898 | break; | 875 | break; |
899 | case ACPI_RESOURCE_TYPE_MEMORY24: | 876 | case ACPI_RESOURCE_TYPE_MEMORY24: |
900 | pnp_dbg("Encode mem24"); | 877 | pnp_dbg("Encode mem24"); |
901 | pnpacpi_encode_mem24(resource, | 878 | pnpacpi_encode_mem24(resource, |
902 | &res_table->mem_resource[mem]); | 879 | &res_table->mem_resource[mem]); |
903 | mem ++; | 880 | mem++; |
904 | break; | 881 | break; |
905 | case ACPI_RESOURCE_TYPE_MEMORY32: | 882 | case ACPI_RESOURCE_TYPE_MEMORY32: |
906 | pnp_dbg("Encode mem32"); | 883 | pnp_dbg("Encode mem32"); |
907 | pnpacpi_encode_mem32(resource, | 884 | pnpacpi_encode_mem32(resource, |
908 | &res_table->mem_resource[mem]); | 885 | &res_table->mem_resource[mem]); |
909 | mem ++; | 886 | mem++; |
910 | break; | 887 | break; |
911 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 888 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
912 | pnp_dbg("Encode fixed mem32"); | 889 | pnp_dbg("Encode fixed mem32"); |
913 | pnpacpi_encode_fixed_mem32(resource, | 890 | pnpacpi_encode_fixed_mem32(resource, |
914 | &res_table->mem_resource[mem]); | 891 | &res_table->mem_resource[mem]); |
915 | mem ++; | 892 | mem++; |
916 | break; | 893 | break; |
917 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 894 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
918 | pnp_dbg("Encode ext irq"); | 895 | pnp_dbg("Encode ext irq"); |
@@ -933,8 +910,8 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
933 | pnp_warn("unknown resource type %d", resource->type); | 910 | pnp_warn("unknown resource type %d", resource->type); |
934 | return -EINVAL; | 911 | return -EINVAL; |
935 | } | 912 | } |
936 | resource ++; | 913 | resource++; |
937 | i ++; | 914 | i++; |
938 | } | 915 | } |
939 | return 0; | 916 | return 0; |
940 | } | 917 | } |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 6c9ad92747fd..2011567005f9 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
141 | /* try the driver's ioctl interface */ | 141 | /* try the driver's ioctl interface */ |
142 | if (ops->ioctl) { | 142 | if (ops->ioctl) { |
143 | err = ops->ioctl(class_dev->dev, cmd, arg); | 143 | err = ops->ioctl(class_dev->dev, cmd, arg); |
144 | if (err != -EINVAL) | 144 | if (err != -ENOIOCTLCMD) |
145 | return err; | 145 | return err; |
146 | } | 146 | } |
147 | 147 | ||
148 | /* if the driver does not provide the ioctl interface | 148 | /* if the driver does not provide the ioctl interface |
149 | * or if that particular ioctl was not implemented | 149 | * or if that particular ioctl was not implemented |
150 | * (-EINVAL), we will try to emulate here. | 150 | * (-ENOIOCTLCMD), we will try to emulate here. |
151 | */ | 151 | */ |
152 | 152 | ||
153 | switch (cmd) { | 153 | switch (cmd) { |
@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
233 | break; | 233 | break; |
234 | 234 | ||
235 | default: | 235 | default: |
236 | err = -EINVAL; | 236 | err = -ENOTTY; |
237 | break; | 237 | break; |
238 | } | 238 | } |
239 | 239 | ||
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c index f6e7ee04f3dc..8c0d1a6739ad 100644 --- a/drivers/rtc/rtc-m48t86.c +++ b/drivers/rtc/rtc-m48t86.c | |||
@@ -48,33 +48,33 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
48 | struct platform_device *pdev = to_platform_device(dev); | 48 | struct platform_device *pdev = to_platform_device(dev); |
49 | struct m48t86_ops *ops = pdev->dev.platform_data; | 49 | struct m48t86_ops *ops = pdev->dev.platform_data; |
50 | 50 | ||
51 | reg = ops->readb(M48T86_REG_B); | 51 | reg = ops->readbyte(M48T86_REG_B); |
52 | 52 | ||
53 | if (reg & M48T86_REG_B_DM) { | 53 | if (reg & M48T86_REG_B_DM) { |
54 | /* data (binary) mode */ | 54 | /* data (binary) mode */ |
55 | tm->tm_sec = ops->readb(M48T86_REG_SEC); | 55 | tm->tm_sec = ops->readbyte(M48T86_REG_SEC); |
56 | tm->tm_min = ops->readb(M48T86_REG_MIN); | 56 | tm->tm_min = ops->readbyte(M48T86_REG_MIN); |
57 | tm->tm_hour = ops->readb(M48T86_REG_HOUR) & 0x3F; | 57 | tm->tm_hour = ops->readbyte(M48T86_REG_HOUR) & 0x3F; |
58 | tm->tm_mday = ops->readb(M48T86_REG_DOM); | 58 | tm->tm_mday = ops->readbyte(M48T86_REG_DOM); |
59 | /* tm_mon is 0-11 */ | 59 | /* tm_mon is 0-11 */ |
60 | tm->tm_mon = ops->readb(M48T86_REG_MONTH) - 1; | 60 | tm->tm_mon = ops->readbyte(M48T86_REG_MONTH) - 1; |
61 | tm->tm_year = ops->readb(M48T86_REG_YEAR) + 100; | 61 | tm->tm_year = ops->readbyte(M48T86_REG_YEAR) + 100; |
62 | tm->tm_wday = ops->readb(M48T86_REG_DOW); | 62 | tm->tm_wday = ops->readbyte(M48T86_REG_DOW); |
63 | } else { | 63 | } else { |
64 | /* bcd mode */ | 64 | /* bcd mode */ |
65 | tm->tm_sec = BCD2BIN(ops->readb(M48T86_REG_SEC)); | 65 | tm->tm_sec = BCD2BIN(ops->readbyte(M48T86_REG_SEC)); |
66 | tm->tm_min = BCD2BIN(ops->readb(M48T86_REG_MIN)); | 66 | tm->tm_min = BCD2BIN(ops->readbyte(M48T86_REG_MIN)); |
67 | tm->tm_hour = BCD2BIN(ops->readb(M48T86_REG_HOUR) & 0x3F); | 67 | tm->tm_hour = BCD2BIN(ops->readbyte(M48T86_REG_HOUR) & 0x3F); |
68 | tm->tm_mday = BCD2BIN(ops->readb(M48T86_REG_DOM)); | 68 | tm->tm_mday = BCD2BIN(ops->readbyte(M48T86_REG_DOM)); |
69 | /* tm_mon is 0-11 */ | 69 | /* tm_mon is 0-11 */ |
70 | tm->tm_mon = BCD2BIN(ops->readb(M48T86_REG_MONTH)) - 1; | 70 | tm->tm_mon = BCD2BIN(ops->readbyte(M48T86_REG_MONTH)) - 1; |
71 | tm->tm_year = BCD2BIN(ops->readb(M48T86_REG_YEAR)) + 100; | 71 | tm->tm_year = BCD2BIN(ops->readbyte(M48T86_REG_YEAR)) + 100; |
72 | tm->tm_wday = BCD2BIN(ops->readb(M48T86_REG_DOW)); | 72 | tm->tm_wday = BCD2BIN(ops->readbyte(M48T86_REG_DOW)); |
73 | } | 73 | } |
74 | 74 | ||
75 | /* correct the hour if the clock is in 12h mode */ | 75 | /* correct the hour if the clock is in 12h mode */ |
76 | if (!(reg & M48T86_REG_B_H24)) | 76 | if (!(reg & M48T86_REG_B_H24)) |
77 | if (ops->readb(M48T86_REG_HOUR) & 0x80) | 77 | if (ops->readbyte(M48T86_REG_HOUR) & 0x80) |
78 | tm->tm_hour += 12; | 78 | tm->tm_hour += 12; |
79 | 79 | ||
80 | return 0; | 80 | return 0; |
@@ -86,35 +86,35 @@ static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
86 | struct platform_device *pdev = to_platform_device(dev); | 86 | struct platform_device *pdev = to_platform_device(dev); |
87 | struct m48t86_ops *ops = pdev->dev.platform_data; | 87 | struct m48t86_ops *ops = pdev->dev.platform_data; |
88 | 88 | ||
89 | reg = ops->readb(M48T86_REG_B); | 89 | reg = ops->readbyte(M48T86_REG_B); |
90 | 90 | ||
91 | /* update flag and 24h mode */ | 91 | /* update flag and 24h mode */ |
92 | reg |= M48T86_REG_B_SET | M48T86_REG_B_H24; | 92 | reg |= M48T86_REG_B_SET | M48T86_REG_B_H24; |
93 | ops->writeb(reg, M48T86_REG_B); | 93 | ops->writebyte(reg, M48T86_REG_B); |
94 | 94 | ||
95 | if (reg & M48T86_REG_B_DM) { | 95 | if (reg & M48T86_REG_B_DM) { |
96 | /* data (binary) mode */ | 96 | /* data (binary) mode */ |
97 | ops->writeb(tm->tm_sec, M48T86_REG_SEC); | 97 | ops->writebyte(tm->tm_sec, M48T86_REG_SEC); |
98 | ops->writeb(tm->tm_min, M48T86_REG_MIN); | 98 | ops->writebyte(tm->tm_min, M48T86_REG_MIN); |
99 | ops->writeb(tm->tm_hour, M48T86_REG_HOUR); | 99 | ops->writebyte(tm->tm_hour, M48T86_REG_HOUR); |
100 | ops->writeb(tm->tm_mday, M48T86_REG_DOM); | 100 | ops->writebyte(tm->tm_mday, M48T86_REG_DOM); |
101 | ops->writeb(tm->tm_mon + 1, M48T86_REG_MONTH); | 101 | ops->writebyte(tm->tm_mon + 1, M48T86_REG_MONTH); |
102 | ops->writeb(tm->tm_year % 100, M48T86_REG_YEAR); | 102 | ops->writebyte(tm->tm_year % 100, M48T86_REG_YEAR); |
103 | ops->writeb(tm->tm_wday, M48T86_REG_DOW); | 103 | ops->writebyte(tm->tm_wday, M48T86_REG_DOW); |
104 | } else { | 104 | } else { |
105 | /* bcd mode */ | 105 | /* bcd mode */ |
106 | ops->writeb(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); | 106 | ops->writebyte(BIN2BCD(tm->tm_sec), M48T86_REG_SEC); |
107 | ops->writeb(BIN2BCD(tm->tm_min), M48T86_REG_MIN); | 107 | ops->writebyte(BIN2BCD(tm->tm_min), M48T86_REG_MIN); |
108 | ops->writeb(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); | 108 | ops->writebyte(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR); |
109 | ops->writeb(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); | 109 | ops->writebyte(BIN2BCD(tm->tm_mday), M48T86_REG_DOM); |
110 | ops->writeb(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); | 110 | ops->writebyte(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH); |
111 | ops->writeb(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); | 111 | ops->writebyte(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR); |
112 | ops->writeb(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); | 112 | ops->writebyte(BIN2BCD(tm->tm_wday), M48T86_REG_DOW); |
113 | } | 113 | } |
114 | 114 | ||
115 | /* update ended */ | 115 | /* update ended */ |
116 | reg &= ~M48T86_REG_B_SET; | 116 | reg &= ~M48T86_REG_B_SET; |
117 | ops->writeb(reg, M48T86_REG_B); | 117 | ops->writebyte(reg, M48T86_REG_B); |
118 | 118 | ||
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
@@ -125,12 +125,12 @@ static int m48t86_rtc_proc(struct device *dev, struct seq_file *seq) | |||
125 | struct platform_device *pdev = to_platform_device(dev); | 125 | struct platform_device *pdev = to_platform_device(dev); |
126 | struct m48t86_ops *ops = pdev->dev.platform_data; | 126 | struct m48t86_ops *ops = pdev->dev.platform_data; |
127 | 127 | ||
128 | reg = ops->readb(M48T86_REG_B); | 128 | reg = ops->readbyte(M48T86_REG_B); |
129 | 129 | ||
130 | seq_printf(seq, "mode\t\t: %s\n", | 130 | seq_printf(seq, "mode\t\t: %s\n", |
131 | (reg & M48T86_REG_B_DM) ? "binary" : "bcd"); | 131 | (reg & M48T86_REG_B_DM) ? "binary" : "bcd"); |
132 | 132 | ||
133 | reg = ops->readb(M48T86_REG_D); | 133 | reg = ops->readbyte(M48T86_REG_D); |
134 | 134 | ||
135 | seq_printf(seq, "battery\t\t: %s\n", | 135 | seq_printf(seq, "battery\t\t: %s\n", |
136 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); | 136 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); |
@@ -157,7 +157,7 @@ static int __devinit m48t86_rtc_probe(struct platform_device *dev) | |||
157 | platform_set_drvdata(dev, rtc); | 157 | platform_set_drvdata(dev, rtc); |
158 | 158 | ||
159 | /* read battery status */ | 159 | /* read battery status */ |
160 | reg = ops->readb(M48T86_REG_D); | 160 | reg = ops->readbyte(M48T86_REG_D); |
161 | dev_info(&dev->dev, "battery %s\n", | 161 | dev_info(&dev->dev, "battery %s\n", |
162 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); | 162 | (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted"); |
163 | 163 | ||
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 2bc8aad47219..a997529f8926 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
247 | rtc_freq = arg; | 247 | rtc_freq = arg; |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | return -EINVAL; | 250 | return -ENOIOCTLCMD; |
251 | } | 251 | } |
252 | 252 | ||
253 | static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) | 253 | static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) |
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index e1f7e8e86daf..e1fa5fe7901f 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct device *dev, unsigned int cmd, | |||
71 | return 0; | 71 | return 0; |
72 | 72 | ||
73 | default: | 73 | default: |
74 | return -EINVAL; | 74 | return -ENOIOCTLCMD; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index 4d49fd501198..277596c302e3 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long | |||
270 | epoch = arg; | 270 | epoch = arg; |
271 | break; | 271 | break; |
272 | default: | 272 | default: |
273 | return -EINVAL; | 273 | return -ENOIOCTLCMD; |
274 | } | 274 | } |
275 | 275 | ||
276 | return 0; | 276 | return 0; |
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index 74a257b23383..e210f89a2449 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h | |||
@@ -45,11 +45,11 @@ struct pgid { | |||
45 | union { | 45 | union { |
46 | __u8 fc; /* SPID function code */ | 46 | __u8 fc; /* SPID function code */ |
47 | struct path_state ps; /* SNID path state */ | 47 | struct path_state ps; /* SNID path state */ |
48 | } inf; | 48 | } __attribute__ ((packed)) inf; |
49 | union { | 49 | union { |
50 | __u32 cpu_addr : 16; /* CPU address */ | 50 | __u32 cpu_addr : 16; /* CPU address */ |
51 | struct extended_cssid ext_cssid; | 51 | struct extended_cssid ext_cssid; |
52 | } pgid_high; | 52 | } __attribute__ ((packed)) pgid_high; |
53 | __u32 cpu_id : 24; /* CPU identification */ | 53 | __u32 cpu_id : 24; /* CPU identification */ |
54 | __u32 cpu_model : 16; /* CPU model */ | 54 | __u32 cpu_model : 16; /* CPU model */ |
55 | __u32 tod_high; /* high word TOD clock */ | 55 | __u32 tod_high; /* high word TOD clock */ |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 180b3bf8b90d..49ec562d7f60 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -749,7 +749,7 @@ ccw_device_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
749 | /* Unit check but no sense data. Need basic sense. */ | 749 | /* Unit check but no sense data. Need basic sense. */ |
750 | if (ccw_device_do_sense(cdev, irb) != 0) | 750 | if (ccw_device_do_sense(cdev, irb) != 0) |
751 | goto call_handler_unsol; | 751 | goto call_handler_unsol; |
752 | memcpy(irb, &cdev->private->irb, sizeof(struct irb)); | 752 | memcpy(&cdev->private->irb, irb, sizeof(struct irb)); |
753 | cdev->private->state = DEV_STATE_W4SENSE; | 753 | cdev->private->state = DEV_STATE_W4SENSE; |
754 | cdev->private->intparm = 0; | 754 | cdev->private->intparm = 0; |
755 | return; | 755 | return; |
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index af9f212314b3..fe986af884f8 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -1486,13 +1486,13 @@ ch_action_iofatal(fsm_instance * fi, int event, void *arg) | |||
1486 | } | 1486 | } |
1487 | } | 1487 | } |
1488 | 1488 | ||
1489 | static void | 1489 | static void |
1490 | ch_action_reinit(fsm_instance *fi, int event, void *arg) | 1490 | ch_action_reinit(fsm_instance *fi, int event, void *arg) |
1491 | { | 1491 | { |
1492 | struct channel *ch = (struct channel *)arg; | 1492 | struct channel *ch = (struct channel *)arg; |
1493 | struct net_device *dev = ch->netdev; | 1493 | struct net_device *dev = ch->netdev; |
1494 | struct ctc_priv *privptr = dev->priv; | 1494 | struct ctc_priv *privptr = dev->priv; |
1495 | 1495 | ||
1496 | DBF_TEXT(trace, 4, __FUNCTION__); | 1496 | DBF_TEXT(trace, 4, __FUNCTION__); |
1497 | ch_action_iofatal(fi, event, arg); | 1497 | ch_action_iofatal(fi, event, arg); |
1498 | fsm_addtimer(&privptr->restart_timer, 1000, DEV_EVENT_RESTART, dev); | 1498 | fsm_addtimer(&privptr->restart_timer, 1000, DEV_EVENT_RESTART, dev); |
@@ -1624,7 +1624,7 @@ less_than(char *id1, char *id2) | |||
1624 | } | 1624 | } |
1625 | dev1 = simple_strtoul(id1, &id1, 16); | 1625 | dev1 = simple_strtoul(id1, &id1, 16); |
1626 | dev2 = simple_strtoul(id2, &id2, 16); | 1626 | dev2 = simple_strtoul(id2, &id2, 16); |
1627 | 1627 | ||
1628 | return (dev1 < dev2); | 1628 | return (dev1 < dev2); |
1629 | } | 1629 | } |
1630 | 1630 | ||
@@ -1895,7 +1895,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1895 | irb->scsw.dstat); | 1895 | irb->scsw.dstat); |
1896 | return; | 1896 | return; |
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | priv = ((struct ccwgroup_device *)cdev->dev.driver_data) | 1899 | priv = ((struct ccwgroup_device *)cdev->dev.driver_data) |
1900 | ->dev.driver_data; | 1900 | ->dev.driver_data; |
1901 | 1901 | ||
@@ -1909,7 +1909,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1909 | "device %s\n", cdev->dev.bus_id); | 1909 | "device %s\n", cdev->dev.bus_id); |
1910 | return; | 1910 | return; |
1911 | } | 1911 | } |
1912 | 1912 | ||
1913 | dev = (struct net_device *) (ch->netdev); | 1913 | dev = (struct net_device *) (ch->netdev); |
1914 | if (dev == NULL) { | 1914 | if (dev == NULL) { |
1915 | ctc_pr_crit("ctc: ctc_irq_handler dev=NULL bus_id=%s, ch=0x%p\n", | 1915 | ctc_pr_crit("ctc: ctc_irq_handler dev=NULL bus_id=%s, ch=0x%p\n", |
@@ -2008,12 +2008,12 @@ dev_action_stop(fsm_instance * fi, int event, void *arg) | |||
2008 | fsm_event(ch->fsm, CH_EVENT_STOP, ch); | 2008 | fsm_event(ch->fsm, CH_EVENT_STOP, ch); |
2009 | } | 2009 | } |
2010 | } | 2010 | } |
2011 | static void | 2011 | static void |
2012 | dev_action_restart(fsm_instance *fi, int event, void *arg) | 2012 | dev_action_restart(fsm_instance *fi, int event, void *arg) |
2013 | { | 2013 | { |
2014 | struct net_device *dev = (struct net_device *)arg; | 2014 | struct net_device *dev = (struct net_device *)arg; |
2015 | struct ctc_priv *privptr = dev->priv; | 2015 | struct ctc_priv *privptr = dev->priv; |
2016 | 2016 | ||
2017 | DBF_TEXT(trace, 3, __FUNCTION__); | 2017 | DBF_TEXT(trace, 3, __FUNCTION__); |
2018 | ctc_pr_debug("%s: Restarting\n", dev->name); | 2018 | ctc_pr_debug("%s: Restarting\n", dev->name); |
2019 | dev_action_stop(fi, event, arg); | 2019 | dev_action_stop(fi, event, arg); |
@@ -2193,7 +2193,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
2193 | 2193 | ||
2194 | DBF_TEXT(trace, 5, __FUNCTION__); | 2194 | DBF_TEXT(trace, 5, __FUNCTION__); |
2195 | /* we need to acquire the lock for testing the state | 2195 | /* we need to acquire the lock for testing the state |
2196 | * otherwise we can have an IRQ changing the state to | 2196 | * otherwise we can have an IRQ changing the state to |
2197 | * TXIDLE after the test but before acquiring the lock. | 2197 | * TXIDLE after the test but before acquiring the lock. |
2198 | */ | 2198 | */ |
2199 | spin_lock_irqsave(&ch->collect_lock, saveflags); | 2199 | spin_lock_irqsave(&ch->collect_lock, saveflags); |
@@ -2393,7 +2393,7 @@ ctc_tx(struct sk_buff *skb, struct net_device * dev) | |||
2393 | 2393 | ||
2394 | /** | 2394 | /** |
2395 | * If channels are not running, try to restart them | 2395 | * If channels are not running, try to restart them |
2396 | * and throw away packet. | 2396 | * and throw away packet. |
2397 | */ | 2397 | */ |
2398 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { | 2398 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { |
2399 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); | 2399 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); |
@@ -2738,7 +2738,7 @@ ctc_remove_files(struct device *dev) | |||
2738 | /** | 2738 | /** |
2739 | * Add ctc specific attributes. | 2739 | * Add ctc specific attributes. |
2740 | * Add ctc private data. | 2740 | * Add ctc private data. |
2741 | * | 2741 | * |
2742 | * @param cgdev pointer to ccwgroup_device just added | 2742 | * @param cgdev pointer to ccwgroup_device just added |
2743 | * | 2743 | * |
2744 | * @returns 0 on success, !0 on failure. | 2744 | * @returns 0 on success, !0 on failure. |
@@ -2869,7 +2869,7 @@ ctc_new_device(struct ccwgroup_device *cgdev) | |||
2869 | DBF_TEXT(setup, 3, buffer); | 2869 | DBF_TEXT(setup, 3, buffer); |
2870 | 2870 | ||
2871 | type = get_channel_type(&cgdev->cdev[0]->id); | 2871 | type = get_channel_type(&cgdev->cdev[0]->id); |
2872 | 2872 | ||
2873 | snprintf(read_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id); | 2873 | snprintf(read_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id); |
2874 | snprintf(write_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id); | 2874 | snprintf(write_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id); |
2875 | 2875 | ||
@@ -2907,7 +2907,7 @@ ctc_new_device(struct ccwgroup_device *cgdev) | |||
2907 | channel_get(type, direction == READ ? read_id : write_id, | 2907 | channel_get(type, direction == READ ? read_id : write_id, |
2908 | direction); | 2908 | direction); |
2909 | if (privptr->channel[direction] == NULL) { | 2909 | if (privptr->channel[direction] == NULL) { |
2910 | if (direction == WRITE) | 2910 | if (direction == WRITE) |
2911 | channel_free(privptr->channel[READ]); | 2911 | channel_free(privptr->channel[READ]); |
2912 | 2912 | ||
2913 | ctc_free_netdevice(dev, 1); | 2913 | ctc_free_netdevice(dev, 1); |
@@ -2955,7 +2955,7 @@ ctc_shutdown_device(struct ccwgroup_device *cgdev) | |||
2955 | { | 2955 | { |
2956 | struct ctc_priv *priv; | 2956 | struct ctc_priv *priv; |
2957 | struct net_device *ndev; | 2957 | struct net_device *ndev; |
2958 | 2958 | ||
2959 | DBF_TEXT(setup, 3, __FUNCTION__); | 2959 | DBF_TEXT(setup, 3, __FUNCTION__); |
2960 | pr_debug("%s() called\n", __FUNCTION__); | 2960 | pr_debug("%s() called\n", __FUNCTION__); |
2961 | 2961 | ||
diff --git a/drivers/s390/net/ctctty.c b/drivers/s390/net/ctctty.c index 5cdcdbf92962..af54d1de07bf 100644 --- a/drivers/s390/net/ctctty.c +++ b/drivers/s390/net/ctctty.c | |||
@@ -130,7 +130,7 @@ ctc_tty_readmodem(ctc_tty_info *info) | |||
130 | if ((tty = info->tty)) { | 130 | if ((tty = info->tty)) { |
131 | if (info->mcr & UART_MCR_RTS) { | 131 | if (info->mcr & UART_MCR_RTS) { |
132 | struct sk_buff *skb; | 132 | struct sk_buff *skb; |
133 | 133 | ||
134 | if ((skb = skb_dequeue(&info->rx_queue))) { | 134 | if ((skb = skb_dequeue(&info->rx_queue))) { |
135 | int len = skb->len; | 135 | int len = skb->len; |
136 | tty_insert_flip_string(tty, skb->data, len); | 136 | tty_insert_flip_string(tty, skb->data, len); |
@@ -328,7 +328,7 @@ ctc_tty_inject(ctc_tty_info *info, char c) | |||
328 | { | 328 | { |
329 | int skb_res; | 329 | int skb_res; |
330 | struct sk_buff *skb; | 330 | struct sk_buff *skb; |
331 | 331 | ||
332 | DBF_TEXT(trace, 4, __FUNCTION__); | 332 | DBF_TEXT(trace, 4, __FUNCTION__); |
333 | if (ctc_tty_shuttingdown) | 333 | if (ctc_tty_shuttingdown) |
334 | return; | 334 | return; |
@@ -497,7 +497,7 @@ ctc_tty_write(struct tty_struct *tty, const u_char * buf, int count) | |||
497 | c = (count < CTC_TTY_XMIT_SIZE) ? count : CTC_TTY_XMIT_SIZE; | 497 | c = (count < CTC_TTY_XMIT_SIZE) ? count : CTC_TTY_XMIT_SIZE; |
498 | if (c <= 0) | 498 | if (c <= 0) |
499 | break; | 499 | break; |
500 | 500 | ||
501 | skb_res = info->netdev->hard_header_len + sizeof(info->mcr) + | 501 | skb_res = info->netdev->hard_header_len + sizeof(info->mcr) + |
502 | + sizeof(__u32); | 502 | + sizeof(__u32); |
503 | skb = dev_alloc_skb(skb_res + c); | 503 | skb = dev_alloc_skb(skb_res + c); |
@@ -828,7 +828,7 @@ ctc_tty_block_til_ready(struct tty_struct *tty, struct file *filp, ctc_tty_info | |||
828 | if (tty_hung_up_p(filp) || | 828 | if (tty_hung_up_p(filp) || |
829 | (info->flags & CTC_ASYNC_CLOSING)) { | 829 | (info->flags & CTC_ASYNC_CLOSING)) { |
830 | if (info->flags & CTC_ASYNC_CLOSING) | 830 | if (info->flags & CTC_ASYNC_CLOSING) |
831 | wait_event(info->close_wait, | 831 | wait_event(info->close_wait, |
832 | !(info->flags & CTC_ASYNC_CLOSING)); | 832 | !(info->flags & CTC_ASYNC_CLOSING)); |
833 | #ifdef MODEM_DO_RESTART | 833 | #ifdef MODEM_DO_RESTART |
834 | if (info->flags & CTC_ASYNC_HUP_NOTIFY) | 834 | if (info->flags & CTC_ASYNC_HUP_NOTIFY) |
@@ -1247,7 +1247,7 @@ ctc_tty_unregister_netdev(struct net_device *dev) { | |||
1247 | void | 1247 | void |
1248 | ctc_tty_cleanup(void) { | 1248 | ctc_tty_cleanup(void) { |
1249 | unsigned long saveflags; | 1249 | unsigned long saveflags; |
1250 | 1250 | ||
1251 | DBF_TEXT(trace, 2, __FUNCTION__); | 1251 | DBF_TEXT(trace, 2, __FUNCTION__); |
1252 | spin_lock_irqsave(&ctc_tty_lock, saveflags); | 1252 | spin_lock_irqsave(&ctc_tty_lock, saveflags); |
1253 | ctc_tty_shuttingdown = 1; | 1253 | ctc_tty_shuttingdown = 1; |
diff --git a/drivers/s390/net/cu3088.c b/drivers/s390/net/cu3088.c index b12533104c1f..e965f03a7291 100644 --- a/drivers/s390/net/cu3088.c +++ b/drivers/s390/net/cu3088.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
@@ -77,7 +77,7 @@ group_write(struct device_driver *drv, const char *buf, size_t count) | |||
77 | int len; | 77 | int len; |
78 | 78 | ||
79 | if (!(end = strchr(start, delim[i]))) | 79 | if (!(end = strchr(start, delim[i]))) |
80 | return count; | 80 | return -EINVAL; |
81 | len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start + 1); | 81 | len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start + 1); |
82 | strlcpy (bus_ids[i], start, len); | 82 | strlcpy (bus_ids[i], start, len); |
83 | argv[i] = bus_ids[i]; | 83 | argv[i] = bus_ids[i]; |
@@ -94,7 +94,7 @@ static DRIVER_ATTR(group, 0200, NULL, group_write); | |||
94 | 94 | ||
95 | /* Register-unregister for ctc&lcs */ | 95 | /* Register-unregister for ctc&lcs */ |
96 | int | 96 | int |
97 | register_cu3088_discipline(struct ccwgroup_driver *dcp) | 97 | register_cu3088_discipline(struct ccwgroup_driver *dcp) |
98 | { | 98 | { |
99 | int rc; | 99 | int rc; |
100 | 100 | ||
@@ -109,7 +109,7 @@ register_cu3088_discipline(struct ccwgroup_driver *dcp) | |||
109 | rc = driver_create_file(&dcp->driver, &driver_attr_group); | 109 | rc = driver_create_file(&dcp->driver, &driver_attr_group); |
110 | if (rc) | 110 | if (rc) |
111 | ccwgroup_driver_unregister(dcp); | 111 | ccwgroup_driver_unregister(dcp); |
112 | 112 | ||
113 | return rc; | 113 | return rc; |
114 | 114 | ||
115 | } | 115 | } |
@@ -137,7 +137,7 @@ static int __init | |||
137 | cu3088_init (void) | 137 | cu3088_init (void) |
138 | { | 138 | { |
139 | int rc; | 139 | int rc; |
140 | 140 | ||
141 | cu3088_root_dev = s390_root_dev_register("cu3088"); | 141 | cu3088_root_dev = s390_root_dev_register("cu3088"); |
142 | if (IS_ERR(cu3088_root_dev)) | 142 | if (IS_ERR(cu3088_root_dev)) |
143 | return PTR_ERR(cu3088_root_dev); | 143 | return PTR_ERR(cu3088_root_dev); |
diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index 6190be9dca99..e0c7deb98831 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * IUCV network driver | 2 | * IUCV network driver |
3 | * | 3 | * |
4 | * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation | 4 | * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation |
@@ -28,7 +28,7 @@ | |||
28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* #define DEBUG */ | 32 | /* #define DEBUG */ |
33 | 33 | ||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
@@ -81,7 +81,7 @@ iucv_bus_match (struct device *dev, struct device_driver *drv) | |||
81 | struct bus_type iucv_bus = { | 81 | struct bus_type iucv_bus = { |
82 | .name = "iucv", | 82 | .name = "iucv", |
83 | .match = iucv_bus_match, | 83 | .match = iucv_bus_match, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct device *iucv_root; | 86 | struct device *iucv_root; |
87 | 87 | ||
@@ -297,7 +297,7 @@ MODULE_LICENSE("GPL"); | |||
297 | /* | 297 | /* |
298 | * Debugging stuff | 298 | * Debugging stuff |
299 | *******************************************************************************/ | 299 | *******************************************************************************/ |
300 | 300 | ||
301 | 301 | ||
302 | #ifdef DEBUG | 302 | #ifdef DEBUG |
303 | static int debuglevel = 0; | 303 | static int debuglevel = 0; |
@@ -344,7 +344,7 @@ do { \ | |||
344 | /* | 344 | /* |
345 | * Internal functions | 345 | * Internal functions |
346 | *******************************************************************************/ | 346 | *******************************************************************************/ |
347 | 347 | ||
348 | /** | 348 | /** |
349 | * print start banner | 349 | * print start banner |
350 | */ | 350 | */ |
@@ -810,7 +810,7 @@ iucv_register_program (__u8 pgmname[16], | |||
810 | sizeof (new_handler->id.userid)); | 810 | sizeof (new_handler->id.userid)); |
811 | EBC_TOUPPER (new_handler->id.userid, | 811 | EBC_TOUPPER (new_handler->id.userid, |
812 | sizeof (new_handler->id.userid)); | 812 | sizeof (new_handler->id.userid)); |
813 | 813 | ||
814 | if (pgmmask) { | 814 | if (pgmmask) { |
815 | memcpy (new_handler->id.mask, pgmmask, | 815 | memcpy (new_handler->id.mask, pgmmask, |
816 | sizeof (new_handler->id.mask)); | 816 | sizeof (new_handler->id.mask)); |
@@ -1229,7 +1229,7 @@ iucv_purge (__u16 pathid, __u32 msgid, __u32 srccls, __u32 *audit) | |||
1229 | /* parm->ipaudit has only 3 bytes */ | 1229 | /* parm->ipaudit has only 3 bytes */ |
1230 | *audit >>= 8; | 1230 | *audit >>= 8; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | release_param(parm); | 1233 | release_param(parm); |
1234 | 1234 | ||
1235 | iucv_debug(1, "b2f0_result = %ld", b2f0_result); | 1235 | iucv_debug(1, "b2f0_result = %ld", b2f0_result); |
@@ -2330,14 +2330,14 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2330 | temp_buff1[j] &= (h->id.mask)[j]; | 2330 | temp_buff1[j] &= (h->id.mask)[j]; |
2331 | temp_buff2[j] &= (h->id.mask)[j]; | 2331 | temp_buff2[j] &= (h->id.mask)[j]; |
2332 | } | 2332 | } |
2333 | 2333 | ||
2334 | iucv_dumpit("temp_buff1:", | 2334 | iucv_dumpit("temp_buff1:", |
2335 | temp_buff1, sizeof(temp_buff1)); | 2335 | temp_buff1, sizeof(temp_buff1)); |
2336 | iucv_dumpit("temp_buff2", | 2336 | iucv_dumpit("temp_buff2", |
2337 | temp_buff2, sizeof(temp_buff2)); | 2337 | temp_buff2, sizeof(temp_buff2)); |
2338 | 2338 | ||
2339 | if (!memcmp (temp_buff1, temp_buff2, 24)) { | 2339 | if (!memcmp (temp_buff1, temp_buff2, 24)) { |
2340 | 2340 | ||
2341 | iucv_debug(2, | 2341 | iucv_debug(2, |
2342 | "found a matching handler"); | 2342 | "found a matching handler"); |
2343 | break; | 2343 | break; |
@@ -2368,7 +2368,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2368 | } else | 2368 | } else |
2369 | iucv_sever(int_buf->ippathid, no_listener); | 2369 | iucv_sever(int_buf->ippathid, no_listener); |
2370 | break; | 2370 | break; |
2371 | 2371 | ||
2372 | case 0x02: /*connection complete */ | 2372 | case 0x02: /*connection complete */ |
2373 | if (messagesDisabled) { | 2373 | if (messagesDisabled) { |
2374 | iucv_setmask(~0); | 2374 | iucv_setmask(~0); |
@@ -2387,7 +2387,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2387 | } else | 2387 | } else |
2388 | iucv_sever(int_buf->ippathid, no_listener); | 2388 | iucv_sever(int_buf->ippathid, no_listener); |
2389 | break; | 2389 | break; |
2390 | 2390 | ||
2391 | case 0x03: /* connection severed */ | 2391 | case 0x03: /* connection severed */ |
2392 | if (messagesDisabled) { | 2392 | if (messagesDisabled) { |
2393 | iucv_setmask(~0); | 2393 | iucv_setmask(~0); |
@@ -2398,13 +2398,13 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2398 | interrupt->ConnectionSevered( | 2398 | interrupt->ConnectionSevered( |
2399 | (iucv_ConnectionSevered *)int_buf, | 2399 | (iucv_ConnectionSevered *)int_buf, |
2400 | h->pgm_data); | 2400 | h->pgm_data); |
2401 | 2401 | ||
2402 | else | 2402 | else |
2403 | iucv_sever (int_buf->ippathid, no_listener); | 2403 | iucv_sever (int_buf->ippathid, no_listener); |
2404 | } else | 2404 | } else |
2405 | iucv_sever(int_buf->ippathid, no_listener); | 2405 | iucv_sever(int_buf->ippathid, no_listener); |
2406 | break; | 2406 | break; |
2407 | 2407 | ||
2408 | case 0x04: /* connection quiesced */ | 2408 | case 0x04: /* connection quiesced */ |
2409 | if (messagesDisabled) { | 2409 | if (messagesDisabled) { |
2410 | iucv_setmask(~0); | 2410 | iucv_setmask(~0); |
@@ -2420,7 +2420,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2420 | "ConnectionQuiesced not called"); | 2420 | "ConnectionQuiesced not called"); |
2421 | } | 2421 | } |
2422 | break; | 2422 | break; |
2423 | 2423 | ||
2424 | case 0x05: /* connection resumed */ | 2424 | case 0x05: /* connection resumed */ |
2425 | if (messagesDisabled) { | 2425 | if (messagesDisabled) { |
2426 | iucv_setmask(~0); | 2426 | iucv_setmask(~0); |
@@ -2436,7 +2436,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2436 | "ConnectionResumed not called"); | 2436 | "ConnectionResumed not called"); |
2437 | } | 2437 | } |
2438 | break; | 2438 | break; |
2439 | 2439 | ||
2440 | case 0x06: /* priority message complete */ | 2440 | case 0x06: /* priority message complete */ |
2441 | case 0x07: /* nonpriority message complete */ | 2441 | case 0x07: /* nonpriority message complete */ |
2442 | if (h) { | 2442 | if (h) { |
@@ -2449,7 +2449,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2449 | "MessageComplete not called"); | 2449 | "MessageComplete not called"); |
2450 | } | 2450 | } |
2451 | break; | 2451 | break; |
2452 | 2452 | ||
2453 | case 0x08: /* priority message pending */ | 2453 | case 0x08: /* priority message pending */ |
2454 | case 0x09: /* nonpriority message pending */ | 2454 | case 0x09: /* nonpriority message pending */ |
2455 | if (h) { | 2455 | if (h) { |
@@ -2467,7 +2467,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf) | |||
2467 | __FUNCTION__); | 2467 | __FUNCTION__); |
2468 | break; | 2468 | break; |
2469 | } /* end switch */ | 2469 | } /* end switch */ |
2470 | 2470 | ||
2471 | iucv_debug(2, "exiting pathid %d, type %02X", | 2471 | iucv_debug(2, "exiting pathid %d, type %02X", |
2472 | int_buf->ippathid, int_buf->iptype); | 2472 | int_buf->ippathid, int_buf->iptype); |
2473 | 2473 | ||
diff --git a/drivers/s390/net/iucv.h b/drivers/s390/net/iucv.h index 0c4644d3d2f3..5b6b1b7241c9 100644 --- a/drivers/s390/net/iucv.h +++ b/drivers/s390/net/iucv.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * S390 version | 5 | * S390 version |
6 | * Copyright (C) 2000 IBM Corporation | 6 | * Copyright (C) 2000 IBM Corporation |
7 | * Author(s):Alan Altmark (Alan_Altmark@us.ibm.com) | 7 | * Author(s):Alan Altmark (Alan_Altmark@us.ibm.com) |
8 | * Xenia Tkatschow (xenia@us.ibm.com) | 8 | * Xenia Tkatschow (xenia@us.ibm.com) |
9 | * | 9 | * |
10 | * | 10 | * |
@@ -16,17 +16,17 @@ | |||
16 | * CP Programming Services book, also available on the web | 16 | * CP Programming Services book, also available on the web |
17 | * thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 | 17 | * thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 |
18 | * | 18 | * |
19 | * Definition of Return Codes | 19 | * Definition of Return Codes |
20 | * -All positive return codes including zero are reflected back | 20 | * -All positive return codes including zero are reflected back |
21 | * from CP except for iucv_register_program. The definition of each | 21 | * from CP except for iucv_register_program. The definition of each |
22 | * return code can be found in CP Programming Services book. | 22 | * return code can be found in CP Programming Services book. |
23 | * Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 | 23 | * Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760 |
24 | * - Return Code of: | 24 | * - Return Code of: |
25 | * (-EINVAL) Invalid value | 25 | * (-EINVAL) Invalid value |
26 | * (-ENOMEM) storage allocation failed | 26 | * (-ENOMEM) storage allocation failed |
27 | * pgmask defined in iucv_register_program will be set depending on input | 27 | * pgmask defined in iucv_register_program will be set depending on input |
28 | * paramters. | 28 | * paramters. |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
@@ -124,13 +124,13 @@ iucv_hex_dump(unsigned char *buf, size_t len) | |||
124 | #define iucv_handle_t void * | 124 | #define iucv_handle_t void * |
125 | 125 | ||
126 | /* flags1: | 126 | /* flags1: |
127 | * All flags are defined in the field IPFLAGS1 of each function | 127 | * All flags are defined in the field IPFLAGS1 of each function |
128 | * and can be found in CP Programming Services. | 128 | * and can be found in CP Programming Services. |
129 | * IPLOCAL - Indicates the connect can only be satisfied on the | 129 | * IPLOCAL - Indicates the connect can only be satisfied on the |
130 | * local system | 130 | * local system |
131 | * IPPRTY - Indicates a priority message | 131 | * IPPRTY - Indicates a priority message |
132 | * IPQUSCE - Indicates you do not want to receive messages on a | 132 | * IPQUSCE - Indicates you do not want to receive messages on a |
133 | * path until an iucv_resume is issued | 133 | * path until an iucv_resume is issued |
134 | * IPRMDATA - Indicates that the message is in the parameter list | 134 | * IPRMDATA - Indicates that the message is in the parameter list |
135 | */ | 135 | */ |
136 | #define IPLOCAL 0x01 | 136 | #define IPLOCAL 0x01 |
@@ -154,14 +154,14 @@ iucv_hex_dump(unsigned char *buf, size_t len) | |||
154 | #define AllInterrupts 0xf8 | 154 | #define AllInterrupts 0xf8 |
155 | /* | 155 | /* |
156 | * Mapping of external interrupt buffers should be used with the corresponding | 156 | * Mapping of external interrupt buffers should be used with the corresponding |
157 | * interrupt types. | 157 | * interrupt types. |
158 | * Names: iucv_ConnectionPending -> connection pending | 158 | * Names: iucv_ConnectionPending -> connection pending |
159 | * iucv_ConnectionComplete -> connection complete | 159 | * iucv_ConnectionComplete -> connection complete |
160 | * iucv_ConnectionSevered -> connection severed | 160 | * iucv_ConnectionSevered -> connection severed |
161 | * iucv_ConnectionQuiesced -> connection quiesced | 161 | * iucv_ConnectionQuiesced -> connection quiesced |
162 | * iucv_ConnectionResumed -> connection resumed | 162 | * iucv_ConnectionResumed -> connection resumed |
163 | * iucv_MessagePending -> message pending | 163 | * iucv_MessagePending -> message pending |
164 | * iucv_MessageComplete -> message complete | 164 | * iucv_MessageComplete -> message complete |
165 | */ | 165 | */ |
166 | typedef struct { | 166 | typedef struct { |
167 | u16 ippathid; | 167 | u16 ippathid; |
@@ -260,16 +260,16 @@ typedef struct { | |||
260 | uchar res2[3]; | 260 | uchar res2[3]; |
261 | } iucv_MessageComplete; | 261 | } iucv_MessageComplete; |
262 | 262 | ||
263 | /* | 263 | /* |
264 | * iucv_interrupt_ops_t: Is a vector of functions that handle | 264 | * iucv_interrupt_ops_t: Is a vector of functions that handle |
265 | * IUCV interrupts. | 265 | * IUCV interrupts. |
266 | * Parameter list: | 266 | * Parameter list: |
267 | * eib - is a pointer to a 40-byte area described | 267 | * eib - is a pointer to a 40-byte area described |
268 | * with one of the structures above. | 268 | * with one of the structures above. |
269 | * pgm_data - this data is strictly for the | 269 | * pgm_data - this data is strictly for the |
270 | * interrupt handler that is passed by | 270 | * interrupt handler that is passed by |
271 | * the application. This may be an address | 271 | * the application. This may be an address |
272 | * or token. | 272 | * or token. |
273 | */ | 273 | */ |
274 | typedef struct { | 274 | typedef struct { |
275 | void (*ConnectionPending) (iucv_ConnectionPending * eib, | 275 | void (*ConnectionPending) (iucv_ConnectionPending * eib, |
@@ -287,8 +287,8 @@ typedef struct { | |||
287 | } iucv_interrupt_ops_t; | 287 | } iucv_interrupt_ops_t; |
288 | 288 | ||
289 | /* | 289 | /* |
290 | *iucv_array_t : Defines buffer array. | 290 | *iucv_array_t : Defines buffer array. |
291 | * Inside the array may be 31- bit addresses and 31-bit lengths. | 291 | * Inside the array may be 31- bit addresses and 31-bit lengths. |
292 | */ | 292 | */ |
293 | typedef struct { | 293 | typedef struct { |
294 | u32 address; | 294 | u32 address; |
@@ -299,19 +299,19 @@ extern struct bus_type iucv_bus; | |||
299 | extern struct device *iucv_root; | 299 | extern struct device *iucv_root; |
300 | 300 | ||
301 | /* -prototypes- */ | 301 | /* -prototypes- */ |
302 | /* | 302 | /* |
303 | * Name: iucv_register_program | 303 | * Name: iucv_register_program |
304 | * Purpose: Registers an application with IUCV | 304 | * Purpose: Registers an application with IUCV |
305 | * Input: prmname - user identification | 305 | * Input: prmname - user identification |
306 | * userid - machine identification | 306 | * userid - machine identification |
307 | * pgmmask - indicates which bits in the prmname and userid combined will be | 307 | * pgmmask - indicates which bits in the prmname and userid combined will be |
308 | * used to determine who is given control | 308 | * used to determine who is given control |
309 | * ops - address of vector of interrupt handlers | 309 | * ops - address of vector of interrupt handlers |
310 | * pgm_data- application data passed to interrupt handlers | 310 | * pgm_data- application data passed to interrupt handlers |
311 | * Output: NA | 311 | * Output: NA |
312 | * Return: address of handler | 312 | * Return: address of handler |
313 | * (0) - Error occurred, registration not completed. | 313 | * (0) - Error occurred, registration not completed. |
314 | * NOTE: Exact cause of failure will be recorded in syslog. | 314 | * NOTE: Exact cause of failure will be recorded in syslog. |
315 | */ | 315 | */ |
316 | iucv_handle_t iucv_register_program (uchar pgmname[16], | 316 | iucv_handle_t iucv_register_program (uchar pgmname[16], |
317 | uchar userid[8], | 317 | uchar userid[8], |
@@ -319,13 +319,13 @@ iucv_handle_t iucv_register_program (uchar pgmname[16], | |||
319 | iucv_interrupt_ops_t * ops, | 319 | iucv_interrupt_ops_t * ops, |
320 | void *pgm_data); | 320 | void *pgm_data); |
321 | 321 | ||
322 | /* | 322 | /* |
323 | * Name: iucv_unregister_program | 323 | * Name: iucv_unregister_program |
324 | * Purpose: Unregister application with IUCV | 324 | * Purpose: Unregister application with IUCV |
325 | * Input: address of handler | 325 | * Input: address of handler |
326 | * Output: NA | 326 | * Output: NA |
327 | * Return: (0) - Normal return | 327 | * Return: (0) - Normal return |
328 | * (-EINVAL) - Internal error, wild pointer | 328 | * (-EINVAL) - Internal error, wild pointer |
329 | */ | 329 | */ |
330 | int iucv_unregister_program (iucv_handle_t handle); | 330 | int iucv_unregister_program (iucv_handle_t handle); |
331 | 331 | ||
@@ -333,7 +333,7 @@ int iucv_unregister_program (iucv_handle_t handle); | |||
333 | * Name: iucv_accept | 333 | * Name: iucv_accept |
334 | * Purpose: This function is issued after the user receives a Connection Pending external | 334 | * Purpose: This function is issued after the user receives a Connection Pending external |
335 | * interrupt and now wishes to complete the IUCV communication path. | 335 | * interrupt and now wishes to complete the IUCV communication path. |
336 | * Input: pathid - u16 , Path identification number | 336 | * Input: pathid - u16 , Path identification number |
337 | * msglim_reqstd - u16, The number of outstanding messages requested. | 337 | * msglim_reqstd - u16, The number of outstanding messages requested. |
338 | * user_data - uchar[16], Data specified by the iucv_connect function. | 338 | * user_data - uchar[16], Data specified by the iucv_connect function. |
339 | * flags1 - int, Contains options for this path. | 339 | * flags1 - int, Contains options for this path. |
@@ -358,34 +358,34 @@ int iucv_accept (u16 pathid, | |||
358 | void *pgm_data, int *flags1_out, u16 * msglim); | 358 | void *pgm_data, int *flags1_out, u16 * msglim); |
359 | 359 | ||
360 | /* | 360 | /* |
361 | * Name: iucv_connect | 361 | * Name: iucv_connect |
362 | * Purpose: This function establishes an IUCV path. Although the connect may complete | 362 | * Purpose: This function establishes an IUCV path. Although the connect may complete |
363 | * successfully, you are not able to use the path until you receive an IUCV | 363 | * successfully, you are not able to use the path until you receive an IUCV |
364 | * Connection Complete external interrupt. | 364 | * Connection Complete external interrupt. |
365 | * Input: pathid - u16 *, Path identification number | 365 | * Input: pathid - u16 *, Path identification number |
366 | * msglim_reqstd - u16, Number of outstanding messages requested | 366 | * msglim_reqstd - u16, Number of outstanding messages requested |
367 | * user_data - uchar[16], 16-byte user data | 367 | * user_data - uchar[16], 16-byte user data |
368 | * userid - uchar[8], User identification | 368 | * userid - uchar[8], User identification |
369 | * system_name - uchar[8], 8-byte identifying the system name | 369 | * system_name - uchar[8], 8-byte identifying the system name |
370 | * flags1 - int, Contains options for this path. | 370 | * flags1 - int, Contains options for this path. |
371 | * -IPPRTY - 0x20, Specifies if you want to send priority message. | 371 | * -IPPRTY - 0x20, Specifies if you want to send priority message. |
372 | * -IPRMDATA - 0x80, Specifies whether your program can handle a message | 372 | * -IPRMDATA - 0x80, Specifies whether your program can handle a message |
373 | * in the parameter list. | 373 | * in the parameter list. |
374 | * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being | 374 | * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being |
375 | * established. | 375 | * established. |
376 | * -IPLOCAL - 0X01, Allows an application to force the partner to be on | 376 | * -IPLOCAL - 0X01, Allows an application to force the partner to be on |
377 | * the local system. If local is specified then target class cannot be | 377 | * the local system. If local is specified then target class cannot be |
378 | * specified. | 378 | * specified. |
379 | * flags1_out - int * Contains information about the path | 379 | * flags1_out - int * Contains information about the path |
380 | * - IPPRTY - 0x20, Indicates you may send priority messages. | 380 | * - IPPRTY - 0x20, Indicates you may send priority messages. |
381 | * msglim - * u16, Number of outstanding messages | 381 | * msglim - * u16, Number of outstanding messages |
382 | * handle - iucv_handle_t, Address of handler | 382 | * handle - iucv_handle_t, Address of handler |
383 | * pgm_data - void *, Application data passed to interrupt handlers | 383 | * pgm_data - void *, Application data passed to interrupt handlers |
384 | * Output: return code from CP IUCV call | 384 | * Output: return code from CP IUCV call |
385 | * rc - return code from iucv_declare_buffer | 385 | * rc - return code from iucv_declare_buffer |
386 | * -EINVAL - Invalid handle passed by application | 386 | * -EINVAL - Invalid handle passed by application |
387 | * -EINVAL - Pathid address is NULL | 387 | * -EINVAL - Pathid address is NULL |
388 | * add_pathid_result - Return code from internal function add_pathid | 388 | * add_pathid_result - Return code from internal function add_pathid |
389 | */ | 389 | */ |
390 | int | 390 | int |
391 | iucv_connect (u16 * pathid, | 391 | iucv_connect (u16 * pathid, |
@@ -397,16 +397,16 @@ int | |||
397 | int *flags1_out, | 397 | int *flags1_out, |
398 | u16 * msglim, iucv_handle_t handle, void *pgm_data); | 398 | u16 * msglim, iucv_handle_t handle, void *pgm_data); |
399 | 399 | ||
400 | /* | 400 | /* |
401 | * Name: iucv_purge | 401 | * Name: iucv_purge |
402 | * Purpose: This function cancels a message that you have sent. | 402 | * Purpose: This function cancels a message that you have sent. |
403 | * Input: pathid - Path identification number. | 403 | * Input: pathid - Path identification number. |
404 | * msgid - Specifies the message ID of the message to be purged. | 404 | * msgid - Specifies the message ID of the message to be purged. |
405 | * srccls - Specifies the source message class. | 405 | * srccls - Specifies the source message class. |
406 | * Output: audit - Contains information about asynchronous error | 406 | * Output: audit - Contains information about asynchronous error |
407 | * that may have affected the normal completion | 407 | * that may have affected the normal completion |
408 | * of this message. | 408 | * of this message. |
409 | * Return: Return code from CP IUCV call. | 409 | * Return: Return code from CP IUCV call. |
410 | */ | 410 | */ |
411 | int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit); | 411 | int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit); |
412 | /* | 412 | /* |
@@ -426,38 +426,38 @@ ulong iucv_query_maxconn (void); | |||
426 | */ | 426 | */ |
427 | ulong iucv_query_bufsize (void); | 427 | ulong iucv_query_bufsize (void); |
428 | 428 | ||
429 | /* | 429 | /* |
430 | * Name: iucv_quiesce | 430 | * Name: iucv_quiesce |
431 | * Purpose: This function temporarily suspends incoming messages on an | 431 | * Purpose: This function temporarily suspends incoming messages on an |
432 | * IUCV path. You can later reactivate the path by invoking | 432 | * IUCV path. You can later reactivate the path by invoking |
433 | * the iucv_resume function. | 433 | * the iucv_resume function. |
434 | * Input: pathid - Path identification number | 434 | * Input: pathid - Path identification number |
435 | * user_data - 16-bytes of user data | 435 | * user_data - 16-bytes of user data |
436 | * Output: NA | 436 | * Output: NA |
437 | * Return: Return code from CP IUCV call. | 437 | * Return: Return code from CP IUCV call. |
438 | */ | 438 | */ |
439 | int iucv_quiesce (u16 pathid, uchar user_data[16]); | 439 | int iucv_quiesce (u16 pathid, uchar user_data[16]); |
440 | 440 | ||
441 | /* | 441 | /* |
442 | * Name: iucv_receive | 442 | * Name: iucv_receive |
443 | * Purpose: This function receives messages that are being sent to you | 443 | * Purpose: This function receives messages that are being sent to you |
444 | * over established paths. Data will be returned in buffer for length of | 444 | * over established paths. Data will be returned in buffer for length of |
445 | * buflen. | 445 | * buflen. |
446 | * Input: | 446 | * Input: |
447 | * pathid - Path identification number. | 447 | * pathid - Path identification number. |
448 | * buffer - Address of buffer to receive. | 448 | * buffer - Address of buffer to receive. |
449 | * buflen - Length of buffer to receive. | 449 | * buflen - Length of buffer to receive. |
450 | * msgid - Specifies the message ID. | 450 | * msgid - Specifies the message ID. |
451 | * trgcls - Specifies target class. | 451 | * trgcls - Specifies target class. |
452 | * Output: | 452 | * Output: |
453 | * flags1_out: int *, Contains information about this path. | 453 | * flags1_out: int *, Contains information about this path. |
454 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is | 454 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is |
455 | * expected. | 455 | * expected. |
456 | * IPPRTY - 0x20 Specifies if you want to send priority message. | 456 | * IPPRTY - 0x20 Specifies if you want to send priority message. |
457 | * IPRMDATA - 0x80 specifies the data is contained in the parameter list | 457 | * IPRMDATA - 0x80 specifies the data is contained in the parameter list |
458 | * residual_buffer - address of buffer updated by the number | 458 | * residual_buffer - address of buffer updated by the number |
459 | * of bytes you have received. | 459 | * of bytes you have received. |
460 | * residual_length - | 460 | * residual_length - |
461 | * Contains one of the following values, if the receive buffer is: | 461 | * Contains one of the following values, if the receive buffer is: |
462 | * The same length as the message, this field is zero. | 462 | * The same length as the message, this field is zero. |
463 | * Longer than the message, this field contains the number of | 463 | * Longer than the message, this field contains the number of |
@@ -466,8 +466,8 @@ int iucv_quiesce (u16 pathid, uchar user_data[16]); | |||
466 | * count (that is, the number of bytes remaining in the | 466 | * count (that is, the number of bytes remaining in the |
467 | * message that does not fit into the buffer. In this | 467 | * message that does not fit into the buffer. In this |
468 | * case b2f0_result = 5. | 468 | * case b2f0_result = 5. |
469 | * Return: Return code from CP IUCV call. | 469 | * Return: Return code from CP IUCV call. |
470 | * (-EINVAL) - buffer address is pointing to NULL | 470 | * (-EINVAL) - buffer address is pointing to NULL |
471 | */ | 471 | */ |
472 | int iucv_receive (u16 pathid, | 472 | int iucv_receive (u16 pathid, |
473 | u32 msgid, | 473 | u32 msgid, |
@@ -477,16 +477,16 @@ int iucv_receive (u16 pathid, | |||
477 | int *flags1_out, | 477 | int *flags1_out, |
478 | ulong * residual_buffer, ulong * residual_length); | 478 | ulong * residual_buffer, ulong * residual_length); |
479 | 479 | ||
480 | /* | 480 | /* |
481 | * Name: iucv_receive_array | 481 | * Name: iucv_receive_array |
482 | * Purpose: This function receives messages that are being sent to you | 482 | * Purpose: This function receives messages that are being sent to you |
483 | * over established paths. Data will be returned in first buffer for | 483 | * over established paths. Data will be returned in first buffer for |
484 | * length of first buffer. | 484 | * length of first buffer. |
485 | * Input: pathid - Path identification number. | 485 | * Input: pathid - Path identification number. |
486 | * msgid - specifies the message ID. | 486 | * msgid - specifies the message ID. |
487 | * trgcls - Specifies target class. | 487 | * trgcls - Specifies target class. |
488 | * buffer - Address of array of buffers. | 488 | * buffer - Address of array of buffers. |
489 | * buflen - Total length of buffers. | 489 | * buflen - Total length of buffers. |
490 | * Output: | 490 | * Output: |
491 | * flags1_out: int *, Contains information about this path. | 491 | * flags1_out: int *, Contains information about this path. |
492 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is | 492 | * IPNORPY - 0x10 Specifies this is a one-way message and no reply is |
@@ -504,8 +504,8 @@ int iucv_receive (u16 pathid, | |||
504 | * count (that is, the number of bytes remaining in the | 504 | * count (that is, the number of bytes remaining in the |
505 | * message that does not fit into the buffer. In this | 505 | * message that does not fit into the buffer. In this |
506 | * case b2f0_result = 5. | 506 | * case b2f0_result = 5. |
507 | * Return: Return code from CP IUCV call. | 507 | * Return: Return code from CP IUCV call. |
508 | * (-EINVAL) - Buffer address is NULL. | 508 | * (-EINVAL) - Buffer address is NULL. |
509 | */ | 509 | */ |
510 | int iucv_receive_array (u16 pathid, | 510 | int iucv_receive_array (u16 pathid, |
511 | u32 msgid, | 511 | u32 msgid, |
@@ -515,44 +515,44 @@ int iucv_receive_array (u16 pathid, | |||
515 | int *flags1_out, | 515 | int *flags1_out, |
516 | ulong * residual_buffer, ulong * residual_length); | 516 | ulong * residual_buffer, ulong * residual_length); |
517 | 517 | ||
518 | /* | 518 | /* |
519 | * Name: iucv_reject | 519 | * Name: iucv_reject |
520 | * Purpose: The reject function refuses a specified message. Between the | 520 | * Purpose: The reject function refuses a specified message. Between the |
521 | * time you are notified of a message and the time that you | 521 | * time you are notified of a message and the time that you |
522 | * complete the message, the message may be rejected. | 522 | * complete the message, the message may be rejected. |
523 | * Input: pathid - Path identification number. | 523 | * Input: pathid - Path identification number. |
524 | * msgid - Specifies the message ID. | 524 | * msgid - Specifies the message ID. |
525 | * trgcls - Specifies target class. | 525 | * trgcls - Specifies target class. |
526 | * Output: NA | 526 | * Output: NA |
527 | * Return: Return code from CP IUCV call. | 527 | * Return: Return code from CP IUCV call. |
528 | */ | 528 | */ |
529 | int iucv_reject (u16 pathid, u32 msgid, u32 trgcls); | 529 | int iucv_reject (u16 pathid, u32 msgid, u32 trgcls); |
530 | 530 | ||
531 | /* | 531 | /* |
532 | * Name: iucv_reply | 532 | * Name: iucv_reply |
533 | * Purpose: This function responds to the two-way messages that you | 533 | * Purpose: This function responds to the two-way messages that you |
534 | * receive. You must identify completely the message to | 534 | * receive. You must identify completely the message to |
535 | * which you wish to reply. ie, pathid, msgid, and trgcls. | 535 | * which you wish to reply. ie, pathid, msgid, and trgcls. |
536 | * Input: pathid - Path identification number. | 536 | * Input: pathid - Path identification number. |
537 | * msgid - Specifies the message ID. | 537 | * msgid - Specifies the message ID. |
538 | * trgcls - Specifies target class. | 538 | * trgcls - Specifies target class. |
539 | * flags1 - Option for path. | 539 | * flags1 - Option for path. |
540 | * IPPRTY- 0x20, Specifies if you want to send priority message. | 540 | * IPPRTY- 0x20, Specifies if you want to send priority message. |
541 | * buffer - Address of reply buffer. | 541 | * buffer - Address of reply buffer. |
542 | * buflen - Length of reply buffer. | 542 | * buflen - Length of reply buffer. |
543 | * Output: residual_buffer - Address of buffer updated by the number | 543 | * Output: residual_buffer - Address of buffer updated by the number |
544 | * of bytes you have moved. | 544 | * of bytes you have moved. |
545 | * residual_length - Contains one of the following values: | 545 | * residual_length - Contains one of the following values: |
546 | * If the answer buffer is the same length as the reply, this field | 546 | * If the answer buffer is the same length as the reply, this field |
547 | * contains zero. | 547 | * contains zero. |
548 | * If the answer buffer is longer than the reply, this field contains | 548 | * If the answer buffer is longer than the reply, this field contains |
549 | * the number of bytes remaining in the buffer. | 549 | * the number of bytes remaining in the buffer. |
550 | * If the answer buffer is shorter than the reply, this field contains | 550 | * If the answer buffer is shorter than the reply, this field contains |
551 | * a residual count (that is, the number of bytes remianing in the | 551 | * a residual count (that is, the number of bytes remianing in the |
552 | * reply that does not fit into the buffer. In this | 552 | * reply that does not fit into the buffer. In this |
553 | * case b2f0_result = 5. | 553 | * case b2f0_result = 5. |
554 | * Return: Return code from CP IUCV call. | 554 | * Return: Return code from CP IUCV call. |
555 | * (-EINVAL) - Buffer address is NULL. | 555 | * (-EINVAL) - Buffer address is NULL. |
556 | */ | 556 | */ |
557 | int iucv_reply (u16 pathid, | 557 | int iucv_reply (u16 pathid, |
558 | u32 msgid, | 558 | u32 msgid, |
@@ -561,20 +561,20 @@ int iucv_reply (u16 pathid, | |||
561 | void *buffer, ulong buflen, ulong * residual_buffer, | 561 | void *buffer, ulong buflen, ulong * residual_buffer, |
562 | ulong * residual_length); | 562 | ulong * residual_length); |
563 | 563 | ||
564 | /* | 564 | /* |
565 | * Name: iucv_reply_array | 565 | * Name: iucv_reply_array |
566 | * Purpose: This function responds to the two-way messages that you | 566 | * Purpose: This function responds to the two-way messages that you |
567 | * receive. You must identify completely the message to | 567 | * receive. You must identify completely the message to |
568 | * which you wish to reply. ie, pathid, msgid, and trgcls. | 568 | * which you wish to reply. ie, pathid, msgid, and trgcls. |
569 | * The array identifies a list of addresses and lengths of | 569 | * The array identifies a list of addresses and lengths of |
570 | * discontiguous buffers that contains the reply data. | 570 | * discontiguous buffers that contains the reply data. |
571 | * Input: pathid - Path identification number | 571 | * Input: pathid - Path identification number |
572 | * msgid - Specifies the message ID. | 572 | * msgid - Specifies the message ID. |
573 | * trgcls - Specifies target class. | 573 | * trgcls - Specifies target class. |
574 | * flags1 - Option for path. | 574 | * flags1 - Option for path. |
575 | * IPPRTY- 0x20, Specifies if you want to send priority message. | 575 | * IPPRTY- 0x20, Specifies if you want to send priority message. |
576 | * buffer - Address of array of reply buffers. | 576 | * buffer - Address of array of reply buffers. |
577 | * buflen - Total length of reply buffers. | 577 | * buflen - Total length of reply buffers. |
578 | * Output: residual_buffer - Address of buffer which IUCV is currently working on. | 578 | * Output: residual_buffer - Address of buffer which IUCV is currently working on. |
579 | * residual_length - Contains one of the following values: | 579 | * residual_length - Contains one of the following values: |
580 | * If the answer buffer is the same length as the reply, this field | 580 | * If the answer buffer is the same length as the reply, this field |
@@ -585,8 +585,8 @@ int iucv_reply (u16 pathid, | |||
585 | * a residual count (that is, the number of bytes remianing in the | 585 | * a residual count (that is, the number of bytes remianing in the |
586 | * reply that does not fit into the buffer. In this | 586 | * reply that does not fit into the buffer. In this |
587 | * case b2f0_result = 5. | 587 | * case b2f0_result = 5. |
588 | * Return: Return code from CP IUCV call. | 588 | * Return: Return code from CP IUCV call. |
589 | * (-EINVAL) - Buffer address is NULL. | 589 | * (-EINVAL) - Buffer address is NULL. |
590 | */ | 590 | */ |
591 | int iucv_reply_array (u16 pathid, | 591 | int iucv_reply_array (u16 pathid, |
592 | u32 msgid, | 592 | u32 msgid, |
@@ -596,77 +596,77 @@ int iucv_reply_array (u16 pathid, | |||
596 | ulong buflen, ulong * residual_address, | 596 | ulong buflen, ulong * residual_address, |
597 | ulong * residual_length); | 597 | ulong * residual_length); |
598 | 598 | ||
599 | /* | 599 | /* |
600 | * Name: iucv_reply_prmmsg | 600 | * Name: iucv_reply_prmmsg |
601 | * Purpose: This function responds to the two-way messages that you | 601 | * Purpose: This function responds to the two-way messages that you |
602 | * receive. You must identify completely the message to | 602 | * receive. You must identify completely the message to |
603 | * which you wish to reply. ie, pathid, msgid, and trgcls. | 603 | * which you wish to reply. ie, pathid, msgid, and trgcls. |
604 | * Prmmsg signifies the data is moved into the | 604 | * Prmmsg signifies the data is moved into the |
605 | * parameter list. | 605 | * parameter list. |
606 | * Input: pathid - Path identification number. | 606 | * Input: pathid - Path identification number. |
607 | * msgid - Specifies the message ID. | 607 | * msgid - Specifies the message ID. |
608 | * trgcls - Specifies target class. | 608 | * trgcls - Specifies target class. |
609 | * flags1 - Option for path. | 609 | * flags1 - Option for path. |
610 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 610 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
611 | * prmmsg - 8-bytes of data to be placed into the parameter. | 611 | * prmmsg - 8-bytes of data to be placed into the parameter. |
612 | * list. | 612 | * list. |
613 | * Output: NA | 613 | * Output: NA |
614 | * Return: Return code from CP IUCV call. | 614 | * Return: Return code from CP IUCV call. |
615 | */ | 615 | */ |
616 | int iucv_reply_prmmsg (u16 pathid, | 616 | int iucv_reply_prmmsg (u16 pathid, |
617 | u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]); | 617 | u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]); |
618 | 618 | ||
619 | /* | 619 | /* |
620 | * Name: iucv_resume | 620 | * Name: iucv_resume |
621 | * Purpose: This function restores communications over a quiesced path | 621 | * Purpose: This function restores communications over a quiesced path |
622 | * Input: pathid - Path identification number. | 622 | * Input: pathid - Path identification number. |
623 | * user_data - 16-bytes of user data. | 623 | * user_data - 16-bytes of user data. |
624 | * Output: NA | 624 | * Output: NA |
625 | * Return: Return code from CP IUCV call. | 625 | * Return: Return code from CP IUCV call. |
626 | */ | 626 | */ |
627 | int iucv_resume (u16 pathid, uchar user_data[16]); | 627 | int iucv_resume (u16 pathid, uchar user_data[16]); |
628 | 628 | ||
629 | /* | 629 | /* |
630 | * Name: iucv_send | 630 | * Name: iucv_send |
631 | * Purpose: This function transmits data to another application. | 631 | * Purpose: This function transmits data to another application. |
632 | * Data to be transmitted is in a buffer and this is a | 632 | * Data to be transmitted is in a buffer and this is a |
633 | * one-way message and the receiver will not reply to the | 633 | * one-way message and the receiver will not reply to the |
634 | * message. | 634 | * message. |
635 | * Input: pathid - Path identification number. | 635 | * Input: pathid - Path identification number. |
636 | * trgcls - Specifies target class. | 636 | * trgcls - Specifies target class. |
637 | * srccls - Specifies the source message class. | 637 | * srccls - Specifies the source message class. |
638 | * msgtag - Specifies a tag to be associated with the message. | 638 | * msgtag - Specifies a tag to be associated with the message. |
639 | * flags1 - Option for path. | 639 | * flags1 - Option for path. |
640 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 640 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
641 | * buffer - Address of send buffer. | 641 | * buffer - Address of send buffer. |
642 | * buflen - Length of send buffer. | 642 | * buflen - Length of send buffer. |
643 | * Output: msgid - Specifies the message ID. | 643 | * Output: msgid - Specifies the message ID. |
644 | * Return: Return code from CP IUCV call. | 644 | * Return: Return code from CP IUCV call. |
645 | * (-EINVAL) - Buffer address is NULL. | 645 | * (-EINVAL) - Buffer address is NULL. |
646 | */ | 646 | */ |
647 | int iucv_send (u16 pathid, | 647 | int iucv_send (u16 pathid, |
648 | u32 * msgid, | 648 | u32 * msgid, |
649 | u32 trgcls, | 649 | u32 trgcls, |
650 | u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen); | 650 | u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen); |
651 | 651 | ||
652 | /* | 652 | /* |
653 | * Name: iucv_send_array | 653 | * Name: iucv_send_array |
654 | * Purpose: This function transmits data to another application. | 654 | * Purpose: This function transmits data to another application. |
655 | * The contents of buffer is the address of the array of | 655 | * The contents of buffer is the address of the array of |
656 | * addresses and lengths of discontiguous buffers that hold | 656 | * addresses and lengths of discontiguous buffers that hold |
657 | * the message text. This is a one-way message and the | 657 | * the message text. This is a one-way message and the |
658 | * receiver will not reply to the message. | 658 | * receiver will not reply to the message. |
659 | * Input: pathid - Path identification number. | 659 | * Input: pathid - Path identification number. |
660 | * trgcls - Specifies target class. | 660 | * trgcls - Specifies target class. |
661 | * srccls - Specifies the source message class. | 661 | * srccls - Specifies the source message class. |
662 | * msgtag - Specifies a tag to be associated witht the message. | 662 | * msgtag - Specifies a tag to be associated witht the message. |
663 | * flags1 - Option for path. | 663 | * flags1 - Option for path. |
664 | * IPPRTY- specifies if you want to send priority message. | 664 | * IPPRTY- specifies if you want to send priority message. |
665 | * buffer - Address of array of send buffers. | 665 | * buffer - Address of array of send buffers. |
666 | * buflen - Total length of send buffers. | 666 | * buflen - Total length of send buffers. |
667 | * Output: msgid - Specifies the message ID. | 667 | * Output: msgid - Specifies the message ID. |
668 | * Return: Return code from CP IUCV call. | 668 | * Return: Return code from CP IUCV call. |
669 | * (-EINVAL) - Buffer address is NULL. | 669 | * (-EINVAL) - Buffer address is NULL. |
670 | */ | 670 | */ |
671 | int iucv_send_array (u16 pathid, | 671 | int iucv_send_array (u16 pathid, |
672 | u32 * msgid, | 672 | u32 * msgid, |
@@ -675,48 +675,48 @@ int iucv_send_array (u16 pathid, | |||
675 | u32 msgtag, | 675 | u32 msgtag, |
676 | int flags1, iucv_array_t * buffer, ulong buflen); | 676 | int flags1, iucv_array_t * buffer, ulong buflen); |
677 | 677 | ||
678 | /* | 678 | /* |
679 | * Name: iucv_send_prmmsg | 679 | * Name: iucv_send_prmmsg |
680 | * Purpose: This function transmits data to another application. | 680 | * Purpose: This function transmits data to another application. |
681 | * Prmmsg specifies that the 8-bytes of data are to be moved | 681 | * Prmmsg specifies that the 8-bytes of data are to be moved |
682 | * into the parameter list. This is a one-way message and the | 682 | * into the parameter list. This is a one-way message and the |
683 | * receiver will not reply to the message. | 683 | * receiver will not reply to the message. |
684 | * Input: pathid - Path identification number. | 684 | * Input: pathid - Path identification number. |
685 | * trgcls - Specifies target class. | 685 | * trgcls - Specifies target class. |
686 | * srccls - Specifies the source message class. | 686 | * srccls - Specifies the source message class. |
687 | * msgtag - Specifies a tag to be associated with the message. | 687 | * msgtag - Specifies a tag to be associated with the message. |
688 | * flags1 - Option for path. | 688 | * flags1 - Option for path. |
689 | * IPPRTY- 0x20 specifies if you want to send priority message. | 689 | * IPPRTY- 0x20 specifies if you want to send priority message. |
690 | * prmmsg - 8-bytes of data to be placed into parameter list. | 690 | * prmmsg - 8-bytes of data to be placed into parameter list. |
691 | * Output: msgid - Specifies the message ID. | 691 | * Output: msgid - Specifies the message ID. |
692 | * Return: Return code from CP IUCV call. | 692 | * Return: Return code from CP IUCV call. |
693 | */ | 693 | */ |
694 | int iucv_send_prmmsg (u16 pathid, | 694 | int iucv_send_prmmsg (u16 pathid, |
695 | u32 * msgid, | 695 | u32 * msgid, |
696 | u32 trgcls, | 696 | u32 trgcls, |
697 | u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]); | 697 | u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]); |
698 | 698 | ||
699 | /* | 699 | /* |
700 | * Name: iucv_send2way | 700 | * Name: iucv_send2way |
701 | * Purpose: This function transmits data to another application. | 701 | * Purpose: This function transmits data to another application. |
702 | * Data to be transmitted is in a buffer. The receiver | 702 | * Data to be transmitted is in a buffer. The receiver |
703 | * of the send is expected to reply to the message and | 703 | * of the send is expected to reply to the message and |
704 | * a buffer is provided into which IUCV moves the reply | 704 | * a buffer is provided into which IUCV moves the reply |
705 | * to this message. | 705 | * to this message. |
706 | * Input: pathid - Path identification number. | 706 | * Input: pathid - Path identification number. |
707 | * trgcls - Specifies target class. | 707 | * trgcls - Specifies target class. |
708 | * srccls - Specifies the source message class. | 708 | * srccls - Specifies the source message class. |
709 | * msgtag - Specifies a tag associated with the message. | 709 | * msgtag - Specifies a tag associated with the message. |
710 | * flags1 - Option for path. | 710 | * flags1 - Option for path. |
711 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 711 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
712 | * buffer - Address of send buffer. | 712 | * buffer - Address of send buffer. |
713 | * buflen - Length of send buffer. | 713 | * buflen - Length of send buffer. |
714 | * ansbuf - Address of buffer into which IUCV moves the reply of | 714 | * ansbuf - Address of buffer into which IUCV moves the reply of |
715 | * this message. | 715 | * this message. |
716 | * anslen - Address of length of buffer. | 716 | * anslen - Address of length of buffer. |
717 | * Output: msgid - Specifies the message ID. | 717 | * Output: msgid - Specifies the message ID. |
718 | * Return: Return code from CP IUCV call. | 718 | * Return: Return code from CP IUCV call. |
719 | * (-EINVAL) - Buffer or ansbuf address is NULL. | 719 | * (-EINVAL) - Buffer or ansbuf address is NULL. |
720 | */ | 720 | */ |
721 | int iucv_send2way (u16 pathid, | 721 | int iucv_send2way (u16 pathid, |
722 | u32 * msgid, | 722 | u32 * msgid, |
@@ -726,28 +726,28 @@ int iucv_send2way (u16 pathid, | |||
726 | int flags1, | 726 | int flags1, |
727 | void *buffer, ulong buflen, void *ansbuf, ulong anslen); | 727 | void *buffer, ulong buflen, void *ansbuf, ulong anslen); |
728 | 728 | ||
729 | /* | 729 | /* |
730 | * Name: iucv_send2way_array | 730 | * Name: iucv_send2way_array |
731 | * Purpose: This function transmits data to another application. | 731 | * Purpose: This function transmits data to another application. |
732 | * The contents of buffer is the address of the array of | 732 | * The contents of buffer is the address of the array of |
733 | * addresses and lengths of discontiguous buffers that hold | 733 | * addresses and lengths of discontiguous buffers that hold |
734 | * the message text. The receiver of the send is expected to | 734 | * the message text. The receiver of the send is expected to |
735 | * reply to the message and a buffer is provided into which | 735 | * reply to the message and a buffer is provided into which |
736 | * IUCV moves the reply to this message. | 736 | * IUCV moves the reply to this message. |
737 | * Input: pathid - Path identification number. | 737 | * Input: pathid - Path identification number. |
738 | * trgcls - Specifies target class. | 738 | * trgcls - Specifies target class. |
739 | * srccls - Specifies the source message class. | 739 | * srccls - Specifies the source message class. |
740 | * msgtag - Specifies a tag to be associated with the message. | 740 | * msgtag - Specifies a tag to be associated with the message. |
741 | * flags1 - Option for path. | 741 | * flags1 - Option for path. |
742 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 742 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
743 | * buffer - Sddress of array of send buffers. | 743 | * buffer - Sddress of array of send buffers. |
744 | * buflen - Total length of send buffers. | 744 | * buflen - Total length of send buffers. |
745 | * ansbuf - Address of array of buffer into which IUCV moves the reply | 745 | * ansbuf - Address of array of buffer into which IUCV moves the reply |
746 | * of this message. | 746 | * of this message. |
747 | * anslen - Address of length reply buffers. | 747 | * anslen - Address of length reply buffers. |
748 | * Output: msgid - Specifies the message ID. | 748 | * Output: msgid - Specifies the message ID. |
749 | * Return: Return code from CP IUCV call. | 749 | * Return: Return code from CP IUCV call. |
750 | * (-EINVAL) - Buffer address is NULL. | 750 | * (-EINVAL) - Buffer address is NULL. |
751 | */ | 751 | */ |
752 | int iucv_send2way_array (u16 pathid, | 752 | int iucv_send2way_array (u16 pathid, |
753 | u32 * msgid, | 753 | u32 * msgid, |
@@ -758,27 +758,27 @@ int iucv_send2way_array (u16 pathid, | |||
758 | iucv_array_t * buffer, | 758 | iucv_array_t * buffer, |
759 | ulong buflen, iucv_array_t * ansbuf, ulong anslen); | 759 | ulong buflen, iucv_array_t * ansbuf, ulong anslen); |
760 | 760 | ||
761 | /* | 761 | /* |
762 | * Name: iucv_send2way_prmmsg | 762 | * Name: iucv_send2way_prmmsg |
763 | * Purpose: This function transmits data to another application. | 763 | * Purpose: This function transmits data to another application. |
764 | * Prmmsg specifies that the 8-bytes of data are to be moved | 764 | * Prmmsg specifies that the 8-bytes of data are to be moved |
765 | * into the parameter list. This is a two-way message and the | 765 | * into the parameter list. This is a two-way message and the |
766 | * receiver of the message is expected to reply. A buffer | 766 | * receiver of the message is expected to reply. A buffer |
767 | * is provided into which IUCV moves the reply to this | 767 | * is provided into which IUCV moves the reply to this |
768 | * message. | 768 | * message. |
769 | * Input: pathid - Rath identification number. | 769 | * Input: pathid - Rath identification number. |
770 | * trgcls - Specifies target class. | 770 | * trgcls - Specifies target class. |
771 | * srccls - Specifies the source message class. | 771 | * srccls - Specifies the source message class. |
772 | * msgtag - Specifies a tag to be associated with the message. | 772 | * msgtag - Specifies a tag to be associated with the message. |
773 | * flags1 - Option for path. | 773 | * flags1 - Option for path. |
774 | * IPPRTY- 0x20 Specifies if you want to send priority message. | 774 | * IPPRTY- 0x20 Specifies if you want to send priority message. |
775 | * prmmsg - 8-bytes of data to be placed in parameter list. | 775 | * prmmsg - 8-bytes of data to be placed in parameter list. |
776 | * ansbuf - Address of buffer into which IUCV moves the reply of | 776 | * ansbuf - Address of buffer into which IUCV moves the reply of |
777 | * this message. | 777 | * this message. |
778 | * anslen - Address of length of buffer. | 778 | * anslen - Address of length of buffer. |
779 | * Output: msgid - Specifies the message ID. | 779 | * Output: msgid - Specifies the message ID. |
780 | * Return: Return code from CP IUCV call. | 780 | * Return: Return code from CP IUCV call. |
781 | * (-EINVAL) - Buffer address is NULL. | 781 | * (-EINVAL) - Buffer address is NULL. |
782 | */ | 782 | */ |
783 | int iucv_send2way_prmmsg (u16 pathid, | 783 | int iucv_send2way_prmmsg (u16 pathid, |
784 | u32 * msgid, | 784 | u32 * msgid, |
@@ -788,29 +788,29 @@ int iucv_send2way_prmmsg (u16 pathid, | |||
788 | ulong flags1, | 788 | ulong flags1, |
789 | uchar prmmsg[8], void *ansbuf, ulong anslen); | 789 | uchar prmmsg[8], void *ansbuf, ulong anslen); |
790 | 790 | ||
791 | /* | 791 | /* |
792 | * Name: iucv_send2way_prmmsg_array | 792 | * Name: iucv_send2way_prmmsg_array |
793 | * Purpose: This function transmits data to another application. | 793 | * Purpose: This function transmits data to another application. |
794 | * Prmmsg specifies that the 8-bytes of data are to be moved | 794 | * Prmmsg specifies that the 8-bytes of data are to be moved |
795 | * into the parameter list. This is a two-way message and the | 795 | * into the parameter list. This is a two-way message and the |
796 | * receiver of the message is expected to reply. A buffer | 796 | * receiver of the message is expected to reply. A buffer |
797 | * is provided into which IUCV moves the reply to this | 797 | * is provided into which IUCV moves the reply to this |
798 | * message. The contents of ansbuf is the address of the | 798 | * message. The contents of ansbuf is the address of the |
799 | * array of addresses and lengths of discontiguous buffers | 799 | * array of addresses and lengths of discontiguous buffers |
800 | * that contain the reply. | 800 | * that contain the reply. |
801 | * Input: pathid - Path identification number. | 801 | * Input: pathid - Path identification number. |
802 | * trgcls - Specifies target class. | 802 | * trgcls - Specifies target class. |
803 | * srccls - Specifies the source message class. | 803 | * srccls - Specifies the source message class. |
804 | * msgtag - Specifies a tag to be associated with the message. | 804 | * msgtag - Specifies a tag to be associated with the message. |
805 | * flags1 - Option for path. | 805 | * flags1 - Option for path. |
806 | * IPPRTY- 0x20 specifies if you want to send priority message. | 806 | * IPPRTY- 0x20 specifies if you want to send priority message. |
807 | * prmmsg - 8-bytes of data to be placed into the parameter list. | 807 | * prmmsg - 8-bytes of data to be placed into the parameter list. |
808 | * ansbuf - Address of array of buffer into which IUCV moves the reply | 808 | * ansbuf - Address of array of buffer into which IUCV moves the reply |
809 | * of this message. | 809 | * of this message. |
810 | * anslen - Address of length of reply buffers. | 810 | * anslen - Address of length of reply buffers. |
811 | * Output: msgid - Specifies the message ID. | 811 | * Output: msgid - Specifies the message ID. |
812 | * Return: Return code from CP IUCV call. | 812 | * Return: Return code from CP IUCV call. |
813 | * (-EINVAL) - Ansbuf address is NULL. | 813 | * (-EINVAL) - Ansbuf address is NULL. |
814 | */ | 814 | */ |
815 | int iucv_send2way_prmmsg_array (u16 pathid, | 815 | int iucv_send2way_prmmsg_array (u16 pathid, |
816 | u32 * msgid, | 816 | u32 * msgid, |
@@ -821,29 +821,29 @@ int iucv_send2way_prmmsg_array (u16 pathid, | |||
821 | uchar prmmsg[8], | 821 | uchar prmmsg[8], |
822 | iucv_array_t * ansbuf, ulong anslen); | 822 | iucv_array_t * ansbuf, ulong anslen); |
823 | 823 | ||
824 | /* | 824 | /* |
825 | * Name: iucv_setmask | 825 | * Name: iucv_setmask |
826 | * Purpose: This function enables or disables the following IUCV | 826 | * Purpose: This function enables or disables the following IUCV |
827 | * external interruptions: Nonpriority and priority message | 827 | * external interruptions: Nonpriority and priority message |
828 | * interrupts, nonpriority and priority reply interrupts. | 828 | * interrupts, nonpriority and priority reply interrupts. |
829 | * Input: SetMaskFlag - options for interrupts | 829 | * Input: SetMaskFlag - options for interrupts |
830 | * 0x80 - Nonpriority_MessagePendingInterruptsFlag | 830 | * 0x80 - Nonpriority_MessagePendingInterruptsFlag |
831 | * 0x40 - Priority_MessagePendingInterruptsFlag | 831 | * 0x40 - Priority_MessagePendingInterruptsFlag |
832 | * 0x20 - Nonpriority_MessageCompletionInterruptsFlag | 832 | * 0x20 - Nonpriority_MessageCompletionInterruptsFlag |
833 | * 0x10 - Priority_MessageCompletionInterruptsFlag | 833 | * 0x10 - Priority_MessageCompletionInterruptsFlag |
834 | * 0x08 - IUCVControlInterruptsFlag | 834 | * 0x08 - IUCVControlInterruptsFlag |
835 | * Output: NA | 835 | * Output: NA |
836 | * Return: Return code from CP IUCV call. | 836 | * Return: Return code from CP IUCV call. |
837 | */ | 837 | */ |
838 | int iucv_setmask (int SetMaskFlag); | 838 | int iucv_setmask (int SetMaskFlag); |
839 | 839 | ||
840 | /* | 840 | /* |
841 | * Name: iucv_sever | 841 | * Name: iucv_sever |
842 | * Purpose: This function terminates an IUCV path. | 842 | * Purpose: This function terminates an IUCV path. |
843 | * Input: pathid - Path identification number. | 843 | * Input: pathid - Path identification number. |
844 | * user_data - 16-bytes of user data. | 844 | * user_data - 16-bytes of user data. |
845 | * Output: NA | 845 | * Output: NA |
846 | * Return: Return code from CP IUCV call. | 846 | * Return: Return code from CP IUCV call. |
847 | * (-EINVAL) - Interal error, wild pointer. | 847 | * (-EINVAL) - Interal error, wild pointer. |
848 | */ | 848 | */ |
849 | int iucv_sever (u16 pathid, uchar user_data[16]); | 849 | int iucv_sever (u16 pathid, uchar user_data[16]); |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 5d6b7a57b02f..f94419b334f7 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -68,6 +68,7 @@ static void lcs_tasklet(unsigned long); | |||
68 | static void lcs_start_kernel_thread(struct lcs_card *card); | 68 | static void lcs_start_kernel_thread(struct lcs_card *card); |
69 | static void lcs_get_frames_cb(struct lcs_channel *, struct lcs_buffer *); | 69 | static void lcs_get_frames_cb(struct lcs_channel *, struct lcs_buffer *); |
70 | static int lcs_send_delipm(struct lcs_card *, struct lcs_ipm_list *); | 70 | static int lcs_send_delipm(struct lcs_card *, struct lcs_ipm_list *); |
71 | static int lcs_recovery(void *ptr); | ||
71 | 72 | ||
72 | /** | 73 | /** |
73 | * Debug Facility Stuff | 74 | * Debug Facility Stuff |
@@ -429,12 +430,6 @@ lcs_setup_card(struct lcs_card *card) | |||
429 | card->tx_buffer = NULL; | 430 | card->tx_buffer = NULL; |
430 | card->tx_emitted = 0; | 431 | card->tx_emitted = 0; |
431 | 432 | ||
432 | /* Initialize kernel thread task used for LGW commands. */ | ||
433 | INIT_WORK(&card->kernel_thread_starter, | ||
434 | (void *)lcs_start_kernel_thread,card); | ||
435 | card->thread_start_mask = 0; | ||
436 | card->thread_allowed_mask = 0; | ||
437 | card->thread_running_mask = 0; | ||
438 | init_waitqueue_head(&card->wait_q); | 433 | init_waitqueue_head(&card->wait_q); |
439 | spin_lock_init(&card->lock); | 434 | spin_lock_init(&card->lock); |
440 | spin_lock_init(&card->ipm_lock); | 435 | spin_lock_init(&card->ipm_lock); |
@@ -675,8 +670,9 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
675 | int index, rc; | 670 | int index, rc; |
676 | 671 | ||
677 | LCS_DBF_TEXT(5, trace, "rdybuff"); | 672 | LCS_DBF_TEXT(5, trace, "rdybuff"); |
678 | BUG_ON(buffer->state != BUF_STATE_LOCKED && | 673 | if (buffer->state != BUF_STATE_LOCKED && |
679 | buffer->state != BUF_STATE_PROCESSED); | 674 | buffer->state != BUF_STATE_PROCESSED) |
675 | BUG(); | ||
680 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 676 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
681 | buffer->state = BUF_STATE_READY; | 677 | buffer->state = BUF_STATE_READY; |
682 | index = buffer - channel->iob; | 678 | index = buffer - channel->iob; |
@@ -700,7 +696,8 @@ __lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
700 | int index, prev, next; | 696 | int index, prev, next; |
701 | 697 | ||
702 | LCS_DBF_TEXT(5, trace, "prcsbuff"); | 698 | LCS_DBF_TEXT(5, trace, "prcsbuff"); |
703 | BUG_ON(buffer->state != BUF_STATE_READY); | 699 | if (buffer->state != BUF_STATE_READY) |
700 | BUG(); | ||
704 | buffer->state = BUF_STATE_PROCESSED; | 701 | buffer->state = BUF_STATE_PROCESSED; |
705 | index = buffer - channel->iob; | 702 | index = buffer - channel->iob; |
706 | prev = (index - 1) & (LCS_NUM_BUFFS - 1); | 703 | prev = (index - 1) & (LCS_NUM_BUFFS - 1); |
@@ -732,8 +729,9 @@ lcs_release_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
732 | unsigned long flags; | 729 | unsigned long flags; |
733 | 730 | ||
734 | LCS_DBF_TEXT(5, trace, "relbuff"); | 731 | LCS_DBF_TEXT(5, trace, "relbuff"); |
735 | BUG_ON(buffer->state != BUF_STATE_LOCKED && | 732 | if (buffer->state != BUF_STATE_LOCKED && |
736 | buffer->state != BUF_STATE_PROCESSED); | 733 | buffer->state != BUF_STATE_PROCESSED) |
734 | BUG(); | ||
737 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 735 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
738 | buffer->state = BUF_STATE_EMPTY; | 736 | buffer->state = BUF_STATE_EMPTY; |
739 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); | 737 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); |
@@ -1147,8 +1145,6 @@ list_modified: | |||
1147 | list_add_tail(&ipm->list, &card->ipm_list); | 1145 | list_add_tail(&ipm->list, &card->ipm_list); |
1148 | } | 1146 | } |
1149 | spin_unlock_irqrestore(&card->ipm_lock, flags); | 1147 | spin_unlock_irqrestore(&card->ipm_lock, flags); |
1150 | if (card->state == DEV_STATE_UP) | ||
1151 | netif_wake_queue(card->dev); | ||
1152 | } | 1148 | } |
1153 | 1149 | ||
1154 | /** | 1150 | /** |
@@ -1231,17 +1227,17 @@ lcs_set_mc_addresses(struct lcs_card *card, struct in_device *in4_dev) | |||
1231 | if (ipm != NULL) | 1227 | if (ipm != NULL) |
1232 | continue; /* Address already in list. */ | 1228 | continue; /* Address already in list. */ |
1233 | ipm = (struct lcs_ipm_list *) | 1229 | ipm = (struct lcs_ipm_list *) |
1234 | kmalloc(sizeof(struct lcs_ipm_list), GFP_ATOMIC); | 1230 | kzalloc(sizeof(struct lcs_ipm_list), GFP_ATOMIC); |
1235 | if (ipm == NULL) { | 1231 | if (ipm == NULL) { |
1236 | PRINT_INFO("Not enough memory to add " | 1232 | PRINT_INFO("Not enough memory to add " |
1237 | "new multicast entry!\n"); | 1233 | "new multicast entry!\n"); |
1238 | break; | 1234 | break; |
1239 | } | 1235 | } |
1240 | memset(ipm, 0, sizeof(struct lcs_ipm_list)); | ||
1241 | memcpy(&ipm->ipm.mac_addr, buf, LCS_MAC_LENGTH); | 1236 | memcpy(&ipm->ipm.mac_addr, buf, LCS_MAC_LENGTH); |
1242 | ipm->ipm.ip_addr = im4->multiaddr; | 1237 | ipm->ipm.ip_addr = im4->multiaddr; |
1243 | ipm->ipm_state = LCS_IPM_STATE_SET_REQUIRED; | 1238 | ipm->ipm_state = LCS_IPM_STATE_SET_REQUIRED; |
1244 | spin_lock_irqsave(&card->ipm_lock, flags); | 1239 | spin_lock_irqsave(&card->ipm_lock, flags); |
1240 | LCS_DBF_HEX(2,trace,&ipm->ipm.ip_addr,4); | ||
1245 | list_add(&ipm->list, &card->ipm_list); | 1241 | list_add(&ipm->list, &card->ipm_list); |
1246 | spin_unlock_irqrestore(&card->ipm_lock, flags); | 1242 | spin_unlock_irqrestore(&card->ipm_lock, flags); |
1247 | } | 1243 | } |
@@ -1269,7 +1265,15 @@ lcs_register_mc_addresses(void *data) | |||
1269 | read_unlock(&in4_dev->mc_list_lock); | 1265 | read_unlock(&in4_dev->mc_list_lock); |
1270 | in_dev_put(in4_dev); | 1266 | in_dev_put(in4_dev); |
1271 | 1267 | ||
1268 | netif_carrier_off(card->dev); | ||
1269 | netif_tx_disable(card->dev); | ||
1270 | wait_event(card->write.wait_q, | ||
1271 | (card->write.state != CH_STATE_RUNNING)); | ||
1272 | lcs_fix_multicast_list(card); | 1272 | lcs_fix_multicast_list(card); |
1273 | if (card->state == DEV_STATE_UP) { | ||
1274 | netif_carrier_on(card->dev); | ||
1275 | netif_wake_queue(card->dev); | ||
1276 | } | ||
1273 | out: | 1277 | out: |
1274 | lcs_clear_thread_running_bit(card, LCS_SET_MC_THREAD); | 1278 | lcs_clear_thread_running_bit(card, LCS_SET_MC_THREAD); |
1275 | return 0; | 1279 | return 0; |
@@ -1286,7 +1290,7 @@ lcs_set_multicast_list(struct net_device *dev) | |||
1286 | LCS_DBF_TEXT(4, trace, "setmulti"); | 1290 | LCS_DBF_TEXT(4, trace, "setmulti"); |
1287 | card = (struct lcs_card *) dev->priv; | 1291 | card = (struct lcs_card *) dev->priv; |
1288 | 1292 | ||
1289 | if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD)) | 1293 | if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD)) |
1290 | schedule_work(&card->kernel_thread_starter); | 1294 | schedule_work(&card->kernel_thread_starter); |
1291 | } | 1295 | } |
1292 | 1296 | ||
@@ -1318,6 +1322,53 @@ lcs_check_irb_error(struct ccw_device *cdev, struct irb *irb) | |||
1318 | return PTR_ERR(irb); | 1322 | return PTR_ERR(irb); |
1319 | } | 1323 | } |
1320 | 1324 | ||
1325 | static int | ||
1326 | lcs_get_problem(struct ccw_device *cdev, struct irb *irb) | ||
1327 | { | ||
1328 | int dstat, cstat; | ||
1329 | char *sense; | ||
1330 | |||
1331 | sense = (char *) irb->ecw; | ||
1332 | cstat = irb->scsw.cstat; | ||
1333 | dstat = irb->scsw.dstat; | ||
1334 | |||
1335 | if (cstat & (SCHN_STAT_CHN_CTRL_CHK | SCHN_STAT_INTF_CTRL_CHK | | ||
1336 | SCHN_STAT_CHN_DATA_CHK | SCHN_STAT_CHAIN_CHECK | | ||
1337 | SCHN_STAT_PROT_CHECK | SCHN_STAT_PROG_CHECK)) { | ||
1338 | LCS_DBF_TEXT(2, trace, "CGENCHK"); | ||
1339 | return 1; | ||
1340 | } | ||
1341 | if (dstat & DEV_STAT_UNIT_CHECK) { | ||
1342 | if (sense[LCS_SENSE_BYTE_1] & | ||
1343 | LCS_SENSE_RESETTING_EVENT) { | ||
1344 | LCS_DBF_TEXT(2, trace, "REVIND"); | ||
1345 | return 1; | ||
1346 | } | ||
1347 | if (sense[LCS_SENSE_BYTE_0] & | ||
1348 | LCS_SENSE_CMD_REJECT) { | ||
1349 | LCS_DBF_TEXT(2, trace, "CMDREJ"); | ||
1350 | return 0; | ||
1351 | } | ||
1352 | if ((!sense[LCS_SENSE_BYTE_0]) && | ||
1353 | (!sense[LCS_SENSE_BYTE_1]) && | ||
1354 | (!sense[LCS_SENSE_BYTE_2]) && | ||
1355 | (!sense[LCS_SENSE_BYTE_3])) { | ||
1356 | LCS_DBF_TEXT(2, trace, "ZEROSEN"); | ||
1357 | return 0; | ||
1358 | } | ||
1359 | LCS_DBF_TEXT(2, trace, "DGENCHK"); | ||
1360 | return 1; | ||
1361 | } | ||
1362 | return 0; | ||
1363 | } | ||
1364 | |||
1365 | void | ||
1366 | lcs_schedule_recovery(struct lcs_card *card) | ||
1367 | { | ||
1368 | LCS_DBF_TEXT(2, trace, "startrec"); | ||
1369 | if (!lcs_set_thread_start_bit(card, LCS_RECOVERY_THREAD)) | ||
1370 | schedule_work(&card->kernel_thread_starter); | ||
1371 | } | ||
1321 | 1372 | ||
1322 | /** | 1373 | /** |
1323 | * IRQ Handler for LCS channels | 1374 | * IRQ Handler for LCS channels |
@@ -1327,7 +1378,8 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1327 | { | 1378 | { |
1328 | struct lcs_card *card; | 1379 | struct lcs_card *card; |
1329 | struct lcs_channel *channel; | 1380 | struct lcs_channel *channel; |
1330 | int index; | 1381 | int rc, index; |
1382 | int cstat, dstat; | ||
1331 | 1383 | ||
1332 | if (lcs_check_irb_error(cdev, irb)) | 1384 | if (lcs_check_irb_error(cdev, irb)) |
1333 | return; | 1385 | return; |
@@ -1338,17 +1390,30 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1338 | else | 1390 | else |
1339 | channel = &card->write; | 1391 | channel = &card->write; |
1340 | 1392 | ||
1393 | cstat = irb->scsw.cstat; | ||
1394 | dstat = irb->scsw.dstat; | ||
1341 | LCS_DBF_TEXT_(5, trace, "Rint%s",cdev->dev.bus_id); | 1395 | LCS_DBF_TEXT_(5, trace, "Rint%s",cdev->dev.bus_id); |
1342 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.cstat, irb->scsw.dstat); | 1396 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.cstat, irb->scsw.dstat); |
1343 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.fctl, irb->scsw.actl); | 1397 | LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.fctl, irb->scsw.actl); |
1344 | 1398 | ||
1399 | /* Check for channel and device errors presented */ | ||
1400 | rc = lcs_get_problem(cdev, irb); | ||
1401 | if (rc || (dstat & DEV_STAT_UNIT_EXCEP)) { | ||
1402 | PRINT_WARN("check on device %s, dstat=0x%X, cstat=0x%X \n", | ||
1403 | cdev->dev.bus_id, dstat, cstat); | ||
1404 | if (rc) { | ||
1405 | lcs_schedule_recovery(card); | ||
1406 | wake_up(&card->wait_q); | ||
1407 | return; | ||
1408 | } | ||
1409 | } | ||
1345 | /* How far in the ccw chain have we processed? */ | 1410 | /* How far in the ccw chain have we processed? */ |
1346 | if ((channel->state != CH_STATE_INIT) && | 1411 | if ((channel->state != CH_STATE_INIT) && |
1347 | (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) { | 1412 | (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) { |
1348 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) | 1413 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) |
1349 | - channel->ccws; | 1414 | - channel->ccws; |
1350 | if ((irb->scsw.actl & SCSW_ACTL_SUSPENDED) || | 1415 | if ((irb->scsw.actl & SCSW_ACTL_SUSPENDED) || |
1351 | (irb->scsw.cstat | SCHN_STAT_PCI)) | 1416 | (irb->scsw.cstat & SCHN_STAT_PCI)) |
1352 | /* Bloody io subsystem tells us lies about cpa... */ | 1417 | /* Bloody io subsystem tells us lies about cpa... */ |
1353 | index = (index - 1) & (LCS_NUM_BUFFS - 1); | 1418 | index = (index - 1) & (LCS_NUM_BUFFS - 1); |
1354 | while (channel->io_idx != index) { | 1419 | while (channel->io_idx != index) { |
@@ -1367,7 +1432,6 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1367 | else if (irb->scsw.actl & SCSW_ACTL_SUSPENDED) | 1432 | else if (irb->scsw.actl & SCSW_ACTL_SUSPENDED) |
1368 | /* CCW execution stopped on a suspend bit. */ | 1433 | /* CCW execution stopped on a suspend bit. */ |
1369 | channel->state = CH_STATE_SUSPENDED; | 1434 | channel->state = CH_STATE_SUSPENDED; |
1370 | |||
1371 | if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) { | 1435 | if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) { |
1372 | if (irb->scsw.cc != 0) { | 1436 | if (irb->scsw.cc != 0) { |
1373 | ccw_device_halt(channel->ccwdev, (addr_t) channel); | 1437 | ccw_device_halt(channel->ccwdev, (addr_t) channel); |
@@ -1376,7 +1440,6 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1376 | /* The channel has been stopped by halt_IO. */ | 1440 | /* The channel has been stopped by halt_IO. */ |
1377 | channel->state = CH_STATE_HALTED; | 1441 | channel->state = CH_STATE_HALTED; |
1378 | } | 1442 | } |
1379 | |||
1380 | if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { | 1443 | if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { |
1381 | channel->state = CH_STATE_CLEARED; | 1444 | channel->state = CH_STATE_CLEARED; |
1382 | } | 1445 | } |
@@ -1452,7 +1515,7 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
1452 | lcs_release_buffer(channel, buffer); | 1515 | lcs_release_buffer(channel, buffer); |
1453 | card = (struct lcs_card *) | 1516 | card = (struct lcs_card *) |
1454 | ((char *) channel - offsetof(struct lcs_card, write)); | 1517 | ((char *) channel - offsetof(struct lcs_card, write)); |
1455 | if (netif_queue_stopped(card->dev)) | 1518 | if (netif_queue_stopped(card->dev) && netif_carrier_ok(card->dev)) |
1456 | netif_wake_queue(card->dev); | 1519 | netif_wake_queue(card->dev); |
1457 | spin_lock(&card->lock); | 1520 | spin_lock(&card->lock); |
1458 | card->tx_emitted--; | 1521 | card->tx_emitted--; |
@@ -1488,6 +1551,10 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb, | |||
1488 | card->stats.tx_carrier_errors++; | 1551 | card->stats.tx_carrier_errors++; |
1489 | return 0; | 1552 | return 0; |
1490 | } | 1553 | } |
1554 | if (skb->protocol == htons(ETH_P_IPV6)) { | ||
1555 | dev_kfree_skb(skb); | ||
1556 | return 0; | ||
1557 | } | ||
1491 | netif_stop_queue(card->dev); | 1558 | netif_stop_queue(card->dev); |
1492 | spin_lock(&card->lock); | 1559 | spin_lock(&card->lock); |
1493 | if (card->tx_buffer != NULL && | 1560 | if (card->tx_buffer != NULL && |
@@ -1633,30 +1700,6 @@ lcs_detect(struct lcs_card *card) | |||
1633 | } | 1700 | } |
1634 | 1701 | ||
1635 | /** | 1702 | /** |
1636 | * reset card | ||
1637 | */ | ||
1638 | static int | ||
1639 | lcs_resetcard(struct lcs_card *card) | ||
1640 | { | ||
1641 | int retries; | ||
1642 | |||
1643 | LCS_DBF_TEXT(2, trace, "rescard"); | ||
1644 | for (retries = 0; retries < 10; retries++) { | ||
1645 | if (lcs_detect(card) == 0) { | ||
1646 | netif_wake_queue(card->dev); | ||
1647 | card->state = DEV_STATE_UP; | ||
1648 | PRINT_INFO("LCS device %s successfully restarted!\n", | ||
1649 | card->dev->name); | ||
1650 | return 0; | ||
1651 | } | ||
1652 | msleep(3000); | ||
1653 | } | ||
1654 | PRINT_ERR("Error in Reseting LCS card!\n"); | ||
1655 | return -EIO; | ||
1656 | } | ||
1657 | |||
1658 | |||
1659 | /** | ||
1660 | * LCS Stop card | 1703 | * LCS Stop card |
1661 | */ | 1704 | */ |
1662 | static int | 1705 | static int |
@@ -1680,126 +1723,18 @@ lcs_stopcard(struct lcs_card *card) | |||
1680 | } | 1723 | } |
1681 | 1724 | ||
1682 | /** | 1725 | /** |
1683 | * LGW initiated commands | ||
1684 | */ | ||
1685 | static int | ||
1686 | lcs_lgw_startlan_thread(void *data) | ||
1687 | { | ||
1688 | struct lcs_card *card; | ||
1689 | |||
1690 | card = (struct lcs_card *) data; | ||
1691 | daemonize("lgwstpln"); | ||
1692 | |||
1693 | if (!lcs_do_run_thread(card, LCS_STARTLAN_THREAD)) | ||
1694 | return 0; | ||
1695 | LCS_DBF_TEXT(4, trace, "lgwstpln"); | ||
1696 | if (card->dev) | ||
1697 | netif_stop_queue(card->dev); | ||
1698 | if (lcs_startlan(card) == 0) { | ||
1699 | netif_wake_queue(card->dev); | ||
1700 | card->state = DEV_STATE_UP; | ||
1701 | PRINT_INFO("LCS Startlan for device %s succeeded!\n", | ||
1702 | card->dev->name); | ||
1703 | |||
1704 | } else | ||
1705 | PRINT_ERR("LCS Startlan for device %s failed!\n", | ||
1706 | card->dev->name); | ||
1707 | lcs_clear_thread_running_bit(card, LCS_STARTLAN_THREAD); | ||
1708 | return 0; | ||
1709 | } | ||
1710 | |||
1711 | /** | ||
1712 | * Send startup command initiated by Lan Gateway | ||
1713 | */ | ||
1714 | static int | ||
1715 | lcs_lgw_startup_thread(void *data) | ||
1716 | { | ||
1717 | int rc; | ||
1718 | |||
1719 | struct lcs_card *card; | ||
1720 | |||
1721 | card = (struct lcs_card *) data; | ||
1722 | daemonize("lgwstaln"); | ||
1723 | |||
1724 | if (!lcs_do_run_thread(card, LCS_STARTUP_THREAD)) | ||
1725 | return 0; | ||
1726 | LCS_DBF_TEXT(4, trace, "lgwstaln"); | ||
1727 | if (card->dev) | ||
1728 | netif_stop_queue(card->dev); | ||
1729 | rc = lcs_send_startup(card, LCS_INITIATOR_LGW); | ||
1730 | if (rc != 0) { | ||
1731 | PRINT_ERR("Startup for LCS device %s initiated " \ | ||
1732 | "by LGW failed!\nReseting card ...\n", | ||
1733 | card->dev->name); | ||
1734 | /* do a card reset */ | ||
1735 | rc = lcs_resetcard(card); | ||
1736 | if (rc == 0) | ||
1737 | goto Done; | ||
1738 | } | ||
1739 | rc = lcs_startlan(card); | ||
1740 | if (rc == 0) { | ||
1741 | netif_wake_queue(card->dev); | ||
1742 | card->state = DEV_STATE_UP; | ||
1743 | } | ||
1744 | Done: | ||
1745 | if (rc == 0) | ||
1746 | PRINT_INFO("LCS Startup for device %s succeeded!\n", | ||
1747 | card->dev->name); | ||
1748 | else | ||
1749 | PRINT_ERR("LCS Startup for device %s failed!\n", | ||
1750 | card->dev->name); | ||
1751 | lcs_clear_thread_running_bit(card, LCS_STARTUP_THREAD); | ||
1752 | return 0; | ||
1753 | } | ||
1754 | |||
1755 | |||
1756 | /** | ||
1757 | * send stoplan command initiated by Lan Gateway | ||
1758 | */ | ||
1759 | static int | ||
1760 | lcs_lgw_stoplan_thread(void *data) | ||
1761 | { | ||
1762 | struct lcs_card *card; | ||
1763 | int rc; | ||
1764 | |||
1765 | card = (struct lcs_card *) data; | ||
1766 | daemonize("lgwstop"); | ||
1767 | |||
1768 | if (!lcs_do_run_thread(card, LCS_STOPLAN_THREAD)) | ||
1769 | return 0; | ||
1770 | LCS_DBF_TEXT(4, trace, "lgwstop"); | ||
1771 | if (card->dev) | ||
1772 | netif_stop_queue(card->dev); | ||
1773 | if (lcs_send_stoplan(card, LCS_INITIATOR_LGW) == 0) | ||
1774 | PRINT_INFO("Stoplan for %s initiated by LGW succeeded!\n", | ||
1775 | card->dev->name); | ||
1776 | else | ||
1777 | PRINT_ERR("Stoplan %s initiated by LGW failed!\n", | ||
1778 | card->dev->name); | ||
1779 | /*Try to reset the card, stop it on failure */ | ||
1780 | rc = lcs_resetcard(card); | ||
1781 | if (rc != 0) | ||
1782 | rc = lcs_stopcard(card); | ||
1783 | lcs_clear_thread_running_bit(card, LCS_STOPLAN_THREAD); | ||
1784 | return rc; | ||
1785 | } | ||
1786 | |||
1787 | /** | ||
1788 | * Kernel Thread helper functions for LGW initiated commands | 1726 | * Kernel Thread helper functions for LGW initiated commands |
1789 | */ | 1727 | */ |
1790 | static void | 1728 | static void |
1791 | lcs_start_kernel_thread(struct lcs_card *card) | 1729 | lcs_start_kernel_thread(struct lcs_card *card) |
1792 | { | 1730 | { |
1793 | LCS_DBF_TEXT(5, trace, "krnthrd"); | 1731 | LCS_DBF_TEXT(5, trace, "krnthrd"); |
1794 | if (lcs_do_start_thread(card, LCS_STARTUP_THREAD)) | 1732 | if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) |
1795 | kernel_thread(lcs_lgw_startup_thread, (void *) card, SIGCHLD); | 1733 | kernel_thread(lcs_recovery, (void *) card, SIGCHLD); |
1796 | if (lcs_do_start_thread(card, LCS_STARTLAN_THREAD)) | ||
1797 | kernel_thread(lcs_lgw_startlan_thread, (void *) card, SIGCHLD); | ||
1798 | if (lcs_do_start_thread(card, LCS_STOPLAN_THREAD)) | ||
1799 | kernel_thread(lcs_lgw_stoplan_thread, (void *) card, SIGCHLD); | ||
1800 | #ifdef CONFIG_IP_MULTICAST | 1734 | #ifdef CONFIG_IP_MULTICAST |
1801 | if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) | 1735 | if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) |
1802 | kernel_thread(lcs_register_mc_addresses, (void *) card, SIGCHLD); | 1736 | kernel_thread(lcs_register_mc_addresses, |
1737 | (void *) card, SIGCHLD); | ||
1803 | #endif | 1738 | #endif |
1804 | } | 1739 | } |
1805 | 1740 | ||
@@ -1813,19 +1748,14 @@ lcs_get_control(struct lcs_card *card, struct lcs_cmd *cmd) | |||
1813 | if (cmd->initiator == LCS_INITIATOR_LGW) { | 1748 | if (cmd->initiator == LCS_INITIATOR_LGW) { |
1814 | switch(cmd->cmd_code) { | 1749 | switch(cmd->cmd_code) { |
1815 | case LCS_CMD_STARTUP: | 1750 | case LCS_CMD_STARTUP: |
1816 | if (!lcs_set_thread_start_bit(card, | ||
1817 | LCS_STARTUP_THREAD)) | ||
1818 | schedule_work(&card->kernel_thread_starter); | ||
1819 | break; | ||
1820 | case LCS_CMD_STARTLAN: | 1751 | case LCS_CMD_STARTLAN: |
1821 | if (!lcs_set_thread_start_bit(card, | 1752 | lcs_schedule_recovery(card); |
1822 | LCS_STARTLAN_THREAD)) | ||
1823 | schedule_work(&card->kernel_thread_starter); | ||
1824 | break; | 1753 | break; |
1825 | case LCS_CMD_STOPLAN: | 1754 | case LCS_CMD_STOPLAN: |
1826 | if (!lcs_set_thread_start_bit(card, | 1755 | PRINT_WARN("Stoplan for %s initiated by LGW.\n", |
1827 | LCS_STOPLAN_THREAD)) | 1756 | card->dev->name); |
1828 | schedule_work(&card->kernel_thread_starter); | 1757 | if (card->dev) |
1758 | netif_carrier_off(card->dev); | ||
1829 | break; | 1759 | break; |
1830 | default: | 1760 | default: |
1831 | PRINT_INFO("UNRECOGNIZED LGW COMMAND\n"); | 1761 | PRINT_INFO("UNRECOGNIZED LGW COMMAND\n"); |
@@ -1941,8 +1871,11 @@ lcs_stop_device(struct net_device *dev) | |||
1941 | 1871 | ||
1942 | LCS_DBF_TEXT(2, trace, "stopdev"); | 1872 | LCS_DBF_TEXT(2, trace, "stopdev"); |
1943 | card = (struct lcs_card *) dev->priv; | 1873 | card = (struct lcs_card *) dev->priv; |
1944 | netif_stop_queue(dev); | 1874 | netif_carrier_off(dev); |
1875 | netif_tx_disable(dev); | ||
1945 | dev->flags &= ~IFF_UP; | 1876 | dev->flags &= ~IFF_UP; |
1877 | wait_event(card->write.wait_q, | ||
1878 | (card->write.state != CH_STATE_RUNNING)); | ||
1946 | rc = lcs_stopcard(card); | 1879 | rc = lcs_stopcard(card); |
1947 | if (rc) | 1880 | if (rc) |
1948 | PRINT_ERR("Try it again!\n "); | 1881 | PRINT_ERR("Try it again!\n "); |
@@ -1968,6 +1901,7 @@ lcs_open_device(struct net_device *dev) | |||
1968 | 1901 | ||
1969 | } else { | 1902 | } else { |
1970 | dev->flags |= IFF_UP; | 1903 | dev->flags |= IFF_UP; |
1904 | netif_carrier_on(dev); | ||
1971 | netif_wake_queue(dev); | 1905 | netif_wake_queue(dev); |
1972 | card->state = DEV_STATE_UP; | 1906 | card->state = DEV_STATE_UP; |
1973 | } | 1907 | } |
@@ -2059,10 +1993,31 @@ lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char | |||
2059 | 1993 | ||
2060 | DEVICE_ATTR(lancmd_timeout, 0644, lcs_timeout_show, lcs_timeout_store); | 1994 | DEVICE_ATTR(lancmd_timeout, 0644, lcs_timeout_show, lcs_timeout_store); |
2061 | 1995 | ||
1996 | static ssize_t | ||
1997 | lcs_dev_recover_store(struct device *dev, struct device_attribute *attr, | ||
1998 | const char *buf, size_t count) | ||
1999 | { | ||
2000 | struct lcs_card *card = dev->driver_data; | ||
2001 | char *tmp; | ||
2002 | int i; | ||
2003 | |||
2004 | if (!card) | ||
2005 | return -EINVAL; | ||
2006 | if (card->state != DEV_STATE_UP) | ||
2007 | return -EPERM; | ||
2008 | i = simple_strtoul(buf, &tmp, 16); | ||
2009 | if (i == 1) | ||
2010 | lcs_schedule_recovery(card); | ||
2011 | return count; | ||
2012 | } | ||
2013 | |||
2014 | static DEVICE_ATTR(recover, 0200, NULL, lcs_dev_recover_store); | ||
2015 | |||
2062 | static struct attribute * lcs_attrs[] = { | 2016 | static struct attribute * lcs_attrs[] = { |
2063 | &dev_attr_portno.attr, | 2017 | &dev_attr_portno.attr, |
2064 | &dev_attr_type.attr, | 2018 | &dev_attr_type.attr, |
2065 | &dev_attr_lancmd_timeout.attr, | 2019 | &dev_attr_lancmd_timeout.attr, |
2020 | &dev_attr_recover.attr, | ||
2066 | NULL, | 2021 | NULL, |
2067 | }; | 2022 | }; |
2068 | 2023 | ||
@@ -2099,6 +2054,12 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev) | |||
2099 | ccwgdev->dev.driver_data = card; | 2054 | ccwgdev->dev.driver_data = card; |
2100 | ccwgdev->cdev[0]->handler = lcs_irq; | 2055 | ccwgdev->cdev[0]->handler = lcs_irq; |
2101 | ccwgdev->cdev[1]->handler = lcs_irq; | 2056 | ccwgdev->cdev[1]->handler = lcs_irq; |
2057 | card->gdev = ccwgdev; | ||
2058 | INIT_WORK(&card->kernel_thread_starter, | ||
2059 | (void *) lcs_start_kernel_thread, card); | ||
2060 | card->thread_start_mask = 0; | ||
2061 | card->thread_allowed_mask = 0; | ||
2062 | card->thread_running_mask = 0; | ||
2102 | return 0; | 2063 | return 0; |
2103 | } | 2064 | } |
2104 | 2065 | ||
@@ -2200,6 +2161,7 @@ netdev_out: | |||
2200 | if (recover_state == DEV_STATE_RECOVER) { | 2161 | if (recover_state == DEV_STATE_RECOVER) { |
2201 | lcs_set_multicast_list(card->dev); | 2162 | lcs_set_multicast_list(card->dev); |
2202 | card->dev->flags |= IFF_UP; | 2163 | card->dev->flags |= IFF_UP; |
2164 | netif_carrier_on(card->dev); | ||
2203 | netif_wake_queue(card->dev); | 2165 | netif_wake_queue(card->dev); |
2204 | card->state = DEV_STATE_UP; | 2166 | card->state = DEV_STATE_UP; |
2205 | } else { | 2167 | } else { |
@@ -2229,7 +2191,7 @@ out: | |||
2229 | * lcs_shutdown_device, called when setting the group device offline. | 2191 | * lcs_shutdown_device, called when setting the group device offline. |
2230 | */ | 2192 | */ |
2231 | static int | 2193 | static int |
2232 | lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | 2194 | __lcs_shutdown_device(struct ccwgroup_device *ccwgdev, int recovery_mode) |
2233 | { | 2195 | { |
2234 | struct lcs_card *card; | 2196 | struct lcs_card *card; |
2235 | enum lcs_dev_states recover_state; | 2197 | enum lcs_dev_states recover_state; |
@@ -2239,9 +2201,11 @@ lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | |||
2239 | card = (struct lcs_card *)ccwgdev->dev.driver_data; | 2201 | card = (struct lcs_card *)ccwgdev->dev.driver_data; |
2240 | if (!card) | 2202 | if (!card) |
2241 | return -ENODEV; | 2203 | return -ENODEV; |
2242 | lcs_set_allowed_threads(card, 0); | 2204 | if (recovery_mode == 0) { |
2243 | if (lcs_wait_for_threads(card, LCS_SET_MC_THREAD)) | 2205 | lcs_set_allowed_threads(card, 0); |
2244 | return -ERESTARTSYS; | 2206 | if (lcs_wait_for_threads(card, LCS_SET_MC_THREAD)) |
2207 | return -ERESTARTSYS; | ||
2208 | } | ||
2245 | LCS_DBF_HEX(3, setup, &card, sizeof(void*)); | 2209 | LCS_DBF_HEX(3, setup, &card, sizeof(void*)); |
2246 | recover_state = card->state; | 2210 | recover_state = card->state; |
2247 | 2211 | ||
@@ -2256,6 +2220,43 @@ lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | |||
2256 | return 0; | 2220 | return 0; |
2257 | } | 2221 | } |
2258 | 2222 | ||
2223 | static int | ||
2224 | lcs_shutdown_device(struct ccwgroup_device *ccwgdev) | ||
2225 | { | ||
2226 | return __lcs_shutdown_device(ccwgdev, 0); | ||
2227 | } | ||
2228 | |||
2229 | /** | ||
2230 | * drive lcs recovery after startup and startlan initiated by Lan Gateway | ||
2231 | */ | ||
2232 | static int | ||
2233 | lcs_recovery(void *ptr) | ||
2234 | { | ||
2235 | struct lcs_card *card; | ||
2236 | struct ccwgroup_device *gdev; | ||
2237 | int rc; | ||
2238 | |||
2239 | card = (struct lcs_card *) ptr; | ||
2240 | daemonize("lcs_recover"); | ||
2241 | |||
2242 | LCS_DBF_TEXT(4, trace, "recover1"); | ||
2243 | if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD)) | ||
2244 | return 0; | ||
2245 | LCS_DBF_TEXT(4, trace, "recover2"); | ||
2246 | gdev = card->gdev; | ||
2247 | PRINT_WARN("Recovery of device %s started...\n", gdev->dev.bus_id); | ||
2248 | rc = __lcs_shutdown_device(gdev, 1); | ||
2249 | rc = lcs_new_device(gdev); | ||
2250 | if (!rc) | ||
2251 | PRINT_INFO("Device %s successfully recovered!\n", | ||
2252 | card->dev->name); | ||
2253 | else | ||
2254 | PRINT_INFO("Device %s could not be recovered!\n", | ||
2255 | card->dev->name); | ||
2256 | lcs_clear_thread_running_bit(card, LCS_RECOVERY_THREAD); | ||
2257 | return 0; | ||
2258 | } | ||
2259 | |||
2259 | /** | 2260 | /** |
2260 | * lcs_remove_device, free buffers and card | 2261 | * lcs_remove_device, free buffers and card |
2261 | */ | 2262 | */ |
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h index 2fad5e40c2e4..93143932983b 100644 --- a/drivers/s390/net/lcs.h +++ b/drivers/s390/net/lcs.h | |||
@@ -73,13 +73,17 @@ do { \ | |||
73 | /** | 73 | /** |
74 | * LCS sense byte definitions | 74 | * LCS sense byte definitions |
75 | */ | 75 | */ |
76 | #define LCS_SENSE_BYTE_0 0 | ||
77 | #define LCS_SENSE_BYTE_1 1 | ||
78 | #define LCS_SENSE_BYTE_2 2 | ||
79 | #define LCS_SENSE_BYTE_3 3 | ||
76 | #define LCS_SENSE_INTERFACE_DISCONNECT 0x01 | 80 | #define LCS_SENSE_INTERFACE_DISCONNECT 0x01 |
77 | #define LCS_SENSE_EQUIPMENT_CHECK 0x10 | 81 | #define LCS_SENSE_EQUIPMENT_CHECK 0x10 |
78 | #define LCS_SENSE_BUS_OUT_CHECK 0x20 | 82 | #define LCS_SENSE_BUS_OUT_CHECK 0x20 |
79 | #define LCS_SENSE_INTERVENTION_REQUIRED 0x40 | 83 | #define LCS_SENSE_INTERVENTION_REQUIRED 0x40 |
80 | #define LCS_SENSE_CMD_REJECT 0x80 | 84 | #define LCS_SENSE_CMD_REJECT 0x80 |
81 | #define LCS_SENSE_RESETTING_EVENT 0x0080 | 85 | #define LCS_SENSE_RESETTING_EVENT 0x80 |
82 | #define LCS_SENSE_DEVICE_ONLINE 0x0020 | 86 | #define LCS_SENSE_DEVICE_ONLINE 0x20 |
83 | 87 | ||
84 | /** | 88 | /** |
85 | * LCS packet type definitions | 89 | * LCS packet type definitions |
@@ -152,10 +156,9 @@ enum lcs_dev_states { | |||
152 | 156 | ||
153 | enum lcs_threads { | 157 | enum lcs_threads { |
154 | LCS_SET_MC_THREAD = 1, | 158 | LCS_SET_MC_THREAD = 1, |
155 | LCS_STARTLAN_THREAD = 2, | 159 | LCS_RECOVERY_THREAD = 2, |
156 | LCS_STOPLAN_THREAD = 4, | ||
157 | LCS_STARTUP_THREAD = 8, | ||
158 | }; | 160 | }; |
161 | |||
159 | /** | 162 | /** |
160 | * LCS struct declarations | 163 | * LCS struct declarations |
161 | */ | 164 | */ |
@@ -286,6 +289,7 @@ struct lcs_card { | |||
286 | struct net_device_stats stats; | 289 | struct net_device_stats stats; |
287 | unsigned short (*lan_type_trans)(struct sk_buff *skb, | 290 | unsigned short (*lan_type_trans)(struct sk_buff *skb, |
288 | struct net_device *dev); | 291 | struct net_device *dev); |
292 | struct ccwgroup_device *gdev; | ||
289 | struct lcs_channel read; | 293 | struct lcs_channel read; |
290 | struct lcs_channel write; | 294 | struct lcs_channel write; |
291 | struct lcs_buffer *tx_buffer; | 295 | struct lcs_buffer *tx_buffer; |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 260a93c8c442..b452cc1afd55 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -30,7 +30,7 @@ | |||
30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #undef DEBUG | 34 | #undef DEBUG |
35 | 35 | ||
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
@@ -65,7 +65,7 @@ MODULE_AUTHOR | |||
65 | ("(C) 2001 IBM Corporation by Fritz Elfert (felfert@millenux.com)"); | 65 | ("(C) 2001 IBM Corporation by Fritz Elfert (felfert@millenux.com)"); |
66 | MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver"); | 66 | MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver"); |
67 | 67 | ||
68 | 68 | ||
69 | #define PRINTK_HEADER " iucv: " /* for debugging */ | 69 | #define PRINTK_HEADER " iucv: " /* for debugging */ |
70 | 70 | ||
71 | static struct device_driver netiucv_driver = { | 71 | static struct device_driver netiucv_driver = { |
@@ -202,7 +202,7 @@ netiucv_printname(char *name) | |||
202 | *p = '\0'; | 202 | *p = '\0'; |
203 | return tmp; | 203 | return tmp; |
204 | } | 204 | } |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * States of the interface statemachine. | 207 | * States of the interface statemachine. |
208 | */ | 208 | */ |
@@ -244,7 +244,7 @@ static const char *dev_event_names[] = { | |||
244 | "Connection up", | 244 | "Connection up", |
245 | "Connection down", | 245 | "Connection down", |
246 | }; | 246 | }; |
247 | 247 | ||
248 | /** | 248 | /** |
249 | * Events of the connection statemachine | 249 | * Events of the connection statemachine |
250 | */ | 250 | */ |
@@ -364,7 +364,7 @@ static const char *conn_state_names[] = { | |||
364 | "Connect error", | 364 | "Connect error", |
365 | }; | 365 | }; |
366 | 366 | ||
367 | 367 | ||
368 | /** | 368 | /** |
369 | * Debug Facility Stuff | 369 | * Debug Facility Stuff |
370 | */ | 370 | */ |
@@ -516,7 +516,7 @@ static void | |||
516 | fsm_action_nop(fsm_instance *fi, int event, void *arg) | 516 | fsm_action_nop(fsm_instance *fi, int event, void *arg) |
517 | { | 517 | { |
518 | } | 518 | } |
519 | 519 | ||
520 | /** | 520 | /** |
521 | * Actions of the connection statemachine | 521 | * Actions of the connection statemachine |
522 | *****************************************************************************/ | 522 | *****************************************************************************/ |
@@ -993,7 +993,7 @@ static const fsm_node conn_fsm[] = { | |||
993 | 993 | ||
994 | static const int CONN_FSM_LEN = sizeof(conn_fsm) / sizeof(fsm_node); | 994 | static const int CONN_FSM_LEN = sizeof(conn_fsm) / sizeof(fsm_node); |
995 | 995 | ||
996 | 996 | ||
997 | /** | 997 | /** |
998 | * Actions for interface - statemachine. | 998 | * Actions for interface - statemachine. |
999 | *****************************************************************************/ | 999 | *****************************************************************************/ |
@@ -1182,7 +1182,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) { | |||
1182 | 1182 | ||
1183 | fsm_newstate(conn->fsm, CONN_STATE_TX); | 1183 | fsm_newstate(conn->fsm, CONN_STATE_TX); |
1184 | conn->prof.send_stamp = xtime; | 1184 | conn->prof.send_stamp = xtime; |
1185 | 1185 | ||
1186 | rc = iucv_send(conn->pathid, NULL, 0, 0, 1 /* single_flag */, | 1186 | rc = iucv_send(conn->pathid, NULL, 0, 0, 1 /* single_flag */, |
1187 | 0, nskb->data, nskb->len); | 1187 | 0, nskb->data, nskb->len); |
1188 | /* Shut up, gcc! nskb is always below 2G. */ | 1188 | /* Shut up, gcc! nskb is always below 2G. */ |
@@ -1220,7 +1220,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) { | |||
1220 | 1220 | ||
1221 | return rc; | 1221 | return rc; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | /** | 1224 | /** |
1225 | * Interface API for upper network layers | 1225 | * Interface API for upper network layers |
1226 | *****************************************************************************/ | 1226 | *****************************************************************************/ |
@@ -1291,7 +1291,7 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev) | |||
1291 | 1291 | ||
1292 | /** | 1292 | /** |
1293 | * If connection is not running, try to restart it | 1293 | * If connection is not running, try to restart it |
1294 | * and throw away packet. | 1294 | * and throw away packet. |
1295 | */ | 1295 | */ |
1296 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { | 1296 | if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { |
1297 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); | 1297 | fsm_event(privptr->fsm, DEV_EVENT_START, dev); |
@@ -1538,7 +1538,7 @@ static ssize_t | |||
1538 | maxcq_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1538 | maxcq_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1539 | { | 1539 | { |
1540 | struct netiucv_priv *priv = dev->driver_data; | 1540 | struct netiucv_priv *priv = dev->driver_data; |
1541 | 1541 | ||
1542 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1542 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1543 | priv->conn->prof.maxcqueue = 0; | 1543 | priv->conn->prof.maxcqueue = 0; |
1544 | return count; | 1544 | return count; |
@@ -1559,7 +1559,7 @@ static ssize_t | |||
1559 | sdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1559 | sdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1560 | { | 1560 | { |
1561 | struct netiucv_priv *priv = dev->driver_data; | 1561 | struct netiucv_priv *priv = dev->driver_data; |
1562 | 1562 | ||
1563 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1563 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1564 | priv->conn->prof.doios_single = 0; | 1564 | priv->conn->prof.doios_single = 0; |
1565 | return count; | 1565 | return count; |
@@ -1580,7 +1580,7 @@ static ssize_t | |||
1580 | mdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1580 | mdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1581 | { | 1581 | { |
1582 | struct netiucv_priv *priv = dev->driver_data; | 1582 | struct netiucv_priv *priv = dev->driver_data; |
1583 | 1583 | ||
1584 | IUCV_DBF_TEXT(trace, 5, __FUNCTION__); | 1584 | IUCV_DBF_TEXT(trace, 5, __FUNCTION__); |
1585 | priv->conn->prof.doios_multi = 0; | 1585 | priv->conn->prof.doios_multi = 0; |
1586 | return count; | 1586 | return count; |
@@ -1601,7 +1601,7 @@ static ssize_t | |||
1601 | txlen_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1601 | txlen_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1602 | { | 1602 | { |
1603 | struct netiucv_priv *priv = dev->driver_data; | 1603 | struct netiucv_priv *priv = dev->driver_data; |
1604 | 1604 | ||
1605 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1605 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1606 | priv->conn->prof.txlen = 0; | 1606 | priv->conn->prof.txlen = 0; |
1607 | return count; | 1607 | return count; |
@@ -1622,7 +1622,7 @@ static ssize_t | |||
1622 | txtime_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1622 | txtime_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1623 | { | 1623 | { |
1624 | struct netiucv_priv *priv = dev->driver_data; | 1624 | struct netiucv_priv *priv = dev->driver_data; |
1625 | 1625 | ||
1626 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); | 1626 | IUCV_DBF_TEXT(trace, 4, __FUNCTION__); |
1627 | priv->conn->prof.tx_time = 0; | 1627 | priv->conn->prof.tx_time = 0; |
1628 | return count; | 1628 | return count; |
@@ -2000,7 +2000,7 @@ conn_write(struct device_driver *drv, const char *buf, size_t count) | |||
2000 | } | 2000 | } |
2001 | 2001 | ||
2002 | PRINT_INFO("%s: '%s'\n", dev->name, netiucv_printname(username)); | 2002 | PRINT_INFO("%s: '%s'\n", dev->name, netiucv_printname(username)); |
2003 | 2003 | ||
2004 | return count; | 2004 | return count; |
2005 | 2005 | ||
2006 | out_free_ndev: | 2006 | out_free_ndev: |
@@ -2099,7 +2099,7 @@ static int __init | |||
2099 | netiucv_init(void) | 2099 | netiucv_init(void) |
2100 | { | 2100 | { |
2101 | int ret; | 2101 | int ret; |
2102 | 2102 | ||
2103 | ret = iucv_register_dbf_views(); | 2103 | ret = iucv_register_dbf_views(); |
2104 | if (ret) { | 2104 | if (ret) { |
2105 | PRINT_WARN("netiucv_init failed, " | 2105 | PRINT_WARN("netiucv_init failed, " |
@@ -2128,7 +2128,7 @@ netiucv_init(void) | |||
2128 | } | 2128 | } |
2129 | return ret; | 2129 | return ret; |
2130 | } | 2130 | } |
2131 | 2131 | ||
2132 | module_init(netiucv_init); | 2132 | module_init(netiucv_init); |
2133 | module_exit(netiucv_exit); | 2133 | module_exit(netiucv_exit); |
2134 | MODULE_LICENSE("GPL"); | 2134 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 4df0fcd7b10b..619f4a0c7160 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
@@ -376,7 +376,7 @@ struct qeth_hdr_osn { | |||
376 | __u8 reserved3[18]; | 376 | __u8 reserved3[18]; |
377 | __u32 ccid; | 377 | __u32 ccid; |
378 | } __attribute__ ((packed)); | 378 | } __attribute__ ((packed)); |
379 | 379 | ||
380 | struct qeth_hdr { | 380 | struct qeth_hdr { |
381 | union { | 381 | union { |
382 | struct qeth_hdr_layer2 l2; | 382 | struct qeth_hdr_layer2 l2; |
@@ -825,7 +825,7 @@ struct qeth_card { | |||
825 | int use_hard_stop; | 825 | int use_hard_stop; |
826 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, | 826 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, |
827 | unsigned short,void *,void *,unsigned); | 827 | unsigned short,void *,void *,unsigned); |
828 | struct qeth_osn_info osn_info; | 828 | struct qeth_osn_info osn_info; |
829 | }; | 829 | }; |
830 | 830 | ||
831 | struct qeth_card_list_struct { | 831 | struct qeth_card_list_struct { |
@@ -944,7 +944,7 @@ qeth_get_netdev_flags(struct qeth_card *card) | |||
944 | return 0; | 944 | return 0; |
945 | switch (card->info.type) { | 945 | switch (card->info.type) { |
946 | case QETH_CARD_TYPE_IQD: | 946 | case QETH_CARD_TYPE_IQD: |
947 | case QETH_CARD_TYPE_OSN: | 947 | case QETH_CARD_TYPE_OSN: |
948 | return IFF_NOARP; | 948 | return IFF_NOARP; |
949 | #ifdef CONFIG_QETH_IPV6 | 949 | #ifdef CONFIG_QETH_IPV6 |
950 | default: | 950 | default: |
@@ -981,7 +981,7 @@ static inline int | |||
981 | qeth_get_max_mtu_for_card(int cardtype) | 981 | qeth_get_max_mtu_for_card(int cardtype) |
982 | { | 982 | { |
983 | switch (cardtype) { | 983 | switch (cardtype) { |
984 | 984 | ||
985 | case QETH_CARD_TYPE_UNKNOWN: | 985 | case QETH_CARD_TYPE_UNKNOWN: |
986 | case QETH_CARD_TYPE_OSAE: | 986 | case QETH_CARD_TYPE_OSAE: |
987 | case QETH_CARD_TYPE_OSN: | 987 | case QETH_CARD_TYPE_OSN: |
@@ -1097,9 +1097,9 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr) | |||
1097 | int count = 0, rc = 0; | 1097 | int count = 0, rc = 0; |
1098 | int in[4]; | 1098 | int in[4]; |
1099 | 1099 | ||
1100 | rc = sscanf(buf, "%d.%d.%d.%d%n", | 1100 | rc = sscanf(buf, "%d.%d.%d.%d%n", |
1101 | &in[0], &in[1], &in[2], &in[3], &count); | 1101 | &in[0], &in[1], &in[2], &in[3], &count); |
1102 | if (rc != 4 || count) | 1102 | if (rc != 4 || count<=0) |
1103 | return -EINVAL; | 1103 | return -EINVAL; |
1104 | for (count = 0; count < 4; count++) { | 1104 | for (count = 0; count < 4; count++) { |
1105 | if (in[count] > 255) | 1105 | if (in[count] > 255) |
@@ -1131,7 +1131,7 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | |||
1131 | 1131 | ||
1132 | cnt = out = found = save_cnt = num2 = 0; | 1132 | cnt = out = found = save_cnt = num2 = 0; |
1133 | end = start = (char *) buf; | 1133 | end = start = (char *) buf; |
1134 | in = (__u16 *) addr; | 1134 | in = (__u16 *) addr; |
1135 | memset(in, 0, 16); | 1135 | memset(in, 0, 16); |
1136 | while (end) { | 1136 | while (end) { |
1137 | end = strchr(end,':'); | 1137 | end = strchr(end,':'); |
@@ -1139,7 +1139,7 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr) | |||
1139 | end = (char *)buf + (strlen(buf)); | 1139 | end = (char *)buf + (strlen(buf)); |
1140 | out = 1; | 1140 | out = 1; |
1141 | } | 1141 | } |
1142 | if ((end - start)) { | 1142 | if ((end - start)) { |
1143 | memset(num, 0, 5); | 1143 | memset(num, 0, 5); |
1144 | memcpy(num, start, end - start); | 1144 | memcpy(num, start, end - start); |
1145 | if (!qeth_isxdigit(num)) | 1145 | if (!qeth_isxdigit(num)) |
@@ -1241,5 +1241,5 @@ qeth_osn_register(unsigned char *read_dev_no, | |||
1241 | 1241 | ||
1242 | extern void | 1242 | extern void |
1243 | qeth_osn_deregister(struct net_device *); | 1243 | qeth_osn_deregister(struct net_device *); |
1244 | 1244 | ||
1245 | #endif /* __QETH_H__ */ | 1245 | #endif /* __QETH_H__ */ |
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 44e226f211e7..0bab60a20309 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c | |||
@@ -81,7 +81,7 @@ void | |||
81 | qeth_eddp_buf_release_contexts(struct qeth_qdio_out_buffer *buf) | 81 | qeth_eddp_buf_release_contexts(struct qeth_qdio_out_buffer *buf) |
82 | { | 82 | { |
83 | struct qeth_eddp_context_reference *ref; | 83 | struct qeth_eddp_context_reference *ref; |
84 | 84 | ||
85 | QETH_DBF_TEXT(trace, 6, "eddprctx"); | 85 | QETH_DBF_TEXT(trace, 6, "eddprctx"); |
86 | while (!list_empty(&buf->ctx_list)){ | 86 | while (!list_empty(&buf->ctx_list)){ |
87 | ref = list_entry(buf->ctx_list.next, | 87 | ref = list_entry(buf->ctx_list.next, |
@@ -135,7 +135,7 @@ qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue, | |||
135 | "buffer!\n"); | 135 | "buffer!\n"); |
136 | goto out; | 136 | goto out; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | /* check if the whole next skb fits into current buffer */ | 139 | /* check if the whole next skb fits into current buffer */ |
140 | if ((QETH_MAX_BUFFER_ELEMENTS(queue->card) - | 140 | if ((QETH_MAX_BUFFER_ELEMENTS(queue->card) - |
141 | buf->next_element_to_fill) | 141 | buf->next_element_to_fill) |
@@ -148,7 +148,7 @@ qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue, | |||
148 | * and increment ctx's refcnt */ | 148 | * and increment ctx's refcnt */ |
149 | must_refcnt = 1; | 149 | must_refcnt = 1; |
150 | continue; | 150 | continue; |
151 | } | 151 | } |
152 | if (must_refcnt){ | 152 | if (must_refcnt){ |
153 | must_refcnt = 0; | 153 | must_refcnt = 0; |
154 | if (qeth_eddp_buf_ref_context(buf, ctx)){ | 154 | if (qeth_eddp_buf_ref_context(buf, ctx)){ |
@@ -266,7 +266,7 @@ qeth_eddp_copy_data_tcp(char *dst, struct qeth_eddp_data *eddp, int len, | |||
266 | int left_in_frag; | 266 | int left_in_frag; |
267 | int copy_len; | 267 | int copy_len; |
268 | u8 *src; | 268 | u8 *src; |
269 | 269 | ||
270 | QETH_DBF_TEXT(trace, 5, "eddpcdtc"); | 270 | QETH_DBF_TEXT(trace, 5, "eddpcdtc"); |
271 | if (skb_shinfo(eddp->skb)->nr_frags == 0) { | 271 | if (skb_shinfo(eddp->skb)->nr_frags == 0) { |
272 | memcpy(dst, eddp->skb->data + eddp->skb_offset, len); | 272 | memcpy(dst, eddp->skb->data + eddp->skb_offset, len); |
@@ -408,7 +408,7 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | |||
408 | struct tcphdr *tcph; | 408 | struct tcphdr *tcph; |
409 | int data_len; | 409 | int data_len; |
410 | u32 hcsum; | 410 | u32 hcsum; |
411 | 411 | ||
412 | QETH_DBF_TEXT(trace, 5, "eddpftcp"); | 412 | QETH_DBF_TEXT(trace, 5, "eddpftcp"); |
413 | eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl; | 413 | eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl; |
414 | if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2) { | 414 | if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2) { |
@@ -465,13 +465,13 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | |||
465 | eddp->th.tcp.h.seq += data_len; | 465 | eddp->th.tcp.h.seq += data_len; |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | static inline int | 469 | static inline int |
470 | qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, | 470 | qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx, |
471 | struct sk_buff *skb, struct qeth_hdr *qhdr) | 471 | struct sk_buff *skb, struct qeth_hdr *qhdr) |
472 | { | 472 | { |
473 | struct qeth_eddp_data *eddp = NULL; | 473 | struct qeth_eddp_data *eddp = NULL; |
474 | 474 | ||
475 | QETH_DBF_TEXT(trace, 5, "eddpficx"); | 475 | QETH_DBF_TEXT(trace, 5, "eddpficx"); |
476 | /* create our segmentation headers and copy original headers */ | 476 | /* create our segmentation headers and copy original headers */ |
477 | if (skb->protocol == ETH_P_IP) | 477 | if (skb->protocol == ETH_P_IP) |
@@ -512,7 +512,7 @@ qeth_eddp_calc_num_pages(struct qeth_eddp_context *ctx, struct sk_buff *skb, | |||
512 | int hdr_len) | 512 | int hdr_len) |
513 | { | 513 | { |
514 | int skbs_per_page; | 514 | int skbs_per_page; |
515 | 515 | ||
516 | QETH_DBF_TEXT(trace, 5, "eddpcanp"); | 516 | QETH_DBF_TEXT(trace, 5, "eddpcanp"); |
517 | /* can we put multiple skbs in one page? */ | 517 | /* can we put multiple skbs in one page? */ |
518 | skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len); | 518 | skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len); |
@@ -588,7 +588,7 @@ qeth_eddp_create_context_tcp(struct qeth_card *card, struct sk_buff *skb, | |||
588 | struct qeth_hdr *qhdr) | 588 | struct qeth_hdr *qhdr) |
589 | { | 589 | { |
590 | struct qeth_eddp_context *ctx = NULL; | 590 | struct qeth_eddp_context *ctx = NULL; |
591 | 591 | ||
592 | QETH_DBF_TEXT(trace, 5, "creddpct"); | 592 | QETH_DBF_TEXT(trace, 5, "creddpct"); |
593 | if (skb->protocol == ETH_P_IP) | 593 | if (skb->protocol == ETH_P_IP) |
594 | ctx = qeth_eddp_create_context_generic(card, skb, | 594 | ctx = qeth_eddp_create_context_generic(card, skb, |
diff --git a/drivers/s390/net/qeth_fs.h b/drivers/s390/net/qeth_fs.h index e422b41c656e..61faf05517d6 100644 --- a/drivers/s390/net/qeth_fs.h +++ b/drivers/s390/net/qeth_fs.h | |||
@@ -42,7 +42,7 @@ qeth_create_device_attributes_osn(struct device *dev); | |||
42 | 42 | ||
43 | extern void | 43 | extern void |
44 | qeth_remove_device_attributes_osn(struct device *dev); | 44 | qeth_remove_device_attributes_osn(struct device *dev); |
45 | 45 | ||
46 | extern int | 46 | extern int |
47 | qeth_create_driver_attributes(void); | 47 | qeth_create_driver_attributes(void); |
48 | 48 | ||
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index cb14642d97aa..9e671a48cd2f 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -513,7 +513,7 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) | |||
513 | 513 | ||
514 | QETH_DBF_TEXT(setup, 3, "setoffl"); | 514 | QETH_DBF_TEXT(setup, 3, "setoffl"); |
515 | QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); | 515 | QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); |
516 | 516 | ||
517 | if (card->dev && netif_carrier_ok(card->dev)) | 517 | if (card->dev && netif_carrier_ok(card->dev)) |
518 | netif_carrier_off(card->dev); | 518 | netif_carrier_off(card->dev); |
519 | recover_flag = card->state; | 519 | recover_flag = card->state; |
@@ -604,13 +604,13 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo, | |||
604 | list_for_each_entry(addr, &card->ip_list, entry) { | 604 | list_for_each_entry(addr, &card->ip_list, entry) { |
605 | if (card->options.layer2) { | 605 | if (card->options.layer2) { |
606 | if ((addr->type == todo->type) && | 606 | if ((addr->type == todo->type) && |
607 | (memcmp(&addr->mac, &todo->mac, | 607 | (memcmp(&addr->mac, &todo->mac, |
608 | OSA_ADDR_LEN) == 0)) { | 608 | OSA_ADDR_LEN) == 0)) { |
609 | found = 1; | 609 | found = 1; |
610 | break; | 610 | break; |
611 | } | 611 | } |
612 | continue; | 612 | continue; |
613 | } | 613 | } |
614 | if ((addr->proto == QETH_PROT_IPV4) && | 614 | if ((addr->proto == QETH_PROT_IPV4) && |
615 | (todo->proto == QETH_PROT_IPV4) && | 615 | (todo->proto == QETH_PROT_IPV4) && |
616 | (addr->type == todo->type) && | 616 | (addr->type == todo->type) && |
@@ -694,13 +694,13 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add) | |||
694 | if (card->options.layer2) { | 694 | if (card->options.layer2) { |
695 | if ((tmp->type == addr->type) && | 695 | if ((tmp->type == addr->type) && |
696 | (tmp->is_multicast == addr->is_multicast) && | 696 | (tmp->is_multicast == addr->is_multicast) && |
697 | (memcmp(&tmp->mac, &addr->mac, | 697 | (memcmp(&tmp->mac, &addr->mac, |
698 | OSA_ADDR_LEN) == 0)) { | 698 | OSA_ADDR_LEN) == 0)) { |
699 | found = 1; | 699 | found = 1; |
700 | break; | 700 | break; |
701 | } | 701 | } |
702 | continue; | 702 | continue; |
703 | } | 703 | } |
704 | if ((tmp->proto == QETH_PROT_IPV4) && | 704 | if ((tmp->proto == QETH_PROT_IPV4) && |
705 | (addr->proto == QETH_PROT_IPV4) && | 705 | (addr->proto == QETH_PROT_IPV4) && |
706 | (tmp->type == addr->type) && | 706 | (tmp->type == addr->type) && |
@@ -1173,7 +1173,7 @@ qeth_determine_card_type(struct qeth_card *card) | |||
1173 | "due to hardware limitations!\n"); | 1173 | "due to hardware limitations!\n"); |
1174 | card->qdio.no_out_queues = 1; | 1174 | card->qdio.no_out_queues = 1; |
1175 | card->qdio.default_out_queue = 0; | 1175 | card->qdio.default_out_queue = 0; |
1176 | } | 1176 | } |
1177 | return 0; | 1177 | return 0; |
1178 | } | 1178 | } |
1179 | i++; | 1179 | i++; |
@@ -1198,7 +1198,7 @@ qeth_probe_device(struct ccwgroup_device *gdev) | |||
1198 | return -ENODEV; | 1198 | return -ENODEV; |
1199 | 1199 | ||
1200 | QETH_DBF_TEXT_(setup, 2, "%s", gdev->dev.bus_id); | 1200 | QETH_DBF_TEXT_(setup, 2, "%s", gdev->dev.bus_id); |
1201 | 1201 | ||
1202 | card = qeth_alloc_card(); | 1202 | card = qeth_alloc_card(); |
1203 | if (!card) { | 1203 | if (!card) { |
1204 | put_device(dev); | 1204 | put_device(dev); |
@@ -1220,7 +1220,7 @@ qeth_probe_device(struct ccwgroup_device *gdev) | |||
1220 | put_device(dev); | 1220 | put_device(dev); |
1221 | qeth_free_card(card); | 1221 | qeth_free_card(card); |
1222 | return rc; | 1222 | return rc; |
1223 | } | 1223 | } |
1224 | if ((rc = qeth_setup_card(card))){ | 1224 | if ((rc = qeth_setup_card(card))){ |
1225 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); | 1225 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); |
1226 | put_device(dev); | 1226 | put_device(dev); |
@@ -1843,7 +1843,7 @@ struct qeth_cmd_buffer *iob) | |||
1843 | &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); | 1843 | &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); |
1844 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); | 1844 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | static int | 1847 | static int |
1848 | qeth_send_control_data(struct qeth_card *card, int len, | 1848 | qeth_send_control_data(struct qeth_card *card, int len, |
1849 | struct qeth_cmd_buffer *iob, | 1849 | struct qeth_cmd_buffer *iob, |
@@ -1937,7 +1937,7 @@ qeth_osn_send_control_data(struct qeth_card *card, int len, | |||
1937 | wake_up(&card->wait_q); | 1937 | wake_up(&card->wait_q); |
1938 | } | 1938 | } |
1939 | return rc; | 1939 | return rc; |
1940 | } | 1940 | } |
1941 | 1941 | ||
1942 | static inline void | 1942 | static inline void |
1943 | qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | 1943 | qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, |
@@ -1966,7 +1966,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | |||
1966 | memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2); | 1966 | memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2); |
1967 | return qeth_osn_send_control_data(card, s1, iob); | 1967 | return qeth_osn_send_control_data(card, s1, iob); |
1968 | } | 1968 | } |
1969 | 1969 | ||
1970 | static int | 1970 | static int |
1971 | qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | 1971 | qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, |
1972 | int (*reply_cb) | 1972 | int (*reply_cb) |
@@ -2579,7 +2579,7 @@ qeth_process_inbound_buffer(struct qeth_card *card, | |||
2579 | skb->dev = card->dev; | 2579 | skb->dev = card->dev; |
2580 | if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) | 2580 | if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) |
2581 | vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr); | 2581 | vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr); |
2582 | else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3) | 2582 | else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3) |
2583 | qeth_rebuild_skb(card, skb, hdr); | 2583 | qeth_rebuild_skb(card, skb, hdr); |
2584 | else { /*in case of OSN*/ | 2584 | else { /*in case of OSN*/ |
2585 | skb_push(skb, sizeof(struct qeth_hdr)); | 2585 | skb_push(skb, sizeof(struct qeth_hdr)); |
@@ -2763,7 +2763,7 @@ qeth_qdio_input_handler(struct ccw_device * ccwdev, unsigned int status, | |||
2763 | index = i % QDIO_MAX_BUFFERS_PER_Q; | 2763 | index = i % QDIO_MAX_BUFFERS_PER_Q; |
2764 | buffer = &card->qdio.in_q->bufs[index]; | 2764 | buffer = &card->qdio.in_q->bufs[index]; |
2765 | if (!((status & QDIO_STATUS_LOOK_FOR_ERROR) && | 2765 | if (!((status & QDIO_STATUS_LOOK_FOR_ERROR) && |
2766 | qeth_check_qdio_errors(buffer->buffer, | 2766 | qeth_check_qdio_errors(buffer->buffer, |
2767 | qdio_err, siga_err,"qinerr"))) | 2767 | qdio_err, siga_err,"qinerr"))) |
2768 | qeth_process_inbound_buffer(card, buffer, index); | 2768 | qeth_process_inbound_buffer(card, buffer, index); |
2769 | /* clear buffer and give back to hardware */ | 2769 | /* clear buffer and give back to hardware */ |
@@ -3187,7 +3187,7 @@ qeth_alloc_qdio_buffers(struct qeth_card *card) | |||
3187 | if (card->qdio.state == QETH_QDIO_ALLOCATED) | 3187 | if (card->qdio.state == QETH_QDIO_ALLOCATED) |
3188 | return 0; | 3188 | return 0; |
3189 | 3189 | ||
3190 | card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), | 3190 | card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), |
3191 | GFP_KERNEL|GFP_DMA); | 3191 | GFP_KERNEL|GFP_DMA); |
3192 | if (!card->qdio.in_q) | 3192 | if (!card->qdio.in_q) |
3193 | return - ENOMEM; | 3193 | return - ENOMEM; |
@@ -3476,7 +3476,7 @@ qeth_halt_channels(struct qeth_card *card) | |||
3476 | rc3 = qeth_halt_channel(&card->data); | 3476 | rc3 = qeth_halt_channel(&card->data); |
3477 | if (rc1) | 3477 | if (rc1) |
3478 | return rc1; | 3478 | return rc1; |
3479 | if (rc2) | 3479 | if (rc2) |
3480 | return rc2; | 3480 | return rc2; |
3481 | return rc3; | 3481 | return rc3; |
3482 | } | 3482 | } |
@@ -3491,7 +3491,7 @@ qeth_clear_channels(struct qeth_card *card) | |||
3491 | rc3 = qeth_clear_channel(&card->data); | 3491 | rc3 = qeth_clear_channel(&card->data); |
3492 | if (rc1) | 3492 | if (rc1) |
3493 | return rc1; | 3493 | return rc1; |
3494 | if (rc2) | 3494 | if (rc2) |
3495 | return rc2; | 3495 | return rc2; |
3496 | return rc3; | 3496 | return rc3; |
3497 | } | 3497 | } |
@@ -3798,10 +3798,10 @@ qeth_open(struct net_device *dev) | |||
3798 | QETH_DBF_TEXT(trace,4,"nomacadr"); | 3798 | QETH_DBF_TEXT(trace,4,"nomacadr"); |
3799 | return -EPERM; | 3799 | return -EPERM; |
3800 | } | 3800 | } |
3801 | card->dev->flags |= IFF_UP; | ||
3802 | netif_start_queue(dev); | ||
3803 | card->data.state = CH_STATE_UP; | 3801 | card->data.state = CH_STATE_UP; |
3804 | card->state = CARD_STATE_UP; | 3802 | card->state = CARD_STATE_UP; |
3803 | card->dev->flags |= IFF_UP; | ||
3804 | netif_start_queue(dev); | ||
3805 | 3805 | ||
3806 | if (!card->lan_online && netif_carrier_ok(dev)) | 3806 | if (!card->lan_online && netif_carrier_ok(dev)) |
3807 | netif_carrier_off(dev); | 3807 | netif_carrier_off(dev); |
@@ -3817,7 +3817,7 @@ qeth_stop(struct net_device *dev) | |||
3817 | 3817 | ||
3818 | card = (struct qeth_card *) dev->priv; | 3818 | card = (struct qeth_card *) dev->priv; |
3819 | 3819 | ||
3820 | netif_stop_queue(dev); | 3820 | netif_tx_disable(dev); |
3821 | card->dev->flags &= ~IFF_UP; | 3821 | card->dev->flags &= ~IFF_UP; |
3822 | if (card->state == CARD_STATE_UP) | 3822 | if (card->state == CARD_STATE_UP) |
3823 | card->state = CARD_STATE_SOFTSETUP; | 3823 | card->state = CARD_STATE_SOFTSETUP; |
@@ -3958,7 +3958,7 @@ qeth_prepare_skb(struct qeth_card *card, struct sk_buff **skb, | |||
3958 | #endif | 3958 | #endif |
3959 | *hdr = (struct qeth_hdr *) | 3959 | *hdr = (struct qeth_hdr *) |
3960 | qeth_push_skb(card, skb, sizeof(struct qeth_hdr)); | 3960 | qeth_push_skb(card, skb, sizeof(struct qeth_hdr)); |
3961 | if (hdr == NULL) | 3961 | if (*hdr == NULL) |
3962 | return -EINVAL; | 3962 | return -EINVAL; |
3963 | return 0; | 3963 | return 0; |
3964 | } | 3964 | } |
@@ -4098,7 +4098,7 @@ qeth_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
4098 | } | 4098 | } |
4099 | } else { /* passthrough */ | 4099 | } else { /* passthrough */ |
4100 | if((skb->dev->type == ARPHRD_IEEE802_TR) && | 4100 | if((skb->dev->type == ARPHRD_IEEE802_TR) && |
4101 | !memcmp(skb->data + sizeof(struct qeth_hdr) + | 4101 | !memcmp(skb->data + sizeof(struct qeth_hdr) + |
4102 | sizeof(__u16), skb->dev->broadcast, 6)) { | 4102 | sizeof(__u16), skb->dev->broadcast, 6)) { |
4103 | hdr->hdr.l3.flags = QETH_CAST_BROADCAST | | 4103 | hdr->hdr.l3.flags = QETH_CAST_BROADCAST | |
4104 | QETH_HDR_PASSTHRU; | 4104 | QETH_HDR_PASSTHRU; |
@@ -4385,7 +4385,7 @@ out: | |||
4385 | } | 4385 | } |
4386 | 4386 | ||
4387 | static inline int | 4387 | static inline int |
4388 | qeth_get_elements_no(struct qeth_card *card, void *hdr, | 4388 | qeth_get_elements_no(struct qeth_card *card, void *hdr, |
4389 | struct sk_buff *skb, int elems) | 4389 | struct sk_buff *skb, int elems) |
4390 | { | 4390 | { |
4391 | int elements_needed = 0; | 4391 | int elements_needed = 0; |
@@ -4416,6 +4416,8 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4416 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; | 4416 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; |
4417 | struct qeth_eddp_context *ctx = NULL; | 4417 | struct qeth_eddp_context *ctx = NULL; |
4418 | int tx_bytes = skb->len; | 4418 | int tx_bytes = skb->len; |
4419 | unsigned short nr_frags = skb_shinfo(skb)->nr_frags; | ||
4420 | unsigned short tso_size = skb_shinfo(skb)->tso_size; | ||
4419 | int rc; | 4421 | int rc; |
4420 | 4422 | ||
4421 | QETH_DBF_TEXT(trace, 6, "sendpkt"); | 4423 | QETH_DBF_TEXT(trace, 6, "sendpkt"); |
@@ -4441,7 +4443,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4441 | return 0; | 4443 | return 0; |
4442 | } | 4444 | } |
4443 | cast_type = qeth_get_cast_type(card, skb); | 4445 | cast_type = qeth_get_cast_type(card, skb); |
4444 | if ((cast_type == RTN_BROADCAST) && | 4446 | if ((cast_type == RTN_BROADCAST) && |
4445 | (card->info.broadcast_capable == 0)){ | 4447 | (card->info.broadcast_capable == 0)){ |
4446 | card->stats.tx_dropped++; | 4448 | card->stats.tx_dropped++; |
4447 | card->stats.tx_errors++; | 4449 | card->stats.tx_errors++; |
@@ -4463,7 +4465,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4463 | card->stats.tx_errors++; | 4465 | card->stats.tx_errors++; |
4464 | dev_kfree_skb_any(skb); | 4466 | dev_kfree_skb_any(skb); |
4465 | return NETDEV_TX_OK; | 4467 | return NETDEV_TX_OK; |
4466 | } | 4468 | } |
4467 | elements_needed++; | 4469 | elements_needed++; |
4468 | } else { | 4470 | } else { |
4469 | if ((rc = qeth_prepare_skb(card, &skb, &hdr, ipv))) { | 4471 | if ((rc = qeth_prepare_skb(card, &skb, &hdr, ipv))) { |
@@ -4498,16 +4500,16 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4498 | card->stats.tx_packets++; | 4500 | card->stats.tx_packets++; |
4499 | card->stats.tx_bytes += tx_bytes; | 4501 | card->stats.tx_bytes += tx_bytes; |
4500 | #ifdef CONFIG_QETH_PERF_STATS | 4502 | #ifdef CONFIG_QETH_PERF_STATS |
4501 | if (skb_shinfo(skb)->tso_size && | 4503 | if (tso_size && |
4502 | !(large_send == QETH_LARGE_SEND_NO)) { | 4504 | !(large_send == QETH_LARGE_SEND_NO)) { |
4503 | card->perf_stats.large_send_bytes += skb->len; | 4505 | card->perf_stats.large_send_bytes += tx_bytes; |
4504 | card->perf_stats.large_send_cnt++; | 4506 | card->perf_stats.large_send_cnt++; |
4505 | } | 4507 | } |
4506 | if (skb_shinfo(skb)->nr_frags > 0){ | 4508 | if (nr_frags > 0){ |
4507 | card->perf_stats.sg_skbs_sent++; | 4509 | card->perf_stats.sg_skbs_sent++; |
4508 | /* nr_frags + skb->data */ | 4510 | /* nr_frags + skb->data */ |
4509 | card->perf_stats.sg_frags_sent += | 4511 | card->perf_stats.sg_frags_sent += |
4510 | skb_shinfo(skb)->nr_frags + 1; | 4512 | nr_frags + 1; |
4511 | } | 4513 | } |
4512 | #endif /* CONFIG_QETH_PERF_STATS */ | 4514 | #endif /* CONFIG_QETH_PERF_STATS */ |
4513 | } | 4515 | } |
@@ -5373,7 +5375,7 @@ qeth_layer2_send_setdelvlan_cb(struct qeth_card *card, | |||
5373 | cmd = (struct qeth_ipa_cmd *) data; | 5375 | cmd = (struct qeth_ipa_cmd *) data; |
5374 | if (cmd->hdr.return_code) { | 5376 | if (cmd->hdr.return_code) { |
5375 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " | 5377 | PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. " |
5376 | "Continuing\n",cmd->data.setdelvlan.vlan_id, | 5378 | "Continuing\n",cmd->data.setdelvlan.vlan_id, |
5377 | QETH_CARD_IFNAME(card), cmd->hdr.return_code); | 5379 | QETH_CARD_IFNAME(card), cmd->hdr.return_code); |
5378 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", cmd->hdr.command); | 5380 | QETH_DBF_TEXT_(trace, 2, "L2VL%4x", cmd->hdr.command); |
5379 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); | 5381 | QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card)); |
@@ -5393,7 +5395,7 @@ qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i, | |||
5393 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); | 5395 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); |
5394 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 5396 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
5395 | cmd->data.setdelvlan.vlan_id = i; | 5397 | cmd->data.setdelvlan.vlan_id = i; |
5396 | return qeth_send_ipa_cmd(card, iob, | 5398 | return qeth_send_ipa_cmd(card, iob, |
5397 | qeth_layer2_send_setdelvlan_cb, NULL); | 5399 | qeth_layer2_send_setdelvlan_cb, NULL); |
5398 | } | 5400 | } |
5399 | 5401 | ||
@@ -5457,7 +5459,7 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
5457 | * Examine hardware response to SET_PROMISC_MODE | 5459 | * Examine hardware response to SET_PROMISC_MODE |
5458 | */ | 5460 | */ |
5459 | static int | 5461 | static int |
5460 | qeth_setadp_promisc_mode_cb(struct qeth_card *card, | 5462 | qeth_setadp_promisc_mode_cb(struct qeth_card *card, |
5461 | struct qeth_reply *reply, | 5463 | struct qeth_reply *reply, |
5462 | unsigned long data) | 5464 | unsigned long data) |
5463 | { | 5465 | { |
@@ -5468,10 +5470,10 @@ qeth_setadp_promisc_mode_cb(struct qeth_card *card, | |||
5468 | 5470 | ||
5469 | cmd = (struct qeth_ipa_cmd *) data; | 5471 | cmd = (struct qeth_ipa_cmd *) data; |
5470 | setparms = &(cmd->data.setadapterparms); | 5472 | setparms = &(cmd->data.setadapterparms); |
5471 | 5473 | ||
5472 | qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); | 5474 | qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); |
5473 | if (cmd->hdr.return_code) { | 5475 | if (cmd->hdr.return_code) { |
5474 | QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code); | 5476 | QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code); |
5475 | setparms->data.mode = SET_PROMISC_MODE_OFF; | 5477 | setparms->data.mode = SET_PROMISC_MODE_OFF; |
5476 | } | 5478 | } |
5477 | card->info.promisc_mode = setparms->data.mode; | 5479 | card->info.promisc_mode = setparms->data.mode; |
@@ -5517,7 +5519,7 @@ qeth_set_multicast_list(struct net_device *dev) | |||
5517 | 5519 | ||
5518 | if (card->info.type == QETH_CARD_TYPE_OSN) | 5520 | if (card->info.type == QETH_CARD_TYPE_OSN) |
5519 | return ; | 5521 | return ; |
5520 | 5522 | ||
5521 | QETH_DBF_TEXT(trace, 3, "setmulti"); | 5523 | QETH_DBF_TEXT(trace, 3, "setmulti"); |
5522 | qeth_delete_mc_addresses(card); | 5524 | qeth_delete_mc_addresses(card); |
5523 | if (card->options.layer2) { | 5525 | if (card->options.layer2) { |
@@ -5575,7 +5577,7 @@ qeth_osn_assist(struct net_device *dev, | |||
5575 | struct qeth_cmd_buffer *iob; | 5577 | struct qeth_cmd_buffer *iob; |
5576 | struct qeth_card *card; | 5578 | struct qeth_card *card; |
5577 | int rc; | 5579 | int rc; |
5578 | 5580 | ||
5579 | QETH_DBF_TEXT(trace, 2, "osnsdmc"); | 5581 | QETH_DBF_TEXT(trace, 2, "osnsdmc"); |
5580 | if (!dev) | 5582 | if (!dev) |
5581 | return -ENODEV; | 5583 | return -ENODEV; |
@@ -5654,7 +5656,7 @@ qeth_osn_deregister(struct net_device * dev) | |||
5654 | card->osn_info.data_cb = NULL; | 5656 | card->osn_info.data_cb = NULL; |
5655 | return; | 5657 | return; |
5656 | } | 5658 | } |
5657 | 5659 | ||
5658 | static void | 5660 | static void |
5659 | qeth_delete_mc_addresses(struct qeth_card *card) | 5661 | qeth_delete_mc_addresses(struct qeth_card *card) |
5660 | { | 5662 | { |
@@ -5818,7 +5820,7 @@ qeth_add_multicast_ipv6(struct qeth_card *card) | |||
5818 | struct inet6_dev *in6_dev; | 5820 | struct inet6_dev *in6_dev; |
5819 | 5821 | ||
5820 | QETH_DBF_TEXT(trace,4,"chkmcv6"); | 5822 | QETH_DBF_TEXT(trace,4,"chkmcv6"); |
5821 | if (!qeth_is_supported(card, IPA_IPV6)) | 5823 | if (!qeth_is_supported(card, IPA_IPV6)) |
5822 | return ; | 5824 | return ; |
5823 | in6_dev = in6_dev_get(card->dev); | 5825 | in6_dev = in6_dev_get(card->dev); |
5824 | if (in6_dev == NULL) | 5826 | if (in6_dev == NULL) |
@@ -6359,12 +6361,9 @@ qeth_netdev_init(struct net_device *dev) | |||
6359 | dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; | 6361 | dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; |
6360 | dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; | 6362 | dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; |
6361 | #endif | 6363 | #endif |
6362 | dev->hard_header = card->orig_hard_header; | ||
6363 | if (qeth_get_netdev_flags(card) & IFF_NOARP) { | 6364 | if (qeth_get_netdev_flags(card) & IFF_NOARP) { |
6364 | dev->rebuild_header = NULL; | 6365 | dev->rebuild_header = NULL; |
6365 | dev->hard_header = NULL; | 6366 | dev->hard_header = NULL; |
6366 | if (card->options.fake_ll) | ||
6367 | dev->hard_header = qeth_fake_header; | ||
6368 | dev->header_cache_update = NULL; | 6367 | dev->header_cache_update = NULL; |
6369 | dev->hard_header_cache = NULL; | 6368 | dev->hard_header_cache = NULL; |
6370 | } | 6369 | } |
@@ -6373,6 +6372,9 @@ qeth_netdev_init(struct net_device *dev) | |||
6373 | if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD)) | 6372 | if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD)) |
6374 | card->dev->dev_id = card->info.unique_id & 0xffff; | 6373 | card->dev->dev_id = card->info.unique_id & 0xffff; |
6375 | #endif | 6374 | #endif |
6375 | if (card->options.fake_ll && | ||
6376 | (qeth_get_netdev_flags(card) & IFF_NOARP)) | ||
6377 | dev->hard_header = qeth_fake_header; | ||
6376 | dev->hard_header_parse = NULL; | 6378 | dev->hard_header_parse = NULL; |
6377 | dev->set_mac_address = qeth_layer2_set_mac_address; | 6379 | dev->set_mac_address = qeth_layer2_set_mac_address; |
6378 | dev->flags |= qeth_get_netdev_flags(card); | 6380 | dev->flags |= qeth_get_netdev_flags(card); |
@@ -6477,6 +6479,9 @@ retry: | |||
6477 | /*network device will be recovered*/ | 6479 | /*network device will be recovered*/ |
6478 | if (card->dev) { | 6480 | if (card->dev) { |
6479 | card->dev->hard_header = card->orig_hard_header; | 6481 | card->dev->hard_header = card->orig_hard_header; |
6482 | if (card->options.fake_ll && | ||
6483 | (qeth_get_netdev_flags(card) & IFF_NOARP)) | ||
6484 | card->dev->hard_header = qeth_fake_header; | ||
6480 | return 0; | 6485 | return 0; |
6481 | } | 6486 | } |
6482 | /* at first set_online allocate netdev */ | 6487 | /* at first set_online allocate netdev */ |
@@ -6584,7 +6589,7 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, | |||
6584 | 6589 | ||
6585 | cmd = (struct qeth_ipa_cmd *) data; | 6590 | cmd = (struct qeth_ipa_cmd *) data; |
6586 | if (!card->options.layer2 || card->info.guestlan || | 6591 | if (!card->options.layer2 || card->info.guestlan || |
6587 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { | 6592 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { |
6588 | memcpy(card->dev->dev_addr, | 6593 | memcpy(card->dev->dev_addr, |
6589 | &cmd->data.setadapterparms.data.change_addr.addr, | 6594 | &cmd->data.setadapterparms.data.change_addr.addr, |
6590 | OSA_ADDR_LEN); | 6595 | OSA_ADDR_LEN); |
@@ -7031,14 +7036,12 @@ qeth_softsetup_ipv6(struct qeth_card *card) | |||
7031 | 7036 | ||
7032 | QETH_DBF_TEXT(trace,3,"softipv6"); | 7037 | QETH_DBF_TEXT(trace,3,"softipv6"); |
7033 | 7038 | ||
7034 | netif_stop_queue(card->dev); | ||
7035 | rc = qeth_send_startlan(card, QETH_PROT_IPV6); | 7039 | rc = qeth_send_startlan(card, QETH_PROT_IPV6); |
7036 | if (rc) { | 7040 | if (rc) { |
7037 | PRINT_ERR("IPv6 startlan failed on %s\n", | 7041 | PRINT_ERR("IPv6 startlan failed on %s\n", |
7038 | QETH_CARD_IFNAME(card)); | 7042 | QETH_CARD_IFNAME(card)); |
7039 | return rc; | 7043 | return rc; |
7040 | } | 7044 | } |
7041 | netif_wake_queue(card->dev); | ||
7042 | rc = qeth_query_ipassists(card,QETH_PROT_IPV6); | 7045 | rc = qeth_query_ipassists(card,QETH_PROT_IPV6); |
7043 | if (rc) { | 7046 | if (rc) { |
7044 | PRINT_ERR("IPv6 query ipassist failed on %s\n", | 7047 | PRINT_ERR("IPv6 query ipassist failed on %s\n", |
@@ -7352,7 +7355,8 @@ qeth_set_large_send(struct qeth_card *card, enum qeth_large_send_types type) | |||
7352 | card->options.large_send = type; | 7355 | card->options.large_send = type; |
7353 | return 0; | 7356 | return 0; |
7354 | } | 7357 | } |
7355 | netif_stop_queue(card->dev); | 7358 | if (card->state == CARD_STATE_UP) |
7359 | netif_tx_disable(card->dev); | ||
7356 | card->options.large_send = type; | 7360 | card->options.large_send = type; |
7357 | switch (card->options.large_send) { | 7361 | switch (card->options.large_send) { |
7358 | case QETH_LARGE_SEND_EDDP: | 7362 | case QETH_LARGE_SEND_EDDP: |
@@ -7374,7 +7378,8 @@ qeth_set_large_send(struct qeth_card *card, enum qeth_large_send_types type) | |||
7374 | card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG); | 7378 | card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG); |
7375 | break; | 7379 | break; |
7376 | } | 7380 | } |
7377 | netif_wake_queue(card->dev); | 7381 | if (card->state == CARD_STATE_UP) |
7382 | netif_wake_queue(card->dev); | ||
7378 | return rc; | 7383 | return rc; |
7379 | } | 7384 | } |
7380 | 7385 | ||
@@ -7427,7 +7432,7 @@ qeth_softsetup_card(struct qeth_card *card) | |||
7427 | if ((rc = qeth_setrouting_v6(card))) | 7432 | if ((rc = qeth_setrouting_v6(card))) |
7428 | QETH_DBF_TEXT_(setup, 2, "5err%d", rc); | 7433 | QETH_DBF_TEXT_(setup, 2, "5err%d", rc); |
7429 | out: | 7434 | out: |
7430 | netif_stop_queue(card->dev); | 7435 | netif_tx_disable(card->dev); |
7431 | return 0; | 7436 | return 0; |
7432 | } | 7437 | } |
7433 | 7438 | ||
@@ -7567,7 +7572,7 @@ qeth_stop_card(struct qeth_card *card, int recovery_mode) | |||
7567 | if (card->read.state == CH_STATE_UP && | 7572 | if (card->read.state == CH_STATE_UP && |
7568 | card->write.state == CH_STATE_UP && | 7573 | card->write.state == CH_STATE_UP && |
7569 | (card->state == CARD_STATE_UP)) { | 7574 | (card->state == CARD_STATE_UP)) { |
7570 | if (recovery_mode && | 7575 | if (recovery_mode && |
7571 | card->info.type != QETH_CARD_TYPE_OSN) { | 7576 | card->info.type != QETH_CARD_TYPE_OSN) { |
7572 | qeth_stop(card->dev); | 7577 | qeth_stop(card->dev); |
7573 | } else { | 7578 | } else { |
@@ -7736,10 +7741,8 @@ static int | |||
7736 | qeth_register_netdev(struct qeth_card *card) | 7741 | qeth_register_netdev(struct qeth_card *card) |
7737 | { | 7742 | { |
7738 | QETH_DBF_TEXT(setup, 3, "regnetd"); | 7743 | QETH_DBF_TEXT(setup, 3, "regnetd"); |
7739 | if (card->dev->reg_state != NETREG_UNINITIALIZED) { | 7744 | if (card->dev->reg_state != NETREG_UNINITIALIZED) |
7740 | qeth_netdev_init(card->dev); | ||
7741 | return 0; | 7745 | return 0; |
7742 | } | ||
7743 | /* sysfs magic */ | 7746 | /* sysfs magic */ |
7744 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); | 7747 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); |
7745 | return register_netdev(card->dev); | 7748 | return register_netdev(card->dev); |
@@ -7750,7 +7753,7 @@ qeth_start_again(struct qeth_card *card, int recovery_mode) | |||
7750 | { | 7753 | { |
7751 | QETH_DBF_TEXT(setup ,2, "startag"); | 7754 | QETH_DBF_TEXT(setup ,2, "startag"); |
7752 | 7755 | ||
7753 | if (recovery_mode && | 7756 | if (recovery_mode && |
7754 | card->info.type != QETH_CARD_TYPE_OSN) { | 7757 | card->info.type != QETH_CARD_TYPE_OSN) { |
7755 | qeth_open(card->dev); | 7758 | qeth_open(card->dev); |
7756 | } else { | 7759 | } else { |
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 011c41041029..0477c47471c5 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h | |||
@@ -445,7 +445,7 @@ enum qeth_ipa_arp_return_codes { | |||
445 | /* Helper functions */ | 445 | /* Helper functions */ |
446 | #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \ | 446 | #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \ |
447 | (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY)) | 447 | (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY)) |
448 | 448 | ||
449 | /*****************************************************************************/ | 449 | /*****************************************************************************/ |
450 | /* END OF IP Assist related definitions */ | 450 | /* END OF IP Assist related definitions */ |
451 | /*****************************************************************************/ | 451 | /*****************************************************************************/ |
@@ -490,7 +490,7 @@ extern unsigned char ULP_ENABLE[]; | |||
490 | /* Layer 2 defintions */ | 490 | /* Layer 2 defintions */ |
491 | #define QETH_PROT_LAYER2 0x08 | 491 | #define QETH_PROT_LAYER2 0x08 |
492 | #define QETH_PROT_TCPIP 0x03 | 492 | #define QETH_PROT_TCPIP 0x03 |
493 | #define QETH_PROT_OSN2 0x0a | 493 | #define QETH_PROT_OSN2 0x0a |
494 | #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50) | 494 | #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50) |
495 | #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19) | 495 | #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19) |
496 | 496 | ||
diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index 360d782c7ada..66f2da14e6e3 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c | |||
@@ -36,7 +36,7 @@ qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) | |||
36 | { | 36 | { |
37 | struct device *dev = NULL; | 37 | struct device *dev = NULL; |
38 | loff_t nr = 0; | 38 | loff_t nr = 0; |
39 | 39 | ||
40 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 40 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
41 | if (*offset == 0) | 41 | if (*offset == 0) |
42 | return SEQ_START_TOKEN; | 42 | return SEQ_START_TOKEN; |
@@ -60,8 +60,8 @@ static void * | |||
60 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 60 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
61 | { | 61 | { |
62 | struct device *prev, *next; | 62 | struct device *prev, *next; |
63 | 63 | ||
64 | if (it == SEQ_START_TOKEN) | 64 | if (it == SEQ_START_TOKEN) |
65 | prev = NULL; | 65 | prev = NULL; |
66 | else | 66 | else |
67 | prev = (struct device *) it; | 67 | prev = (struct device *) it; |
@@ -180,7 +180,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) | |||
180 | struct device *device; | 180 | struct device *device; |
181 | struct qeth_card *card; | 181 | struct qeth_card *card; |
182 | 182 | ||
183 | 183 | ||
184 | if (it == SEQ_START_TOKEN) | 184 | if (it == SEQ_START_TOKEN) |
185 | return 0; | 185 | return 0; |
186 | 186 | ||
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index 882d419e4160..185a9cfbcbdc 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -785,7 +785,7 @@ qeth_dev_large_send_store(struct device *dev, struct device_attribute *attr, con | |||
785 | } | 785 | } |
786 | if (card->options.large_send == type) | 786 | if (card->options.large_send == type) |
787 | return count; | 787 | return count; |
788 | if ((rc = qeth_set_large_send(card, type))) | 788 | if ((rc = qeth_set_large_send(card, type))) |
789 | return rc; | 789 | return rc; |
790 | return count; | 790 | return count; |
791 | } | 791 | } |
@@ -1682,7 +1682,7 @@ qeth_create_device_attributes(struct device *dev) | |||
1682 | if (card->info.type == QETH_CARD_TYPE_OSN) | 1682 | if (card->info.type == QETH_CARD_TYPE_OSN) |
1683 | return sysfs_create_group(&dev->kobj, | 1683 | return sysfs_create_group(&dev->kobj, |
1684 | &qeth_osn_device_attr_group); | 1684 | &qeth_osn_device_attr_group); |
1685 | 1685 | ||
1686 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group))) | 1686 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group))) |
1687 | return ret; | 1687 | return ret; |
1688 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){ | 1688 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){ |
@@ -1713,7 +1713,7 @@ qeth_remove_device_attributes(struct device *dev) | |||
1713 | if (card->info.type == QETH_CARD_TYPE_OSN) | 1713 | if (card->info.type == QETH_CARD_TYPE_OSN) |
1714 | return sysfs_remove_group(&dev->kobj, | 1714 | return sysfs_remove_group(&dev->kobj, |
1715 | &qeth_osn_device_attr_group); | 1715 | &qeth_osn_device_attr_group); |
1716 | 1716 | ||
1717 | sysfs_remove_group(&dev->kobj, &qeth_device_attr_group); | 1717 | sysfs_remove_group(&dev->kobj, &qeth_device_attr_group); |
1718 | sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group); | 1718 | sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group); |
1719 | sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group); | 1719 | sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group); |
diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h index 1286ddea450b..24ef40ca9562 100644 --- a/drivers/s390/net/qeth_tso.h +++ b/drivers/s390/net/qeth_tso.h | |||
@@ -117,11 +117,11 @@ __qeth_fill_buffer_frag(struct sk_buff *skb, struct qdio_buffer *buffer, | |||
117 | int fragno; | 117 | int fragno; |
118 | unsigned long addr; | 118 | unsigned long addr; |
119 | int element, cnt, dlen; | 119 | int element, cnt, dlen; |
120 | 120 | ||
121 | fragno = skb_shinfo(skb)->nr_frags; | 121 | fragno = skb_shinfo(skb)->nr_frags; |
122 | element = *next_element_to_fill; | 122 | element = *next_element_to_fill; |
123 | dlen = 0; | 123 | dlen = 0; |
124 | 124 | ||
125 | if (is_tso) | 125 | if (is_tso) |
126 | buffer->element[element].flags = | 126 | buffer->element[element].flags = |
127 | SBAL_FLAGS_MIDDLE_FRAG; | 127 | SBAL_FLAGS_MIDDLE_FRAG; |
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 383a95f34a0d..239e108b8ed1 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c | |||
@@ -392,13 +392,16 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file, | |||
392 | return -ENOMEM; | 392 | return -ENOMEM; |
393 | } | 393 | } |
394 | 394 | ||
395 | prom_getproperty(op.op_nodeid, str, tmp, len); | 395 | cnt = prom_getproperty(op.op_nodeid, str, tmp, len); |
396 | 396 | if (cnt <= 0) { | |
397 | tmp[len] = '\0'; | 397 | error = -EINVAL; |
398 | } else { | ||
399 | tmp[len] = '\0'; | ||
398 | 400 | ||
399 | if (__copy_to_user(argp, &op, sizeof(op)) != 0 | 401 | if (__copy_to_user(argp, &op, sizeof(op)) != 0 || |
400 | || copy_to_user(op.op_buf, tmp, len) != 0) | 402 | copy_to_user(op.op_buf, tmp, len) != 0) |
401 | error = -EFAULT; | 403 | error = -EFAULT; |
404 | } | ||
402 | 405 | ||
403 | kfree(tmp); | 406 | kfree(tmp); |
404 | kfree(str); | 407 | kfree(str); |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index bd147207f25d..b046ffa22101 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -864,6 +864,9 @@ static unsigned int ata_id_xfermask(const u16 *id) | |||
864 | /** | 864 | /** |
865 | * ata_port_queue_task - Queue port_task | 865 | * ata_port_queue_task - Queue port_task |
866 | * @ap: The ata_port to queue port_task for | 866 | * @ap: The ata_port to queue port_task for |
867 | * @fn: workqueue function to be scheduled | ||
868 | * @data: data value to pass to workqueue function | ||
869 | * @delay: delay time for workqueue function | ||
867 | * | 870 | * |
868 | * Schedule @fn(@data) for execution after @delay jiffies using | 871 | * Schedule @fn(@data) for execution after @delay jiffies using |
869 | * port_task. There is one port_task per port and it's the | 872 | * port_task. There is one port_task per port and it's the |
@@ -2739,6 +2742,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_port *ap, | |||
2739 | * ata_dev_init_params - Issue INIT DEV PARAMS command | 2742 | * ata_dev_init_params - Issue INIT DEV PARAMS command |
2740 | * @ap: Port associated with device @dev | 2743 | * @ap: Port associated with device @dev |
2741 | * @dev: Device to which command will be sent | 2744 | * @dev: Device to which command will be sent |
2745 | * @heads: Number of heads (taskfile parameter) | ||
2746 | * @sectors: Number of sectors (taskfile parameter) | ||
2742 | * | 2747 | * |
2743 | * LOCKING: | 2748 | * LOCKING: |
2744 | * Kernel thread context (may sleep) | 2749 | * Kernel thread context (may sleep) |
@@ -3638,6 +3643,8 @@ static void ata_pio_block(struct ata_port *ap) | |||
3638 | 3643 | ||
3639 | ata_pio_sector(qc); | 3644 | ata_pio_sector(qc); |
3640 | } | 3645 | } |
3646 | |||
3647 | ata_altstatus(ap); /* flush */ | ||
3641 | } | 3648 | } |
3642 | 3649 | ||
3643 | static void ata_pio_error(struct ata_port *ap) | 3650 | static void ata_pio_error(struct ata_port *ap) |
@@ -3754,11 +3761,14 @@ static void atapi_packet_task(void *_data) | |||
3754 | spin_lock_irqsave(&ap->host_set->lock, flags); | 3761 | spin_lock_irqsave(&ap->host_set->lock, flags); |
3755 | ap->flags &= ~ATA_FLAG_NOINTR; | 3762 | ap->flags &= ~ATA_FLAG_NOINTR; |
3756 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); | 3763 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); |
3764 | ata_altstatus(ap); /* flush */ | ||
3765 | |||
3757 | if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) | 3766 | if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) |
3758 | ap->ops->bmdma_start(qc); /* initiate bmdma */ | 3767 | ap->ops->bmdma_start(qc); /* initiate bmdma */ |
3759 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 3768 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
3760 | } else { | 3769 | } else { |
3761 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); | 3770 | ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1); |
3771 | ata_altstatus(ap); /* flush */ | ||
3762 | 3772 | ||
3763 | /* PIO commands are handled by polling */ | 3773 | /* PIO commands are handled by polling */ |
3764 | ap->hsm_task_state = HSM_ST; | 3774 | ap->hsm_task_state = HSM_ST; |
@@ -4287,6 +4297,7 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev) | |||
4287 | int ata_device_resume(struct ata_port *ap, struct ata_device *dev) | 4297 | int ata_device_resume(struct ata_port *ap, struct ata_device *dev) |
4288 | { | 4298 | { |
4289 | if (ap->flags & ATA_FLAG_SUSPENDED) { | 4299 | if (ap->flags & ATA_FLAG_SUSPENDED) { |
4300 | ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000); | ||
4290 | ap->flags &= ~ATA_FLAG_SUSPENDED; | 4301 | ap->flags &= ~ATA_FLAG_SUSPENDED; |
4291 | ata_set_mode(ap); | 4302 | ata_set_mode(ap); |
4292 | } | 4303 | } |
@@ -4302,6 +4313,7 @@ int ata_device_resume(struct ata_port *ap, struct ata_device *dev) | |||
4302 | * ata_device_suspend - prepare a device for suspend | 4313 | * ata_device_suspend - prepare a device for suspend |
4303 | * @ap: port the device is connected to | 4314 | * @ap: port the device is connected to |
4304 | * @dev: the device to suspend | 4315 | * @dev: the device to suspend |
4316 | * @state: target power management state | ||
4305 | * | 4317 | * |
4306 | * Flush the cache on the drive, if appropriate, then issue a | 4318 | * Flush the cache on the drive, if appropriate, then issue a |
4307 | * standbynow command. | 4319 | * standbynow command. |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index fee843fab1c7..108910f512e4 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -982,6 +982,12 @@ static int device_check(ppa_struct *dev) | |||
982 | return -ENODEV; | 982 | return -ENODEV; |
983 | } | 983 | } |
984 | 984 | ||
985 | static int ppa_adjust_queue(struct scsi_device *device) | ||
986 | { | ||
987 | blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH); | ||
988 | return 0; | ||
989 | } | ||
990 | |||
985 | static struct scsi_host_template ppa_template = { | 991 | static struct scsi_host_template ppa_template = { |
986 | .module = THIS_MODULE, | 992 | .module = THIS_MODULE, |
987 | .proc_name = "ppa", | 993 | .proc_name = "ppa", |
@@ -997,6 +1003,7 @@ static struct scsi_host_template ppa_template = { | |||
997 | .cmd_per_lun = 1, | 1003 | .cmd_per_lun = 1, |
998 | .use_clustering = ENABLE_CLUSTERING, | 1004 | .use_clustering = ENABLE_CLUSTERING, |
999 | .can_queue = 1, | 1005 | .can_queue = 1, |
1006 | .slave_alloc = ppa_adjust_queue, | ||
1000 | }; | 1007 | }; |
1001 | 1008 | ||
1002 | /*************************************************************************** | 1009 | /*************************************************************************** |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index d5fdcb9a8842..f16f92a6ec0f 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | 38 | ||
39 | #define DRV_NAME "sata_mv" | 39 | #define DRV_NAME "sata_mv" |
40 | #define DRV_VERSION "0.6" | 40 | #define DRV_VERSION "0.7" |
41 | 41 | ||
42 | enum { | 42 | enum { |
43 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 43 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -50,6 +50,12 @@ enum { | |||
50 | 50 | ||
51 | MV_PCI_REG_BASE = 0, | 51 | MV_PCI_REG_BASE = 0, |
52 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ | 52 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ |
53 | MV_IRQ_COAL_CAUSE = (MV_IRQ_COAL_REG_BASE + 0x08), | ||
54 | MV_IRQ_COAL_CAUSE_LO = (MV_IRQ_COAL_REG_BASE + 0x88), | ||
55 | MV_IRQ_COAL_CAUSE_HI = (MV_IRQ_COAL_REG_BASE + 0x8c), | ||
56 | MV_IRQ_COAL_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xcc), | ||
57 | MV_IRQ_COAL_TIME_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xd0), | ||
58 | |||
53 | MV_SATAHC0_REG_BASE = 0x20000, | 59 | MV_SATAHC0_REG_BASE = 0x20000, |
54 | MV_FLASH_CTL = 0x1046c, | 60 | MV_FLASH_CTL = 0x1046c, |
55 | MV_GPIO_PORT_CTL = 0x104f0, | 61 | MV_GPIO_PORT_CTL = 0x104f0, |
@@ -302,9 +308,6 @@ struct mv_port_priv { | |||
302 | dma_addr_t crpb_dma; | 308 | dma_addr_t crpb_dma; |
303 | struct mv_sg *sg_tbl; | 309 | struct mv_sg *sg_tbl; |
304 | dma_addr_t sg_tbl_dma; | 310 | dma_addr_t sg_tbl_dma; |
305 | |||
306 | unsigned req_producer; /* cp of req_in_ptr */ | ||
307 | unsigned rsp_consumer; /* cp of rsp_out_ptr */ | ||
308 | u32 pp_flags; | 311 | u32 pp_flags; |
309 | }; | 312 | }; |
310 | 313 | ||
@@ -937,8 +940,6 @@ static int mv_port_start(struct ata_port *ap) | |||
937 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, | 940 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, |
938 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 941 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
939 | 942 | ||
940 | pp->req_producer = pp->rsp_consumer = 0; | ||
941 | |||
942 | /* Don't turn on EDMA here...do it before DMA commands only. Else | 943 | /* Don't turn on EDMA here...do it before DMA commands only. Else |
943 | * we'll be unable to send non-data, PIO, etc due to restricted access | 944 | * we'll be unable to send non-data, PIO, etc due to restricted access |
944 | * to shadow regs. | 945 | * to shadow regs. |
@@ -1022,16 +1023,16 @@ static void mv_fill_sg(struct ata_queued_cmd *qc) | |||
1022 | } | 1023 | } |
1023 | } | 1024 | } |
1024 | 1025 | ||
1025 | static inline unsigned mv_inc_q_index(unsigned *index) | 1026 | static inline unsigned mv_inc_q_index(unsigned index) |
1026 | { | 1027 | { |
1027 | *index = (*index + 1) & MV_MAX_Q_DEPTH_MASK; | 1028 | return (index + 1) & MV_MAX_Q_DEPTH_MASK; |
1028 | return *index; | ||
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last) | 1031 | static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last) |
1032 | { | 1032 | { |
1033 | *cmdw = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | | 1033 | u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | |
1034 | (last ? CRQB_CMD_LAST : 0); | 1034 | (last ? CRQB_CMD_LAST : 0); |
1035 | *cmdw = cpu_to_le16(tmp); | ||
1035 | } | 1036 | } |
1036 | 1037 | ||
1037 | /** | 1038 | /** |
@@ -1053,15 +1054,11 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1053 | u16 *cw; | 1054 | u16 *cw; |
1054 | struct ata_taskfile *tf; | 1055 | struct ata_taskfile *tf; |
1055 | u16 flags = 0; | 1056 | u16 flags = 0; |
1057 | unsigned in_index; | ||
1056 | 1058 | ||
1057 | if (ATA_PROT_DMA != qc->tf.protocol) | 1059 | if (ATA_PROT_DMA != qc->tf.protocol) |
1058 | return; | 1060 | return; |
1059 | 1061 | ||
1060 | /* the req producer index should be the same as we remember it */ | ||
1061 | WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> | ||
1062 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1063 | pp->req_producer); | ||
1064 | |||
1065 | /* Fill in command request block | 1062 | /* Fill in command request block |
1066 | */ | 1063 | */ |
1067 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) | 1064 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) |
@@ -1069,13 +1066,17 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1069 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); | 1066 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); |
1070 | flags |= qc->tag << CRQB_TAG_SHIFT; | 1067 | flags |= qc->tag << CRQB_TAG_SHIFT; |
1071 | 1068 | ||
1072 | pp->crqb[pp->req_producer].sg_addr = | 1069 | /* get current queue index from hardware */ |
1070 | in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS) | ||
1071 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1072 | |||
1073 | pp->crqb[in_index].sg_addr = | ||
1073 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); | 1074 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); |
1074 | pp->crqb[pp->req_producer].sg_addr_hi = | 1075 | pp->crqb[in_index].sg_addr_hi = |
1075 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); | 1076 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); |
1076 | pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); | 1077 | pp->crqb[in_index].ctrl_flags = cpu_to_le16(flags); |
1077 | 1078 | ||
1078 | cw = &pp->crqb[pp->req_producer].ata_cmd[0]; | 1079 | cw = &pp->crqb[in_index].ata_cmd[0]; |
1079 | tf = &qc->tf; | 1080 | tf = &qc->tf; |
1080 | 1081 | ||
1081 | /* Sadly, the CRQB cannot accomodate all registers--there are | 1082 | /* Sadly, the CRQB cannot accomodate all registers--there are |
@@ -1144,16 +1145,12 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc) | |||
1144 | struct mv_port_priv *pp = ap->private_data; | 1145 | struct mv_port_priv *pp = ap->private_data; |
1145 | struct mv_crqb_iie *crqb; | 1146 | struct mv_crqb_iie *crqb; |
1146 | struct ata_taskfile *tf; | 1147 | struct ata_taskfile *tf; |
1148 | unsigned in_index; | ||
1147 | u32 flags = 0; | 1149 | u32 flags = 0; |
1148 | 1150 | ||
1149 | if (ATA_PROT_DMA != qc->tf.protocol) | 1151 | if (ATA_PROT_DMA != qc->tf.protocol) |
1150 | return; | 1152 | return; |
1151 | 1153 | ||
1152 | /* the req producer index should be the same as we remember it */ | ||
1153 | WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> | ||
1154 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1155 | pp->req_producer); | ||
1156 | |||
1157 | /* Fill in Gen IIE command request block | 1154 | /* Fill in Gen IIE command request block |
1158 | */ | 1155 | */ |
1159 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) | 1156 | if (!(qc->tf.flags & ATA_TFLAG_WRITE)) |
@@ -1162,7 +1159,11 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc) | |||
1162 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); | 1159 | WARN_ON(MV_MAX_Q_DEPTH <= qc->tag); |
1163 | flags |= qc->tag << CRQB_TAG_SHIFT; | 1160 | flags |= qc->tag << CRQB_TAG_SHIFT; |
1164 | 1161 | ||
1165 | crqb = (struct mv_crqb_iie *) &pp->crqb[pp->req_producer]; | 1162 | /* get current queue index from hardware */ |
1163 | in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS) | ||
1164 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1165 | |||
1166 | crqb = (struct mv_crqb_iie *) &pp->crqb[in_index]; | ||
1166 | crqb->addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); | 1167 | crqb->addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); |
1167 | crqb->addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); | 1168 | crqb->addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); |
1168 | crqb->flags = cpu_to_le32(flags); | 1169 | crqb->flags = cpu_to_le32(flags); |
@@ -1210,6 +1211,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
1210 | { | 1211 | { |
1211 | void __iomem *port_mmio = mv_ap_base(qc->ap); | 1212 | void __iomem *port_mmio = mv_ap_base(qc->ap); |
1212 | struct mv_port_priv *pp = qc->ap->private_data; | 1213 | struct mv_port_priv *pp = qc->ap->private_data; |
1214 | unsigned in_index; | ||
1213 | u32 in_ptr; | 1215 | u32 in_ptr; |
1214 | 1216 | ||
1215 | if (ATA_PROT_DMA != qc->tf.protocol) { | 1217 | if (ATA_PROT_DMA != qc->tf.protocol) { |
@@ -1221,23 +1223,20 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
1221 | return ata_qc_issue_prot(qc); | 1223 | return ata_qc_issue_prot(qc); |
1222 | } | 1224 | } |
1223 | 1225 | ||
1224 | in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 1226 | in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
1227 | in_index = (in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1225 | 1228 | ||
1226 | /* the req producer index should be the same as we remember it */ | ||
1227 | WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1228 | pp->req_producer); | ||
1229 | /* until we do queuing, the queue should be empty at this point */ | 1229 | /* until we do queuing, the queue should be empty at this point */ |
1230 | WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | 1230 | WARN_ON(in_index != ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) |
1231 | ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> | 1231 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); |
1232 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); | ||
1233 | 1232 | ||
1234 | mv_inc_q_index(&pp->req_producer); /* now incr producer index */ | 1233 | in_index = mv_inc_q_index(in_index); /* now incr producer index */ |
1235 | 1234 | ||
1236 | mv_start_dma(port_mmio, pp); | 1235 | mv_start_dma(port_mmio, pp); |
1237 | 1236 | ||
1238 | /* and write the request in pointer to kick the EDMA to life */ | 1237 | /* and write the request in pointer to kick the EDMA to life */ |
1239 | in_ptr &= EDMA_REQ_Q_BASE_LO_MASK; | 1238 | in_ptr &= EDMA_REQ_Q_BASE_LO_MASK; |
1240 | in_ptr |= pp->req_producer << EDMA_REQ_Q_PTR_SHIFT; | 1239 | in_ptr |= in_index << EDMA_REQ_Q_PTR_SHIFT; |
1241 | writelfl(in_ptr, port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 1240 | writelfl(in_ptr, port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
1242 | 1241 | ||
1243 | return 0; | 1242 | return 0; |
@@ -1260,28 +1259,26 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1260 | { | 1259 | { |
1261 | void __iomem *port_mmio = mv_ap_base(ap); | 1260 | void __iomem *port_mmio = mv_ap_base(ap); |
1262 | struct mv_port_priv *pp = ap->private_data; | 1261 | struct mv_port_priv *pp = ap->private_data; |
1262 | unsigned out_index; | ||
1263 | u32 out_ptr; | 1263 | u32 out_ptr; |
1264 | u8 ata_status; | 1264 | u8 ata_status; |
1265 | 1265 | ||
1266 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1266 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1267 | 1267 | out_index = (out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | |
1268 | /* the response consumer index should be the same as we remember it */ | ||
1269 | WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | ||
1270 | pp->rsp_consumer); | ||
1271 | 1268 | ||
1272 | ata_status = pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT; | 1269 | ata_status = le16_to_cpu(pp->crpb[out_index].flags) |
1270 | >> CRPB_FLAG_STATUS_SHIFT; | ||
1273 | 1271 | ||
1274 | /* increment our consumer index... */ | 1272 | /* increment our consumer index... */ |
1275 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); | 1273 | out_index = mv_inc_q_index(out_index); |
1276 | 1274 | ||
1277 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ | 1275 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ |
1278 | WARN_ON(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> | 1276 | WARN_ON(out_index != ((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) |
1279 | EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | 1277 | >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); |
1280 | pp->rsp_consumer); | ||
1281 | 1278 | ||
1282 | /* write out our inc'd consumer index so EDMA knows we're caught up */ | 1279 | /* write out our inc'd consumer index so EDMA knows we're caught up */ |
1283 | out_ptr &= EDMA_RSP_Q_BASE_LO_MASK; | 1280 | out_ptr &= EDMA_RSP_Q_BASE_LO_MASK; |
1284 | out_ptr |= pp->rsp_consumer << EDMA_RSP_Q_PTR_SHIFT; | 1281 | out_ptr |= out_index << EDMA_RSP_Q_PTR_SHIFT; |
1285 | writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1282 | writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1286 | 1283 | ||
1287 | /* Return ATA status register for completed CRPB */ | 1284 | /* Return ATA status register for completed CRPB */ |
@@ -1291,6 +1288,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1291 | /** | 1288 | /** |
1292 | * mv_err_intr - Handle error interrupts on the port | 1289 | * mv_err_intr - Handle error interrupts on the port |
1293 | * @ap: ATA channel to manipulate | 1290 | * @ap: ATA channel to manipulate |
1291 | * @reset_allowed: bool: 0 == don't trigger from reset here | ||
1294 | * | 1292 | * |
1295 | * In most cases, just clear the interrupt and move on. However, | 1293 | * In most cases, just clear the interrupt and move on. However, |
1296 | * some cases require an eDMA reset, which is done right before | 1294 | * some cases require an eDMA reset, which is done right before |
@@ -1301,7 +1299,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1301 | * LOCKING: | 1299 | * LOCKING: |
1302 | * Inherited from caller. | 1300 | * Inherited from caller. |
1303 | */ | 1301 | */ |
1304 | static void mv_err_intr(struct ata_port *ap) | 1302 | static void mv_err_intr(struct ata_port *ap, int reset_allowed) |
1305 | { | 1303 | { |
1306 | void __iomem *port_mmio = mv_ap_base(ap); | 1304 | void __iomem *port_mmio = mv_ap_base(ap); |
1307 | u32 edma_err_cause, serr = 0; | 1305 | u32 edma_err_cause, serr = 0; |
@@ -1323,9 +1321,8 @@ static void mv_err_intr(struct ata_port *ap) | |||
1323 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1321 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1324 | 1322 | ||
1325 | /* check for fatal here and recover if needed */ | 1323 | /* check for fatal here and recover if needed */ |
1326 | if (EDMA_ERR_FATAL & edma_err_cause) { | 1324 | if (reset_allowed && (EDMA_ERR_FATAL & edma_err_cause)) |
1327 | mv_stop_and_reset(ap); | 1325 | mv_stop_and_reset(ap); |
1328 | } | ||
1329 | } | 1326 | } |
1330 | 1327 | ||
1331 | /** | 1328 | /** |
@@ -1374,12 +1371,12 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1374 | struct ata_port *ap = host_set->ports[port]; | 1371 | struct ata_port *ap = host_set->ports[port]; |
1375 | struct mv_port_priv *pp = ap->private_data; | 1372 | struct mv_port_priv *pp = ap->private_data; |
1376 | 1373 | ||
1377 | hard_port = port & MV_PORT_MASK; /* range 0-3 */ | 1374 | hard_port = mv_hardport_from_port(port); /* range 0..3 */ |
1378 | handled = 0; /* ensure ata_status is set if handled++ */ | 1375 | handled = 0; /* ensure ata_status is set if handled++ */ |
1379 | 1376 | ||
1380 | /* Note that DEV_IRQ might happen spuriously during EDMA, | 1377 | /* Note that DEV_IRQ might happen spuriously during EDMA, |
1381 | * and should be ignored in such cases. We could mask it, | 1378 | * and should be ignored in such cases. |
1382 | * but it's pretty rare and may not be worth the overhead. | 1379 | * The cause of this is still under investigation. |
1383 | */ | 1380 | */ |
1384 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { | 1381 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { |
1385 | /* EDMA: check for response queue interrupt */ | 1382 | /* EDMA: check for response queue interrupt */ |
@@ -1393,6 +1390,11 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1393 | ata_status = readb((void __iomem *) | 1390 | ata_status = readb((void __iomem *) |
1394 | ap->ioaddr.status_addr); | 1391 | ap->ioaddr.status_addr); |
1395 | handled = 1; | 1392 | handled = 1; |
1393 | /* ignore spurious intr if drive still BUSY */ | ||
1394 | if (ata_status & ATA_BUSY) { | ||
1395 | ata_status = 0; | ||
1396 | handled = 0; | ||
1397 | } | ||
1396 | } | 1398 | } |
1397 | } | 1399 | } |
1398 | 1400 | ||
@@ -1406,7 +1408,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1406 | shift++; /* skip bit 8 in the HC Main IRQ reg */ | 1408 | shift++; /* skip bit 8 in the HC Main IRQ reg */ |
1407 | } | 1409 | } |
1408 | if ((PORT0_ERR << shift) & relevant) { | 1410 | if ((PORT0_ERR << shift) & relevant) { |
1409 | mv_err_intr(ap); | 1411 | mv_err_intr(ap, 1); |
1410 | err_mask |= AC_ERR_OTHER; | 1412 | err_mask |= AC_ERR_OTHER; |
1411 | handled = 1; | 1413 | handled = 1; |
1412 | } | 1414 | } |
@@ -1448,6 +1450,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1448 | struct ata_host_set *host_set = dev_instance; | 1450 | struct ata_host_set *host_set = dev_instance; |
1449 | unsigned int hc, handled = 0, n_hcs; | 1451 | unsigned int hc, handled = 0, n_hcs; |
1450 | void __iomem *mmio = host_set->mmio_base; | 1452 | void __iomem *mmio = host_set->mmio_base; |
1453 | struct mv_host_priv *hpriv; | ||
1451 | u32 irq_stat; | 1454 | u32 irq_stat; |
1452 | 1455 | ||
1453 | irq_stat = readl(mmio + HC_MAIN_IRQ_CAUSE_OFS); | 1456 | irq_stat = readl(mmio + HC_MAIN_IRQ_CAUSE_OFS); |
@@ -1469,6 +1472,17 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1469 | handled++; | 1472 | handled++; |
1470 | } | 1473 | } |
1471 | } | 1474 | } |
1475 | |||
1476 | hpriv = host_set->private_data; | ||
1477 | if (IS_60XX(hpriv)) { | ||
1478 | /* deal with the interrupt coalescing bits */ | ||
1479 | if (irq_stat & (TRAN_LO_DONE | TRAN_HI_DONE | PORTS_0_7_COAL_DONE)) { | ||
1480 | writelfl(0, mmio + MV_IRQ_COAL_CAUSE_LO); | ||
1481 | writelfl(0, mmio + MV_IRQ_COAL_CAUSE_HI); | ||
1482 | writelfl(0, mmio + MV_IRQ_COAL_CAUSE); | ||
1483 | } | ||
1484 | } | ||
1485 | |||
1472 | if (PCI_ERR & irq_stat) { | 1486 | if (PCI_ERR & irq_stat) { |
1473 | printk(KERN_ERR DRV_NAME ": PCI ERROR; PCI IRQ cause=0x%08x\n", | 1487 | printk(KERN_ERR DRV_NAME ": PCI ERROR; PCI IRQ cause=0x%08x\n", |
1474 | readl(mmio + PCI_IRQ_CAUSE_OFS)); | 1488 | readl(mmio + PCI_IRQ_CAUSE_OFS)); |
@@ -1867,7 +1881,8 @@ static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
1867 | 1881 | ||
1868 | if (IS_60XX(hpriv)) { | 1882 | if (IS_60XX(hpriv)) { |
1869 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | 1883 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); |
1870 | ifctl |= (1 << 12) | (1 << 7); | 1884 | ifctl |= (1 << 7); /* enable gen2i speed */ |
1885 | ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */ | ||
1871 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | 1886 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); |
1872 | } | 1887 | } |
1873 | 1888 | ||
@@ -2020,6 +2035,7 @@ static void mv_phy_reset(struct ata_port *ap) | |||
2020 | static void mv_eng_timeout(struct ata_port *ap) | 2035 | static void mv_eng_timeout(struct ata_port *ap) |
2021 | { | 2036 | { |
2022 | struct ata_queued_cmd *qc; | 2037 | struct ata_queued_cmd *qc; |
2038 | unsigned long flags; | ||
2023 | 2039 | ||
2024 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); | 2040 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); |
2025 | DPRINTK("All regs @ start of eng_timeout\n"); | 2041 | DPRINTK("All regs @ start of eng_timeout\n"); |
@@ -2031,11 +2047,16 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
2031 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, | 2047 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, |
2032 | &qc->scsicmd->cmnd); | 2048 | &qc->scsicmd->cmnd); |
2033 | 2049 | ||
2034 | mv_err_intr(ap); | 2050 | spin_lock_irqsave(&ap->host_set->lock, flags); |
2051 | mv_err_intr(ap, 0); | ||
2035 | mv_stop_and_reset(ap); | 2052 | mv_stop_and_reset(ap); |
2053 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
2036 | 2054 | ||
2037 | qc->err_mask |= AC_ERR_TIMEOUT; | 2055 | WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); |
2038 | ata_eh_qc_complete(qc); | 2056 | if (qc->flags & ATA_QCFLAG_ACTIVE) { |
2057 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
2058 | ata_eh_qc_complete(qc); | ||
2059 | } | ||
2039 | } | 2060 | } |
2040 | 2061 | ||
2041 | /** | 2062 | /** |
@@ -2229,7 +2250,8 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, | |||
2229 | void __iomem *port_mmio = mv_port_base(mmio, port); | 2250 | void __iomem *port_mmio = mv_port_base(mmio, port); |
2230 | 2251 | ||
2231 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | 2252 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); |
2232 | ifctl |= (1 << 12); | 2253 | ifctl |= (1 << 7); /* enable gen2i speed */ |
2254 | ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */ | ||
2233 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | 2255 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); |
2234 | } | 2256 | } |
2235 | 2257 | ||
@@ -2330,6 +2352,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2330 | if (rc) { | 2352 | if (rc) { |
2331 | return rc; | 2353 | return rc; |
2332 | } | 2354 | } |
2355 | pci_set_master(pdev); | ||
2333 | 2356 | ||
2334 | rc = pci_request_regions(pdev, DRV_NAME); | 2357 | rc = pci_request_regions(pdev, DRV_NAME); |
2335 | if (rc) { | 2358 | if (rc) { |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index f7264fd611c2..cb9082fd7e2f 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -454,7 +454,7 @@ static int sil24_softreset(struct ata_port *ap, int verbose, | |||
454 | */ | 454 | */ |
455 | msleep(10); | 455 | msleep(10); |
456 | 456 | ||
457 | prb->ctrl = PRB_CTRL_SRST; | 457 | prb->ctrl = cpu_to_le16(PRB_CTRL_SRST); |
458 | prb->fis[1] = 0; /* no PM yet */ | 458 | prb->fis[1] = 0; /* no PM yet */ |
459 | 459 | ||
460 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); | 460 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); |
@@ -551,9 +551,9 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) | |||
551 | 551 | ||
552 | if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { | 552 | if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { |
553 | if (qc->tf.flags & ATA_TFLAG_WRITE) | 553 | if (qc->tf.flags & ATA_TFLAG_WRITE) |
554 | prb->ctrl = PRB_CTRL_PACKET_WRITE; | 554 | prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_WRITE); |
555 | else | 555 | else |
556 | prb->ctrl = PRB_CTRL_PACKET_READ; | 556 | prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_READ); |
557 | } else | 557 | } else |
558 | prb->ctrl = 0; | 558 | prb->ctrl = 0; |
559 | 559 | ||
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 941c1e15c899..62f8cb7b3d2b 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -165,6 +165,7 @@ static struct { | |||
165 | {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, | 165 | {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD}, |
166 | {"HP", "C1557A", NULL, BLIST_FORCELUN}, | 166 | {"HP", "C1557A", NULL, BLIST_FORCELUN}, |
167 | {"HP", "C3323-300", "4269", BLIST_NOTQ}, | 167 | {"HP", "C3323-300", "4269", BLIST_NOTQ}, |
168 | {"HP", "C5713A", NULL, BLIST_NOREPORTLUN}, | ||
168 | {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, | 169 | {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, |
169 | {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, | 170 | {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, |
170 | {"IBM", "2105", NULL, BLIST_RETRY_HWERROR}, | 171 | {"IBM", "2105", NULL, BLIST_RETRY_HWERROR}, |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 764a8b375ead..faee4757c03a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -367,7 +367,7 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, | |||
367 | int nsegs, unsigned bufflen, gfp_t gfp) | 367 | int nsegs, unsigned bufflen, gfp_t gfp) |
368 | { | 368 | { |
369 | struct request_queue *q = rq->q; | 369 | struct request_queue *q = rq->q; |
370 | int nr_pages = (bufflen + PAGE_SIZE - 1) >> PAGE_SHIFT; | 370 | int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; |
371 | unsigned int data_len = 0, len, bytes, off; | 371 | unsigned int data_len = 0, len, bytes, off; |
372 | struct page *page; | 372 | struct page *page; |
373 | struct bio *bio = NULL; | 373 | struct bio *bio = NULL; |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 8b6d65e21bae..f3b16066387c 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -955,7 +955,8 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, | |||
955 | list_for_each_entry(rphy, &sas_host->rphy_list, list) { | 955 | list_for_each_entry(rphy, &sas_host->rphy_list, list) { |
956 | struct sas_phy *parent = dev_to_phy(rphy->dev.parent); | 956 | struct sas_phy *parent = dev_to_phy(rphy->dev.parent); |
957 | 957 | ||
958 | if (rphy->scsi_target_id == -1) | 958 | if (rphy->identify.device_type != SAS_END_DEVICE || |
959 | rphy->scsi_target_id == -1) | ||
959 | continue; | 960 | continue; |
960 | 961 | ||
961 | if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) && | 962 | if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) && |
@@ -977,7 +978,6 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, | |||
977 | #define SETUP_TEMPLATE(attrb, field, perm, test) \ | 978 | #define SETUP_TEMPLATE(attrb, field, perm, test) \ |
978 | i->private_##attrb[count] = class_device_attr_##field; \ | 979 | i->private_##attrb[count] = class_device_attr_##field; \ |
979 | i->private_##attrb[count].attr.mode = perm; \ | 980 | i->private_##attrb[count].attr.mode = perm; \ |
980 | i->private_##attrb[count].store = NULL; \ | ||
981 | i->attrb[count] = &i->private_##attrb[count]; \ | 981 | i->attrb[count] = &i->private_##attrb[count]; \ |
982 | if (test) \ | 982 | if (test) \ |
983 | count++ | 983 | count++ |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index d40e7c871c36..56cb49006116 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4054,7 +4054,7 @@ static int st_probe(struct device *dev) | |||
4054 | } | 4054 | } |
4055 | 4055 | ||
4056 | sdev_printk(KERN_WARNING, SDp, | 4056 | sdev_printk(KERN_WARNING, SDp, |
4057 | "Attached scsi tape %s", tape_name(tpnt)); | 4057 | "Attached scsi tape %s\n", tape_name(tpnt)); |
4058 | printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B)\n", | 4058 | printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B)\n", |
4059 | tape_name(tpnt), tpnt->try_dio ? "yes" : "no", | 4059 | tape_name(tpnt), tpnt->try_dio ? "yes" : "no", |
4060 | queue_dma_alignment(SDp->request_queue) + 1); | 4060 | queue_dma_alignment(SDp->request_queue) + 1); |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 969f94900431..5cba59ad7dc5 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -1164,14 +1164,16 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
1164 | struct fs_uart_platform_info *pdata; | 1164 | struct fs_uart_platform_info *pdata; |
1165 | struct platform_device* pdev = early_uart_get_pdev(co->index); | 1165 | struct platform_device* pdev = early_uart_get_pdev(co->index); |
1166 | 1166 | ||
1167 | port = | ||
1168 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; | ||
1169 | pinfo = (struct uart_cpm_port *)port; | ||
1170 | if (!pdev) { | 1167 | if (!pdev) { |
1171 | pr_info("cpm_uart: console: compat mode\n"); | 1168 | pr_info("cpm_uart: console: compat mode\n"); |
1172 | /* compatibility - will be cleaned up */ | 1169 | /* compatibility - will be cleaned up */ |
1173 | cpm_uart_init_portdesc(); | 1170 | cpm_uart_init_portdesc(); |
1171 | } | ||
1174 | 1172 | ||
1173 | port = | ||
1174 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; | ||
1175 | pinfo = (struct uart_cpm_port *)port; | ||
1176 | if (!pdev) { | ||
1175 | if (pinfo->set_lineif) | 1177 | if (pinfo->set_lineif) |
1176 | pinfo->set_lineif(pinfo); | 1178 | pinfo->set_lineif(pinfo); |
1177 | } else { | 1179 | } else { |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index 4b2de08f46d0..cdba128250a9 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c | |||
@@ -213,7 +213,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
213 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); | 213 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); |
214 | if (is_con) { | 214 | if (is_con) { |
215 | mem_addr = alloc_bootmem(memsz); | 215 | mem_addr = alloc_bootmem(memsz); |
216 | dma_addr = mem_addr; | 216 | dma_addr = virt_to_bus(mem_addr); |
217 | } | 217 | } |
218 | else | 218 | else |
219 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 219 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index aeb8153ccf24..17839e753e4c 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1907,9 +1907,12 @@ uart_set_options(struct uart_port *port, struct console *co, | |||
1907 | static void uart_change_pm(struct uart_state *state, int pm_state) | 1907 | static void uart_change_pm(struct uart_state *state, int pm_state) |
1908 | { | 1908 | { |
1909 | struct uart_port *port = state->port; | 1909 | struct uart_port *port = state->port; |
1910 | if (port->ops->pm) | 1910 | |
1911 | port->ops->pm(port, pm_state, state->pm_state); | 1911 | if (state->pm_state != pm_state) { |
1912 | state->pm_state = pm_state; | 1912 | if (port->ops->pm) |
1913 | port->ops->pm(port, pm_state, state->pm_state); | ||
1914 | state->pm_state = pm_state; | ||
1915 | } | ||
1913 | } | 1916 | } |
1914 | 1917 | ||
1915 | int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | 1918 | int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 1c4396c2962d..2b4f96541b8e 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1730,3 +1730,4 @@ static void __exit sunsu_exit(void) | |||
1730 | 1730 | ||
1731 | module_init(sunsu_probe); | 1731 | module_init(sunsu_probe); |
1732 | module_exit(sunsu_exit); | 1732 | module_exit(sunsu_exit); |
1733 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 7a75faeb0526..23334c8bc4c7 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -75,11 +75,45 @@ config SPI_BUTTERFLY | |||
75 | inexpensive battery powered microcontroller evaluation board. | 75 | inexpensive battery powered microcontroller evaluation board. |
76 | This same cable can be used to flash new firmware. | 76 | This same cable can be used to flash new firmware. |
77 | 77 | ||
78 | config SPI_MPC83xx | ||
79 | tristate "Freescale MPC83xx SPI controller" | ||
80 | depends on SPI_MASTER && PPC_83xx && EXPERIMENTAL | ||
81 | select SPI_BITBANG | ||
82 | help | ||
83 | This enables using the Freescale MPC83xx SPI controller in master | ||
84 | mode. | ||
85 | |||
86 | Note, this driver uniquely supports the SPI controller on the MPC83xx | ||
87 | family of PowerPC processors. The MPC83xx uses a simple set of shift | ||
88 | registers for data (opposed to the CPM based descriptor model). | ||
89 | |||
90 | config SPI_PXA2XX | ||
91 | tristate "PXA2xx SSP SPI master" | ||
92 | depends on SPI_MASTER && ARCH_PXA && EXPERIMENTAL | ||
93 | help | ||
94 | This enables using a PXA2xx SSP port as a SPI master controller. | ||
95 | The driver can be configured to use any SSP port and additional | ||
96 | documentation can be found a Documentation/spi/pxa2xx. | ||
97 | |||
98 | config SPI_S3C24XX_GPIO | ||
99 | tristate "Samsung S3C24XX series SPI by GPIO" | ||
100 | depends on SPI_MASTER && ARCH_S3C2410 && SPI_BITBANG && EXPERIMENTAL | ||
101 | help | ||
102 | SPI driver for Samsung S3C24XX series ARM SoCs using | ||
103 | GPIO lines to provide the SPI bus. This can be used where | ||
104 | the inbuilt hardware cannot provide the transfer mode, or | ||
105 | where the board is using non hardware connected pins. | ||
78 | # | 106 | # |
79 | # Add new SPI master controllers in alphabetical order above this line | 107 | # Add new SPI master controllers in alphabetical order above this line |
80 | # | 108 | # |
81 | 109 | ||
82 | 110 | ||
111 | config SPI_S3C24XX | ||
112 | tristate "Samsung S3C24XX series SPI" | ||
113 | depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL | ||
114 | help | ||
115 | SPI driver for Samsung S3C24XX series ARM SoCs | ||
116 | |||
83 | # | 117 | # |
84 | # There are lots of SPI device types, with sensors and memory | 118 | # There are lots of SPI device types, with sensors and memory |
85 | # being probably the most widely used ones. | 119 | # being probably the most widely used ones. |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index c2c87e845abf..8f4cb67997b3 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -13,6 +13,10 @@ obj-$(CONFIG_SPI_MASTER) += spi.o | |||
13 | # SPI master controller drivers (bus) | 13 | # SPI master controller drivers (bus) |
14 | obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o | 14 | obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o |
15 | obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o | 15 | obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o |
16 | obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o | ||
17 | obj-$(CONFIG_SPI_MPC83xx) += spi_mpc83xx.o | ||
18 | obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o | ||
19 | obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24xx.o | ||
16 | # ... add above this line ... | 20 | # ... add above this line ... |
17 | 21 | ||
18 | # SPI protocol drivers (device/link on bus) | 22 | # SPI protocol drivers (device/link on bus) |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c new file mode 100644 index 000000000000..29aec77f98be --- /dev/null +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -0,0 +1,1486 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #include <linux/init.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/spi/spi.h> | ||
28 | #include <linux/workqueue.h> | ||
29 | #include <linux/errno.h> | ||
30 | #include <linux/delay.h> | ||
31 | |||
32 | #include <asm/io.h> | ||
33 | #include <asm/irq.h> | ||
34 | #include <asm/hardware.h> | ||
35 | #include <asm/delay.h> | ||
36 | #include <asm/dma.h> | ||
37 | |||
38 | #include <asm/arch/hardware.h> | ||
39 | #include <asm/arch/pxa-regs.h> | ||
40 | #include <asm/arch/pxa2xx_spi.h> | ||
41 | |||
42 | MODULE_AUTHOR("Stephen Street"); | ||
43 | MODULE_DESCRIPTION("PXA2xx SSP SPI Contoller"); | ||
44 | MODULE_LICENSE("GPL"); | ||
45 | |||
46 | #define MAX_BUSES 3 | ||
47 | |||
48 | #define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR) | ||
49 | #define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK) | ||
50 | #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) | ||
51 | |||
52 | #define DEFINE_SSP_REG(reg, off) \ | ||
53 | static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \ | ||
54 | static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); } | ||
55 | |||
56 | DEFINE_SSP_REG(SSCR0, 0x00) | ||
57 | DEFINE_SSP_REG(SSCR1, 0x04) | ||
58 | DEFINE_SSP_REG(SSSR, 0x08) | ||
59 | DEFINE_SSP_REG(SSITR, 0x0c) | ||
60 | DEFINE_SSP_REG(SSDR, 0x10) | ||
61 | DEFINE_SSP_REG(SSTO, 0x28) | ||
62 | DEFINE_SSP_REG(SSPSP, 0x2c) | ||
63 | |||
64 | #define START_STATE ((void*)0) | ||
65 | #define RUNNING_STATE ((void*)1) | ||
66 | #define DONE_STATE ((void*)2) | ||
67 | #define ERROR_STATE ((void*)-1) | ||
68 | |||
69 | #define QUEUE_RUNNING 0 | ||
70 | #define QUEUE_STOPPED 1 | ||
71 | |||
72 | struct driver_data { | ||
73 | /* Driver model hookup */ | ||
74 | struct platform_device *pdev; | ||
75 | |||
76 | /* SPI framework hookup */ | ||
77 | enum pxa_ssp_type ssp_type; | ||
78 | struct spi_master *master; | ||
79 | |||
80 | /* PXA hookup */ | ||
81 | struct pxa2xx_spi_master *master_info; | ||
82 | |||
83 | /* DMA setup stuff */ | ||
84 | int rx_channel; | ||
85 | int tx_channel; | ||
86 | u32 *null_dma_buf; | ||
87 | |||
88 | /* SSP register addresses */ | ||
89 | void *ioaddr; | ||
90 | u32 ssdr_physical; | ||
91 | |||
92 | /* SSP masks*/ | ||
93 | u32 dma_cr1; | ||
94 | u32 int_cr1; | ||
95 | u32 clear_sr; | ||
96 | u32 mask_sr; | ||
97 | |||
98 | /* Driver message queue */ | ||
99 | struct workqueue_struct *workqueue; | ||
100 | struct work_struct pump_messages; | ||
101 | spinlock_t lock; | ||
102 | struct list_head queue; | ||
103 | int busy; | ||
104 | int run; | ||
105 | |||
106 | /* Message Transfer pump */ | ||
107 | struct tasklet_struct pump_transfers; | ||
108 | |||
109 | /* Current message transfer state info */ | ||
110 | struct spi_message* cur_msg; | ||
111 | struct spi_transfer* cur_transfer; | ||
112 | struct chip_data *cur_chip; | ||
113 | size_t len; | ||
114 | void *tx; | ||
115 | void *tx_end; | ||
116 | void *rx; | ||
117 | void *rx_end; | ||
118 | int dma_mapped; | ||
119 | dma_addr_t rx_dma; | ||
120 | dma_addr_t tx_dma; | ||
121 | size_t rx_map_len; | ||
122 | size_t tx_map_len; | ||
123 | u8 n_bytes; | ||
124 | u32 dma_width; | ||
125 | int cs_change; | ||
126 | void (*write)(struct driver_data *drv_data); | ||
127 | void (*read)(struct driver_data *drv_data); | ||
128 | irqreturn_t (*transfer_handler)(struct driver_data *drv_data); | ||
129 | void (*cs_control)(u32 command); | ||
130 | }; | ||
131 | |||
132 | struct chip_data { | ||
133 | u32 cr0; | ||
134 | u32 cr1; | ||
135 | u32 to; | ||
136 | u32 psp; | ||
137 | u32 timeout; | ||
138 | u8 n_bytes; | ||
139 | u32 dma_width; | ||
140 | u32 dma_burst_size; | ||
141 | u32 threshold; | ||
142 | u32 dma_threshold; | ||
143 | u8 enable_dma; | ||
144 | u8 bits_per_word; | ||
145 | u32 speed_hz; | ||
146 | void (*write)(struct driver_data *drv_data); | ||
147 | void (*read)(struct driver_data *drv_data); | ||
148 | void (*cs_control)(u32 command); | ||
149 | }; | ||
150 | |||
151 | static void pump_messages(void *data); | ||
152 | |||
153 | static int flush(struct driver_data *drv_data) | ||
154 | { | ||
155 | unsigned long limit = loops_per_jiffy << 1; | ||
156 | |||
157 | void *reg = drv_data->ioaddr; | ||
158 | |||
159 | do { | ||
160 | while (read_SSSR(reg) & SSSR_RNE) { | ||
161 | read_SSDR(reg); | ||
162 | } | ||
163 | } while ((read_SSSR(reg) & SSSR_BSY) && limit--); | ||
164 | write_SSSR(SSSR_ROR, reg); | ||
165 | |||
166 | return limit; | ||
167 | } | ||
168 | |||
169 | static void restore_state(struct driver_data *drv_data) | ||
170 | { | ||
171 | void *reg = drv_data->ioaddr; | ||
172 | |||
173 | /* Clear status and disable clock */ | ||
174 | write_SSSR(drv_data->clear_sr, reg); | ||
175 | write_SSCR0(drv_data->cur_chip->cr0 & ~SSCR0_SSE, reg); | ||
176 | |||
177 | /* Load the registers */ | ||
178 | write_SSCR1(drv_data->cur_chip->cr1, reg); | ||
179 | write_SSCR0(drv_data->cur_chip->cr0, reg); | ||
180 | if (drv_data->ssp_type != PXA25x_SSP) { | ||
181 | write_SSTO(0, reg); | ||
182 | write_SSPSP(drv_data->cur_chip->psp, reg); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | static void null_cs_control(u32 command) | ||
187 | { | ||
188 | } | ||
189 | |||
190 | static void null_writer(struct driver_data *drv_data) | ||
191 | { | ||
192 | void *reg = drv_data->ioaddr; | ||
193 | u8 n_bytes = drv_data->n_bytes; | ||
194 | |||
195 | while ((read_SSSR(reg) & SSSR_TNF) | ||
196 | && (drv_data->tx < drv_data->tx_end)) { | ||
197 | write_SSDR(0, reg); | ||
198 | drv_data->tx += n_bytes; | ||
199 | } | ||
200 | } | ||
201 | |||
202 | static void null_reader(struct driver_data *drv_data) | ||
203 | { | ||
204 | void *reg = drv_data->ioaddr; | ||
205 | u8 n_bytes = drv_data->n_bytes; | ||
206 | |||
207 | while ((read_SSSR(reg) & SSSR_RNE) | ||
208 | && (drv_data->rx < drv_data->rx_end)) { | ||
209 | read_SSDR(reg); | ||
210 | drv_data->rx += n_bytes; | ||
211 | } | ||
212 | } | ||
213 | |||
214 | static void u8_writer(struct driver_data *drv_data) | ||
215 | { | ||
216 | void *reg = drv_data->ioaddr; | ||
217 | |||
218 | while ((read_SSSR(reg) & SSSR_TNF) | ||
219 | && (drv_data->tx < drv_data->tx_end)) { | ||
220 | write_SSDR(*(u8 *)(drv_data->tx), reg); | ||
221 | ++drv_data->tx; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | static void u8_reader(struct driver_data *drv_data) | ||
226 | { | ||
227 | void *reg = drv_data->ioaddr; | ||
228 | |||
229 | while ((read_SSSR(reg) & SSSR_RNE) | ||
230 | && (drv_data->rx < drv_data->rx_end)) { | ||
231 | *(u8 *)(drv_data->rx) = read_SSDR(reg); | ||
232 | ++drv_data->rx; | ||
233 | } | ||
234 | } | ||
235 | |||
236 | static void u16_writer(struct driver_data *drv_data) | ||
237 | { | ||
238 | void *reg = drv_data->ioaddr; | ||
239 | |||
240 | while ((read_SSSR(reg) & SSSR_TNF) | ||
241 | && (drv_data->tx < drv_data->tx_end)) { | ||
242 | write_SSDR(*(u16 *)(drv_data->tx), reg); | ||
243 | drv_data->tx += 2; | ||
244 | } | ||
245 | } | ||
246 | |||
247 | static void u16_reader(struct driver_data *drv_data) | ||
248 | { | ||
249 | void *reg = drv_data->ioaddr; | ||
250 | |||
251 | while ((read_SSSR(reg) & SSSR_RNE) | ||
252 | && (drv_data->rx < drv_data->rx_end)) { | ||
253 | *(u16 *)(drv_data->rx) = read_SSDR(reg); | ||
254 | drv_data->rx += 2; | ||
255 | } | ||
256 | } | ||
257 | static void u32_writer(struct driver_data *drv_data) | ||
258 | { | ||
259 | void *reg = drv_data->ioaddr; | ||
260 | |||
261 | while ((read_SSSR(reg) & SSSR_TNF) | ||
262 | && (drv_data->tx < drv_data->tx_end)) { | ||
263 | write_SSDR(*(u32 *)(drv_data->tx), reg); | ||
264 | drv_data->tx += 4; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | static void u32_reader(struct driver_data *drv_data) | ||
269 | { | ||
270 | void *reg = drv_data->ioaddr; | ||
271 | |||
272 | while ((read_SSSR(reg) & SSSR_RNE) | ||
273 | && (drv_data->rx < drv_data->rx_end)) { | ||
274 | *(u32 *)(drv_data->rx) = read_SSDR(reg); | ||
275 | drv_data->rx += 4; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | static void *next_transfer(struct driver_data *drv_data) | ||
280 | { | ||
281 | struct spi_message *msg = drv_data->cur_msg; | ||
282 | struct spi_transfer *trans = drv_data->cur_transfer; | ||
283 | |||
284 | /* Move to next transfer */ | ||
285 | if (trans->transfer_list.next != &msg->transfers) { | ||
286 | drv_data->cur_transfer = | ||
287 | list_entry(trans->transfer_list.next, | ||
288 | struct spi_transfer, | ||
289 | transfer_list); | ||
290 | return RUNNING_STATE; | ||
291 | } else | ||
292 | return DONE_STATE; | ||
293 | } | ||
294 | |||
295 | static int map_dma_buffers(struct driver_data *drv_data) | ||
296 | { | ||
297 | struct spi_message *msg = drv_data->cur_msg; | ||
298 | struct device *dev = &msg->spi->dev; | ||
299 | |||
300 | if (!drv_data->cur_chip->enable_dma) | ||
301 | return 0; | ||
302 | |||
303 | if (msg->is_dma_mapped) | ||
304 | return drv_data->rx_dma && drv_data->tx_dma; | ||
305 | |||
306 | if (!IS_DMA_ALIGNED(drv_data->rx) || !IS_DMA_ALIGNED(drv_data->tx)) | ||
307 | return 0; | ||
308 | |||
309 | /* Modify setup if rx buffer is null */ | ||
310 | if (drv_data->rx == NULL) { | ||
311 | *drv_data->null_dma_buf = 0; | ||
312 | drv_data->rx = drv_data->null_dma_buf; | ||
313 | drv_data->rx_map_len = 4; | ||
314 | } else | ||
315 | drv_data->rx_map_len = drv_data->len; | ||
316 | |||
317 | |||
318 | /* Modify setup if tx buffer is null */ | ||
319 | if (drv_data->tx == NULL) { | ||
320 | *drv_data->null_dma_buf = 0; | ||
321 | drv_data->tx = drv_data->null_dma_buf; | ||
322 | drv_data->tx_map_len = 4; | ||
323 | } else | ||
324 | drv_data->tx_map_len = drv_data->len; | ||
325 | |||
326 | /* Stream map the rx buffer */ | ||
327 | drv_data->rx_dma = dma_map_single(dev, drv_data->rx, | ||
328 | drv_data->rx_map_len, | ||
329 | DMA_FROM_DEVICE); | ||
330 | if (dma_mapping_error(drv_data->rx_dma)) | ||
331 | return 0; | ||
332 | |||
333 | /* Stream map the tx buffer */ | ||
334 | drv_data->tx_dma = dma_map_single(dev, drv_data->tx, | ||
335 | drv_data->tx_map_len, | ||
336 | DMA_TO_DEVICE); | ||
337 | |||
338 | if (dma_mapping_error(drv_data->tx_dma)) { | ||
339 | dma_unmap_single(dev, drv_data->rx_dma, | ||
340 | drv_data->rx_map_len, DMA_FROM_DEVICE); | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | return 1; | ||
345 | } | ||
346 | |||
347 | static void unmap_dma_buffers(struct driver_data *drv_data) | ||
348 | { | ||
349 | struct device *dev; | ||
350 | |||
351 | if (!drv_data->dma_mapped) | ||
352 | return; | ||
353 | |||
354 | if (!drv_data->cur_msg->is_dma_mapped) { | ||
355 | dev = &drv_data->cur_msg->spi->dev; | ||
356 | dma_unmap_single(dev, drv_data->rx_dma, | ||
357 | drv_data->rx_map_len, DMA_FROM_DEVICE); | ||
358 | dma_unmap_single(dev, drv_data->tx_dma, | ||
359 | drv_data->tx_map_len, DMA_TO_DEVICE); | ||
360 | } | ||
361 | |||
362 | drv_data->dma_mapped = 0; | ||
363 | } | ||
364 | |||
365 | /* caller already set message->status; dma and pio irqs are blocked */ | ||
366 | static void giveback(struct driver_data *drv_data) | ||
367 | { | ||
368 | struct spi_transfer* last_transfer; | ||
369 | unsigned long flags; | ||
370 | struct spi_message *msg; | ||
371 | |||
372 | spin_lock_irqsave(&drv_data->lock, flags); | ||
373 | msg = drv_data->cur_msg; | ||
374 | drv_data->cur_msg = NULL; | ||
375 | drv_data->cur_transfer = NULL; | ||
376 | drv_data->cur_chip = NULL; | ||
377 | queue_work(drv_data->workqueue, &drv_data->pump_messages); | ||
378 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
379 | |||
380 | last_transfer = list_entry(msg->transfers.prev, | ||
381 | struct spi_transfer, | ||
382 | transfer_list); | ||
383 | |||
384 | if (!last_transfer->cs_change) | ||
385 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
386 | |||
387 | msg->state = NULL; | ||
388 | if (msg->complete) | ||
389 | msg->complete(msg->context); | ||
390 | } | ||
391 | |||
392 | static int wait_ssp_rx_stall(void *ioaddr) | ||
393 | { | ||
394 | unsigned long limit = loops_per_jiffy << 1; | ||
395 | |||
396 | while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--) | ||
397 | cpu_relax(); | ||
398 | |||
399 | return limit; | ||
400 | } | ||
401 | |||
402 | static int wait_dma_channel_stop(int channel) | ||
403 | { | ||
404 | unsigned long limit = loops_per_jiffy << 1; | ||
405 | |||
406 | while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--) | ||
407 | cpu_relax(); | ||
408 | |||
409 | return limit; | ||
410 | } | ||
411 | |||
412 | static void dma_handler(int channel, void *data, struct pt_regs *regs) | ||
413 | { | ||
414 | struct driver_data *drv_data = data; | ||
415 | struct spi_message *msg = drv_data->cur_msg; | ||
416 | void *reg = drv_data->ioaddr; | ||
417 | u32 irq_status = DCSR(channel) & DMA_INT_MASK; | ||
418 | u32 trailing_sssr = 0; | ||
419 | |||
420 | if (irq_status & DCSR_BUSERR) { | ||
421 | |||
422 | /* Disable interrupts, clear status and reset DMA */ | ||
423 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
424 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
425 | if (drv_data->ssp_type != PXA25x_SSP) | ||
426 | write_SSTO(0, reg); | ||
427 | write_SSSR(drv_data->clear_sr, reg); | ||
428 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
429 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
430 | |||
431 | if (flush(drv_data) == 0) | ||
432 | dev_err(&drv_data->pdev->dev, | ||
433 | "dma_handler: flush fail\n"); | ||
434 | |||
435 | unmap_dma_buffers(drv_data); | ||
436 | |||
437 | if (channel == drv_data->tx_channel) | ||
438 | dev_err(&drv_data->pdev->dev, | ||
439 | "dma_handler: bad bus address on " | ||
440 | "tx channel %d, source %x target = %x\n", | ||
441 | channel, DSADR(channel), DTADR(channel)); | ||
442 | else | ||
443 | dev_err(&drv_data->pdev->dev, | ||
444 | "dma_handler: bad bus address on " | ||
445 | "rx channel %d, source %x target = %x\n", | ||
446 | channel, DSADR(channel), DTADR(channel)); | ||
447 | |||
448 | msg->state = ERROR_STATE; | ||
449 | tasklet_schedule(&drv_data->pump_transfers); | ||
450 | } | ||
451 | |||
452 | /* PXA255x_SSP has no timeout interrupt, wait for tailing bytes */ | ||
453 | if ((drv_data->ssp_type == PXA25x_SSP) | ||
454 | && (channel == drv_data->tx_channel) | ||
455 | && (irq_status & DCSR_ENDINTR)) { | ||
456 | |||
457 | /* Wait for rx to stall */ | ||
458 | if (wait_ssp_rx_stall(drv_data->ioaddr) == 0) | ||
459 | dev_err(&drv_data->pdev->dev, | ||
460 | "dma_handler: ssp rx stall failed\n"); | ||
461 | |||
462 | /* Clear and disable interrupts on SSP and DMA channels*/ | ||
463 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
464 | write_SSSR(drv_data->clear_sr, reg); | ||
465 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
466 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
467 | if (wait_dma_channel_stop(drv_data->rx_channel) == 0) | ||
468 | dev_err(&drv_data->pdev->dev, | ||
469 | "dma_handler: dma rx channel stop failed\n"); | ||
470 | |||
471 | unmap_dma_buffers(drv_data); | ||
472 | |||
473 | /* Read trailing bytes */ | ||
474 | /* Calculate number of trailing bytes, read them */ | ||
475 | trailing_sssr = read_SSSR(reg); | ||
476 | if ((trailing_sssr & 0xf008) != 0xf000) { | ||
477 | drv_data->rx = drv_data->rx_end - | ||
478 | (((trailing_sssr >> 12) & 0x0f) + 1); | ||
479 | drv_data->read(drv_data); | ||
480 | } | ||
481 | msg->actual_length += drv_data->len; | ||
482 | |||
483 | /* Release chip select if requested, transfer delays are | ||
484 | * handled in pump_transfers */ | ||
485 | if (drv_data->cs_change) | ||
486 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
487 | |||
488 | /* Move to next transfer */ | ||
489 | msg->state = next_transfer(drv_data); | ||
490 | |||
491 | /* Schedule transfer tasklet */ | ||
492 | tasklet_schedule(&drv_data->pump_transfers); | ||
493 | } | ||
494 | } | ||
495 | |||
496 | static irqreturn_t dma_transfer(struct driver_data *drv_data) | ||
497 | { | ||
498 | u32 irq_status; | ||
499 | u32 trailing_sssr = 0; | ||
500 | struct spi_message *msg = drv_data->cur_msg; | ||
501 | void *reg = drv_data->ioaddr; | ||
502 | |||
503 | irq_status = read_SSSR(reg) & drv_data->mask_sr; | ||
504 | if (irq_status & SSSR_ROR) { | ||
505 | /* Clear and disable interrupts on SSP and DMA channels*/ | ||
506 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
507 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
508 | if (drv_data->ssp_type != PXA25x_SSP) | ||
509 | write_SSTO(0, reg); | ||
510 | write_SSSR(drv_data->clear_sr, reg); | ||
511 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
512 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
513 | unmap_dma_buffers(drv_data); | ||
514 | |||
515 | if (flush(drv_data) == 0) | ||
516 | dev_err(&drv_data->pdev->dev, | ||
517 | "dma_transfer: flush fail\n"); | ||
518 | |||
519 | dev_warn(&drv_data->pdev->dev, "dma_transfer: fifo overun\n"); | ||
520 | |||
521 | drv_data->cur_msg->state = ERROR_STATE; | ||
522 | tasklet_schedule(&drv_data->pump_transfers); | ||
523 | |||
524 | return IRQ_HANDLED; | ||
525 | } | ||
526 | |||
527 | /* Check for false positive timeout */ | ||
528 | if ((irq_status & SSSR_TINT) && DCSR(drv_data->tx_channel) & DCSR_RUN) { | ||
529 | write_SSSR(SSSR_TINT, reg); | ||
530 | return IRQ_HANDLED; | ||
531 | } | ||
532 | |||
533 | if (irq_status & SSSR_TINT || drv_data->rx == drv_data->rx_end) { | ||
534 | |||
535 | /* Clear and disable interrupts on SSP and DMA channels*/ | ||
536 | write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg); | ||
537 | if (drv_data->ssp_type != PXA25x_SSP) | ||
538 | write_SSTO(0, reg); | ||
539 | write_SSSR(drv_data->clear_sr, reg); | ||
540 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
541 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
542 | |||
543 | if (wait_dma_channel_stop(drv_data->rx_channel) == 0) | ||
544 | dev_err(&drv_data->pdev->dev, | ||
545 | "dma_transfer: dma rx channel stop failed\n"); | ||
546 | |||
547 | if (wait_ssp_rx_stall(drv_data->ioaddr) == 0) | ||
548 | dev_err(&drv_data->pdev->dev, | ||
549 | "dma_transfer: ssp rx stall failed\n"); | ||
550 | |||
551 | unmap_dma_buffers(drv_data); | ||
552 | |||
553 | /* Calculate number of trailing bytes, read them */ | ||
554 | trailing_sssr = read_SSSR(reg); | ||
555 | if ((trailing_sssr & 0xf008) != 0xf000) { | ||
556 | drv_data->rx = drv_data->rx_end - | ||
557 | (((trailing_sssr >> 12) & 0x0f) + 1); | ||
558 | drv_data->read(drv_data); | ||
559 | } | ||
560 | msg->actual_length += drv_data->len; | ||
561 | |||
562 | /* Release chip select if requested, transfer delays are | ||
563 | * handled in pump_transfers */ | ||
564 | if (drv_data->cs_change) | ||
565 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
566 | |||
567 | /* Move to next transfer */ | ||
568 | msg->state = next_transfer(drv_data); | ||
569 | |||
570 | /* Schedule transfer tasklet */ | ||
571 | tasklet_schedule(&drv_data->pump_transfers); | ||
572 | |||
573 | return IRQ_HANDLED; | ||
574 | } | ||
575 | |||
576 | /* Opps problem detected */ | ||
577 | return IRQ_NONE; | ||
578 | } | ||
579 | |||
580 | static irqreturn_t interrupt_transfer(struct driver_data *drv_data) | ||
581 | { | ||
582 | struct spi_message *msg = drv_data->cur_msg; | ||
583 | void *reg = drv_data->ioaddr; | ||
584 | unsigned long limit = loops_per_jiffy << 1; | ||
585 | u32 irq_status; | ||
586 | u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ? | ||
587 | drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS; | ||
588 | |||
589 | while ((irq_status = read_SSSR(reg) & irq_mask)) { | ||
590 | |||
591 | if (irq_status & SSSR_ROR) { | ||
592 | |||
593 | /* Clear and disable interrupts */ | ||
594 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
595 | write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg); | ||
596 | if (drv_data->ssp_type != PXA25x_SSP) | ||
597 | write_SSTO(0, reg); | ||
598 | write_SSSR(drv_data->clear_sr, reg); | ||
599 | |||
600 | if (flush(drv_data) == 0) | ||
601 | dev_err(&drv_data->pdev->dev, | ||
602 | "interrupt_transfer: flush fail\n"); | ||
603 | |||
604 | /* Stop the SSP */ | ||
605 | |||
606 | dev_warn(&drv_data->pdev->dev, | ||
607 | "interrupt_transfer: fifo overun\n"); | ||
608 | |||
609 | msg->state = ERROR_STATE; | ||
610 | tasklet_schedule(&drv_data->pump_transfers); | ||
611 | |||
612 | return IRQ_HANDLED; | ||
613 | } | ||
614 | |||
615 | /* Look for false positive timeout */ | ||
616 | if ((irq_status & SSSR_TINT) | ||
617 | && (drv_data->rx < drv_data->rx_end)) | ||
618 | write_SSSR(SSSR_TINT, reg); | ||
619 | |||
620 | /* Pump data */ | ||
621 | drv_data->read(drv_data); | ||
622 | drv_data->write(drv_data); | ||
623 | |||
624 | if (drv_data->tx == drv_data->tx_end) { | ||
625 | /* Disable tx interrupt */ | ||
626 | write_SSCR1(read_SSCR1(reg) & ~SSCR1_TIE, reg); | ||
627 | irq_mask = drv_data->mask_sr & ~SSSR_TFS; | ||
628 | |||
629 | /* PXA25x_SSP has no timeout, read trailing bytes */ | ||
630 | if (drv_data->ssp_type == PXA25x_SSP) { | ||
631 | while ((read_SSSR(reg) & SSSR_BSY) && limit--) | ||
632 | drv_data->read(drv_data); | ||
633 | |||
634 | if (limit == 0) | ||
635 | dev_err(&drv_data->pdev->dev, | ||
636 | "interrupt_transfer: " | ||
637 | "trailing byte read failed\n"); | ||
638 | } | ||
639 | } | ||
640 | |||
641 | if ((irq_status & SSSR_TINT) | ||
642 | || (drv_data->rx == drv_data->rx_end)) { | ||
643 | |||
644 | /* Clear timeout */ | ||
645 | write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg); | ||
646 | if (drv_data->ssp_type != PXA25x_SSP) | ||
647 | write_SSTO(0, reg); | ||
648 | write_SSSR(drv_data->clear_sr, reg); | ||
649 | |||
650 | /* Update total byte transfered */ | ||
651 | msg->actual_length += drv_data->len; | ||
652 | |||
653 | /* Release chip select if requested, transfer delays are | ||
654 | * handled in pump_transfers */ | ||
655 | if (drv_data->cs_change) | ||
656 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
657 | |||
658 | /* Move to next transfer */ | ||
659 | msg->state = next_transfer(drv_data); | ||
660 | |||
661 | /* Schedule transfer tasklet */ | ||
662 | tasklet_schedule(&drv_data->pump_transfers); | ||
663 | } | ||
664 | } | ||
665 | |||
666 | /* We did something */ | ||
667 | return IRQ_HANDLED; | ||
668 | } | ||
669 | |||
670 | static irqreturn_t ssp_int(int irq, void *dev_id, struct pt_regs *regs) | ||
671 | { | ||
672 | struct driver_data *drv_data = (struct driver_data *)dev_id; | ||
673 | void *reg = drv_data->ioaddr; | ||
674 | |||
675 | if (!drv_data->cur_msg) { | ||
676 | |||
677 | write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg); | ||
678 | write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg); | ||
679 | if (drv_data->ssp_type != PXA25x_SSP) | ||
680 | write_SSTO(0, reg); | ||
681 | write_SSSR(drv_data->clear_sr, reg); | ||
682 | |||
683 | dev_err(&drv_data->pdev->dev, "bad message state " | ||
684 | "in interrupt handler"); | ||
685 | |||
686 | /* Never fail */ | ||
687 | return IRQ_HANDLED; | ||
688 | } | ||
689 | |||
690 | return drv_data->transfer_handler(drv_data); | ||
691 | } | ||
692 | |||
693 | static void pump_transfers(unsigned long data) | ||
694 | { | ||
695 | struct driver_data *drv_data = (struct driver_data *)data; | ||
696 | struct spi_message *message = NULL; | ||
697 | struct spi_transfer *transfer = NULL; | ||
698 | struct spi_transfer *previous = NULL; | ||
699 | struct chip_data *chip = NULL; | ||
700 | void *reg = drv_data->ioaddr; | ||
701 | u32 clk_div = 0; | ||
702 | u8 bits = 0; | ||
703 | u32 speed = 0; | ||
704 | u32 cr0; | ||
705 | |||
706 | /* Get current state information */ | ||
707 | message = drv_data->cur_msg; | ||
708 | transfer = drv_data->cur_transfer; | ||
709 | chip = drv_data->cur_chip; | ||
710 | |||
711 | /* Handle for abort */ | ||
712 | if (message->state == ERROR_STATE) { | ||
713 | message->status = -EIO; | ||
714 | giveback(drv_data); | ||
715 | return; | ||
716 | } | ||
717 | |||
718 | /* Handle end of message */ | ||
719 | if (message->state == DONE_STATE) { | ||
720 | message->status = 0; | ||
721 | giveback(drv_data); | ||
722 | return; | ||
723 | } | ||
724 | |||
725 | /* Delay if requested at end of transfer*/ | ||
726 | if (message->state == RUNNING_STATE) { | ||
727 | previous = list_entry(transfer->transfer_list.prev, | ||
728 | struct spi_transfer, | ||
729 | transfer_list); | ||
730 | if (previous->delay_usecs) | ||
731 | udelay(previous->delay_usecs); | ||
732 | } | ||
733 | |||
734 | /* Setup the transfer state based on the type of transfer */ | ||
735 | if (flush(drv_data) == 0) { | ||
736 | dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n"); | ||
737 | message->status = -EIO; | ||
738 | giveback(drv_data); | ||
739 | return; | ||
740 | } | ||
741 | drv_data->n_bytes = chip->n_bytes; | ||
742 | drv_data->dma_width = chip->dma_width; | ||
743 | drv_data->cs_control = chip->cs_control; | ||
744 | drv_data->tx = (void *)transfer->tx_buf; | ||
745 | drv_data->tx_end = drv_data->tx + transfer->len; | ||
746 | drv_data->rx = transfer->rx_buf; | ||
747 | drv_data->rx_end = drv_data->rx + transfer->len; | ||
748 | drv_data->rx_dma = transfer->rx_dma; | ||
749 | drv_data->tx_dma = transfer->tx_dma; | ||
750 | drv_data->len = transfer->len; | ||
751 | drv_data->write = drv_data->tx ? chip->write : null_writer; | ||
752 | drv_data->read = drv_data->rx ? chip->read : null_reader; | ||
753 | drv_data->cs_change = transfer->cs_change; | ||
754 | |||
755 | /* Change speed and bit per word on a per transfer */ | ||
756 | if (transfer->speed_hz || transfer->bits_per_word) { | ||
757 | |||
758 | /* Disable clock */ | ||
759 | write_SSCR0(chip->cr0 & ~SSCR0_SSE, reg); | ||
760 | cr0 = chip->cr0; | ||
761 | bits = chip->bits_per_word; | ||
762 | speed = chip->speed_hz; | ||
763 | |||
764 | if (transfer->speed_hz) | ||
765 | speed = transfer->speed_hz; | ||
766 | |||
767 | if (transfer->bits_per_word) | ||
768 | bits = transfer->bits_per_word; | ||
769 | |||
770 | if (reg == SSP1_VIRT) | ||
771 | clk_div = SSP1_SerClkDiv(speed); | ||
772 | else if (reg == SSP2_VIRT) | ||
773 | clk_div = SSP2_SerClkDiv(speed); | ||
774 | else if (reg == SSP3_VIRT) | ||
775 | clk_div = SSP3_SerClkDiv(speed); | ||
776 | |||
777 | if (bits <= 8) { | ||
778 | drv_data->n_bytes = 1; | ||
779 | drv_data->dma_width = DCMD_WIDTH1; | ||
780 | drv_data->read = drv_data->read != null_reader ? | ||
781 | u8_reader : null_reader; | ||
782 | drv_data->write = drv_data->write != null_writer ? | ||
783 | u8_writer : null_writer; | ||
784 | } else if (bits <= 16) { | ||
785 | drv_data->n_bytes = 2; | ||
786 | drv_data->dma_width = DCMD_WIDTH2; | ||
787 | drv_data->read = drv_data->read != null_reader ? | ||
788 | u16_reader : null_reader; | ||
789 | drv_data->write = drv_data->write != null_writer ? | ||
790 | u16_writer : null_writer; | ||
791 | } else if (bits <= 32) { | ||
792 | drv_data->n_bytes = 4; | ||
793 | drv_data->dma_width = DCMD_WIDTH4; | ||
794 | drv_data->read = drv_data->read != null_reader ? | ||
795 | u32_reader : null_reader; | ||
796 | drv_data->write = drv_data->write != null_writer ? | ||
797 | u32_writer : null_writer; | ||
798 | } | ||
799 | |||
800 | cr0 = clk_div | ||
801 | | SSCR0_Motorola | ||
802 | | SSCR0_DataSize(bits > 16 ? bits - 16 : bits) | ||
803 | | SSCR0_SSE | ||
804 | | (bits > 16 ? SSCR0_EDSS : 0); | ||
805 | |||
806 | /* Start it back up */ | ||
807 | write_SSCR0(cr0, reg); | ||
808 | } | ||
809 | |||
810 | message->state = RUNNING_STATE; | ||
811 | |||
812 | /* Try to map dma buffer and do a dma transfer if successful */ | ||
813 | if ((drv_data->dma_mapped = map_dma_buffers(drv_data))) { | ||
814 | |||
815 | /* Ensure we have the correct interrupt handler */ | ||
816 | drv_data->transfer_handler = dma_transfer; | ||
817 | |||
818 | /* Setup rx DMA Channel */ | ||
819 | DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; | ||
820 | DSADR(drv_data->rx_channel) = drv_data->ssdr_physical; | ||
821 | DTADR(drv_data->rx_channel) = drv_data->rx_dma; | ||
822 | if (drv_data->rx == drv_data->null_dma_buf) | ||
823 | /* No target address increment */ | ||
824 | DCMD(drv_data->rx_channel) = DCMD_FLOWSRC | ||
825 | | drv_data->dma_width | ||
826 | | chip->dma_burst_size | ||
827 | | drv_data->len; | ||
828 | else | ||
829 | DCMD(drv_data->rx_channel) = DCMD_INCTRGADDR | ||
830 | | DCMD_FLOWSRC | ||
831 | | drv_data->dma_width | ||
832 | | chip->dma_burst_size | ||
833 | | drv_data->len; | ||
834 | |||
835 | /* Setup tx DMA Channel */ | ||
836 | DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL; | ||
837 | DSADR(drv_data->tx_channel) = drv_data->tx_dma; | ||
838 | DTADR(drv_data->tx_channel) = drv_data->ssdr_physical; | ||
839 | if (drv_data->tx == drv_data->null_dma_buf) | ||
840 | /* No source address increment */ | ||
841 | DCMD(drv_data->tx_channel) = DCMD_FLOWTRG | ||
842 | | drv_data->dma_width | ||
843 | | chip->dma_burst_size | ||
844 | | drv_data->len; | ||
845 | else | ||
846 | DCMD(drv_data->tx_channel) = DCMD_INCSRCADDR | ||
847 | | DCMD_FLOWTRG | ||
848 | | drv_data->dma_width | ||
849 | | chip->dma_burst_size | ||
850 | | drv_data->len; | ||
851 | |||
852 | /* Enable dma end irqs on SSP to detect end of transfer */ | ||
853 | if (drv_data->ssp_type == PXA25x_SSP) | ||
854 | DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN; | ||
855 | |||
856 | /* Fix me, need to handle cs polarity */ | ||
857 | drv_data->cs_control(PXA2XX_CS_ASSERT); | ||
858 | |||
859 | /* Go baby, go */ | ||
860 | write_SSSR(drv_data->clear_sr, reg); | ||
861 | DCSR(drv_data->rx_channel) |= DCSR_RUN; | ||
862 | DCSR(drv_data->tx_channel) |= DCSR_RUN; | ||
863 | if (drv_data->ssp_type != PXA25x_SSP) | ||
864 | write_SSTO(chip->timeout, reg); | ||
865 | write_SSCR1(chip->cr1 | ||
866 | | chip->dma_threshold | ||
867 | | drv_data->dma_cr1, | ||
868 | reg); | ||
869 | } else { | ||
870 | /* Ensure we have the correct interrupt handler */ | ||
871 | drv_data->transfer_handler = interrupt_transfer; | ||
872 | |||
873 | /* Fix me, need to handle cs polarity */ | ||
874 | drv_data->cs_control(PXA2XX_CS_ASSERT); | ||
875 | |||
876 | /* Go baby, go */ | ||
877 | write_SSSR(drv_data->clear_sr, reg); | ||
878 | if (drv_data->ssp_type != PXA25x_SSP) | ||
879 | write_SSTO(chip->timeout, reg); | ||
880 | write_SSCR1(chip->cr1 | ||
881 | | chip->threshold | ||
882 | | drv_data->int_cr1, | ||
883 | reg); | ||
884 | } | ||
885 | } | ||
886 | |||
887 | static void pump_messages(void *data) | ||
888 | { | ||
889 | struct driver_data *drv_data = data; | ||
890 | unsigned long flags; | ||
891 | |||
892 | /* Lock queue and check for queue work */ | ||
893 | spin_lock_irqsave(&drv_data->lock, flags); | ||
894 | if (list_empty(&drv_data->queue) || drv_data->run == QUEUE_STOPPED) { | ||
895 | drv_data->busy = 0; | ||
896 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
897 | return; | ||
898 | } | ||
899 | |||
900 | /* Make sure we are not already running a message */ | ||
901 | if (drv_data->cur_msg) { | ||
902 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
903 | return; | ||
904 | } | ||
905 | |||
906 | /* Extract head of queue */ | ||
907 | drv_data->cur_msg = list_entry(drv_data->queue.next, | ||
908 | struct spi_message, queue); | ||
909 | list_del_init(&drv_data->cur_msg->queue); | ||
910 | |||
911 | /* Initial message state*/ | ||
912 | drv_data->cur_msg->state = START_STATE; | ||
913 | drv_data->cur_transfer = list_entry(drv_data->cur_msg->transfers.next, | ||
914 | struct spi_transfer, | ||
915 | transfer_list); | ||
916 | |||
917 | /* Setup the SSP using the per chip configuration */ | ||
918 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); | ||
919 | restore_state(drv_data); | ||
920 | |||
921 | /* Mark as busy and launch transfers */ | ||
922 | tasklet_schedule(&drv_data->pump_transfers); | ||
923 | |||
924 | drv_data->busy = 1; | ||
925 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
926 | } | ||
927 | |||
928 | static int transfer(struct spi_device *spi, struct spi_message *msg) | ||
929 | { | ||
930 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); | ||
931 | unsigned long flags; | ||
932 | |||
933 | spin_lock_irqsave(&drv_data->lock, flags); | ||
934 | |||
935 | if (drv_data->run == QUEUE_STOPPED) { | ||
936 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
937 | return -ESHUTDOWN; | ||
938 | } | ||
939 | |||
940 | msg->actual_length = 0; | ||
941 | msg->status = -EINPROGRESS; | ||
942 | msg->state = START_STATE; | ||
943 | |||
944 | list_add_tail(&msg->queue, &drv_data->queue); | ||
945 | |||
946 | if (drv_data->run == QUEUE_RUNNING && !drv_data->busy) | ||
947 | queue_work(drv_data->workqueue, &drv_data->pump_messages); | ||
948 | |||
949 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
950 | |||
951 | return 0; | ||
952 | } | ||
953 | |||
954 | static int setup(struct spi_device *spi) | ||
955 | { | ||
956 | struct pxa2xx_spi_chip *chip_info = NULL; | ||
957 | struct chip_data *chip; | ||
958 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); | ||
959 | unsigned int clk_div; | ||
960 | |||
961 | if (!spi->bits_per_word) | ||
962 | spi->bits_per_word = 8; | ||
963 | |||
964 | if (drv_data->ssp_type != PXA25x_SSP | ||
965 | && (spi->bits_per_word < 4 || spi->bits_per_word > 32)) | ||
966 | return -EINVAL; | ||
967 | else if (spi->bits_per_word < 4 || spi->bits_per_word > 16) | ||
968 | return -EINVAL; | ||
969 | |||
970 | /* Only alloc (or use chip_info) on first setup */ | ||
971 | chip = spi_get_ctldata(spi); | ||
972 | if (chip == NULL) { | ||
973 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); | ||
974 | if (!chip) | ||
975 | return -ENOMEM; | ||
976 | |||
977 | chip->cs_control = null_cs_control; | ||
978 | chip->enable_dma = 0; | ||
979 | chip->timeout = SSP_TIMEOUT(1000); | ||
980 | chip->threshold = SSCR1_RxTresh(1) | SSCR1_TxTresh(1); | ||
981 | chip->dma_burst_size = drv_data->master_info->enable_dma ? | ||
982 | DCMD_BURST8 : 0; | ||
983 | |||
984 | chip_info = spi->controller_data; | ||
985 | } | ||
986 | |||
987 | /* chip_info isn't always needed */ | ||
988 | if (chip_info) { | ||
989 | if (chip_info->cs_control) | ||
990 | chip->cs_control = chip_info->cs_control; | ||
991 | |||
992 | chip->timeout = SSP_TIMEOUT(chip_info->timeout_microsecs); | ||
993 | |||
994 | chip->threshold = SSCR1_RxTresh(chip_info->rx_threshold) | ||
995 | | SSCR1_TxTresh(chip_info->tx_threshold); | ||
996 | |||
997 | chip->enable_dma = chip_info->dma_burst_size != 0 | ||
998 | && drv_data->master_info->enable_dma; | ||
999 | chip->dma_threshold = 0; | ||
1000 | |||
1001 | if (chip->enable_dma) { | ||
1002 | if (chip_info->dma_burst_size <= 8) { | ||
1003 | chip->dma_threshold = SSCR1_RxTresh(8) | ||
1004 | | SSCR1_TxTresh(8); | ||
1005 | chip->dma_burst_size = DCMD_BURST8; | ||
1006 | } else if (chip_info->dma_burst_size <= 16) { | ||
1007 | chip->dma_threshold = SSCR1_RxTresh(16) | ||
1008 | | SSCR1_TxTresh(16); | ||
1009 | chip->dma_burst_size = DCMD_BURST16; | ||
1010 | } else { | ||
1011 | chip->dma_threshold = SSCR1_RxTresh(32) | ||
1012 | | SSCR1_TxTresh(32); | ||
1013 | chip->dma_burst_size = DCMD_BURST32; | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | |||
1018 | if (chip_info->enable_loopback) | ||
1019 | chip->cr1 = SSCR1_LBM; | ||
1020 | } | ||
1021 | |||
1022 | if (drv_data->ioaddr == SSP1_VIRT) | ||
1023 | clk_div = SSP1_SerClkDiv(spi->max_speed_hz); | ||
1024 | else if (drv_data->ioaddr == SSP2_VIRT) | ||
1025 | clk_div = SSP2_SerClkDiv(spi->max_speed_hz); | ||
1026 | else if (drv_data->ioaddr == SSP3_VIRT) | ||
1027 | clk_div = SSP3_SerClkDiv(spi->max_speed_hz); | ||
1028 | else | ||
1029 | return -ENODEV; | ||
1030 | chip->speed_hz = spi->max_speed_hz; | ||
1031 | |||
1032 | chip->cr0 = clk_div | ||
1033 | | SSCR0_Motorola | ||
1034 | | SSCR0_DataSize(spi->bits_per_word > 16 ? | ||
1035 | spi->bits_per_word - 16 : spi->bits_per_word) | ||
1036 | | SSCR0_SSE | ||
1037 | | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0); | ||
1038 | chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) << 4) | ||
1039 | | (((spi->mode & SPI_CPOL) != 0) << 3); | ||
1040 | |||
1041 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ | ||
1042 | if (drv_data->ssp_type != PXA25x_SSP) | ||
1043 | dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n", | ||
1044 | spi->bits_per_word, | ||
1045 | (CLOCK_SPEED_HZ) | ||
1046 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | ||
1047 | spi->mode & 0x3); | ||
1048 | else | ||
1049 | dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n", | ||
1050 | spi->bits_per_word, | ||
1051 | (CLOCK_SPEED_HZ/2) | ||
1052 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | ||
1053 | spi->mode & 0x3); | ||
1054 | |||
1055 | if (spi->bits_per_word <= 8) { | ||
1056 | chip->n_bytes = 1; | ||
1057 | chip->dma_width = DCMD_WIDTH1; | ||
1058 | chip->read = u8_reader; | ||
1059 | chip->write = u8_writer; | ||
1060 | } else if (spi->bits_per_word <= 16) { | ||
1061 | chip->n_bytes = 2; | ||
1062 | chip->dma_width = DCMD_WIDTH2; | ||
1063 | chip->read = u16_reader; | ||
1064 | chip->write = u16_writer; | ||
1065 | } else if (spi->bits_per_word <= 32) { | ||
1066 | chip->cr0 |= SSCR0_EDSS; | ||
1067 | chip->n_bytes = 4; | ||
1068 | chip->dma_width = DCMD_WIDTH4; | ||
1069 | chip->read = u32_reader; | ||
1070 | chip->write = u32_writer; | ||
1071 | } else { | ||
1072 | dev_err(&spi->dev, "invalid wordsize\n"); | ||
1073 | kfree(chip); | ||
1074 | return -ENODEV; | ||
1075 | } | ||
1076 | chip->bits_per_word = spi->bits_per_word; | ||
1077 | |||
1078 | spi_set_ctldata(spi, chip); | ||
1079 | |||
1080 | return 0; | ||
1081 | } | ||
1082 | |||
1083 | static void cleanup(const struct spi_device *spi) | ||
1084 | { | ||
1085 | struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); | ||
1086 | |||
1087 | kfree(chip); | ||
1088 | } | ||
1089 | |||
1090 | static int init_queue(struct driver_data *drv_data) | ||
1091 | { | ||
1092 | INIT_LIST_HEAD(&drv_data->queue); | ||
1093 | spin_lock_init(&drv_data->lock); | ||
1094 | |||
1095 | drv_data->run = QUEUE_STOPPED; | ||
1096 | drv_data->busy = 0; | ||
1097 | |||
1098 | tasklet_init(&drv_data->pump_transfers, | ||
1099 | pump_transfers, (unsigned long)drv_data); | ||
1100 | |||
1101 | INIT_WORK(&drv_data->pump_messages, pump_messages, drv_data); | ||
1102 | drv_data->workqueue = create_singlethread_workqueue( | ||
1103 | drv_data->master->cdev.dev->bus_id); | ||
1104 | if (drv_data->workqueue == NULL) | ||
1105 | return -EBUSY; | ||
1106 | |||
1107 | return 0; | ||
1108 | } | ||
1109 | |||
1110 | static int start_queue(struct driver_data *drv_data) | ||
1111 | { | ||
1112 | unsigned long flags; | ||
1113 | |||
1114 | spin_lock_irqsave(&drv_data->lock, flags); | ||
1115 | |||
1116 | if (drv_data->run == QUEUE_RUNNING || drv_data->busy) { | ||
1117 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1118 | return -EBUSY; | ||
1119 | } | ||
1120 | |||
1121 | drv_data->run = QUEUE_RUNNING; | ||
1122 | drv_data->cur_msg = NULL; | ||
1123 | drv_data->cur_transfer = NULL; | ||
1124 | drv_data->cur_chip = NULL; | ||
1125 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1126 | |||
1127 | queue_work(drv_data->workqueue, &drv_data->pump_messages); | ||
1128 | |||
1129 | return 0; | ||
1130 | } | ||
1131 | |||
1132 | static int stop_queue(struct driver_data *drv_data) | ||
1133 | { | ||
1134 | unsigned long flags; | ||
1135 | unsigned limit = 500; | ||
1136 | int status = 0; | ||
1137 | |||
1138 | spin_lock_irqsave(&drv_data->lock, flags); | ||
1139 | |||
1140 | /* This is a bit lame, but is optimized for the common execution path. | ||
1141 | * A wait_queue on the drv_data->busy could be used, but then the common | ||
1142 | * execution path (pump_messages) would be required to call wake_up or | ||
1143 | * friends on every SPI message. Do this instead */ | ||
1144 | drv_data->run = QUEUE_STOPPED; | ||
1145 | while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) { | ||
1146 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1147 | msleep(10); | ||
1148 | spin_lock_irqsave(&drv_data->lock, flags); | ||
1149 | } | ||
1150 | |||
1151 | if (!list_empty(&drv_data->queue) || drv_data->busy) | ||
1152 | status = -EBUSY; | ||
1153 | |||
1154 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
1155 | |||
1156 | return status; | ||
1157 | } | ||
1158 | |||
1159 | static int destroy_queue(struct driver_data *drv_data) | ||
1160 | { | ||
1161 | int status; | ||
1162 | |||
1163 | status = stop_queue(drv_data); | ||
1164 | if (status != 0) | ||
1165 | return status; | ||
1166 | |||
1167 | destroy_workqueue(drv_data->workqueue); | ||
1168 | |||
1169 | return 0; | ||
1170 | } | ||
1171 | |||
1172 | static int pxa2xx_spi_probe(struct platform_device *pdev) | ||
1173 | { | ||
1174 | struct device *dev = &pdev->dev; | ||
1175 | struct pxa2xx_spi_master *platform_info; | ||
1176 | struct spi_master *master; | ||
1177 | struct driver_data *drv_data = 0; | ||
1178 | struct resource *memory_resource; | ||
1179 | int irq; | ||
1180 | int status = 0; | ||
1181 | |||
1182 | platform_info = dev->platform_data; | ||
1183 | |||
1184 | if (platform_info->ssp_type == SSP_UNDEFINED) { | ||
1185 | dev_err(&pdev->dev, "undefined SSP\n"); | ||
1186 | return -ENODEV; | ||
1187 | } | ||
1188 | |||
1189 | /* Allocate master with space for drv_data and null dma buffer */ | ||
1190 | master = spi_alloc_master(dev, sizeof(struct driver_data) + 16); | ||
1191 | if (!master) { | ||
1192 | dev_err(&pdev->dev, "can not alloc spi_master\n"); | ||
1193 | return -ENOMEM; | ||
1194 | } | ||
1195 | drv_data = spi_master_get_devdata(master); | ||
1196 | drv_data->master = master; | ||
1197 | drv_data->master_info = platform_info; | ||
1198 | drv_data->pdev = pdev; | ||
1199 | |||
1200 | master->bus_num = pdev->id; | ||
1201 | master->num_chipselect = platform_info->num_chipselect; | ||
1202 | master->cleanup = cleanup; | ||
1203 | master->setup = setup; | ||
1204 | master->transfer = transfer; | ||
1205 | |||
1206 | drv_data->ssp_type = platform_info->ssp_type; | ||
1207 | drv_data->null_dma_buf = (u32 *)ALIGN((u32)(drv_data + | ||
1208 | sizeof(struct driver_data)), 8); | ||
1209 | |||
1210 | /* Setup register addresses */ | ||
1211 | memory_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1212 | if (!memory_resource) { | ||
1213 | dev_err(&pdev->dev, "memory resources not defined\n"); | ||
1214 | status = -ENODEV; | ||
1215 | goto out_error_master_alloc; | ||
1216 | } | ||
1217 | |||
1218 | drv_data->ioaddr = (void *)io_p2v((unsigned long)(memory_resource->start)); | ||
1219 | drv_data->ssdr_physical = memory_resource->start + 0x00000010; | ||
1220 | if (platform_info->ssp_type == PXA25x_SSP) { | ||
1221 | drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE; | ||
1222 | drv_data->dma_cr1 = 0; | ||
1223 | drv_data->clear_sr = SSSR_ROR; | ||
1224 | drv_data->mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR; | ||
1225 | } else { | ||
1226 | drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE; | ||
1227 | drv_data->dma_cr1 = SSCR1_TSRE | SSCR1_RSRE | SSCR1_TINTE; | ||
1228 | drv_data->clear_sr = SSSR_ROR | SSSR_TINT; | ||
1229 | drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR; | ||
1230 | } | ||
1231 | |||
1232 | /* Attach to IRQ */ | ||
1233 | irq = platform_get_irq(pdev, 0); | ||
1234 | if (irq < 0) { | ||
1235 | dev_err(&pdev->dev, "irq resource not defined\n"); | ||
1236 | status = -ENODEV; | ||
1237 | goto out_error_master_alloc; | ||
1238 | } | ||
1239 | |||
1240 | status = request_irq(irq, ssp_int, 0, dev->bus_id, drv_data); | ||
1241 | if (status < 0) { | ||
1242 | dev_err(&pdev->dev, "can not get IRQ\n"); | ||
1243 | goto out_error_master_alloc; | ||
1244 | } | ||
1245 | |||
1246 | /* Setup DMA if requested */ | ||
1247 | drv_data->tx_channel = -1; | ||
1248 | drv_data->rx_channel = -1; | ||
1249 | if (platform_info->enable_dma) { | ||
1250 | |||
1251 | /* Get two DMA channels (rx and tx) */ | ||
1252 | drv_data->rx_channel = pxa_request_dma("pxa2xx_spi_ssp_rx", | ||
1253 | DMA_PRIO_HIGH, | ||
1254 | dma_handler, | ||
1255 | drv_data); | ||
1256 | if (drv_data->rx_channel < 0) { | ||
1257 | dev_err(dev, "problem (%d) requesting rx channel\n", | ||
1258 | drv_data->rx_channel); | ||
1259 | status = -ENODEV; | ||
1260 | goto out_error_irq_alloc; | ||
1261 | } | ||
1262 | drv_data->tx_channel = pxa_request_dma("pxa2xx_spi_ssp_tx", | ||
1263 | DMA_PRIO_MEDIUM, | ||
1264 | dma_handler, | ||
1265 | drv_data); | ||
1266 | if (drv_data->tx_channel < 0) { | ||
1267 | dev_err(dev, "problem (%d) requesting tx channel\n", | ||
1268 | drv_data->tx_channel); | ||
1269 | status = -ENODEV; | ||
1270 | goto out_error_dma_alloc; | ||
1271 | } | ||
1272 | |||
1273 | if (drv_data->ioaddr == SSP1_VIRT) { | ||
1274 | DRCMRRXSSDR = DRCMR_MAPVLD | ||
1275 | | drv_data->rx_channel; | ||
1276 | DRCMRTXSSDR = DRCMR_MAPVLD | ||
1277 | | drv_data->tx_channel; | ||
1278 | } else if (drv_data->ioaddr == SSP2_VIRT) { | ||
1279 | DRCMRRXSS2DR = DRCMR_MAPVLD | ||
1280 | | drv_data->rx_channel; | ||
1281 | DRCMRTXSS2DR = DRCMR_MAPVLD | ||
1282 | | drv_data->tx_channel; | ||
1283 | } else if (drv_data->ioaddr == SSP3_VIRT) { | ||
1284 | DRCMRRXSS3DR = DRCMR_MAPVLD | ||
1285 | | drv_data->rx_channel; | ||
1286 | DRCMRTXSS3DR = DRCMR_MAPVLD | ||
1287 | | drv_data->tx_channel; | ||
1288 | } else { | ||
1289 | dev_err(dev, "bad SSP type\n"); | ||
1290 | goto out_error_dma_alloc; | ||
1291 | } | ||
1292 | } | ||
1293 | |||
1294 | /* Enable SOC clock */ | ||
1295 | pxa_set_cken(platform_info->clock_enable, 1); | ||
1296 | |||
1297 | /* Load default SSP configuration */ | ||
1298 | write_SSCR0(0, drv_data->ioaddr); | ||
1299 | write_SSCR1(SSCR1_RxTresh(4) | SSCR1_TxTresh(12), drv_data->ioaddr); | ||
1300 | write_SSCR0(SSCR0_SerClkDiv(2) | ||
1301 | | SSCR0_Motorola | ||
1302 | | SSCR0_DataSize(8), | ||
1303 | drv_data->ioaddr); | ||
1304 | if (drv_data->ssp_type != PXA25x_SSP) | ||
1305 | write_SSTO(0, drv_data->ioaddr); | ||
1306 | write_SSPSP(0, drv_data->ioaddr); | ||
1307 | |||
1308 | /* Initial and start queue */ | ||
1309 | status = init_queue(drv_data); | ||
1310 | if (status != 0) { | ||
1311 | dev_err(&pdev->dev, "problem initializing queue\n"); | ||
1312 | goto out_error_clock_enabled; | ||
1313 | } | ||
1314 | status = start_queue(drv_data); | ||
1315 | if (status != 0) { | ||
1316 | dev_err(&pdev->dev, "problem starting queue\n"); | ||
1317 | goto out_error_clock_enabled; | ||
1318 | } | ||
1319 | |||
1320 | /* Register with the SPI framework */ | ||
1321 | platform_set_drvdata(pdev, drv_data); | ||
1322 | status = spi_register_master(master); | ||
1323 | if (status != 0) { | ||
1324 | dev_err(&pdev->dev, "problem registering spi master\n"); | ||
1325 | goto out_error_queue_alloc; | ||
1326 | } | ||
1327 | |||
1328 | return status; | ||
1329 | |||
1330 | out_error_queue_alloc: | ||
1331 | destroy_queue(drv_data); | ||
1332 | |||
1333 | out_error_clock_enabled: | ||
1334 | pxa_set_cken(platform_info->clock_enable, 0); | ||
1335 | |||
1336 | out_error_dma_alloc: | ||
1337 | if (drv_data->tx_channel != -1) | ||
1338 | pxa_free_dma(drv_data->tx_channel); | ||
1339 | if (drv_data->rx_channel != -1) | ||
1340 | pxa_free_dma(drv_data->rx_channel); | ||
1341 | |||
1342 | out_error_irq_alloc: | ||
1343 | free_irq(irq, drv_data); | ||
1344 | |||
1345 | out_error_master_alloc: | ||
1346 | spi_master_put(master); | ||
1347 | return status; | ||
1348 | } | ||
1349 | |||
1350 | static int pxa2xx_spi_remove(struct platform_device *pdev) | ||
1351 | { | ||
1352 | struct driver_data *drv_data = platform_get_drvdata(pdev); | ||
1353 | int irq; | ||
1354 | int status = 0; | ||
1355 | |||
1356 | if (!drv_data) | ||
1357 | return 0; | ||
1358 | |||
1359 | /* Remove the queue */ | ||
1360 | status = destroy_queue(drv_data); | ||
1361 | if (status != 0) | ||
1362 | return status; | ||
1363 | |||
1364 | /* Disable the SSP at the peripheral and SOC level */ | ||
1365 | write_SSCR0(0, drv_data->ioaddr); | ||
1366 | pxa_set_cken(drv_data->master_info->clock_enable, 0); | ||
1367 | |||
1368 | /* Release DMA */ | ||
1369 | if (drv_data->master_info->enable_dma) { | ||
1370 | if (drv_data->ioaddr == SSP1_VIRT) { | ||
1371 | DRCMRRXSSDR = 0; | ||
1372 | DRCMRTXSSDR = 0; | ||
1373 | } else if (drv_data->ioaddr == SSP2_VIRT) { | ||
1374 | DRCMRRXSS2DR = 0; | ||
1375 | DRCMRTXSS2DR = 0; | ||
1376 | } else if (drv_data->ioaddr == SSP3_VIRT) { | ||
1377 | DRCMRRXSS3DR = 0; | ||
1378 | DRCMRTXSS3DR = 0; | ||
1379 | } | ||
1380 | pxa_free_dma(drv_data->tx_channel); | ||
1381 | pxa_free_dma(drv_data->rx_channel); | ||
1382 | } | ||
1383 | |||
1384 | /* Release IRQ */ | ||
1385 | irq = platform_get_irq(pdev, 0); | ||
1386 | if (irq >= 0) | ||
1387 | free_irq(irq, drv_data); | ||
1388 | |||
1389 | /* Disconnect from the SPI framework */ | ||
1390 | spi_unregister_master(drv_data->master); | ||
1391 | |||
1392 | /* Prevent double remove */ | ||
1393 | platform_set_drvdata(pdev, NULL); | ||
1394 | |||
1395 | return 0; | ||
1396 | } | ||
1397 | |||
1398 | static void pxa2xx_spi_shutdown(struct platform_device *pdev) | ||
1399 | { | ||
1400 | int status = 0; | ||
1401 | |||
1402 | if ((status = pxa2xx_spi_remove(pdev)) != 0) | ||
1403 | dev_err(&pdev->dev, "shutdown failed with %d\n", status); | ||
1404 | } | ||
1405 | |||
1406 | #ifdef CONFIG_PM | ||
1407 | static int suspend_devices(struct device *dev, void *pm_message) | ||
1408 | { | ||
1409 | pm_message_t *state = pm_message; | ||
1410 | |||
1411 | if (dev->power.power_state.event != state->event) { | ||
1412 | dev_warn(dev, "pm state does not match request\n"); | ||
1413 | return -1; | ||
1414 | } | ||
1415 | |||
1416 | return 0; | ||
1417 | } | ||
1418 | |||
1419 | static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state) | ||
1420 | { | ||
1421 | struct driver_data *drv_data = platform_get_drvdata(pdev); | ||
1422 | int status = 0; | ||
1423 | |||
1424 | /* Check all childern for current power state */ | ||
1425 | if (device_for_each_child(&pdev->dev, &state, suspend_devices) != 0) { | ||
1426 | dev_warn(&pdev->dev, "suspend aborted\n"); | ||
1427 | return -1; | ||
1428 | } | ||
1429 | |||
1430 | status = stop_queue(drv_data); | ||
1431 | if (status != 0) | ||
1432 | return status; | ||
1433 | write_SSCR0(0, drv_data->ioaddr); | ||
1434 | pxa_set_cken(drv_data->master_info->clock_enable, 0); | ||
1435 | |||
1436 | return 0; | ||
1437 | } | ||
1438 | |||
1439 | static int pxa2xx_spi_resume(struct platform_device *pdev) | ||
1440 | { | ||
1441 | struct driver_data *drv_data = platform_get_drvdata(pdev); | ||
1442 | int status = 0; | ||
1443 | |||
1444 | /* Enable the SSP clock */ | ||
1445 | pxa_set_cken(drv_data->master_info->clock_enable, 1); | ||
1446 | |||
1447 | /* Start the queue running */ | ||
1448 | status = start_queue(drv_data); | ||
1449 | if (status != 0) { | ||
1450 | dev_err(&pdev->dev, "problem starting queue (%d)\n", status); | ||
1451 | return status; | ||
1452 | } | ||
1453 | |||
1454 | return 0; | ||
1455 | } | ||
1456 | #else | ||
1457 | #define pxa2xx_spi_suspend NULL | ||
1458 | #define pxa2xx_spi_resume NULL | ||
1459 | #endif /* CONFIG_PM */ | ||
1460 | |||
1461 | static struct platform_driver driver = { | ||
1462 | .driver = { | ||
1463 | .name = "pxa2xx-spi", | ||
1464 | .bus = &platform_bus_type, | ||
1465 | .owner = THIS_MODULE, | ||
1466 | }, | ||
1467 | .probe = pxa2xx_spi_probe, | ||
1468 | .remove = __devexit_p(pxa2xx_spi_remove), | ||
1469 | .shutdown = pxa2xx_spi_shutdown, | ||
1470 | .suspend = pxa2xx_spi_suspend, | ||
1471 | .resume = pxa2xx_spi_resume, | ||
1472 | }; | ||
1473 | |||
1474 | static int __init pxa2xx_spi_init(void) | ||
1475 | { | ||
1476 | platform_driver_register(&driver); | ||
1477 | |||
1478 | return 0; | ||
1479 | } | ||
1480 | module_init(pxa2xx_spi_init); | ||
1481 | |||
1482 | static void __exit pxa2xx_spi_exit(void) | ||
1483 | { | ||
1484 | platform_driver_unregister(&driver); | ||
1485 | } | ||
1486 | module_exit(pxa2xx_spi_exit); | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 94f5e8ed83a7..1cea4a6799fe 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -338,18 +338,18 @@ static struct class spi_master_class = { | |||
338 | * spi_alloc_master - allocate SPI master controller | 338 | * spi_alloc_master - allocate SPI master controller |
339 | * @dev: the controller, possibly using the platform_bus | 339 | * @dev: the controller, possibly using the platform_bus |
340 | * @size: how much driver-private data to preallocate; the pointer to this | 340 | * @size: how much driver-private data to preallocate; the pointer to this |
341 | * memory is in the class_data field of the returned class_device, | 341 | * memory is in the class_data field of the returned class_device, |
342 | * accessible with spi_master_get_devdata(). | 342 | * accessible with spi_master_get_devdata(). |
343 | * | 343 | * |
344 | * This call is used only by SPI master controller drivers, which are the | 344 | * This call is used only by SPI master controller drivers, which are the |
345 | * only ones directly touching chip registers. It's how they allocate | 345 | * only ones directly touching chip registers. It's how they allocate |
346 | * an spi_master structure, prior to calling spi_add_master(). | 346 | * an spi_master structure, prior to calling spi_register_master(). |
347 | * | 347 | * |
348 | * This must be called from context that can sleep. It returns the SPI | 348 | * This must be called from context that can sleep. It returns the SPI |
349 | * master structure on success, else NULL. | 349 | * master structure on success, else NULL. |
350 | * | 350 | * |
351 | * The caller is responsible for assigning the bus number and initializing | 351 | * The caller is responsible for assigning the bus number and initializing |
352 | * the master's methods before calling spi_add_master(); and (after errors | 352 | * the master's methods before calling spi_register_master(); and (after errors |
353 | * adding the device) calling spi_master_put() to prevent a memory leak. | 353 | * adding the device) calling spi_master_put() to prevent a memory leak. |
354 | */ | 354 | */ |
355 | struct spi_master * __init_or_module | 355 | struct spi_master * __init_or_module |
@@ -395,7 +395,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master); | |||
395 | int __init_or_module | 395 | int __init_or_module |
396 | spi_register_master(struct spi_master *master) | 396 | spi_register_master(struct spi_master *master) |
397 | { | 397 | { |
398 | static atomic_t dyn_bus_id = ATOMIC_INIT(0); | 398 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); |
399 | struct device *dev = master->cdev.dev; | 399 | struct device *dev = master->cdev.dev; |
400 | int status = -ENODEV; | 400 | int status = -ENODEV; |
401 | int dynamic = 0; | 401 | int dynamic = 0; |
@@ -404,7 +404,7 @@ spi_register_master(struct spi_master *master) | |||
404 | return -ENODEV; | 404 | return -ENODEV; |
405 | 405 | ||
406 | /* convention: dynamically assigned bus IDs count down from the max */ | 406 | /* convention: dynamically assigned bus IDs count down from the max */ |
407 | if (master->bus_num == 0) { | 407 | if (master->bus_num < 0) { |
408 | master->bus_num = atomic_dec_return(&dyn_bus_id); | 408 | master->bus_num = atomic_dec_return(&dyn_bus_id); |
409 | dynamic = 1; | 409 | dynamic = 1; |
410 | } | 410 | } |
@@ -522,7 +522,8 @@ int spi_sync(struct spi_device *spi, struct spi_message *message) | |||
522 | } | 522 | } |
523 | EXPORT_SYMBOL_GPL(spi_sync); | 523 | EXPORT_SYMBOL_GPL(spi_sync); |
524 | 524 | ||
525 | #define SPI_BUFSIZ (SMP_CACHE_BYTES) | 525 | /* portable code must never pass more than 32 bytes */ |
526 | #define SPI_BUFSIZ max(32,SMP_CACHE_BYTES) | ||
526 | 527 | ||
527 | static u8 *buf; | 528 | static u8 *buf; |
528 | 529 | ||
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index f037e5593269..dd2f950b21a7 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -138,6 +138,45 @@ static unsigned bitbang_txrx_32( | |||
138 | return t->len - count; | 138 | return t->len - count; |
139 | } | 139 | } |
140 | 140 | ||
141 | int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | ||
142 | { | ||
143 | struct spi_bitbang_cs *cs = spi->controller_state; | ||
144 | u8 bits_per_word; | ||
145 | u32 hz; | ||
146 | |||
147 | if (t) { | ||
148 | bits_per_word = t->bits_per_word; | ||
149 | hz = t->speed_hz; | ||
150 | } else { | ||
151 | bits_per_word = 0; | ||
152 | hz = 0; | ||
153 | } | ||
154 | |||
155 | /* spi_transfer level calls that work per-word */ | ||
156 | if (!bits_per_word) | ||
157 | bits_per_word = spi->bits_per_word; | ||
158 | if (bits_per_word <= 8) | ||
159 | cs->txrx_bufs = bitbang_txrx_8; | ||
160 | else if (bits_per_word <= 16) | ||
161 | cs->txrx_bufs = bitbang_txrx_16; | ||
162 | else if (bits_per_word <= 32) | ||
163 | cs->txrx_bufs = bitbang_txrx_32; | ||
164 | else | ||
165 | return -EINVAL; | ||
166 | |||
167 | /* nsecs = (clock period)/2 */ | ||
168 | if (!hz) | ||
169 | hz = spi->max_speed_hz; | ||
170 | if (hz) { | ||
171 | cs->nsecs = (1000000000/2) / hz; | ||
172 | if (cs->nsecs > (MAX_UDELAY_MS * 1000 * 1000)) | ||
173 | return -EINVAL; | ||
174 | } | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | EXPORT_SYMBOL_GPL(spi_bitbang_setup_transfer); | ||
179 | |||
141 | /** | 180 | /** |
142 | * spi_bitbang_setup - default setup for per-word I/O loops | 181 | * spi_bitbang_setup - default setup for per-word I/O loops |
143 | */ | 182 | */ |
@@ -145,8 +184,16 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
145 | { | 184 | { |
146 | struct spi_bitbang_cs *cs = spi->controller_state; | 185 | struct spi_bitbang_cs *cs = spi->controller_state; |
147 | struct spi_bitbang *bitbang; | 186 | struct spi_bitbang *bitbang; |
187 | int retval; | ||
148 | 188 | ||
149 | if (!spi->max_speed_hz) | 189 | bitbang = spi_master_get_devdata(spi->master); |
190 | |||
191 | /* REVISIT: some systems will want to support devices using lsb-first | ||
192 | * bit encodings on the wire. In pure software that would be trivial, | ||
193 | * just bitbang_txrx_le_cphaX() routines shifting the other way, and | ||
194 | * some hardware controllers also have this support. | ||
195 | */ | ||
196 | if ((spi->mode & SPI_LSB_FIRST) != 0) | ||
150 | return -EINVAL; | 197 | return -EINVAL; |
151 | 198 | ||
152 | if (!cs) { | 199 | if (!cs) { |
@@ -155,32 +202,20 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
155 | return -ENOMEM; | 202 | return -ENOMEM; |
156 | spi->controller_state = cs; | 203 | spi->controller_state = cs; |
157 | } | 204 | } |
158 | bitbang = spi_master_get_devdata(spi->master); | ||
159 | 205 | ||
160 | if (!spi->bits_per_word) | 206 | if (!spi->bits_per_word) |
161 | spi->bits_per_word = 8; | 207 | spi->bits_per_word = 8; |
162 | 208 | ||
163 | /* spi_transfer level calls that work per-word */ | ||
164 | if (spi->bits_per_word <= 8) | ||
165 | cs->txrx_bufs = bitbang_txrx_8; | ||
166 | else if (spi->bits_per_word <= 16) | ||
167 | cs->txrx_bufs = bitbang_txrx_16; | ||
168 | else if (spi->bits_per_word <= 32) | ||
169 | cs->txrx_bufs = bitbang_txrx_32; | ||
170 | else | ||
171 | return -EINVAL; | ||
172 | |||
173 | /* per-word shift register access, in hardware or bitbanging */ | 209 | /* per-word shift register access, in hardware or bitbanging */ |
174 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; | 210 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; |
175 | if (!cs->txrx_word) | 211 | if (!cs->txrx_word) |
176 | return -EINVAL; | 212 | return -EINVAL; |
177 | 213 | ||
178 | /* nsecs = (clock period)/2 */ | 214 | retval = spi_bitbang_setup_transfer(spi, NULL); |
179 | cs->nsecs = (1000000000/2) / (spi->max_speed_hz); | 215 | if (retval < 0) |
180 | if (cs->nsecs > MAX_UDELAY_MS * 1000) | 216 | return retval; |
181 | return -EINVAL; | ||
182 | 217 | ||
183 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n", | 218 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", |
184 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), | 219 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), |
185 | spi->bits_per_word, 2 * cs->nsecs); | 220 | spi->bits_per_word, 2 * cs->nsecs); |
186 | 221 | ||
@@ -246,6 +281,8 @@ static void bitbang_work(void *_bitbang) | |||
246 | unsigned tmp; | 281 | unsigned tmp; |
247 | unsigned cs_change; | 282 | unsigned cs_change; |
248 | int status; | 283 | int status; |
284 | int (*setup_transfer)(struct spi_device *, | ||
285 | struct spi_transfer *); | ||
249 | 286 | ||
250 | m = container_of(bitbang->queue.next, struct spi_message, | 287 | m = container_of(bitbang->queue.next, struct spi_message, |
251 | queue); | 288 | queue); |
@@ -262,6 +299,7 @@ static void bitbang_work(void *_bitbang) | |||
262 | tmp = 0; | 299 | tmp = 0; |
263 | cs_change = 1; | 300 | cs_change = 1; |
264 | status = 0; | 301 | status = 0; |
302 | setup_transfer = NULL; | ||
265 | 303 | ||
266 | list_for_each_entry (t, &m->transfers, transfer_list) { | 304 | list_for_each_entry (t, &m->transfers, transfer_list) { |
267 | if (bitbang->shutdown) { | 305 | if (bitbang->shutdown) { |
@@ -269,6 +307,20 @@ static void bitbang_work(void *_bitbang) | |||
269 | break; | 307 | break; |
270 | } | 308 | } |
271 | 309 | ||
310 | /* override or restore speed and wordsize */ | ||
311 | if (t->speed_hz || t->bits_per_word) { | ||
312 | setup_transfer = bitbang->setup_transfer; | ||
313 | if (!setup_transfer) { | ||
314 | status = -ENOPROTOOPT; | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | if (setup_transfer) { | ||
319 | status = setup_transfer(spi, t); | ||
320 | if (status < 0) | ||
321 | break; | ||
322 | } | ||
323 | |||
272 | /* set up default clock polarity, and activate chip; | 324 | /* set up default clock polarity, and activate chip; |
273 | * this implicitly updates clock and spi modes as | 325 | * this implicitly updates clock and spi modes as |
274 | * previously recorded for this device via setup(). | 326 | * previously recorded for this device via setup(). |
@@ -325,6 +377,10 @@ static void bitbang_work(void *_bitbang) | |||
325 | m->status = status; | 377 | m->status = status; |
326 | m->complete(m->context); | 378 | m->complete(m->context); |
327 | 379 | ||
380 | /* restore speed and wordsize */ | ||
381 | if (setup_transfer) | ||
382 | setup_transfer(spi, NULL); | ||
383 | |||
328 | /* normally deactivate chipselect ... unless no error and | 384 | /* normally deactivate chipselect ... unless no error and |
329 | * cs_change has hinted that the next message will probably | 385 | * cs_change has hinted that the next message will probably |
330 | * be for this chip too. | 386 | * be for this chip too. |
@@ -348,6 +404,7 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m) | |||
348 | { | 404 | { |
349 | struct spi_bitbang *bitbang; | 405 | struct spi_bitbang *bitbang; |
350 | unsigned long flags; | 406 | unsigned long flags; |
407 | int status = 0; | ||
351 | 408 | ||
352 | m->actual_length = 0; | 409 | m->actual_length = 0; |
353 | m->status = -EINPROGRESS; | 410 | m->status = -EINPROGRESS; |
@@ -357,11 +414,15 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m) | |||
357 | return -ESHUTDOWN; | 414 | return -ESHUTDOWN; |
358 | 415 | ||
359 | spin_lock_irqsave(&bitbang->lock, flags); | 416 | spin_lock_irqsave(&bitbang->lock, flags); |
360 | list_add_tail(&m->queue, &bitbang->queue); | 417 | if (!spi->max_speed_hz) |
361 | queue_work(bitbang->workqueue, &bitbang->work); | 418 | status = -ENETDOWN; |
419 | else { | ||
420 | list_add_tail(&m->queue, &bitbang->queue); | ||
421 | queue_work(bitbang->workqueue, &bitbang->work); | ||
422 | } | ||
362 | spin_unlock_irqrestore(&bitbang->lock, flags); | 423 | spin_unlock_irqrestore(&bitbang->lock, flags); |
363 | 424 | ||
364 | return 0; | 425 | return status; |
365 | } | 426 | } |
366 | EXPORT_SYMBOL_GPL(spi_bitbang_transfer); | 427 | EXPORT_SYMBOL_GPL(spi_bitbang_transfer); |
367 | 428 | ||
@@ -406,6 +467,9 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) | |||
406 | bitbang->use_dma = 0; | 467 | bitbang->use_dma = 0; |
407 | bitbang->txrx_bufs = spi_bitbang_bufs; | 468 | bitbang->txrx_bufs = spi_bitbang_bufs; |
408 | if (!bitbang->master->setup) { | 469 | if (!bitbang->master->setup) { |
470 | if (!bitbang->setup_transfer) | ||
471 | bitbang->setup_transfer = | ||
472 | spi_bitbang_setup_transfer; | ||
409 | bitbang->master->setup = spi_bitbang_setup; | 473 | bitbang->master->setup = spi_bitbang_setup; |
410 | bitbang->master->cleanup = spi_bitbang_cleanup; | 474 | bitbang->master->cleanup = spi_bitbang_cleanup; |
411 | } | 475 | } |
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c index ff9e5faa4dc9..a006a1ee27ac 100644 --- a/drivers/spi/spi_butterfly.c +++ b/drivers/spi/spi_butterfly.c | |||
@@ -321,6 +321,7 @@ static void butterfly_attach(struct parport *p) | |||
321 | * (firmware resets at45, acts as spi slave) or neither (we ignore | 321 | * (firmware resets at45, acts as spi slave) or neither (we ignore |
322 | * both, AVR uses AT45). Here we expect firmware for the first option. | 322 | * both, AVR uses AT45). Here we expect firmware for the first option. |
323 | */ | 323 | */ |
324 | |||
324 | pp->info[0].max_speed_hz = 15 * 1000 * 1000; | 325 | pp->info[0].max_speed_hz = 15 * 1000 * 1000; |
325 | strcpy(pp->info[0].modalias, "mtd_dataflash"); | 326 | strcpy(pp->info[0].modalias, "mtd_dataflash"); |
326 | pp->info[0].platform_data = &flash; | 327 | pp->info[0].platform_data = &flash; |
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c new file mode 100644 index 000000000000..5d92a7e5cb41 --- /dev/null +++ b/drivers/spi/spi_mpc83xx.c | |||
@@ -0,0 +1,483 @@ | |||
1 | /* | ||
2 | * MPC83xx SPI controller driver. | ||
3 | * | ||
4 | * Maintainer: Kumar Gala | ||
5 | * | ||
6 | * Copyright (C) 2006 Polycom, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/completion.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/spi/spi.h> | ||
23 | #include <linux/spi/spi_bitbang.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/fsl_devices.h> | ||
26 | |||
27 | #include <asm/irq.h> | ||
28 | #include <asm/io.h> | ||
29 | |||
30 | /* SPI Controller registers */ | ||
31 | struct mpc83xx_spi_reg { | ||
32 | u8 res1[0x20]; | ||
33 | __be32 mode; | ||
34 | __be32 event; | ||
35 | __be32 mask; | ||
36 | __be32 command; | ||
37 | __be32 transmit; | ||
38 | __be32 receive; | ||
39 | }; | ||
40 | |||
41 | /* SPI Controller mode register definitions */ | ||
42 | #define SPMODE_CI_INACTIVEHIGH (1 << 29) | ||
43 | #define SPMODE_CP_BEGIN_EDGECLK (1 << 28) | ||
44 | #define SPMODE_DIV16 (1 << 27) | ||
45 | #define SPMODE_REV (1 << 26) | ||
46 | #define SPMODE_MS (1 << 25) | ||
47 | #define SPMODE_ENABLE (1 << 24) | ||
48 | #define SPMODE_LEN(x) ((x) << 20) | ||
49 | #define SPMODE_PM(x) ((x) << 16) | ||
50 | |||
51 | /* | ||
52 | * Default for SPI Mode: | ||
53 | * SPI MODE 0 (inactive low, phase middle, MSB, 8-bit length, slow clk | ||
54 | */ | ||
55 | #define SPMODE_INIT_VAL (SPMODE_CI_INACTIVEHIGH | SPMODE_DIV16 | SPMODE_REV | \ | ||
56 | SPMODE_MS | SPMODE_LEN(7) | SPMODE_PM(0xf)) | ||
57 | |||
58 | /* SPIE register values */ | ||
59 | #define SPIE_NE 0x00000200 /* Not empty */ | ||
60 | #define SPIE_NF 0x00000100 /* Not full */ | ||
61 | |||
62 | /* SPIM register values */ | ||
63 | #define SPIM_NE 0x00000200 /* Not empty */ | ||
64 | #define SPIM_NF 0x00000100 /* Not full */ | ||
65 | |||
66 | /* SPI Controller driver's private data. */ | ||
67 | struct mpc83xx_spi { | ||
68 | /* bitbang has to be first */ | ||
69 | struct spi_bitbang bitbang; | ||
70 | struct completion done; | ||
71 | |||
72 | struct mpc83xx_spi_reg __iomem *base; | ||
73 | |||
74 | /* rx & tx bufs from the spi_transfer */ | ||
75 | const void *tx; | ||
76 | void *rx; | ||
77 | |||
78 | /* functions to deal with different sized buffers */ | ||
79 | void (*get_rx) (u32 rx_data, struct mpc83xx_spi *); | ||
80 | u32(*get_tx) (struct mpc83xx_spi *); | ||
81 | |||
82 | unsigned int count; | ||
83 | u32 irq; | ||
84 | |||
85 | unsigned nsecs; /* (clock cycle time)/2 */ | ||
86 | |||
87 | u32 sysclk; | ||
88 | void (*activate_cs) (u8 cs, u8 polarity); | ||
89 | void (*deactivate_cs) (u8 cs, u8 polarity); | ||
90 | }; | ||
91 | |||
92 | static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val) | ||
93 | { | ||
94 | out_be32(reg, val); | ||
95 | } | ||
96 | |||
97 | static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg) | ||
98 | { | ||
99 | return in_be32(reg); | ||
100 | } | ||
101 | |||
102 | #define MPC83XX_SPI_RX_BUF(type) \ | ||
103 | void mpc83xx_spi_rx_buf_##type(u32 data, struct mpc83xx_spi *mpc83xx_spi) \ | ||
104 | { \ | ||
105 | type * rx = mpc83xx_spi->rx; \ | ||
106 | *rx++ = (type)data; \ | ||
107 | mpc83xx_spi->rx = rx; \ | ||
108 | } | ||
109 | |||
110 | #define MPC83XX_SPI_TX_BUF(type) \ | ||
111 | u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \ | ||
112 | { \ | ||
113 | u32 data; \ | ||
114 | const type * tx = mpc83xx_spi->tx; \ | ||
115 | data = *tx++; \ | ||
116 | mpc83xx_spi->tx = tx; \ | ||
117 | return data; \ | ||
118 | } | ||
119 | |||
120 | MPC83XX_SPI_RX_BUF(u8) | ||
121 | MPC83XX_SPI_RX_BUF(u16) | ||
122 | MPC83XX_SPI_RX_BUF(u32) | ||
123 | MPC83XX_SPI_TX_BUF(u8) | ||
124 | MPC83XX_SPI_TX_BUF(u16) | ||
125 | MPC83XX_SPI_TX_BUF(u32) | ||
126 | |||
127 | static void mpc83xx_spi_chipselect(struct spi_device *spi, int value) | ||
128 | { | ||
129 | struct mpc83xx_spi *mpc83xx_spi; | ||
130 | u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0; | ||
131 | |||
132 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
133 | |||
134 | if (value == BITBANG_CS_INACTIVE) { | ||
135 | if (mpc83xx_spi->deactivate_cs) | ||
136 | mpc83xx_spi->deactivate_cs(spi->chip_select, pol); | ||
137 | } | ||
138 | |||
139 | if (value == BITBANG_CS_ACTIVE) { | ||
140 | u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); | ||
141 | u32 len = spi->bits_per_word; | ||
142 | if (len == 32) | ||
143 | len = 0; | ||
144 | else | ||
145 | len = len - 1; | ||
146 | |||
147 | /* mask out bits we are going to set */ | ||
148 | regval &= ~0x38ff0000; | ||
149 | |||
150 | if (spi->mode & SPI_CPHA) | ||
151 | regval |= SPMODE_CP_BEGIN_EDGECLK; | ||
152 | if (spi->mode & SPI_CPOL) | ||
153 | regval |= SPMODE_CI_INACTIVEHIGH; | ||
154 | |||
155 | regval |= SPMODE_LEN(len); | ||
156 | |||
157 | if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) { | ||
158 | u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64); | ||
159 | regval |= SPMODE_PM(pm) | SPMODE_DIV16; | ||
160 | } else { | ||
161 | u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4); | ||
162 | regval |= SPMODE_PM(pm); | ||
163 | } | ||
164 | |||
165 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); | ||
166 | if (mpc83xx_spi->activate_cs) | ||
167 | mpc83xx_spi->activate_cs(spi->chip_select, pol); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | static | ||
172 | int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | ||
173 | { | ||
174 | struct mpc83xx_spi *mpc83xx_spi; | ||
175 | u32 regval; | ||
176 | u8 bits_per_word; | ||
177 | u32 hz; | ||
178 | |||
179 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
180 | |||
181 | if (t) { | ||
182 | bits_per_word = t->bits_per_word; | ||
183 | hz = t->speed_hz; | ||
184 | } else { | ||
185 | bits_per_word = 0; | ||
186 | hz = 0; | ||
187 | } | ||
188 | |||
189 | /* spi_transfer level calls that work per-word */ | ||
190 | if (!bits_per_word) | ||
191 | bits_per_word = spi->bits_per_word; | ||
192 | |||
193 | /* Make sure its a bit width we support [4..16, 32] */ | ||
194 | if ((bits_per_word < 4) | ||
195 | || ((bits_per_word > 16) && (bits_per_word != 32))) | ||
196 | return -EINVAL; | ||
197 | |||
198 | if (bits_per_word <= 8) { | ||
199 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; | ||
200 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; | ||
201 | } else if (bits_per_word <= 16) { | ||
202 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u16; | ||
203 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u16; | ||
204 | } else if (bits_per_word <= 32) { | ||
205 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u32; | ||
206 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u32; | ||
207 | } else | ||
208 | return -EINVAL; | ||
209 | |||
210 | /* nsecs = (clock period)/2 */ | ||
211 | if (!hz) | ||
212 | hz = spi->max_speed_hz; | ||
213 | mpc83xx_spi->nsecs = (1000000000 / 2) / hz; | ||
214 | if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000) | ||
215 | return -EINVAL; | ||
216 | |||
217 | if (bits_per_word == 32) | ||
218 | bits_per_word = 0; | ||
219 | else | ||
220 | bits_per_word = bits_per_word - 1; | ||
221 | |||
222 | regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); | ||
223 | |||
224 | /* Mask out bits_per_wordgth */ | ||
225 | regval &= 0xff0fffff; | ||
226 | regval |= SPMODE_LEN(bits_per_word); | ||
227 | |||
228 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static int mpc83xx_spi_setup(struct spi_device *spi) | ||
234 | { | ||
235 | struct spi_bitbang *bitbang; | ||
236 | struct mpc83xx_spi *mpc83xx_spi; | ||
237 | int retval; | ||
238 | |||
239 | if (!spi->max_speed_hz) | ||
240 | return -EINVAL; | ||
241 | |||
242 | bitbang = spi_master_get_devdata(spi->master); | ||
243 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
244 | |||
245 | if (!spi->bits_per_word) | ||
246 | spi->bits_per_word = 8; | ||
247 | |||
248 | retval = mpc83xx_spi_setup_transfer(spi, NULL); | ||
249 | if (retval < 0) | ||
250 | return retval; | ||
251 | |||
252 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n", | ||
253 | __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA), | ||
254 | spi->bits_per_word, 2 * mpc83xx_spi->nsecs); | ||
255 | |||
256 | /* NOTE we _need_ to call chipselect() early, ideally with adapter | ||
257 | * setup, unless the hardware defaults cooperate to avoid confusion | ||
258 | * between normal (active low) and inverted chipselects. | ||
259 | */ | ||
260 | |||
261 | /* deselect chip (low or high) */ | ||
262 | spin_lock(&bitbang->lock); | ||
263 | if (!bitbang->busy) { | ||
264 | bitbang->chipselect(spi, BITBANG_CS_INACTIVE); | ||
265 | ndelay(mpc83xx_spi->nsecs); | ||
266 | } | ||
267 | spin_unlock(&bitbang->lock); | ||
268 | |||
269 | return 0; | ||
270 | } | ||
271 | |||
272 | static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | ||
273 | { | ||
274 | struct mpc83xx_spi *mpc83xx_spi; | ||
275 | u32 word; | ||
276 | |||
277 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
278 | |||
279 | mpc83xx_spi->tx = t->tx_buf; | ||
280 | mpc83xx_spi->rx = t->rx_buf; | ||
281 | mpc83xx_spi->count = t->len; | ||
282 | INIT_COMPLETION(mpc83xx_spi->done); | ||
283 | |||
284 | /* enable rx ints */ | ||
285 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE); | ||
286 | |||
287 | /* transmit word */ | ||
288 | word = mpc83xx_spi->get_tx(mpc83xx_spi); | ||
289 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word); | ||
290 | |||
291 | wait_for_completion(&mpc83xx_spi->done); | ||
292 | |||
293 | /* disable rx ints */ | ||
294 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0); | ||
295 | |||
296 | return t->len - mpc83xx_spi->count; | ||
297 | } | ||
298 | |||
299 | irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data, | ||
300 | struct pt_regs * ptregs) | ||
301 | { | ||
302 | struct mpc83xx_spi *mpc83xx_spi = context_data; | ||
303 | u32 event; | ||
304 | irqreturn_t ret = IRQ_NONE; | ||
305 | |||
306 | /* Get interrupt events(tx/rx) */ | ||
307 | event = mpc83xx_spi_read_reg(&mpc83xx_spi->base->event); | ||
308 | |||
309 | /* We need handle RX first */ | ||
310 | if (event & SPIE_NE) { | ||
311 | u32 rx_data = mpc83xx_spi_read_reg(&mpc83xx_spi->base->receive); | ||
312 | |||
313 | if (mpc83xx_spi->rx) | ||
314 | mpc83xx_spi->get_rx(rx_data, mpc83xx_spi); | ||
315 | |||
316 | ret = IRQ_HANDLED; | ||
317 | } | ||
318 | |||
319 | if ((event & SPIE_NF) == 0) | ||
320 | /* spin until TX is done */ | ||
321 | while (((event = | ||
322 | mpc83xx_spi_read_reg(&mpc83xx_spi->base->event)) & | ||
323 | SPIE_NF) == 0) | ||
324 | cpu_relax(); | ||
325 | |||
326 | mpc83xx_spi->count -= 1; | ||
327 | if (mpc83xx_spi->count) { | ||
328 | if (mpc83xx_spi->tx) { | ||
329 | u32 word = mpc83xx_spi->get_tx(mpc83xx_spi); | ||
330 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, | ||
331 | word); | ||
332 | } | ||
333 | } else { | ||
334 | complete(&mpc83xx_spi->done); | ||
335 | } | ||
336 | |||
337 | /* Clear the events */ | ||
338 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, event); | ||
339 | |||
340 | return ret; | ||
341 | } | ||
342 | |||
343 | static int __init mpc83xx_spi_probe(struct platform_device *dev) | ||
344 | { | ||
345 | struct spi_master *master; | ||
346 | struct mpc83xx_spi *mpc83xx_spi; | ||
347 | struct fsl_spi_platform_data *pdata; | ||
348 | struct resource *r; | ||
349 | u32 regval; | ||
350 | int ret = 0; | ||
351 | |||
352 | /* Get resources(memory, IRQ) associated with the device */ | ||
353 | master = spi_alloc_master(&dev->dev, sizeof(struct mpc83xx_spi)); | ||
354 | |||
355 | if (master == NULL) { | ||
356 | ret = -ENOMEM; | ||
357 | goto err; | ||
358 | } | ||
359 | |||
360 | platform_set_drvdata(dev, master); | ||
361 | pdata = dev->dev.platform_data; | ||
362 | |||
363 | if (pdata == NULL) { | ||
364 | ret = -ENODEV; | ||
365 | goto free_master; | ||
366 | } | ||
367 | |||
368 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
369 | if (r == NULL) { | ||
370 | ret = -ENODEV; | ||
371 | goto free_master; | ||
372 | } | ||
373 | |||
374 | mpc83xx_spi = spi_master_get_devdata(master); | ||
375 | mpc83xx_spi->bitbang.master = spi_master_get(master); | ||
376 | mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect; | ||
377 | mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer; | ||
378 | mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs; | ||
379 | mpc83xx_spi->sysclk = pdata->sysclk; | ||
380 | mpc83xx_spi->activate_cs = pdata->activate_cs; | ||
381 | mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; | ||
382 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; | ||
383 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; | ||
384 | |||
385 | mpc83xx_spi->bitbang.master->setup = mpc83xx_spi_setup; | ||
386 | init_completion(&mpc83xx_spi->done); | ||
387 | |||
388 | mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1); | ||
389 | if (mpc83xx_spi->base == NULL) { | ||
390 | ret = -ENOMEM; | ||
391 | goto put_master; | ||
392 | } | ||
393 | |||
394 | mpc83xx_spi->irq = platform_get_irq(dev, 0); | ||
395 | |||
396 | if (mpc83xx_spi->irq < 0) { | ||
397 | ret = -ENXIO; | ||
398 | goto unmap_io; | ||
399 | } | ||
400 | |||
401 | /* Register for SPI Interrupt */ | ||
402 | ret = request_irq(mpc83xx_spi->irq, mpc83xx_spi_irq, | ||
403 | 0, "mpc83xx_spi", mpc83xx_spi); | ||
404 | |||
405 | if (ret != 0) | ||
406 | goto unmap_io; | ||
407 | |||
408 | master->bus_num = pdata->bus_num; | ||
409 | master->num_chipselect = pdata->max_chipselect; | ||
410 | |||
411 | /* SPI controller initializations */ | ||
412 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0); | ||
413 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0); | ||
414 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->command, 0); | ||
415 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, 0xffffffff); | ||
416 | |||
417 | /* Enable SPI interface */ | ||
418 | regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE; | ||
419 | mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval); | ||
420 | |||
421 | ret = spi_bitbang_start(&mpc83xx_spi->bitbang); | ||
422 | |||
423 | if (ret != 0) | ||
424 | goto free_irq; | ||
425 | |||
426 | printk(KERN_INFO | ||
427 | "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n", | ||
428 | dev->dev.bus_id, mpc83xx_spi->base, mpc83xx_spi->irq); | ||
429 | |||
430 | return ret; | ||
431 | |||
432 | free_irq: | ||
433 | free_irq(mpc83xx_spi->irq, mpc83xx_spi); | ||
434 | unmap_io: | ||
435 | iounmap(mpc83xx_spi->base); | ||
436 | put_master: | ||
437 | spi_master_put(master); | ||
438 | free_master: | ||
439 | kfree(master); | ||
440 | err: | ||
441 | return ret; | ||
442 | } | ||
443 | |||
444 | static int __devexit mpc83xx_spi_remove(struct platform_device *dev) | ||
445 | { | ||
446 | struct mpc83xx_spi *mpc83xx_spi; | ||
447 | struct spi_master *master; | ||
448 | |||
449 | master = platform_get_drvdata(dev); | ||
450 | mpc83xx_spi = spi_master_get_devdata(master); | ||
451 | |||
452 | spi_bitbang_stop(&mpc83xx_spi->bitbang); | ||
453 | free_irq(mpc83xx_spi->irq, mpc83xx_spi); | ||
454 | iounmap(mpc83xx_spi->base); | ||
455 | spi_master_put(mpc83xx_spi->bitbang.master); | ||
456 | |||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static struct platform_driver mpc83xx_spi_driver = { | ||
461 | .probe = mpc83xx_spi_probe, | ||
462 | .remove = __devexit_p(mpc83xx_spi_remove), | ||
463 | .driver = { | ||
464 | .name = "mpc83xx_spi", | ||
465 | }, | ||
466 | }; | ||
467 | |||
468 | static int __init mpc83xx_spi_init(void) | ||
469 | { | ||
470 | return platform_driver_register(&mpc83xx_spi_driver); | ||
471 | } | ||
472 | |||
473 | static void __exit mpc83xx_spi_exit(void) | ||
474 | { | ||
475 | platform_driver_unregister(&mpc83xx_spi_driver); | ||
476 | } | ||
477 | |||
478 | module_init(mpc83xx_spi_init); | ||
479 | module_exit(mpc83xx_spi_exit); | ||
480 | |||
481 | MODULE_AUTHOR("Kumar Gala"); | ||
482 | MODULE_DESCRIPTION("Simple MPC83xx SPI Driver"); | ||
483 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c new file mode 100644 index 000000000000..5fc14563ee3a --- /dev/null +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -0,0 +1,453 @@ | |||
1 | /* linux/drivers/spi/spi_s3c24xx.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Ben Dooks | ||
4 | * Copyright (c) 2006 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | |||
14 | //#define DEBUG | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | #include <linux/workqueue.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/err.h> | ||
24 | #include <linux/clk.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | |||
27 | #include <linux/spi/spi.h> | ||
28 | #include <linux/spi/spi_bitbang.h> | ||
29 | |||
30 | #include <asm/io.h> | ||
31 | #include <asm/dma.h> | ||
32 | #include <asm/hardware.h> | ||
33 | |||
34 | #include <asm/arch/regs-gpio.h> | ||
35 | #include <asm/arch/regs-spi.h> | ||
36 | #include <asm/arch/spi.h> | ||
37 | |||
38 | struct s3c24xx_spi { | ||
39 | /* bitbang has to be first */ | ||
40 | struct spi_bitbang bitbang; | ||
41 | struct completion done; | ||
42 | |||
43 | void __iomem *regs; | ||
44 | int irq; | ||
45 | int len; | ||
46 | int count; | ||
47 | |||
48 | /* data buffers */ | ||
49 | const unsigned char *tx; | ||
50 | unsigned char *rx; | ||
51 | |||
52 | struct clk *clk; | ||
53 | struct resource *ioarea; | ||
54 | struct spi_master *master; | ||
55 | struct spi_device *curdev; | ||
56 | struct device *dev; | ||
57 | struct s3c2410_spi_info *pdata; | ||
58 | }; | ||
59 | |||
60 | #define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT) | ||
61 | #define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP) | ||
62 | |||
63 | static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev) | ||
64 | { | ||
65 | return spi_master_get_devdata(sdev->master); | ||
66 | } | ||
67 | |||
68 | static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | ||
69 | { | ||
70 | struct s3c24xx_spi *hw = to_hw(spi); | ||
71 | unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0; | ||
72 | unsigned int spcon; | ||
73 | |||
74 | switch (value) { | ||
75 | case BITBANG_CS_INACTIVE: | ||
76 | if (hw->pdata->set_cs) | ||
77 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
78 | else | ||
79 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1); | ||
80 | break; | ||
81 | |||
82 | case BITBANG_CS_ACTIVE: | ||
83 | spcon = readb(hw->regs + S3C2410_SPCON); | ||
84 | |||
85 | if (spi->mode & SPI_CPHA) | ||
86 | spcon |= S3C2410_SPCON_CPHA_FMTB; | ||
87 | else | ||
88 | spcon &= ~S3C2410_SPCON_CPHA_FMTB; | ||
89 | |||
90 | if (spi->mode & SPI_CPOL) | ||
91 | spcon |= S3C2410_SPCON_CPOL_HIGH; | ||
92 | else | ||
93 | spcon &= ~S3C2410_SPCON_CPOL_HIGH; | ||
94 | |||
95 | spcon |= S3C2410_SPCON_ENSCK; | ||
96 | |||
97 | /* write new configration */ | ||
98 | |||
99 | writeb(spcon, hw->regs + S3C2410_SPCON); | ||
100 | |||
101 | if (hw->pdata->set_cs) | ||
102 | hw->pdata->set_cs(hw->pdata, value, cspol); | ||
103 | else | ||
104 | s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol); | ||
105 | |||
106 | break; | ||
107 | |||
108 | } | ||
109 | } | ||
110 | |||
111 | static int s3c24xx_spi_setupxfer(struct spi_device *spi, | ||
112 | struct spi_transfer *t) | ||
113 | { | ||
114 | struct s3c24xx_spi *hw = to_hw(spi); | ||
115 | unsigned int bpw; | ||
116 | unsigned int hz; | ||
117 | unsigned int div; | ||
118 | |||
119 | bpw = t ? t->bits_per_word : spi->bits_per_word; | ||
120 | hz = t ? t->speed_hz : spi->max_speed_hz; | ||
121 | |||
122 | if (bpw != 8) { | ||
123 | dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); | ||
124 | return -EINVAL; | ||
125 | } | ||
126 | |||
127 | div = clk_get_rate(hw->clk) / hz; | ||
128 | |||
129 | /* is clk = pclk / (2 * (pre+1)), or is it | ||
130 | * clk = (pclk * 2) / ( pre + 1) */ | ||
131 | |||
132 | div = (div / 2) - 1; | ||
133 | |||
134 | if (div < 0) | ||
135 | div = 1; | ||
136 | |||
137 | if (div > 255) | ||
138 | div = 255; | ||
139 | |||
140 | dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", div, hz); | ||
141 | writeb(div, hw->regs + S3C2410_SPPRE); | ||
142 | |||
143 | spin_lock(&hw->bitbang.lock); | ||
144 | if (!hw->bitbang.busy) { | ||
145 | hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE); | ||
146 | /* need to ndelay for 0.5 clocktick ? */ | ||
147 | } | ||
148 | spin_unlock(&hw->bitbang.lock); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int s3c24xx_spi_setup(struct spi_device *spi) | ||
154 | { | ||
155 | int ret; | ||
156 | |||
157 | if (!spi->bits_per_word) | ||
158 | spi->bits_per_word = 8; | ||
159 | |||
160 | if ((spi->mode & SPI_LSB_FIRST) != 0) | ||
161 | return -EINVAL; | ||
162 | |||
163 | ret = s3c24xx_spi_setupxfer(spi, NULL); | ||
164 | if (ret < 0) { | ||
165 | dev_err(&spi->dev, "setupxfer returned %d\n", ret); | ||
166 | return ret; | ||
167 | } | ||
168 | |||
169 | dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", | ||
170 | __FUNCTION__, spi->mode, spi->bits_per_word, | ||
171 | spi->max_speed_hz); | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) | ||
177 | { | ||
178 | return hw->tx ? hw->tx[count] : 0xff; | ||
179 | } | ||
180 | |||
181 | static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t) | ||
182 | { | ||
183 | struct s3c24xx_spi *hw = to_hw(spi); | ||
184 | |||
185 | dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", | ||
186 | t->tx_buf, t->rx_buf, t->len); | ||
187 | |||
188 | hw->tx = t->tx_buf; | ||
189 | hw->rx = t->rx_buf; | ||
190 | hw->len = t->len; | ||
191 | hw->count = 0; | ||
192 | |||
193 | /* send the first byte */ | ||
194 | writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT); | ||
195 | wait_for_completion(&hw->done); | ||
196 | |||
197 | return hw->count; | ||
198 | } | ||
199 | |||
200 | static irqreturn_t s3c24xx_spi_irq(int irq, void *dev, struct pt_regs *regs) | ||
201 | { | ||
202 | struct s3c24xx_spi *hw = dev; | ||
203 | unsigned int spsta = readb(hw->regs + S3C2410_SPSTA); | ||
204 | unsigned int count = hw->count; | ||
205 | |||
206 | if (spsta & S3C2410_SPSTA_DCOL) { | ||
207 | dev_dbg(hw->dev, "data-collision\n"); | ||
208 | complete(&hw->done); | ||
209 | goto irq_done; | ||
210 | } | ||
211 | |||
212 | if (!(spsta & S3C2410_SPSTA_READY)) { | ||
213 | dev_dbg(hw->dev, "spi not ready for tx?\n"); | ||
214 | complete(&hw->done); | ||
215 | goto irq_done; | ||
216 | } | ||
217 | |||
218 | hw->count++; | ||
219 | |||
220 | if (hw->rx) | ||
221 | hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT); | ||
222 | |||
223 | count++; | ||
224 | |||
225 | if (count < hw->len) | ||
226 | writeb(hw_txbyte(hw, count), hw->regs + S3C2410_SPTDAT); | ||
227 | else | ||
228 | complete(&hw->done); | ||
229 | |||
230 | irq_done: | ||
231 | return IRQ_HANDLED; | ||
232 | } | ||
233 | |||
234 | static int s3c24xx_spi_probe(struct platform_device *pdev) | ||
235 | { | ||
236 | struct s3c24xx_spi *hw; | ||
237 | struct spi_master *master; | ||
238 | struct spi_board_info *bi; | ||
239 | struct resource *res; | ||
240 | int err = 0; | ||
241 | int i; | ||
242 | |||
243 | master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi)); | ||
244 | if (master == NULL) { | ||
245 | dev_err(&pdev->dev, "No memory for spi_master\n"); | ||
246 | err = -ENOMEM; | ||
247 | goto err_nomem; | ||
248 | } | ||
249 | |||
250 | hw = spi_master_get_devdata(master); | ||
251 | memset(hw, 0, sizeof(struct s3c24xx_spi)); | ||
252 | |||
253 | hw->master = spi_master_get(master); | ||
254 | hw->pdata = pdev->dev.platform_data; | ||
255 | hw->dev = &pdev->dev; | ||
256 | |||
257 | if (hw->pdata == NULL) { | ||
258 | dev_err(&pdev->dev, "No platform data supplied\n"); | ||
259 | err = -ENOENT; | ||
260 | goto err_no_pdata; | ||
261 | } | ||
262 | |||
263 | platform_set_drvdata(pdev, hw); | ||
264 | init_completion(&hw->done); | ||
265 | |||
266 | /* setup the state for the bitbang driver */ | ||
267 | |||
268 | hw->bitbang.master = hw->master; | ||
269 | hw->bitbang.setup_transfer = s3c24xx_spi_setupxfer; | ||
270 | hw->bitbang.chipselect = s3c24xx_spi_chipsel; | ||
271 | hw->bitbang.txrx_bufs = s3c24xx_spi_txrx; | ||
272 | hw->bitbang.master->setup = s3c24xx_spi_setup; | ||
273 | |||
274 | dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang); | ||
275 | |||
276 | /* find and map our resources */ | ||
277 | |||
278 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
279 | if (res == NULL) { | ||
280 | dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n"); | ||
281 | err = -ENOENT; | ||
282 | goto err_no_iores; | ||
283 | } | ||
284 | |||
285 | hw->ioarea = request_mem_region(res->start, (res->end - res->start)+1, | ||
286 | pdev->name); | ||
287 | |||
288 | if (hw->ioarea == NULL) { | ||
289 | dev_err(&pdev->dev, "Cannot reserve region\n"); | ||
290 | err = -ENXIO; | ||
291 | goto err_no_iores; | ||
292 | } | ||
293 | |||
294 | hw->regs = ioremap(res->start, (res->end - res->start)+1); | ||
295 | if (hw->regs == NULL) { | ||
296 | dev_err(&pdev->dev, "Cannot map IO\n"); | ||
297 | err = -ENXIO; | ||
298 | goto err_no_iomap; | ||
299 | } | ||
300 | |||
301 | hw->irq = platform_get_irq(pdev, 0); | ||
302 | if (hw->irq < 0) { | ||
303 | dev_err(&pdev->dev, "No IRQ specified\n"); | ||
304 | err = -ENOENT; | ||
305 | goto err_no_irq; | ||
306 | } | ||
307 | |||
308 | err = request_irq(hw->irq, s3c24xx_spi_irq, 0, pdev->name, hw); | ||
309 | if (err) { | ||
310 | dev_err(&pdev->dev, "Cannot claim IRQ\n"); | ||
311 | goto err_no_irq; | ||
312 | } | ||
313 | |||
314 | hw->clk = clk_get(&pdev->dev, "spi"); | ||
315 | if (IS_ERR(hw->clk)) { | ||
316 | dev_err(&pdev->dev, "No clock for device\n"); | ||
317 | err = PTR_ERR(hw->clk); | ||
318 | goto err_no_clk; | ||
319 | } | ||
320 | |||
321 | /* for the moment, permanently enable the clock */ | ||
322 | |||
323 | clk_enable(hw->clk); | ||
324 | |||
325 | /* program defaults into the registers */ | ||
326 | |||
327 | writeb(0xff, hw->regs + S3C2410_SPPRE); | ||
328 | writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN); | ||
329 | writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON); | ||
330 | |||
331 | /* setup any gpio we can */ | ||
332 | |||
333 | if (!hw->pdata->set_cs) { | ||
334 | s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); | ||
335 | s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); | ||
336 | } | ||
337 | |||
338 | /* register our spi controller */ | ||
339 | |||
340 | err = spi_bitbang_start(&hw->bitbang); | ||
341 | if (err) { | ||
342 | dev_err(&pdev->dev, "Failed to register SPI master\n"); | ||
343 | goto err_register; | ||
344 | } | ||
345 | |||
346 | dev_dbg(hw->dev, "shutdown=%d\n", hw->bitbang.shutdown); | ||
347 | |||
348 | /* register all the devices associated */ | ||
349 | |||
350 | bi = &hw->pdata->board_info[0]; | ||
351 | for (i = 0; i < hw->pdata->board_size; i++, bi++) { | ||
352 | dev_info(hw->dev, "registering %s\n", bi->modalias); | ||
353 | |||
354 | bi->controller_data = hw; | ||
355 | spi_new_device(master, bi); | ||
356 | } | ||
357 | |||
358 | return 0; | ||
359 | |||
360 | err_register: | ||
361 | clk_disable(hw->clk); | ||
362 | clk_put(hw->clk); | ||
363 | |||
364 | err_no_clk: | ||
365 | free_irq(hw->irq, hw); | ||
366 | |||
367 | err_no_irq: | ||
368 | iounmap(hw->regs); | ||
369 | |||
370 | err_no_iomap: | ||
371 | release_resource(hw->ioarea); | ||
372 | kfree(hw->ioarea); | ||
373 | |||
374 | err_no_iores: | ||
375 | err_no_pdata: | ||
376 | spi_master_put(hw->master);; | ||
377 | |||
378 | err_nomem: | ||
379 | return err; | ||
380 | } | ||
381 | |||
382 | static int s3c24xx_spi_remove(struct platform_device *dev) | ||
383 | { | ||
384 | struct s3c24xx_spi *hw = platform_get_drvdata(dev); | ||
385 | |||
386 | platform_set_drvdata(dev, NULL); | ||
387 | |||
388 | spi_unregister_master(hw->master); | ||
389 | |||
390 | clk_disable(hw->clk); | ||
391 | clk_put(hw->clk); | ||
392 | |||
393 | free_irq(hw->irq, hw); | ||
394 | iounmap(hw->regs); | ||
395 | |||
396 | release_resource(hw->ioarea); | ||
397 | kfree(hw->ioarea); | ||
398 | |||
399 | spi_master_put(hw->master); | ||
400 | return 0; | ||
401 | } | ||
402 | |||
403 | |||
404 | #ifdef CONFIG_PM | ||
405 | |||
406 | static int s3c24xx_spi_suspend(struct platform_device *pdev, pm_message_t msg) | ||
407 | { | ||
408 | struct s3c24xx_spi *hw = platform_get_drvdata(pdev); | ||
409 | |||
410 | clk_disable(hw->clk); | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static int s3c24xx_spi_resume(struct platform_device *pdev) | ||
415 | { | ||
416 | struct s3c24xx_spi *hw = platform_get_drvdata(pdev); | ||
417 | |||
418 | clk_enable(hw->clk); | ||
419 | return 0; | ||
420 | } | ||
421 | |||
422 | #else | ||
423 | #define s3c24xx_spi_suspend NULL | ||
424 | #define s3c24xx_spi_resume NULL | ||
425 | #endif | ||
426 | |||
427 | static struct platform_driver s3c24xx_spidrv = { | ||
428 | .probe = s3c24xx_spi_probe, | ||
429 | .remove = s3c24xx_spi_remove, | ||
430 | .suspend = s3c24xx_spi_suspend, | ||
431 | .resume = s3c24xx_spi_resume, | ||
432 | .driver = { | ||
433 | .name = "s3c2410-spi", | ||
434 | .owner = THIS_MODULE, | ||
435 | }, | ||
436 | }; | ||
437 | |||
438 | static int __init s3c24xx_spi_init(void) | ||
439 | { | ||
440 | return platform_driver_register(&s3c24xx_spidrv); | ||
441 | } | ||
442 | |||
443 | static void __exit s3c24xx_spi_exit(void) | ||
444 | { | ||
445 | platform_driver_unregister(&s3c24xx_spidrv); | ||
446 | } | ||
447 | |||
448 | module_init(s3c24xx_spi_init); | ||
449 | module_exit(s3c24xx_spi_exit); | ||
450 | |||
451 | MODULE_DESCRIPTION("S3C24XX SPI Driver"); | ||
452 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | ||
453 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c new file mode 100644 index 000000000000..aacdceb8f44b --- /dev/null +++ b/drivers/spi/spi_s3c24xx_gpio.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* linux/drivers/spi/spi_s3c24xx_gpio.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Ben Dooks | ||
4 | * Copyright (c) 2006 Simtec Electronics | ||
5 | * | ||
6 | * S3C24XX GPIO based SPI driver | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #include <linux/spi/spi.h> | ||
22 | #include <linux/spi/spi_bitbang.h> | ||
23 | |||
24 | #include <asm/arch/regs-gpio.h> | ||
25 | #include <asm/arch/spi-gpio.h> | ||
26 | #include <asm/arch/hardware.h> | ||
27 | |||
28 | struct s3c2410_spigpio { | ||
29 | struct spi_bitbang bitbang; | ||
30 | |||
31 | struct s3c2410_spigpio_info *info; | ||
32 | struct platform_device *dev; | ||
33 | }; | ||
34 | |||
35 | static inline struct s3c2410_spigpio *spidev_to_sg(struct spi_device *spi) | ||
36 | { | ||
37 | return spi->controller_data; | ||
38 | } | ||
39 | |||
40 | static inline void setsck(struct spi_device *dev, int on) | ||
41 | { | ||
42 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
43 | s3c2410_gpio_setpin(sg->info->pin_clk, on ? 1 : 0); | ||
44 | } | ||
45 | |||
46 | static inline void setmosi(struct spi_device *dev, int on) | ||
47 | { | ||
48 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
49 | s3c2410_gpio_setpin(sg->info->pin_mosi, on ? 1 : 0); | ||
50 | } | ||
51 | |||
52 | static inline u32 getmiso(struct spi_device *dev) | ||
53 | { | ||
54 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
55 | return s3c2410_gpio_getpin(sg->info->pin_miso) ? 1 : 0; | ||
56 | } | ||
57 | |||
58 | #define spidelay(x) ndelay(x) | ||
59 | |||
60 | #define EXPAND_BITBANG_TXRX | ||
61 | #include <linux/spi/spi_bitbang.h> | ||
62 | |||
63 | |||
64 | static u32 s3c2410_spigpio_txrx_mode0(struct spi_device *spi, | ||
65 | unsigned nsecs, u32 word, u8 bits) | ||
66 | { | ||
67 | return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits); | ||
68 | } | ||
69 | |||
70 | static u32 s3c2410_spigpio_txrx_mode1(struct spi_device *spi, | ||
71 | unsigned nsecs, u32 word, u8 bits) | ||
72 | { | ||
73 | return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, bits); | ||
74 | } | ||
75 | |||
76 | static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value) | ||
77 | { | ||
78 | struct s3c2410_spigpio *sg = spidev_to_sg(dev); | ||
79 | |||
80 | if (sg->info && sg->info->chip_select) | ||
81 | (sg->info->chip_select)(sg->info, value); | ||
82 | } | ||
83 | |||
84 | static int s3c2410_spigpio_probe(struct platform_device *dev) | ||
85 | { | ||
86 | struct spi_master *master; | ||
87 | struct s3c2410_spigpio *sp; | ||
88 | int ret; | ||
89 | int i; | ||
90 | |||
91 | master = spi_alloc_master(&dev->dev, sizeof(struct s3c2410_spigpio)); | ||
92 | if (master == NULL) { | ||
93 | dev_err(&dev->dev, "failed to allocate spi master\n"); | ||
94 | ret = -ENOMEM; | ||
95 | goto err; | ||
96 | } | ||
97 | |||
98 | sp = spi_master_get_devdata(master); | ||
99 | |||
100 | platform_set_drvdata(dev, sp); | ||
101 | |||
102 | /* copy in the plkatform data */ | ||
103 | sp->info = dev->dev.platform_data; | ||
104 | |||
105 | /* setup spi bitbang adaptor */ | ||
106 | sp->bitbang.master = spi_master_get(master); | ||
107 | sp->bitbang.chipselect = s3c2410_spigpio_chipselect; | ||
108 | |||
109 | sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; | ||
110 | sp->bitbang.txrx_word[SPI_MODE_1] = s3c2410_spigpio_txrx_mode1; | ||
111 | |||
112 | /* set state of spi pins */ | ||
113 | s3c2410_gpio_setpin(sp->info->pin_clk, 0); | ||
114 | s3c2410_gpio_setpin(sp->info->pin_mosi, 0); | ||
115 | |||
116 | s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT); | ||
117 | s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT); | ||
118 | s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT); | ||
119 | |||
120 | ret = spi_bitbang_start(&sp->bitbang); | ||
121 | if (ret) | ||
122 | goto err_no_bitbang; | ||
123 | |||
124 | /* register the chips to go with the board */ | ||
125 | |||
126 | for (i = 0; i < sp->info->board_size; i++) { | ||
127 | dev_info(&dev->dev, "registering %p: %s\n", | ||
128 | &sp->info->board_info[i], | ||
129 | sp->info->board_info[i].modalias); | ||
130 | |||
131 | sp->info->board_info[i].controller_data = sp; | ||
132 | spi_new_device(master, sp->info->board_info + i); | ||
133 | } | ||
134 | |||
135 | return 0; | ||
136 | |||
137 | err_no_bitbang: | ||
138 | spi_master_put(sp->bitbang.master); | ||
139 | err: | ||
140 | return ret; | ||
141 | |||
142 | } | ||
143 | |||
144 | static int s3c2410_spigpio_remove(struct platform_device *dev) | ||
145 | { | ||
146 | struct s3c2410_spigpio *sp = platform_get_drvdata(dev); | ||
147 | |||
148 | spi_bitbang_stop(&sp->bitbang); | ||
149 | spi_master_put(sp->bitbang.master); | ||
150 | |||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | /* all gpio should be held over suspend/resume, so we should | ||
155 | * not need to deal with this | ||
156 | */ | ||
157 | |||
158 | #define s3c2410_spigpio_suspend NULL | ||
159 | #define s3c2410_spigpio_resume NULL | ||
160 | |||
161 | |||
162 | static struct platform_driver s3c2410_spigpio_drv = { | ||
163 | .probe = s3c2410_spigpio_probe, | ||
164 | .remove = s3c2410_spigpio_remove, | ||
165 | .suspend = s3c2410_spigpio_suspend, | ||
166 | .resume = s3c2410_spigpio_resume, | ||
167 | .driver = { | ||
168 | .name = "s3c24xx-spi-gpio", | ||
169 | .owner = THIS_MODULE, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static int __init s3c2410_spigpio_init(void) | ||
174 | { | ||
175 | return platform_driver_register(&s3c2410_spigpio_drv); | ||
176 | } | ||
177 | |||
178 | static void __exit s3c2410_spigpio_exit(void) | ||
179 | { | ||
180 | platform_driver_unregister(&s3c2410_spigpio_drv); | ||
181 | } | ||
182 | |||
183 | module_init(s3c2410_spigpio_init); | ||
184 | module_exit(s3c2410_spigpio_exit); | ||
185 | |||
186 | MODULE_DESCRIPTION("S3C24XX SPI Driver"); | ||
187 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | ||
188 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 7860c8a5800d..956b7a1e8af9 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -69,7 +69,7 @@ static const char speedtch_driver_name[] = "speedtch"; | |||
69 | #define RESUBMIT_DELAY 1000 /* milliseconds */ | 69 | #define RESUBMIT_DELAY 1000 /* milliseconds */ |
70 | 70 | ||
71 | #define DEFAULT_BULK_ALTSETTING 1 | 71 | #define DEFAULT_BULK_ALTSETTING 1 |
72 | #define DEFAULT_ISOC_ALTSETTING 2 | 72 | #define DEFAULT_ISOC_ALTSETTING 3 |
73 | #define DEFAULT_DL_512_FIRST 0 | 73 | #define DEFAULT_DL_512_FIRST 0 |
74 | #define DEFAULT_ENABLE_ISOC 0 | 74 | #define DEFAULT_ENABLE_ISOC 0 |
75 | #define DEFAULT_SW_BUFFERING 0 | 75 | #define DEFAULT_SW_BUFFERING 0 |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index c1211fc037d9..546249843b8e 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -99,11 +99,11 @@ static const char usbatm_driver_name[] = "usbatm"; | |||
99 | 99 | ||
100 | #define UDSL_MAX_RCV_URBS 16 | 100 | #define UDSL_MAX_RCV_URBS 16 |
101 | #define UDSL_MAX_SND_URBS 16 | 101 | #define UDSL_MAX_SND_URBS 16 |
102 | #define UDSL_MAX_BUF_SIZE 64 * 1024 /* bytes */ | 102 | #define UDSL_MAX_BUF_SIZE 65536 |
103 | #define UDSL_DEFAULT_RCV_URBS 4 | 103 | #define UDSL_DEFAULT_RCV_URBS 4 |
104 | #define UDSL_DEFAULT_SND_URBS 4 | 104 | #define UDSL_DEFAULT_SND_URBS 4 |
105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ | 105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */ |
106 | #define UDSL_DEFAULT_SND_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ | 106 | #define UDSL_DEFAULT_SND_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */ |
107 | 107 | ||
108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) | 108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) |
109 | 109 | ||
@@ -135,7 +135,7 @@ MODULE_PARM_DESC(rcv_buf_bytes, | |||
135 | module_param(snd_buf_bytes, uint, S_IRUGO); | 135 | module_param(snd_buf_bytes, uint, S_IRUGO); |
136 | MODULE_PARM_DESC(snd_buf_bytes, | 136 | MODULE_PARM_DESC(snd_buf_bytes, |
137 | "Size of the buffers used for transmission, in bytes (range: 1-" | 137 | "Size of the buffers used for transmission, in bytes (range: 1-" |
138 | __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: " | 138 | __MODULE_STRING(UDSL_MAX_BUF_SIZE) ", default: " |
139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); | 139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); |
140 | 140 | ||
141 | 141 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index fbd938d4ea58..e2e00ba4e1e6 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1805,6 +1805,12 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
1805 | USB_SPEED_FULL; | 1805 | USB_SPEED_FULL; |
1806 | hcd->self.root_hub = rhdev; | 1806 | hcd->self.root_hub = rhdev; |
1807 | 1807 | ||
1808 | /* wakeup flag init defaults to "everything works" for root hubs, | ||
1809 | * but drivers can override it in reset() if needed, along with | ||
1810 | * recording the overall controller's system wakeup capability. | ||
1811 | */ | ||
1812 | device_init_wakeup(&rhdev->dev, 1); | ||
1813 | |||
1808 | /* "reset" is misnamed; its role is now one-time init. the controller | 1814 | /* "reset" is misnamed; its role is now one-time init. the controller |
1809 | * should already have been reset (and boot firmware kicked off etc). | 1815 | * should already have been reset (and boot firmware kicked off etc). |
1810 | */ | 1816 | */ |
@@ -1813,13 +1819,6 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
1813 | goto err_hcd_driver_setup; | 1819 | goto err_hcd_driver_setup; |
1814 | } | 1820 | } |
1815 | 1821 | ||
1816 | /* wakeup flag init is in transition; for now we can't rely on PCI to | ||
1817 | * initialize these bits properly, so we let reset() override it. | ||
1818 | * This init should _precede_ the reset() once PCI behaves. | ||
1819 | */ | ||
1820 | device_init_wakeup(&rhdev->dev, | ||
1821 | device_can_wakeup(hcd->self.controller)); | ||
1822 | |||
1823 | /* NOTE: root hub and controller capabilities may not be the same */ | 1822 | /* NOTE: root hub and controller capabilities may not be the same */ |
1824 | if (device_can_wakeup(hcd->self.controller) | 1823 | if (device_can_wakeup(hcd->self.controller) |
1825 | && device_can_wakeup(&hcd->self.root_hub->dev)) | 1824 | && device_can_wakeup(&hcd->self.root_hub->dev)) |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0c87f73f2933..90b8d43c6b33 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1168,19 +1168,9 @@ static inline const char *plural(int n) | |||
1168 | static int choose_configuration(struct usb_device *udev) | 1168 | static int choose_configuration(struct usb_device *udev) |
1169 | { | 1169 | { |
1170 | int i; | 1170 | int i; |
1171 | u16 devstatus; | ||
1172 | int bus_powered; | ||
1173 | int num_configs; | 1171 | int num_configs; |
1174 | struct usb_host_config *c, *best; | 1172 | struct usb_host_config *c, *best; |
1175 | 1173 | ||
1176 | /* If this fails, assume the device is bus-powered */ | ||
1177 | devstatus = 0; | ||
1178 | usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); | ||
1179 | le16_to_cpus(&devstatus); | ||
1180 | bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0); | ||
1181 | dev_dbg(&udev->dev, "device is %s-powered\n", | ||
1182 | bus_powered ? "bus" : "self"); | ||
1183 | |||
1184 | best = NULL; | 1174 | best = NULL; |
1185 | c = udev->config; | 1175 | c = udev->config; |
1186 | num_configs = udev->descriptor.bNumConfigurations; | 1176 | num_configs = udev->descriptor.bNumConfigurations; |
@@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev) | |||
1197 | * similar errors in their descriptors. If the next test | 1187 | * similar errors in their descriptors. If the next test |
1198 | * were allowed to execute, such configurations would always | 1188 | * were allowed to execute, such configurations would always |
1199 | * be rejected and the devices would not work as expected. | 1189 | * be rejected and the devices would not work as expected. |
1190 | * In the meantime, we run the risk of selecting a config | ||
1191 | * that requires external power at a time when that power | ||
1192 | * isn't available. It seems to be the lesser of two evils. | ||
1193 | * | ||
1194 | * Bugzilla #6448 reports a device that appears to crash | ||
1195 | * when it receives a GET_DEVICE_STATUS request! We don't | ||
1196 | * have any other way to tell whether a device is self-powered, | ||
1197 | * but since we don't use that information anywhere but here, | ||
1198 | * the call has been removed. | ||
1199 | * | ||
1200 | * Maybe the GET_DEVICE_STATUS call and the test below can | ||
1201 | * be reinstated when device firmwares become more reliable. | ||
1202 | * Don't hold your breath. | ||
1200 | */ | 1203 | */ |
1201 | #if 0 | 1204 | #if 0 |
1202 | /* Rule out self-powered configs for a bus-powered device */ | 1205 | /* Rule out self-powered configs for a bus-powered device */ |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 544f7589912f..73f5a379d9b3 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -863,7 +863,7 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
863 | i = ohci->num_ports; | 863 | i = ohci->num_ports; |
864 | while (i--) | 864 | while (i--) |
865 | ohci_writel (ohci, RH_PS_PSS, | 865 | ohci_writel (ohci, RH_PS_PSS, |
866 | &ohci->regs->roothub.portstatus [temp]); | 866 | &ohci->regs->roothub.portstatus [i]); |
867 | ohci_dbg (ohci, "restart complete\n"); | 867 | ohci_dbg (ohci, "restart complete\n"); |
868 | } | 868 | } |
869 | return 0; | 869 | return 0; |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index acde8868da21..fafe7c1265b3 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -185,6 +185,9 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
185 | /* Select Power Management Mode */ | 185 | /* Select Power Management Mode */ |
186 | pxa27x_ohci_select_pmm(inf->port_mode); | 186 | pxa27x_ohci_select_pmm(inf->port_mode); |
187 | 187 | ||
188 | if (inf->power_budget) | ||
189 | hcd->power_budget = inf->power_budget; | ||
190 | |||
188 | ohci_hcd_init(hcd_to_ohci(hcd)); | 191 | ohci_hcd_init(hcd_to_ohci(hcd)); |
189 | 192 | ||
190 | retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); | 193 | retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index f419bd82ab7f..435273e7c85c 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1557,6 +1557,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1557 | #define USB_VENDOR_ID_HP 0x03f0 | 1557 | #define USB_VENDOR_ID_HP 0x03f0 |
1558 | #define USB_DEVICE_ID_HP_USBHUB_KB 0x020c | 1558 | #define USB_DEVICE_ID_HP_USBHUB_KB 0x020c |
1559 | 1559 | ||
1560 | #define USB_VENDOR_ID_IBM 0x04b3 | ||
1561 | #define USB_DEVICE_ID_IBM_USBHUB_KB 0x3005 | ||
1562 | |||
1560 | #define USB_VENDOR_ID_CREATIVELABS 0x062a | 1563 | #define USB_VENDOR_ID_CREATIVELABS 0x062a |
1561 | #define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201 | 1564 | #define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201 |
1562 | 1565 | ||
@@ -1681,6 +1684,7 @@ static const struct hid_blacklist { | |||
1681 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, | 1684 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, |
1682 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET }, | 1685 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET }, |
1683 | { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, | 1686 | { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, |
1687 | { USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_USBHUB_KB, HID_QUIRK_NOGET }, | ||
1684 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, | 1688 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, |
1685 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 1689 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
1686 | { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET }, | 1690 | { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET }, |
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 6dd666696178..c4670e1d4654 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -317,6 +317,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun | |||
317 | } | 317 | } |
318 | 318 | ||
319 | schedule(); | 319 | schedule(); |
320 | set_current_state(TASK_INTERRUPTIBLE); | ||
320 | } | 321 | } |
321 | 322 | ||
322 | set_current_state(TASK_RUNNING); | 323 | set_current_state(TASK_RUNNING); |
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index 3824df33094e..1fd9cb85f4ca 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/delay.h> | ||
18 | 19 | ||
19 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 | 20 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 |
20 | typedef struct _INTEL_HEX_RECORD | 21 | typedef struct _INTEL_HEX_RECORD |
@@ -114,6 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
114 | 115 | ||
115 | /* De-assert reset (let the CPU run) */ | 116 | /* De-assert reset (let the CPU run) */ |
116 | err = emi26_set_reset(dev,0); | 117 | err = emi26_set_reset(dev,0); |
118 | msleep(250); /* let device settle */ | ||
117 | 119 | ||
118 | /* 2. We upload the FPGA firmware into the EMI | 120 | /* 2. We upload the FPGA firmware into the EMI |
119 | * Note: collect up to 1023 (yes!) bytes and send them with | 121 | * Note: collect up to 1023 (yes!) bytes and send them with |
@@ -150,6 +152,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
150 | goto wraperr; | 152 | goto wraperr; |
151 | } | 153 | } |
152 | } | 154 | } |
155 | msleep(250); /* let device settle */ | ||
153 | 156 | ||
154 | /* De-assert reset (let the CPU run) */ | 157 | /* De-assert reset (let the CPU run) */ |
155 | err = emi26_set_reset(dev,0); | 158 | err = emi26_set_reset(dev,0); |
@@ -192,6 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
192 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 195 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
193 | goto wraperr; | 196 | goto wraperr; |
194 | } | 197 | } |
198 | msleep(250); /* let device settle */ | ||
195 | 199 | ||
196 | /* return 1 to fail the driver inialization | 200 | /* return 1 to fail the driver inialization |
197 | * and give real driver change to load */ | 201 | * and give real driver change to load */ |
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index 52fea2e08db8..fe351371f274 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/delay.h> | ||
18 | 19 | ||
19 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 | 20 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 |
20 | typedef struct _INTEL_HEX_RECORD | 21 | typedef struct _INTEL_HEX_RECORD |
@@ -123,6 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
123 | 124 | ||
124 | /* De-assert reset (let the CPU run) */ | 125 | /* De-assert reset (let the CPU run) */ |
125 | err = emi62_set_reset(dev,0); | 126 | err = emi62_set_reset(dev,0); |
127 | msleep(250); /* let device settle */ | ||
126 | 128 | ||
127 | /* 2. We upload the FPGA firmware into the EMI | 129 | /* 2. We upload the FPGA firmware into the EMI |
128 | * Note: collect up to 1023 (yes!) bytes and send them with | 130 | * Note: collect up to 1023 (yes!) bytes and send them with |
@@ -166,6 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
166 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 168 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
167 | goto wraperr; | 169 | goto wraperr; |
168 | } | 170 | } |
171 | msleep(250); /* let device settle */ | ||
169 | 172 | ||
170 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ | 173 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ |
171 | 174 | ||
@@ -228,6 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
228 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 231 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
229 | goto wraperr; | 232 | goto wraperr; |
230 | } | 233 | } |
234 | msleep(250); /* let device settle */ | ||
231 | 235 | ||
232 | kfree(buf); | 236 | kfree(buf); |
233 | 237 | ||
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 2deb4c01539e..7683926a1b6f 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -318,6 +318,8 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | |||
318 | set_register(pegasus, PhyCtrl, (indx | PHY_READ)); | 318 | set_register(pegasus, PhyCtrl, (indx | PHY_READ)); |
319 | for (i = 0; i < REG_TIMEOUT; i++) { | 319 | for (i = 0; i < REG_TIMEOUT; i++) { |
320 | ret = get_registers(pegasus, PhyCtrl, 1, data); | 320 | ret = get_registers(pegasus, PhyCtrl, 1, data); |
321 | if (ret == -ESHUTDOWN) | ||
322 | goto fail; | ||
321 | if (data[0] & PHY_DONE) | 323 | if (data[0] & PHY_DONE) |
322 | break; | 324 | break; |
323 | } | 325 | } |
@@ -326,6 +328,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | |||
326 | *regd = le16_to_cpu(regdi); | 328 | *regd = le16_to_cpu(regdi); |
327 | return ret; | 329 | return ret; |
328 | } | 330 | } |
331 | fail: | ||
329 | if (netif_msg_drv(pegasus)) | 332 | if (netif_msg_drv(pegasus)) |
330 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 333 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
331 | 334 | ||
@@ -354,12 +357,15 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd) | |||
354 | set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); | 357 | set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); |
355 | for (i = 0; i < REG_TIMEOUT; i++) { | 358 | for (i = 0; i < REG_TIMEOUT; i++) { |
356 | ret = get_registers(pegasus, PhyCtrl, 1, data); | 359 | ret = get_registers(pegasus, PhyCtrl, 1, data); |
360 | if (ret == -ESHUTDOWN) | ||
361 | goto fail; | ||
357 | if (data[0] & PHY_DONE) | 362 | if (data[0] & PHY_DONE) |
358 | break; | 363 | break; |
359 | } | 364 | } |
360 | if (i < REG_TIMEOUT) | 365 | if (i < REG_TIMEOUT) |
361 | return ret; | 366 | return ret; |
362 | 367 | ||
368 | fail: | ||
363 | if (netif_msg_drv(pegasus)) | 369 | if (netif_msg_drv(pegasus)) |
364 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 370 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
365 | return -ETIMEDOUT; | 371 | return -ETIMEDOUT; |
@@ -387,6 +393,8 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) | |||
387 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); | 393 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); |
388 | if (tmp & EPROM_DONE) | 394 | if (tmp & EPROM_DONE) |
389 | break; | 395 | break; |
396 | if (ret == -ESHUTDOWN) | ||
397 | goto fail; | ||
390 | } | 398 | } |
391 | if (i < REG_TIMEOUT) { | 399 | if (i < REG_TIMEOUT) { |
392 | ret = get_registers(pegasus, EpromData, 2, &retdatai); | 400 | ret = get_registers(pegasus, EpromData, 2, &retdatai); |
@@ -394,6 +402,7 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) | |||
394 | return ret; | 402 | return ret; |
395 | } | 403 | } |
396 | 404 | ||
405 | fail: | ||
397 | if (netif_msg_drv(pegasus)) | 406 | if (netif_msg_drv(pegasus)) |
398 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 407 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
399 | return -ETIMEDOUT; | 408 | return -ETIMEDOUT; |
@@ -433,12 +442,15 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data) | |||
433 | 442 | ||
434 | for (i = 0; i < REG_TIMEOUT; i++) { | 443 | for (i = 0; i < REG_TIMEOUT; i++) { |
435 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); | 444 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); |
445 | if (ret == -ESHUTDOWN) | ||
446 | goto fail; | ||
436 | if (tmp & EPROM_DONE) | 447 | if (tmp & EPROM_DONE) |
437 | break; | 448 | break; |
438 | } | 449 | } |
439 | disable_eprom_write(pegasus); | 450 | disable_eprom_write(pegasus); |
440 | if (i < REG_TIMEOUT) | 451 | if (i < REG_TIMEOUT) |
441 | return ret; | 452 | return ret; |
453 | fail: | ||
442 | if (netif_msg_drv(pegasus)) | 454 | if (netif_msg_drv(pegasus)) |
443 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 455 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
444 | return -ETIMEDOUT; | 456 | return -ETIMEDOUT; |
@@ -1378,9 +1390,8 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message) | |||
1378 | struct pegasus *pegasus = usb_get_intfdata(intf); | 1390 | struct pegasus *pegasus = usb_get_intfdata(intf); |
1379 | 1391 | ||
1380 | netif_device_detach (pegasus->net); | 1392 | netif_device_detach (pegasus->net); |
1393 | cancel_delayed_work(&pegasus->carrier_check); | ||
1381 | if (netif_running(pegasus->net)) { | 1394 | if (netif_running(pegasus->net)) { |
1382 | cancel_delayed_work(&pegasus->carrier_check); | ||
1383 | |||
1384 | usb_kill_urb(pegasus->rx_urb); | 1395 | usb_kill_urb(pegasus->rx_urb); |
1385 | usb_kill_urb(pegasus->intr_urb); | 1396 | usb_kill_urb(pegasus->intr_urb); |
1386 | } | 1397 | } |
@@ -1400,10 +1411,9 @@ static int pegasus_resume (struct usb_interface *intf) | |||
1400 | pegasus->intr_urb->status = 0; | 1411 | pegasus->intr_urb->status = 0; |
1401 | pegasus->intr_urb->actual_length = 0; | 1412 | pegasus->intr_urb->actual_length = 0; |
1402 | intr_callback(pegasus->intr_urb, NULL); | 1413 | intr_callback(pegasus->intr_urb, NULL); |
1403 | |||
1404 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | ||
1405 | CARRIER_CHECK_DELAY); | ||
1406 | } | 1414 | } |
1415 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | ||
1416 | CARRIER_CHECK_DELAY); | ||
1407 | return 0; | 1417 | return 0; |
1408 | } | 1418 | } |
1409 | 1419 | ||
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index f96b73f54bf1..5c60be521561 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -71,6 +71,16 @@ config USB_SERIAL_ANYDATA | |||
71 | To compile this driver as a module, choose M here: the | 71 | To compile this driver as a module, choose M here: the |
72 | module will be called anydata. | 72 | module will be called anydata. |
73 | 73 | ||
74 | config USB_SERIAL_ARK3116 | ||
75 | tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" | ||
76 | depends on USB_SERIAL && EXPERIMENTAL | ||
77 | help | ||
78 | Say Y here if you want to use a ARK Micro 3116 USB to Serial | ||
79 | device. | ||
80 | |||
81 | To compile this driver as a module, choose M here: the | ||
82 | module will be called ark3116 | ||
83 | |||
74 | config USB_SERIAL_BELKIN | 84 | config USB_SERIAL_BELKIN |
75 | tristate "USB Belkin and Peracom Single Port Serial Driver" | 85 | tristate "USB Belkin and Peracom Single Port Serial Driver" |
76 | depends on USB_SERIAL | 86 | depends on USB_SERIAL |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 93c21245b1af..5a0960fc9d3e 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -13,6 +13,7 @@ usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) | |||
13 | 13 | ||
14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o | 14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o |
15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o | 15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o |
16 | obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o | ||
16 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o | 17 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o |
17 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o | 18 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o |
18 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o | 19 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index dbf1f063098c..694b205f9b73 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -18,6 +18,7 @@ | |||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ | 19 | { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ |
20 | { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ | 20 | { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ |
21 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless Aircard 580 */ | ||
21 | { }, | 22 | { }, |
22 | }; | 23 | }; |
23 | MODULE_DEVICE_TABLE(usb, id_table); | 24 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c new file mode 100644 index 000000000000..8dec796222a0 --- /dev/null +++ b/drivers/usb/serial/ark3116.c | |||
@@ -0,0 +1,465 @@ | |||
1 | /* | ||
2 | * ark3116 | ||
3 | * - implements a driver for the arkmicro ark3116 chipset (vendor=0x6547, | ||
4 | * productid=0x0232) (used in a datacable called KQ-U8A) | ||
5 | * | ||
6 | * - based on code by krisfx -> thanks !! | ||
7 | * (see http://www.linuxquestions.org/questions/showthread.php?p=2184457#post2184457) | ||
8 | * | ||
9 | * - based on logs created by usbsnoopy | ||
10 | * | ||
11 | * Author : Simon Schulz [ark3116_driver<AT>auctionant.de] | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/tty.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/usb.h> | ||
24 | #include "usb-serial.h" | ||
25 | |||
26 | |||
27 | static int debug; | ||
28 | |||
29 | static struct usb_device_id id_table [] = { | ||
30 | { USB_DEVICE(0x6547, 0x0232) }, | ||
31 | { }, | ||
32 | }; | ||
33 | MODULE_DEVICE_TABLE(usb, id_table); | ||
34 | |||
35 | struct ark3116_private { | ||
36 | spinlock_t lock; | ||
37 | u8 termios_initialized; | ||
38 | }; | ||
39 | |||
40 | static inline void ARK3116_SND(struct usb_serial *serial, int seq, | ||
41 | __u8 request, __u8 requesttype, | ||
42 | __u16 value, __u16 index) | ||
43 | { | ||
44 | int result; | ||
45 | result = usb_control_msg(serial->dev, | ||
46 | usb_sndctrlpipe(serial->dev,0), | ||
47 | request, requesttype, value, index, | ||
48 | NULL,0x00, 1000); | ||
49 | dbg("%03d > ok",seq); | ||
50 | } | ||
51 | |||
52 | static inline void ARK3116_RCV(struct usb_serial *serial, int seq, | ||
53 | __u8 request, __u8 requesttype, | ||
54 | __u16 value, __u16 index, __u8 expected, | ||
55 | char *buf) | ||
56 | { | ||
57 | int result; | ||
58 | result = usb_control_msg(serial->dev, | ||
59 | usb_rcvctrlpipe(serial->dev,0), | ||
60 | request, requesttype, value, index, | ||
61 | buf, 0x0000001, 1000); | ||
62 | if (result) | ||
63 | dbg("%03d < %d bytes [0x%02X]",seq, result, buf[0]); | ||
64 | else | ||
65 | dbg("%03d < 0 bytes", seq); | ||
66 | } | ||
67 | |||
68 | |||
69 | static inline void ARK3116_RCV_QUIET(struct usb_serial *serial, | ||
70 | __u8 request, __u8 requesttype, | ||
71 | __u16 value, __u16 index, char *buf) | ||
72 | { | ||
73 | usb_control_msg(serial->dev, | ||
74 | usb_rcvctrlpipe(serial->dev,0), | ||
75 | request, requesttype, value, index, | ||
76 | buf, 0x0000001, 1000); | ||
77 | } | ||
78 | |||
79 | |||
80 | static int ark3116_attach(struct usb_serial *serial) | ||
81 | { | ||
82 | char *buf; | ||
83 | struct ark3116_private *priv; | ||
84 | int i; | ||
85 | |||
86 | for (i = 0; i < serial->num_ports; ++i) { | ||
87 | priv = kmalloc (sizeof (struct ark3116_private), GFP_KERNEL); | ||
88 | if (!priv) | ||
89 | goto cleanup; | ||
90 | memset (priv, 0x00, sizeof (struct ark3116_private)); | ||
91 | spin_lock_init(&priv->lock); | ||
92 | |||
93 | usb_set_serial_port_data(serial->port[i], priv); | ||
94 | } | ||
95 | |||
96 | buf = kmalloc(1, GFP_KERNEL); | ||
97 | if (!buf) { | ||
98 | dbg("error kmalloc -> out of mem ?"); | ||
99 | goto cleanup; | ||
100 | } | ||
101 | |||
102 | /* 3 */ | ||
103 | ARK3116_SND(serial, 3,0xFE,0x40,0x0008,0x0002); | ||
104 | ARK3116_SND(serial, 4,0xFE,0x40,0x0008,0x0001); | ||
105 | ARK3116_SND(serial, 5,0xFE,0x40,0x0000,0x0008); | ||
106 | ARK3116_SND(serial, 6,0xFE,0x40,0x0000,0x000B); | ||
107 | |||
108 | /* <-- seq7 */ | ||
109 | ARK3116_RCV(serial, 7,0xFE,0xC0,0x0000,0x0003, 0x00, buf); | ||
110 | ARK3116_SND(serial, 8,0xFE,0x40,0x0080,0x0003); | ||
111 | ARK3116_SND(serial, 9,0xFE,0x40,0x001A,0x0000); | ||
112 | ARK3116_SND(serial,10,0xFE,0x40,0x0000,0x0001); | ||
113 | ARK3116_SND(serial,11,0xFE,0x40,0x0000,0x0003); | ||
114 | |||
115 | /* <-- seq12 */ | ||
116 | ARK3116_RCV(serial,12,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
117 | ARK3116_SND(serial,13,0xFE,0x40,0x0000,0x0004); | ||
118 | |||
119 | /* 14 */ | ||
120 | ARK3116_RCV(serial,14,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
121 | ARK3116_SND(serial,15,0xFE,0x40,0x0000,0x0004); | ||
122 | |||
123 | /* 16 */ | ||
124 | ARK3116_RCV(serial,16,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
125 | /* --> seq17 */ | ||
126 | ARK3116_SND(serial,17,0xFE,0x40,0x0001,0x0004); | ||
127 | |||
128 | /* <-- seq18 */ | ||
129 | ARK3116_RCV(serial,18,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | ||
130 | |||
131 | /* --> seq19 */ | ||
132 | ARK3116_SND(serial,19,0xFE,0x40,0x0003,0x0004); | ||
133 | |||
134 | |||
135 | /* <-- seq20 */ | ||
136 | /* seems like serial port status info (RTS, CTS,...) */ | ||
137 | /* returns modem control line status ?! */ | ||
138 | ARK3116_RCV(serial,20,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | ||
139 | |||
140 | /* set 9600 baud & do some init ?! */ | ||
141 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | ||
142 | ARK3116_SND(serial,148,0xFE,0x40,0x0038,0x0000); | ||
143 | ARK3116_SND(serial,149,0xFE,0x40,0x0001,0x0001); | ||
144 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | ||
145 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | ||
146 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | ||
147 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | ||
148 | ARK3116_SND(serial,154,0xFE,0x40,0x0003,0x0003); | ||
149 | |||
150 | kfree(buf); | ||
151 | return(0); | ||
152 | |||
153 | cleanup: | ||
154 | for (--i; i>=0; --i) | ||
155 | usb_set_serial_port_data(serial->port[i], NULL); | ||
156 | return -ENOMEM; | ||
157 | } | ||
158 | |||
159 | static void ark3116_set_termios(struct usb_serial_port *port, | ||
160 | struct termios *old_termios) | ||
161 | { | ||
162 | struct usb_serial *serial = port->serial; | ||
163 | struct ark3116_private *priv = usb_get_serial_port_data(port); | ||
164 | unsigned int cflag = port->tty->termios->c_cflag; | ||
165 | unsigned long flags; | ||
166 | int baud; | ||
167 | int ark3116_baud; | ||
168 | char *buf; | ||
169 | char config; | ||
170 | |||
171 | config = 0; | ||
172 | |||
173 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
174 | |||
175 | if ((!port->tty) || (!port->tty->termios)) { | ||
176 | dbg("%s - no tty structures", __FUNCTION__); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | spin_lock_irqsave(&priv->lock, flags); | ||
181 | if (!priv->termios_initialized) { | ||
182 | *(port->tty->termios) = tty_std_termios; | ||
183 | port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | ||
184 | priv->termios_initialized = 1; | ||
185 | } | ||
186 | spin_unlock_irqrestore(&priv->lock, flags); | ||
187 | |||
188 | cflag = port->tty->termios->c_cflag; | ||
189 | |||
190 | /* check that they really want us to change something: */ | ||
191 | if (old_termios) { | ||
192 | if ((cflag == old_termios->c_cflag) && | ||
193 | (RELEVANT_IFLAG(port->tty->termios->c_iflag) == | ||
194 | RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
195 | dbg("%s - nothing to change...", __FUNCTION__); | ||
196 | return; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | buf = kmalloc(1, GFP_KERNEL); | ||
201 | if (!buf) { | ||
202 | dbg("error kmalloc"); | ||
203 | return; | ||
204 | } | ||
205 | |||
206 | /* set data bit count (8/7/6/5) */ | ||
207 | if (cflag & CSIZE){ | ||
208 | switch (cflag & CSIZE){ | ||
209 | case CS5: | ||
210 | config |= 0x00; | ||
211 | dbg("setting CS5"); | ||
212 | break; | ||
213 | case CS6: | ||
214 | config |= 0x01; | ||
215 | dbg("setting CS6"); | ||
216 | break; | ||
217 | case CS7: | ||
218 | config |= 0x02; | ||
219 | dbg("setting CS7"); | ||
220 | break; | ||
221 | default: | ||
222 | err ("CSIZE was set but not CS5-CS8, using CS8!"); | ||
223 | case CS8: | ||
224 | config |= 0x03; | ||
225 | dbg("setting CS8"); | ||
226 | break; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /* set parity (NONE,EVEN,ODD) */ | ||
231 | if (cflag & PARENB){ | ||
232 | if (cflag & PARODD) { | ||
233 | config |= 0x08; | ||
234 | dbg("setting parity to ODD"); | ||
235 | } else { | ||
236 | config |= 0x18; | ||
237 | dbg("setting parity to EVEN"); | ||
238 | } | ||
239 | } else { | ||
240 | dbg("setting parity to NONE"); | ||
241 | } | ||
242 | |||
243 | /* SET STOPBIT (1/2) */ | ||
244 | if (cflag & CSTOPB) { | ||
245 | config |= 0x04; | ||
246 | dbg ("setting 2 stop bits"); | ||
247 | } else { | ||
248 | dbg ("setting 1 stop bit"); | ||
249 | } | ||
250 | |||
251 | |||
252 | /* set baudrate: */ | ||
253 | baud = 0; | ||
254 | switch (cflag & CBAUD){ | ||
255 | case B0: | ||
256 | err("can't set 0baud, using 9600 instead"); | ||
257 | break; | ||
258 | case B75: baud = 75; break; | ||
259 | case B150: baud = 150; break; | ||
260 | case B300: baud = 300; break; | ||
261 | case B600: baud = 600; break; | ||
262 | case B1200: baud = 1200; break; | ||
263 | case B1800: baud = 1800; break; | ||
264 | case B2400: baud = 2400; break; | ||
265 | case B4800: baud = 4800; break; | ||
266 | case B9600: baud = 9600; break; | ||
267 | case B19200: baud = 19200; break; | ||
268 | case B38400: baud = 38400; break; | ||
269 | case B57600: baud = 57600; break; | ||
270 | case B115200: baud = 115200; break; | ||
271 | case B230400: baud = 230400; break; | ||
272 | case B460800: baud = 460800; break; | ||
273 | default: | ||
274 | dbg("does not support the baudrate requested (fix it)"); | ||
275 | break; | ||
276 | } | ||
277 | |||
278 | /* set 9600 as default (if given baudrate is invalid for example) */ | ||
279 | if (baud == 0) | ||
280 | baud = 9600; | ||
281 | |||
282 | /* | ||
283 | * found by try'n'error, be careful, maybe there are other options | ||
284 | * for multiplicator etc! | ||
285 | */ | ||
286 | if (baud == 460800) | ||
287 | /* strange, for 460800 the formula is wrong | ||
288 | * (dont use round(), then 9600baud is wrong) */ | ||
289 | ark3116_baud = 7; | ||
290 | else | ||
291 | ark3116_baud = 3000000 / baud; | ||
292 | |||
293 | /* ? */ | ||
294 | ARK3116_RCV(serial,0,0xFE,0xC0,0x0000,0x0003, 0x03, buf); | ||
295 | /* offset = buf[0]; */ | ||
296 | /* offset = 0x03; */ | ||
297 | /* dbg("using 0x%04X as target for 0x0003:",0x0080+offset); */ | ||
298 | |||
299 | |||
300 | /* set baudrate */ | ||
301 | dbg("setting baudrate to %d (->reg=%d)",baud,ark3116_baud); | ||
302 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | ||
303 | ARK3116_SND(serial,148,0xFE,0x40,(ark3116_baud & 0x00FF) ,0x0000); | ||
304 | ARK3116_SND(serial,149,0xFE,0x40,(ark3116_baud & 0xFF00)>>8,0x0001); | ||
305 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | ||
306 | |||
307 | /* ? */ | ||
308 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | ||
309 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | ||
310 | |||
311 | /* set data bit count, stop bit count & parity: */ | ||
312 | dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config); | ||
313 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | ||
314 | ARK3116_SND(serial,154,0xFE,0x40,config,0x0003); | ||
315 | |||
316 | if (cflag & CRTSCTS) | ||
317 | dbg("CRTSCTS not supported by chipset ?!"); | ||
318 | |||
319 | /* TEST ARK3116_SND(154,0xFE,0x40,0xFFFF, 0x0006); */ | ||
320 | |||
321 | kfree(buf); | ||
322 | return; | ||
323 | } | ||
324 | |||
325 | static int ark3116_open(struct usb_serial_port *port, struct file *filp) | ||
326 | { | ||
327 | struct termios tmp_termios; | ||
328 | struct usb_serial *serial = port->serial; | ||
329 | char *buf; | ||
330 | int result = 0; | ||
331 | |||
332 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
333 | |||
334 | buf = kmalloc(1, GFP_KERNEL); | ||
335 | if (!buf) { | ||
336 | dbg("error kmalloc -> out of mem ?"); | ||
337 | return -ENOMEM; | ||
338 | } | ||
339 | |||
340 | result = usb_serial_generic_open(port, filp); | ||
341 | if (result) | ||
342 | return result; | ||
343 | |||
344 | /* open */ | ||
345 | ARK3116_RCV(serial,111,0xFE,0xC0,0x0000,0x0003, 0x02, buf); | ||
346 | |||
347 | ARK3116_SND(serial,112,0xFE,0x40,0x0082,0x0003); | ||
348 | ARK3116_SND(serial,113,0xFE,0x40,0x001A,0x0000); | ||
349 | ARK3116_SND(serial,114,0xFE,0x40,0x0000,0x0001); | ||
350 | ARK3116_SND(serial,115,0xFE,0x40,0x0002,0x0003); | ||
351 | |||
352 | ARK3116_RCV(serial,116,0xFE,0xC0,0x0000,0x0004, 0x03, buf); | ||
353 | ARK3116_SND(serial,117,0xFE,0x40,0x0002,0x0004); | ||
354 | |||
355 | ARK3116_RCV(serial,118,0xFE,0xC0,0x0000,0x0004, 0x02, buf); | ||
356 | ARK3116_SND(serial,119,0xFE,0x40,0x0000,0x0004); | ||
357 | |||
358 | ARK3116_RCV(serial,120,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
359 | |||
360 | ARK3116_SND(serial,121,0xFE,0x40,0x0001,0x0004); | ||
361 | |||
362 | ARK3116_RCV(serial,122,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | ||
363 | |||
364 | ARK3116_SND(serial,123,0xFE,0x40,0x0003,0x0004); | ||
365 | |||
366 | /* returns different values (control lines ?!) */ | ||
367 | ARK3116_RCV(serial,124,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | ||
368 | |||
369 | /* initialise termios: */ | ||
370 | if (port->tty) | ||
371 | ark3116_set_termios(port, &tmp_termios); | ||
372 | |||
373 | kfree(buf); | ||
374 | |||
375 | return result; | ||
376 | |||
377 | } | ||
378 | |||
379 | static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, | ||
380 | unsigned int cmd, unsigned long arg) | ||
381 | { | ||
382 | dbg("ioctl not supported yet..."); | ||
383 | return -ENOIOCTLCMD; | ||
384 | } | ||
385 | |||
386 | static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file) | ||
387 | { | ||
388 | struct usb_serial *serial = port->serial; | ||
389 | char *buf; | ||
390 | char temp; | ||
391 | |||
392 | /* seems like serial port status info (RTS, CTS,...) is stored | ||
393 | * in reg(?) 0x0006 | ||
394 | * pcb connection point 11 = GND -> sets bit4 of response | ||
395 | * pcb connection point 7 = GND -> sets bit6 of response | ||
396 | */ | ||
397 | |||
398 | buf = kmalloc(1, GFP_KERNEL); | ||
399 | if (!buf) { | ||
400 | dbg("error kmalloc"); | ||
401 | return -ENOMEM; | ||
402 | } | ||
403 | |||
404 | /* read register: */ | ||
405 | ARK3116_RCV_QUIET(serial,0xFE,0xC0,0x0000,0x0006,buf); | ||
406 | temp = buf[0]; | ||
407 | kfree(buf); | ||
408 | |||
409 | /* i do not really know if bit4=CTS and bit6=DSR... was just a | ||
410 | * quick guess !! | ||
411 | */ | ||
412 | return (temp & (1<<4) ? TIOCM_CTS : 0) | | ||
413 | (temp & (1<<6) ? TIOCM_DSR : 0); | ||
414 | } | ||
415 | |||
416 | static struct usb_driver ark3116_driver = { | ||
417 | .name = "ark3116", | ||
418 | .probe = usb_serial_probe, | ||
419 | .disconnect = usb_serial_disconnect, | ||
420 | .id_table = id_table, | ||
421 | }; | ||
422 | |||
423 | static struct usb_serial_driver ark3116_device = { | ||
424 | .driver = { | ||
425 | .owner = THIS_MODULE, | ||
426 | .name = "ark3116", | ||
427 | }, | ||
428 | .id_table = id_table, | ||
429 | .num_interrupt_in = 1, | ||
430 | .num_bulk_in = 1, | ||
431 | .num_bulk_out = 1, | ||
432 | .num_ports = 1, | ||
433 | .attach = ark3116_attach, | ||
434 | .set_termios = ark3116_set_termios, | ||
435 | .ioctl = ark3116_ioctl, | ||
436 | .tiocmget = ark3116_tiocmget, | ||
437 | .open = ark3116_open, | ||
438 | }; | ||
439 | |||
440 | static int __init ark3116_init(void) | ||
441 | { | ||
442 | int retval; | ||
443 | |||
444 | retval = usb_serial_register(&ark3116_device); | ||
445 | if (retval) | ||
446 | return retval; | ||
447 | retval = usb_register(&ark3116_driver); | ||
448 | if (retval) | ||
449 | usb_serial_deregister(&ark3116_device); | ||
450 | return retval; | ||
451 | } | ||
452 | |||
453 | static void __exit ark3116_exit(void) | ||
454 | { | ||
455 | usb_deregister(&ark3116_driver); | ||
456 | usb_serial_deregister(&ark3116_device); | ||
457 | } | ||
458 | |||
459 | module_init(ark3116_init); | ||
460 | module_exit(ark3116_exit); | ||
461 | MODULE_LICENSE("GPL"); | ||
462 | |||
463 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
464 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
465 | |||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 82151207d814..986d7622273d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -307,6 +307,7 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
307 | 307 | ||
308 | 308 | ||
309 | static struct usb_device_id id_table_combined [] = { | 309 | static struct usb_device_id id_table_combined [] = { |
310 | { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, | ||
310 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, | 311 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, |
311 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, | 312 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, |
312 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, | 313 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, |
@@ -498,6 +499,7 @@ static struct usb_device_id id_table_combined [] = { | |||
498 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | 499 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
499 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 500 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, |
500 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, | 501 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, |
502 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | ||
501 | { }, /* Optional parameter entry */ | 503 | { }, /* Optional parameter entry */ |
502 | { } /* Terminating entry */ | 504 | { } /* Terminating entry */ |
503 | }; | 505 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 2c55a5ea9c99..d69a917e768f 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -32,6 +32,10 @@ | |||
32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ | 32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ |
33 | 33 | ||
34 | 34 | ||
35 | /* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ | ||
36 | #define FTDI_ACTZWAVE_PID 0xF2D0 | ||
37 | |||
38 | |||
35 | /* www.irtrans.de device */ | 39 | /* www.irtrans.de device */ |
36 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ | 40 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ |
37 | 41 | ||
@@ -426,6 +430,11 @@ | |||
426 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ | 430 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ |
427 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ | 431 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ |
428 | 432 | ||
433 | /* | ||
434 | * ACG Identification Technologies GmbH products (http://www.acg.de/). | ||
435 | * Submitted by anton -at- goto10 -dot- org. | ||
436 | */ | ||
437 | #define FTDI_ACG_HFDUAL_PID 0xDD20 /* HF Dual ISO Reader (RFID) */ | ||
429 | 438 | ||
430 | /* Commands */ | 439 | /* Commands */ |
431 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 440 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 476cda107f4f..c62cc2876519 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -138,6 +138,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp) | |||
138 | 138 | ||
139 | return result; | 139 | return result; |
140 | } | 140 | } |
141 | EXPORT_SYMBOL_GPL(usb_serial_generic_open); | ||
141 | 142 | ||
142 | static void generic_cleanup (struct usb_serial_port *port) | 143 | static void generic_cleanup (struct usb_serial_port *port) |
143 | { | 144 | { |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 4d40704dea2c..238033a87092 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -257,14 +257,14 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf | |||
257 | return (0); | 257 | return (0); |
258 | } | 258 | } |
259 | 259 | ||
260 | spin_lock(&port->lock); | 260 | spin_lock(&wport->lock); |
261 | if (port->write_urb_busy) { | 261 | if (wport->write_urb_busy) { |
262 | spin_unlock(&port->lock); | 262 | spin_unlock(&wport->lock); |
263 | dbg("%s - already writing", __FUNCTION__); | 263 | dbg("%s - already writing", __FUNCTION__); |
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | port->write_urb_busy = 1; | 266 | wport->write_urb_busy = 1; |
267 | spin_unlock(&port->lock); | 267 | spin_unlock(&wport->lock); |
268 | 268 | ||
269 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; | 269 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; |
270 | 270 | ||
@@ -283,7 +283,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf | |||
283 | wport->write_urb->dev = serial->dev; | 283 | wport->write_urb->dev = serial->dev; |
284 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); | 284 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); |
285 | if (result) { | 285 | if (result) { |
286 | port->write_urb_busy = 0; | 286 | wport->write_urb_busy = 0; |
287 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); | 287 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); |
288 | } else | 288 | } else |
289 | result = count; | 289 | result = count; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 071f86a59c08..9c36f0ece20f 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -189,11 +189,15 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
189 | 189 | ||
190 | portNumber = tty->index - serial->minor; | 190 | portNumber = tty->index - serial->minor; |
191 | port = serial->port[portNumber]; | 191 | port = serial->port[portNumber]; |
192 | if (!port) | 192 | if (!port) { |
193 | return -ENODEV; | 193 | retval = -ENODEV; |
194 | goto bailout_kref_put; | ||
195 | } | ||
194 | 196 | ||
195 | if (mutex_lock_interruptible(&port->mutex)) | 197 | if (mutex_lock_interruptible(&port->mutex)) { |
196 | return -ERESTARTSYS; | 198 | retval = -ERESTARTSYS; |
199 | goto bailout_kref_put; | ||
200 | } | ||
197 | 201 | ||
198 | ++port->open_count; | 202 | ++port->open_count; |
199 | 203 | ||
@@ -209,7 +213,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
209 | * safe because we are called with BKL held */ | 213 | * safe because we are called with BKL held */ |
210 | if (!try_module_get(serial->type->driver.owner)) { | 214 | if (!try_module_get(serial->type->driver.owner)) { |
211 | retval = -ENODEV; | 215 | retval = -ENODEV; |
212 | goto bailout_kref_put; | 216 | goto bailout_mutex_unlock; |
213 | } | 217 | } |
214 | 218 | ||
215 | /* only call the device specific open if this | 219 | /* only call the device specific open if this |
@@ -224,10 +228,11 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
224 | 228 | ||
225 | bailout_module_put: | 229 | bailout_module_put: |
226 | module_put(serial->type->driver.owner); | 230 | module_put(serial->type->driver.owner); |
227 | bailout_kref_put: | 231 | bailout_mutex_unlock: |
228 | kref_put(&serial->kref, destroy_serial); | ||
229 | port->open_count = 0; | 232 | port->open_count = 0; |
230 | mutex_unlock(&port->mutex); | 233 | mutex_unlock(&port->mutex); |
234 | bailout_kref_put: | ||
235 | kref_put(&serial->kref, destroy_serial); | ||
231 | return retval; | 236 | return retval; |
232 | } | 237 | } |
233 | 238 | ||
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 3d04b2def0f1..789450bb0bc9 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -214,10 +214,13 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) | |||
214 | */ | 214 | */ |
215 | int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi) | 215 | int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi) |
216 | { | 216 | { |
217 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 217 | struct au1100fb_device *fbdev; |
218 | u32 *palette = fbdev->regs->lcd_pallettebase; | 218 | u32 *palette; |
219 | u32 value; | 219 | u32 value; |
220 | 220 | ||
221 | fbdev = to_au1100fb_device(fbi); | ||
222 | palette = fbdev->regs->lcd_pallettebase; | ||
223 | |||
221 | if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1)) | 224 | if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1)) |
222 | return -EINVAL; | 225 | return -EINVAL; |
223 | 226 | ||
@@ -316,9 +319,11 @@ int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi) | |||
316 | */ | 319 | */ |
317 | int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) | 320 | int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) |
318 | { | 321 | { |
319 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 322 | struct au1100fb_device *fbdev; |
320 | int dy; | 323 | int dy; |
321 | 324 | ||
325 | fbdev = to_au1100fb_device(fbi); | ||
326 | |||
322 | print_dbg("fb_pan_display %p %p", var, fbi); | 327 | print_dbg("fb_pan_display %p %p", var, fbi); |
323 | 328 | ||
324 | if (!var || !fbdev) { | 329 | if (!var || !fbdev) { |
@@ -382,10 +387,12 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle) | |||
382 | */ | 387 | */ |
383 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) | 388 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) |
384 | { | 389 | { |
385 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); | 390 | struct au1100fb_device *fbdev; |
386 | unsigned int len; | 391 | unsigned int len; |
387 | unsigned long start=0, off; | 392 | unsigned long start=0, off; |
388 | 393 | ||
394 | fbdev = to_au1100fb_device(fbi); | ||
395 | |||
389 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { | 396 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { |
390 | return -EINVAL; | 397 | return -EINVAL; |
391 | } | 398 | } |
@@ -467,7 +474,7 @@ int au1100fb_drv_probe(struct device *dev) | |||
467 | 474 | ||
468 | if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, | 475 | if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, |
469 | DRIVER_NAME)) { | 476 | DRIVER_NAME)) { |
470 | print_err("fail to lock memory region at 0x%08x", | 477 | print_err("fail to lock memory region at 0x%08lx", |
471 | au1100fb_fix.mmio_start); | 478 | au1100fb_fix.mmio_start); |
472 | return -EBUSY; | 479 | return -EBUSY; |
473 | } | 480 | } |
@@ -595,13 +602,13 @@ int au1100fb_drv_remove(struct device *dev) | |||
595 | return 0; | 602 | return 0; |
596 | } | 603 | } |
597 | 604 | ||
598 | int au1100fb_drv_suspend(struct device *dev, u32 state, u32 level) | 605 | int au1100fb_drv_suspend(struct device *dev, pm_message_t state) |
599 | { | 606 | { |
600 | /* TODO */ | 607 | /* TODO */ |
601 | return 0; | 608 | return 0; |
602 | } | 609 | } |
603 | 610 | ||
604 | int au1100fb_drv_resume(struct device *dev, u32 level) | 611 | int au1100fb_drv_resume(struct device *dev) |
605 | { | 612 | { |
606 | /* TODO */ | 613 | /* TODO */ |
607 | return 0; | 614 | return 0; |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 334b1db1bd7c..27597c576eff 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -29,12 +29,15 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf) | |||
29 | 29 | ||
30 | static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) | 30 | static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) |
31 | { | 31 | { |
32 | int rc = -ENXIO, power; | 32 | int rc = -ENXIO; |
33 | char *endp; | 33 | char *endp; |
34 | struct backlight_device *bd = to_backlight_device(cdev); | 34 | struct backlight_device *bd = to_backlight_device(cdev); |
35 | int power = simple_strtoul(buf, &endp, 0); | ||
36 | size_t size = endp - buf; | ||
35 | 37 | ||
36 | power = simple_strtoul(buf, &endp, 0); | 38 | if (*endp && isspace(*endp)) |
37 | if (*endp && !isspace(*endp)) | 39 | size++; |
40 | if (size != count) | ||
38 | return -EINVAL; | 41 | return -EINVAL; |
39 | 42 | ||
40 | down(&bd->sem); | 43 | down(&bd->sem); |
@@ -65,12 +68,15 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf) | |||
65 | 68 | ||
66 | static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) | 69 | static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) |
67 | { | 70 | { |
68 | int rc = -ENXIO, brightness; | 71 | int rc = -ENXIO; |
69 | char *endp; | 72 | char *endp; |
70 | struct backlight_device *bd = to_backlight_device(cdev); | 73 | struct backlight_device *bd = to_backlight_device(cdev); |
74 | int brightness = simple_strtoul(buf, &endp, 0); | ||
75 | size_t size = endp - buf; | ||
71 | 76 | ||
72 | brightness = simple_strtoul(buf, &endp, 0); | 77 | if (*endp && isspace(*endp)) |
73 | if (*endp && !isspace(*endp)) | 78 | size++; |
79 | if (size != count) | ||
74 | return -EINVAL; | 80 | return -EINVAL; |
75 | 81 | ||
76 | down(&bd->sem); | 82 | down(&bd->sem); |
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 86908a60c630..bc8ab005a3fb 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -31,12 +31,15 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf) | |||
31 | 31 | ||
32 | static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) | 32 | static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) |
33 | { | 33 | { |
34 | int rc, power; | 34 | int rc = -ENXIO; |
35 | char *endp; | 35 | char *endp; |
36 | struct lcd_device *ld = to_lcd_device(cdev); | 36 | struct lcd_device *ld = to_lcd_device(cdev); |
37 | int power = simple_strtoul(buf, &endp, 0); | ||
38 | size_t size = endp - buf; | ||
37 | 39 | ||
38 | power = simple_strtoul(buf, &endp, 0); | 40 | if (*endp && isspace(*endp)) |
39 | if (*endp && !isspace(*endp)) | 41 | size++; |
42 | if (size != count) | ||
40 | return -EINVAL; | 43 | return -EINVAL; |
41 | 44 | ||
42 | down(&ld->sem); | 45 | down(&ld->sem); |
@@ -44,8 +47,7 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
44 | pr_debug("lcd: set power to %d\n", power); | 47 | pr_debug("lcd: set power to %d\n", power); |
45 | ld->props->set_power(ld, power); | 48 | ld->props->set_power(ld, power); |
46 | rc = count; | 49 | rc = count; |
47 | } else | 50 | } |
48 | rc = -ENXIO; | ||
49 | up(&ld->sem); | 51 | up(&ld->sem); |
50 | 52 | ||
51 | return rc; | 53 | return rc; |
@@ -53,14 +55,12 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_ | |||
53 | 55 | ||
54 | static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | 56 | static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) |
55 | { | 57 | { |
56 | int rc; | 58 | int rc = -ENXIO; |
57 | struct lcd_device *ld = to_lcd_device(cdev); | 59 | struct lcd_device *ld = to_lcd_device(cdev); |
58 | 60 | ||
59 | down(&ld->sem); | 61 | down(&ld->sem); |
60 | if (likely(ld->props && ld->props->get_contrast)) | 62 | if (likely(ld->props && ld->props->get_contrast)) |
61 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); | 63 | rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); |
62 | else | ||
63 | rc = -ENXIO; | ||
64 | up(&ld->sem); | 64 | up(&ld->sem); |
65 | 65 | ||
66 | return rc; | 66 | return rc; |
@@ -68,12 +68,15 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) | |||
68 | 68 | ||
69 | static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) | 69 | static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) |
70 | { | 70 | { |
71 | int rc, contrast; | 71 | int rc = -ENXIO; |
72 | char *endp; | 72 | char *endp; |
73 | struct lcd_device *ld = to_lcd_device(cdev); | 73 | struct lcd_device *ld = to_lcd_device(cdev); |
74 | int contrast = simple_strtoul(buf, &endp, 0); | ||
75 | size_t size = endp - buf; | ||
74 | 76 | ||
75 | contrast = simple_strtoul(buf, &endp, 0); | 77 | if (*endp && isspace(*endp)) |
76 | if (*endp && !isspace(*endp)) | 78 | size++; |
79 | if (size != count) | ||
77 | return -EINVAL; | 80 | return -EINVAL; |
78 | 81 | ||
79 | down(&ld->sem); | 82 | down(&ld->sem); |
@@ -81,8 +84,7 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
81 | pr_debug("lcd: set contrast to %d\n", contrast); | 84 | pr_debug("lcd: set contrast to %d\n", contrast); |
82 | ld->props->set_contrast(ld, contrast); | 85 | ld->props->set_contrast(ld, contrast); |
83 | rc = count; | 86 | rc = count; |
84 | } else | 87 | } |
85 | rc = -ENXIO; | ||
86 | up(&ld->sem); | 88 | up(&ld->sem); |
87 | 89 | ||
88 | return rc; | 90 | return rc; |
@@ -90,14 +92,12 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si | |||
90 | 92 | ||
91 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) | 93 | static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) |
92 | { | 94 | { |
93 | int rc; | 95 | int rc = -ENXIO; |
94 | struct lcd_device *ld = to_lcd_device(cdev); | 96 | struct lcd_device *ld = to_lcd_device(cdev); |
95 | 97 | ||
96 | down(&ld->sem); | 98 | down(&ld->sem); |
97 | if (likely(ld->props)) | 99 | if (likely(ld->props)) |
98 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); | 100 | rc = sprintf(buf, "%d\n", ld->props->max_contrast); |
99 | else | ||
100 | rc = -ENXIO; | ||
101 | up(&ld->sem); | 101 | up(&ld->sem); |
102 | 102 | ||
103 | return rc; | 103 | return rc; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index ca020719d20b..47ba1a79adcd 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -1745,7 +1745,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, | |||
1745 | fbcon_redraw_move(vc, p, 0, t, count); | 1745 | fbcon_redraw_move(vc, p, 0, t, count); |
1746 | ypan_up_redraw(vc, t, count); | 1746 | ypan_up_redraw(vc, t, count); |
1747 | if (vc->vc_rows - b > 0) | 1747 | if (vc->vc_rows - b > 0) |
1748 | fbcon_redraw_move(vc, p, b - count, | 1748 | fbcon_redraw_move(vc, p, b, |
1749 | vc->vc_rows - b, b); | 1749 | vc->vc_rows - b, b); |
1750 | } else | 1750 | } else |
1751 | fbcon_redraw_move(vc, p, t + count, b - t - count, t); | 1751 | fbcon_redraw_move(vc, p, t + count, b - t - count, t); |
@@ -2631,7 +2631,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines) | |||
2631 | scr_memcpyw((u16 *) q, (u16 *) p, | 2631 | scr_memcpyw((u16 *) q, (u16 *) p, |
2632 | vc->vc_size_row); | 2632 | vc->vc_size_row); |
2633 | } | 2633 | } |
2634 | softback_in = p; | 2634 | softback_in = softback_curr = p; |
2635 | update_region(vc, vc->vc_origin, | 2635 | update_region(vc, vc->vc_origin, |
2636 | logo_lines * vc->vc_cols); | 2636 | logo_lines * vc->vc_cols); |
2637 | } | 2637 | } |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 788297e9d59e..44aa2ffff973 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -76,8 +76,8 @@ | |||
76 | * | 76 | * |
77 | * Experiment with v_offset to find out which works best for you. | 77 | * Experiment with v_offset to find out which works best for you. |
78 | */ | 78 | */ |
79 | static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */ | 79 | static u32 v_offset_default __devinitdata; /* For 32 MiB Aper size, 8 should be the default */ |
80 | static u32 voffset __initdata = 0; | 80 | static u32 voffset __devinitdata; |
81 | 81 | ||
82 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); | 82 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); |
83 | static int __devinit i810fb_init_pci (struct pci_dev *dev, | 83 | static int __devinit i810fb_init_pci (struct pci_dev *dev, |
diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/matrox/g450_pll.c index 8073a73f6f35..440272ad10e7 100644 --- a/drivers/video/matrox/g450_pll.c +++ b/drivers/video/matrox/g450_pll.c | |||
@@ -316,14 +316,24 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, | |||
316 | case M_PIXEL_PLL_B: | 316 | case M_PIXEL_PLL_B: |
317 | case M_PIXEL_PLL_C: | 317 | case M_PIXEL_PLL_C: |
318 | { | 318 | { |
319 | u_int8_t tmp; | 319 | u_int8_t tmp, xpwrctrl; |
320 | unsigned long flags; | 320 | unsigned long flags; |
321 | 321 | ||
322 | matroxfb_DAC_lock_irqsave(flags); | 322 | matroxfb_DAC_lock_irqsave(flags); |
323 | |||
324 | xpwrctrl = matroxfb_DAC_in(PMINFO M1064_XPWRCTRL); | ||
325 | matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl & ~M1064_XPWRCTRL_PANELPDN); | ||
326 | mga_outb(M_SEQ_INDEX, M_SEQ1); | ||
327 | mga_outb(M_SEQ_DATA, mga_inb(M_SEQ_DATA) | M_SEQ1_SCROFF); | ||
323 | tmp = matroxfb_DAC_in(PMINFO M1064_XPIXCLKCTRL); | 328 | tmp = matroxfb_DAC_in(PMINFO M1064_XPIXCLKCTRL); |
329 | tmp |= M1064_XPIXCLKCTRL_DIS; | ||
324 | if (!(tmp & M1064_XPIXCLKCTRL_PLL_UP)) { | 330 | if (!(tmp & M1064_XPIXCLKCTRL_PLL_UP)) { |
325 | matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp | M1064_XPIXCLKCTRL_PLL_UP); | 331 | tmp |= M1064_XPIXCLKCTRL_PLL_UP; |
326 | } | 332 | } |
333 | matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); | ||
334 | matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0); | ||
335 | matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl); | ||
336 | |||
327 | matroxfb_DAC_unlock_irqrestore(flags); | 337 | matroxfb_DAC_unlock_irqrestore(flags); |
328 | } | 338 | } |
329 | { | 339 | { |
@@ -418,6 +428,15 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll, | |||
418 | frequency to higher - with <= lowest wins, while | 428 | frequency to higher - with <= lowest wins, while |
419 | with < highest one wins */ | 429 | with < highest one wins */ |
420 | if (delta <= deltaarray[idx-1]) { | 430 | if (delta <= deltaarray[idx-1]) { |
431 | /* all else being equal except VCO, | ||
432 | * choose VCO not near (within 1/16th or so) VCOmin | ||
433 | * (freqs near VCOmin aren't as stable) | ||
434 | */ | ||
435 | if (delta == deltaarray[idx-1] | ||
436 | && vco != g450_mnp2vco(PMINFO mnparray[idx-1]) | ||
437 | && vco < (pi->vcomin * 17 / 16)) { | ||
438 | break; | ||
439 | } | ||
421 | mnparray[idx] = mnparray[idx-1]; | 440 | mnparray[idx] = mnparray[idx-1]; |
422 | deltaarray[idx] = deltaarray[idx-1]; | 441 | deltaarray[idx] = deltaarray[idx-1]; |
423 | } else { | 442 | } else { |
diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/matrox/matroxfb_DAC1064.h index 2e7238aa2432..56513a5d220b 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.h +++ b/drivers/video/matrox/matroxfb_DAC1064.h | |||
@@ -40,6 +40,7 @@ void DAC1064_global_restore(WPMINFO2); | |||
40 | #define M1064_XCURCOL1RED 0x0C | 40 | #define M1064_XCURCOL1RED 0x0C |
41 | #define M1064_XCURCOL1GREEN 0x0D | 41 | #define M1064_XCURCOL1GREEN 0x0D |
42 | #define M1064_XCURCOL1BLUE 0x0E | 42 | #define M1064_XCURCOL1BLUE 0x0E |
43 | #define M1064_XDVICLKCTRL 0x0F | ||
43 | #define M1064_XCURCOL2RED 0x10 | 44 | #define M1064_XCURCOL2RED 0x10 |
44 | #define M1064_XCURCOL2GREEN 0x11 | 45 | #define M1064_XCURCOL2GREEN 0x11 |
45 | #define M1064_XCURCOL2BLUE 0x12 | 46 | #define M1064_XCURCOL2BLUE 0x12 |
@@ -144,6 +145,7 @@ void DAC1064_global_restore(WPMINFO2); | |||
144 | #define M1064_XVIDPLLN 0x8F | 145 | #define M1064_XVIDPLLN 0x8F |
145 | 146 | ||
146 | #define M1064_XPWRCTRL 0xA0 | 147 | #define M1064_XPWRCTRL 0xA0 |
148 | #define M1064_XPWRCTRL_PANELPDN 0x04 | ||
147 | 149 | ||
148 | #define M1064_XPANMODE 0xA2 | 150 | #define M1064_XPANMODE 0xA2 |
149 | 151 | ||
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index 3a3e1804c56a..b71737178d0d 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -672,6 +672,8 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv); | |||
672 | 672 | ||
673 | #define M_SEQ_INDEX 0x1FC4 | 673 | #define M_SEQ_INDEX 0x1FC4 |
674 | #define M_SEQ_DATA 0x1FC5 | 674 | #define M_SEQ_DATA 0x1FC5 |
675 | #define M_SEQ1 0x01 | ||
676 | #define M_SEQ1_SCROFF 0x20 | ||
675 | 677 | ||
676 | #define M_MISC_REG_READ 0x1FCC | 678 | #define M_MISC_REG_READ 0x1FCC |
677 | 679 | ||
diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c index 743e7ad26acc..f85421bf7cb5 100644 --- a/drivers/video/maxinefb.c +++ b/drivers/video/maxinefb.c | |||
@@ -55,7 +55,7 @@ static struct fb_var_screeninfo maxinefb_defined = { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | static struct fb_fix_screeninfo maxinefb_fix = { | 57 | static struct fb_fix_screeninfo maxinefb_fix = { |
58 | .id = "Maxine onboard graphics 1024x768x8", | 58 | .id = "Maxine", |
59 | .smem_len = (1024*768), | 59 | .smem_len = (1024*768), |
60 | .type = FB_TYPE_PACKED_PIXELS, | 60 | .type = FB_TYPE_PACKED_PIXELS, |
61 | .visual = FB_VISUAL_PSEUDOCOLOR, | 61 | .visual = FB_VISUAL_PSEUDOCOLOR, |
@@ -107,8 +107,6 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
107 | 107 | ||
108 | static struct fb_ops maxinefb_ops = { | 108 | static struct fb_ops maxinefb_ops = { |
109 | .owner = THIS_MODULE, | 109 | .owner = THIS_MODULE, |
110 | .fb_get_fix = gen_get_fix, | ||
111 | .fb_get_var = gen_get_var, | ||
112 | .fb_setcolreg = maxinefb_setcolreg, | 110 | .fb_setcolreg = maxinefb_setcolreg, |
113 | .fb_fillrect = cfb_fillrect, | 111 | .fb_fillrect = cfb_fillrect, |
114 | .fb_copyarea = cfb_copyarea, | 112 | .fb_copyarea = cfb_copyarea, |