diff options
Diffstat (limited to 'drivers/acpi/executer')
-rw-r--r-- | drivers/acpi/executer/exconvrt.c | 12 | ||||
-rw-r--r-- | drivers/acpi/executer/exdump.c | 15 | ||||
-rw-r--r-- | drivers/acpi/executer/exmisc.c | 38 | ||||
-rw-r--r-- | drivers/acpi/executer/exnames.c | 2 | ||||
-rw-r--r-- | drivers/acpi/executer/exoparg2.c | 10 | ||||
-rw-r--r-- | drivers/acpi/executer/exregion.c | 16 | ||||
-rw-r--r-- | drivers/acpi/executer/exstorob.c | 4 |
7 files changed, 41 insertions, 56 deletions
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 04e5194989a6..fa9e75d4ec65 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -504,18 +504,12 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
504 | } | 504 | } |
505 | 505 | ||
506 | /* | 506 | /* |
507 | * Perform the conversion. | 507 | * Create a new string object and string buffer |
508 | * (-1 because of extra separator included in string_length from above) | 508 | * (-1 because of extra separator included in string_length from above) |
509 | */ | 509 | */ |
510 | string_length--; | ||
511 | if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */ | ||
512 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); | ||
513 | } | ||
514 | |||
515 | /* Create a new string object and string buffer */ | ||
516 | |||
517 | return_desc = | 510 | return_desc = |
518 | acpi_ut_create_string_object((acpi_size) string_length); | 511 | acpi_ut_create_string_object((acpi_size) |
512 | (string_length - 1)); | ||
519 | if (!return_desc) { | 513 | if (!return_desc) { |
520 | return_ACPI_STATUS(AE_NO_MEMORY); | 514 | return_ACPI_STATUS(AE_NO_MEMORY); |
521 | } | 515 | } |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 5a4cca171af6..17c79cd91b31 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -117,12 +117,13 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = { | |||
117 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} | 117 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} |
118 | }; | 118 | }; |
119 | 119 | ||
120 | static struct acpi_exdump_info acpi_ex_dump_method[7] = { | 120 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { |
121 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, | 121 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, |
122 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, | 122 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, |
123 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, | 123 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, |
124 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, | 124 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, |
125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, | 125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, |
126 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"}, | ||
126 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, | 127 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, |
127 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"} | 128 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"} |
128 | }; | 129 | }; |
@@ -339,7 +340,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
339 | count = info->offset; | 340 | count = info->offset; |
340 | 341 | ||
341 | while (count) { | 342 | while (count) { |
342 | target = ((u8 *) obj_desc) + info->offset; | 343 | target = ACPI_ADD_PTR(u8, obj_desc, info->offset); |
343 | name = info->name; | 344 | name = info->name; |
344 | 345 | ||
345 | switch (info->opcode) { | 346 | switch (info->opcode) { |
@@ -360,20 +361,19 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
360 | case ACPI_EXD_UINT16: | 361 | case ACPI_EXD_UINT16: |
361 | 362 | ||
362 | acpi_os_printf("%20s : %4.4X\n", name, | 363 | acpi_os_printf("%20s : %4.4X\n", name, |
363 | *ACPI_CAST_PTR(u16, target)); | 364 | ACPI_GET16(target)); |
364 | break; | 365 | break; |
365 | 366 | ||
366 | case ACPI_EXD_UINT32: | 367 | case ACPI_EXD_UINT32: |
367 | 368 | ||
368 | acpi_os_printf("%20s : %8.8X\n", name, | 369 | acpi_os_printf("%20s : %8.8X\n", name, |
369 | *ACPI_CAST_PTR(u32, target)); | 370 | ACPI_GET32(target)); |
370 | break; | 371 | break; |
371 | 372 | ||
372 | case ACPI_EXD_UINT64: | 373 | case ACPI_EXD_UINT64: |
373 | 374 | ||
374 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", | 375 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", |
375 | ACPI_FORMAT_UINT64(*ACPI_CAST_PTR | 376 | ACPI_FORMAT_UINT64(ACPI_GET64(target))); |
376 | (u64, target))); | ||
377 | break; | 377 | break; |
378 | 378 | ||
379 | case ACPI_EXD_POINTER: | 379 | case ACPI_EXD_POINTER: |
@@ -969,7 +969,8 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
969 | acpi_os_printf("[Buffer] Length %.2X = ", | 969 | acpi_os_printf("[Buffer] Length %.2X = ", |
970 | obj_desc->buffer.length); | 970 | obj_desc->buffer.length); |
971 | if (obj_desc->buffer.length) { | 971 | if (obj_desc->buffer.length) { |
972 | acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, | 972 | acpi_ut_dump_buffer(ACPI_CAST_PTR |
973 | (u8, obj_desc->buffer.pointer), | ||
973 | obj_desc->buffer.length, | 974 | obj_desc->buffer.length, |
974 | DB_DWORD_DISPLAY, _COMPONENT); | 975 | DB_DWORD_DISPLAY, _COMPONENT); |
975 | } else { | 976 | } else { |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 00a25f8188f4..0778bff632bf 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -205,11 +205,9 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
205 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); | 205 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); |
206 | ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); | 206 | ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); |
207 | 207 | ||
208 | /* Compute the new checksum */ | 208 | /* Set the end_tag checksum to zero, means "ignore checksum" */ |
209 | 209 | ||
210 | new_buf[return_desc->buffer.length - 1] = | 210 | new_buf[return_desc->buffer.length - 1] = 0; |
211 | acpi_ut_generate_checksum(return_desc->buffer.pointer, | ||
212 | (return_desc->buffer.length - 1)); | ||
213 | 211 | ||
214 | /* Return the completed resource template */ | 212 | /* Return the completed resource template */ |
215 | 213 | ||
@@ -242,7 +240,6 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
242 | union acpi_operand_object *return_desc; | 240 | union acpi_operand_object *return_desc; |
243 | char *new_buf; | 241 | char *new_buf; |
244 | acpi_status status; | 242 | acpi_status status; |
245 | acpi_size new_length; | ||
246 | 243 | ||
247 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); | 244 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); |
248 | 245 | ||
@@ -269,7 +266,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
269 | break; | 266 | break; |
270 | 267 | ||
271 | default: | 268 | default: |
272 | ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", | 269 | ACPI_REPORT_ERROR(("Concatanate - invalid object type: %X\n", |
273 | ACPI_GET_OBJECT_TYPE(operand0))); | 270 | ACPI_GET_OBJECT_TYPE(operand0))); |
274 | status = AE_AML_INTERNAL; | 271 | status = AE_AML_INTERNAL; |
275 | } | 272 | } |
@@ -309,8 +306,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
309 | 306 | ||
310 | /* Copy the first integer, LSB first */ | 307 | /* Copy the first integer, LSB first */ |
311 | 308 | ||
312 | ACPI_MEMCPY(new_buf, | 309 | ACPI_MEMCPY(new_buf, &operand0->integer.value, |
313 | &operand0->integer.value, | ||
314 | acpi_gbl_integer_byte_width); | 310 | acpi_gbl_integer_byte_width); |
315 | 311 | ||
316 | /* Copy the second integer (LSB first) after the first */ | 312 | /* Copy the second integer (LSB first) after the first */ |
@@ -324,14 +320,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
324 | 320 | ||
325 | /* Result of two Strings is a String */ | 321 | /* Result of two Strings is a String */ |
326 | 322 | ||
327 | new_length = (acpi_size) operand0->string.length + | 323 | return_desc = acpi_ut_create_string_object((acpi_size) |
328 | (acpi_size) local_operand1->string.length; | 324 | (operand0->string. |
329 | if (new_length > ACPI_MAX_STRING_CONVERSION) { | 325 | length + |
330 | status = AE_AML_STRING_LIMIT; | 326 | local_operand1-> |
331 | goto cleanup; | 327 | string.length)); |
332 | } | ||
333 | |||
334 | return_desc = acpi_ut_create_string_object(new_length); | ||
335 | if (!return_desc) { | 328 | if (!return_desc) { |
336 | status = AE_NO_MEMORY; | 329 | status = AE_NO_MEMORY; |
337 | goto cleanup; | 330 | goto cleanup; |
@@ -351,11 +344,10 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
351 | /* Result of two Buffers is a Buffer */ | 344 | /* Result of two Buffers is a Buffer */ |
352 | 345 | ||
353 | return_desc = acpi_ut_create_buffer_object((acpi_size) | 346 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
354 | operand0->buffer. | 347 | (operand0->buffer. |
355 | length + | 348 | length + |
356 | (acpi_size) | 349 | local_operand1-> |
357 | local_operand1-> | 350 | buffer.length)); |
358 | buffer.length); | ||
359 | if (!return_desc) { | 351 | if (!return_desc) { |
360 | status = AE_NO_MEMORY; | 352 | status = AE_NO_MEMORY; |
361 | goto cleanup; | 353 | goto cleanup; |
@@ -365,8 +357,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
365 | 357 | ||
366 | /* Concatenate the buffers */ | 358 | /* Concatenate the buffers */ |
367 | 359 | ||
368 | ACPI_MEMCPY(new_buf, | 360 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, |
369 | operand0->buffer.pointer, operand0->buffer.length); | 361 | operand0->buffer.length); |
370 | ACPI_MEMCPY(new_buf + operand0->buffer.length, | 362 | ACPI_MEMCPY(new_buf + operand0->buffer.length, |
371 | local_operand1->buffer.pointer, | 363 | local_operand1->buffer.pointer, |
372 | local_operand1->buffer.length); | 364 | local_operand1->buffer.length); |
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index dff41121a304..7bb5e17b5680 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -216,7 +216,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
216 | *aml_address, aml_address)); | 216 | *aml_address, aml_address)); |
217 | } | 217 | } |
218 | 218 | ||
219 | *in_aml_address = (u8 *) aml_address; | 219 | *in_aml_address = ACPI_CAST_PTR(u8, aml_address); |
220 | return_ACPI_STATUS(status); | 220 | return_ACPI_STATUS(status); |
221 | } | 221 | } |
222 | 222 | ||
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 8d70c6beef00..d8472842c1fd 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -344,10 +344,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
344 | (length < operand[1]->integer.value) && | 344 | (length < operand[1]->integer.value) && |
345 | (operand[0]->buffer.pointer[length])) { | 345 | (operand[0]->buffer.pointer[length])) { |
346 | length++; | 346 | length++; |
347 | if (length > ACPI_MAX_STRING_CONVERSION) { | ||
348 | status = AE_AML_STRING_LIMIT; | ||
349 | goto cleanup; | ||
350 | } | ||
351 | } | 347 | } |
352 | 348 | ||
353 | /* Allocate a new string object */ | 349 | /* Allocate a new string object */ |
@@ -358,8 +354,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
358 | goto cleanup; | 354 | goto cleanup; |
359 | } | 355 | } |
360 | 356 | ||
361 | /* Copy the raw buffer data with no transform. NULL terminated already */ | 357 | /* |
362 | 358 | * Copy the raw buffer data with no transform. | |
359 | * (NULL terminated already) | ||
360 | */ | ||
363 | ACPI_MEMCPY(return_desc->string.pointer, | 361 | ACPI_MEMCPY(return_desc->string.pointer, |
364 | operand[0]->buffer.pointer, length); | 362 | operand[0]->buffer.pointer, length); |
365 | break; | 363 | break; |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 1897379b5f90..80118be3f544 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -199,20 +199,20 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
199 | *value = 0; | 199 | *value = 0; |
200 | switch (bit_width) { | 200 | switch (bit_width) { |
201 | case 8: | 201 | case 8: |
202 | *value = (acpi_integer) * ((u8 *) logical_addr_ptr); | 202 | *value = (acpi_integer) ACPI_GET8(logical_addr_ptr); |
203 | break; | 203 | break; |
204 | 204 | ||
205 | case 16: | 205 | case 16: |
206 | *value = (acpi_integer) * ((u16 *) logical_addr_ptr); | 206 | *value = (acpi_integer) ACPI_GET16(logical_addr_ptr); |
207 | break; | 207 | break; |
208 | 208 | ||
209 | case 32: | 209 | case 32: |
210 | *value = (acpi_integer) * ((u32 *) logical_addr_ptr); | 210 | *value = (acpi_integer) ACPI_GET32(logical_addr_ptr); |
211 | break; | 211 | break; |
212 | 212 | ||
213 | #if ACPI_MACHINE_WIDTH != 16 | 213 | #if ACPI_MACHINE_WIDTH != 16 |
214 | case 64: | 214 | case 64: |
215 | *value = (acpi_integer) * ((u64 *) logical_addr_ptr); | 215 | *value = (acpi_integer) ACPI_GET64(logical_addr_ptr); |
216 | break; | 216 | break; |
217 | #endif | 217 | #endif |
218 | default: | 218 | default: |
@@ -225,20 +225,20 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
225 | 225 | ||
226 | switch (bit_width) { | 226 | switch (bit_width) { |
227 | case 8: | 227 | case 8: |
228 | *(u8 *) logical_addr_ptr = (u8) * value; | 228 | ACPI_SET8(logical_addr_ptr) = (u8) * value; |
229 | break; | 229 | break; |
230 | 230 | ||
231 | case 16: | 231 | case 16: |
232 | *(u16 *) logical_addr_ptr = (u16) * value; | 232 | ACPI_SET16(logical_addr_ptr) = (u16) * value; |
233 | break; | 233 | break; |
234 | 234 | ||
235 | case 32: | 235 | case 32: |
236 | *(u32 *) logical_addr_ptr = (u32) * value; | 236 | ACPI_SET32(logical_addr_ptr) = (u32) * value; |
237 | break; | 237 | break; |
238 | 238 | ||
239 | #if ACPI_MACHINE_WIDTH != 16 | 239 | #if ACPI_MACHINE_WIDTH != 16 |
240 | case 64: | 240 | case 64: |
241 | *(u64 *) logical_addr_ptr = (u64) * value; | 241 | ACPI_SET64(logical_addr_ptr) = (u64) * value; |
242 | break; | 242 | break; |
243 | #endif | 243 | #endif |
244 | 244 | ||
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index c4ff654a6697..855db7130751 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -71,7 +71,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *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 | ||
74 | buffer = (u8 *) source_desc->buffer.pointer; | 74 | buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer); |
75 | length = source_desc->buffer.length; | 75 | length = source_desc->buffer.length; |
76 | 76 | ||
77 | /* | 77 | /* |
@@ -160,7 +160,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
160 | 160 | ||
161 | /* We know that source_desc is a string by now */ | 161 | /* We know that source_desc is a string by now */ |
162 | 162 | ||
163 | buffer = (u8 *) source_desc->string.pointer; | 163 | buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer); |
164 | length = source_desc->string.length; | 164 | length = source_desc->string.length; |
165 | 165 | ||
166 | /* | 166 | /* |