aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/exutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/exutils.c')
-rw-r--r--drivers/acpi/acpica/exutils.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 264d22d8018c..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
212void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) 212u8 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/*******************************************************************************
@@ -336,7 +340,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
336 /* u64 is unsigned, so we don't worry about a '-' prefix */ 340 /* u64 is unsigned, so we don't worry about a '-' prefix */
337 341
338 if (value == 0) { 342 if (value == 0) {
339 return_UINT32(1); 343 return_VALUE(1);
340 } 344 }
341 345
342 current_value = value; 346 current_value = value;
@@ -350,7 +354,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
350 num_digits++; 354 num_digits++;
351 } 355 }
352 356
353 return_UINT32(num_digits); 357 return_VALUE(num_digits);
354} 358}
355 359
356/******************************************************************************* 360/*******************************************************************************