diff options
author | Bob Moore <robert.moore@intel.com> | 2012-12-30 19:07:18 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-10 06:36:22 -0500 |
commit | ef42e53f271b99fe9eb853df5661edeac8a277f6 (patch) | |
tree | accdeb45436b2278086375374b5d88b529834253 /drivers/acpi/acpica | |
parent | 3e5621a750e2cfb26748c34acbb67c691845494a (diff) |
ACPICA: Interpreter: Add warning if 64-bit constant appears in 32-bit table.
Some ASL compilers allow 64-bit constants within a 32-bit table
(DSDT version == 1). When encountered, emit a warning that the
constant will be truncated to 32 bits. This is potentially a
serious problem in the ACPI table(s).
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r-- | drivers/acpi/acpica/acinterp.h | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsobject.c | 14 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswexec.c | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/exconvrt.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/exstoren.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/exutils.c | 18 |
6 files changed, 28 insertions, 14 deletions
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index eb308635da72..16469b0e7b6a 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h | |||
@@ -458,7 +458,7 @@ void acpi_ex_reacquire_interpreter(void); | |||
458 | 458 | ||
459 | void acpi_ex_relinquish_interpreter(void); | 459 | void acpi_ex_relinquish_interpreter(void); |
460 | 460 | ||
461 | void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); | 461 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); |
462 | 462 | ||
463 | void acpi_ex_acquire_global_lock(u32 rule); | 463 | void acpi_ex_acquire_global_lock(u32 rule); |
464 | 464 | ||
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index 13844a115d97..82050bcd90e7 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
@@ -703,7 +703,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
703 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 703 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
704 | 704 | ||
705 | #ifndef ACPI_NO_METHOD_EXECUTION | 705 | #ifndef ACPI_NO_METHOD_EXECUTION |
706 | acpi_ex_truncate_for32bit_table(obj_desc); | 706 | (void)acpi_ex_truncate_for32bit_table(obj_desc); |
707 | #endif | 707 | #endif |
708 | break; | 708 | break; |
709 | 709 | ||
@@ -725,8 +725,18 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
725 | case AML_TYPE_LITERAL: | 725 | case AML_TYPE_LITERAL: |
726 | 726 | ||
727 | obj_desc->integer.value = op->common.value.integer; | 727 | obj_desc->integer.value = op->common.value.integer; |
728 | |||
728 | #ifndef ACPI_NO_METHOD_EXECUTION | 729 | #ifndef ACPI_NO_METHOD_EXECUTION |
729 | acpi_ex_truncate_for32bit_table(obj_desc); | 730 | if (acpi_ex_truncate_for32bit_table(obj_desc)) { |
731 | |||
732 | /* Warn if we found a 64-bit constant in a 32-bit table */ | ||
733 | |||
734 | ACPI_WARNING((AE_INFO, | ||
735 | "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X", | ||
736 | ACPI_FORMAT_UINT64(op->common. | ||
737 | value.integer), | ||
738 | (u32)obj_desc->integer.value)); | ||
739 | } | ||
730 | #endif | 740 | #endif |
731 | break; | 741 | break; |
732 | 742 | ||
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index 58593931be96..9e0d21076c48 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -149,7 +149,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
149 | 149 | ||
150 | /* Truncate the predicate to 32-bits if necessary */ | 150 | /* Truncate the predicate to 32-bits if necessary */ |
151 | 151 | ||
152 | acpi_ex_truncate_for32bit_table(local_obj_desc); | 152 | (void)acpi_ex_truncate_for32bit_table(local_obj_desc); |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * Save the result of the predicate evaluation on | 155 | * Save the result of the predicate evaluation on |
@@ -706,7 +706,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
706 | * ACPI 2.0 support for 64-bit integers: Truncate numeric | 706 | * ACPI 2.0 support for 64-bit integers: Truncate numeric |
707 | * result value if we are executing from a 32-bit ACPI table | 707 | * result value if we are executing from a 32-bit ACPI table |
708 | */ | 708 | */ |
709 | acpi_ex_truncate_for32bit_table(walk_state->result_obj); | 709 | (void)acpi_ex_truncate_for32bit_table(walk_state->result_obj); |
710 | 710 | ||
711 | /* | 711 | /* |
712 | * Check if we just completed the evaluation of a | 712 | * Check if we just completed the evaluation of a |
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 4492a4e03022..d6a7b6fe359a 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
@@ -176,7 +176,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
176 | 176 | ||
177 | /* Save the Result */ | 177 | /* Save the Result */ |
178 | 178 | ||
179 | acpi_ex_truncate_for32bit_table(return_desc); | 179 | (void)acpi_ex_truncate_for32bit_table(return_desc); |
180 | *result_desc = return_desc; | 180 | *result_desc = return_desc; |
181 | return_ACPI_STATUS(AE_OK); | 181 | return_ACPI_STATUS(AE_OK); |
182 | } | 182 | } |
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c index 87153bbc4b43..85a74b74e372 100644 --- a/drivers/acpi/acpica/exstoren.c +++ b/drivers/acpi/acpica/exstoren.c | |||
@@ -253,7 +253,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
253 | 253 | ||
254 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 254 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
255 | 255 | ||
256 | acpi_ex_truncate_for32bit_table(dest_desc); | 256 | (void)acpi_ex_truncate_for32bit_table(dest_desc); |
257 | break; | 257 | break; |
258 | 258 | ||
259 | case ACPI_TYPE_STRING: | 259 | case ACPI_TYPE_STRING: |
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 02ddc4ceca37..e624958f33b8 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -202,35 +202,39 @@ void acpi_ex_relinquish_interpreter(void) | |||
202 | * | 202 | * |
203 | * PARAMETERS: obj_desc - Object to be truncated | 203 | * PARAMETERS: obj_desc - Object to be truncated |
204 | * | 204 | * |
205 | * RETURN: none | 205 | * RETURN: TRUE if a truncation was performed, FALSE otherwise. |
206 | * | 206 | * |
207 | * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is | 207 | * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is |
208 | * 32-bit, as determined by the revision of the DSDT. | 208 | * 32-bit, as determined by the revision of the DSDT. |
209 | * | 209 | * |
210 | ******************************************************************************/ | 210 | ******************************************************************************/ |
211 | 211 | ||
212 | void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | 212 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) |
213 | { | 213 | { |
214 | 214 | ||
215 | ACPI_FUNCTION_ENTRY(); | 215 | ACPI_FUNCTION_ENTRY(); |
216 | 216 | ||
217 | /* | 217 | /* |
218 | * Object must be a valid number and we must be executing | 218 | * Object must be a valid number and we must be executing |
219 | * a control method. NS node could be there for AML_INT_NAMEPATH_OP. | 219 | * a control method. Object could be NS node for AML_INT_NAMEPATH_OP. |
220 | */ | 220 | */ |
221 | if ((!obj_desc) || | 221 | if ((!obj_desc) || |
222 | (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || | 222 | (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || |
223 | (obj_desc->common.type != ACPI_TYPE_INTEGER)) { | 223 | (obj_desc->common.type != ACPI_TYPE_INTEGER)) { |
224 | return; | 224 | return (FALSE); |
225 | } | 225 | } |
226 | 226 | ||
227 | if (acpi_gbl_integer_byte_width == 4) { | 227 | if ((acpi_gbl_integer_byte_width == 4) && |
228 | (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) { | ||
228 | /* | 229 | /* |
229 | * We are running a method that exists in a 32-bit ACPI table. | 230 | * We are executing in a 32-bit ACPI table. |
230 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field | 231 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field |
231 | */ | 232 | */ |
232 | obj_desc->integer.value &= (u64) ACPI_UINT32_MAX; | 233 | obj_desc->integer.value &= (u64)ACPI_UINT32_MAX; |
234 | return (TRUE); | ||
233 | } | 235 | } |
236 | |||
237 | return (FALSE); | ||
234 | } | 238 | } |
235 | 239 | ||
236 | /******************************************************************************* | 240 | /******************************************************************************* |