提交 fd1af712 编写于 作者: B Bob Moore 提交者: Rafael J. Wysocki

ACPICA: Regression fix: reinstate safe exit macros

Removal caused a regression on at least FreeBSD. This fix
reinstates the macros.
Signed-off-by: NBob Moore <robert.moore@intel.com>
Signed-off-by: NLv Zheng <lv.zheng@intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 c39660b2
...@@ -178,7 +178,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -178,7 +178,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
if (!op) { if (!op) {
ACPI_ERROR((AE_INFO, "Null Op")); ACPI_ERROR((AE_INFO, "Null Op"));
return_VALUE(TRUE); return_UINT8(TRUE);
} }
/* /*
...@@ -210,7 +210,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -210,7 +210,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
"At Method level, result of [%s] not used\n", "At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name(op->common. acpi_ps_get_opcode_name(op->common.
aml_opcode))); aml_opcode)));
return_VALUE(FALSE); return_UINT8(FALSE);
} }
/* Get info on the parent. The root_op is AML_SCOPE */ /* Get info on the parent. The root_op is AML_SCOPE */
...@@ -219,7 +219,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -219,7 +219,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) { if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op)); ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
return_VALUE(FALSE); return_UINT8(FALSE);
} }
/* /*
...@@ -307,7 +307,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -307,7 +307,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common. acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op)); aml_opcode), op));
return_VALUE(TRUE); return_UINT8(TRUE);
result_not_used: result_not_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
...@@ -316,7 +316,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, ...@@ -316,7 +316,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common. acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op)); aml_opcode), op));
return_VALUE(FALSE); return_UINT8(FALSE);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -707,7 +707,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, ...@@ -707,7 +707,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"Unable to clear GPE%02X", gpe_number)); "Unable to clear GPE%02X", gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
...@@ -724,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, ...@@ -724,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"Unable to disable GPE%02X", gpe_number)); "Unable to disable GPE%02X", gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
} }
/* /*
...@@ -784,7 +784,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, ...@@ -784,7 +784,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
break; break;
} }
return_VALUE(ACPI_INTERRUPT_HANDLED); return_UINT32(ACPI_INTERRUPT_HANDLED);
} }
#endif /* !ACPI_REDUCED_HARDWARE */ #endif /* !ACPI_REDUCED_HARDWARE */
...@@ -89,7 +89,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) ...@@ -89,7 +89,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
*/ */
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
return_VALUE(interrupt_handled); return_UINT32(interrupt_handled);
} }
/******************************************************************************* /*******************************************************************************
...@@ -120,7 +120,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) ...@@ -120,7 +120,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
return_VALUE(interrupt_handled); return_UINT32(interrupt_handled);
} }
/****************************************************************************** /******************************************************************************
......
...@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, ...@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
/* Invalid field access type */ /* Invalid field access type */
ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
return_VALUE(0); return_UINT32(0);
} }
if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) { if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
...@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, ...@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
} }
*return_byte_alignment = byte_alignment; *return_byte_alignment = byte_alignment;
return_VALUE(bit_length); return_UINT32(bit_length);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -340,7 +340,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base) ...@@ -340,7 +340,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
/* u64 is unsigned, so we don't worry about a '-' prefix */ /* u64 is unsigned, so we don't worry about a '-' prefix */
if (value == 0) { if (value == 0) {
return_VALUE(1); return_UINT32(1);
} }
current_value = value; current_value = value;
...@@ -354,7 +354,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base) ...@@ -354,7 +354,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
num_digits++; num_digits++;
} }
return_VALUE(num_digits); return_UINT32(num_digits);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -155,7 +155,7 @@ u32 acpi_hw_get_mode(void) ...@@ -155,7 +155,7 @@ u32 acpi_hw_get_mode(void)
/* If the Hardware Reduced flag is set, machine is always in acpi mode */ /* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (acpi_gbl_reduced_hardware) { if (acpi_gbl_reduced_hardware) {
return_VALUE(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} }
/* /*
...@@ -163,18 +163,18 @@ u32 acpi_hw_get_mode(void) ...@@ -163,18 +163,18 @@ u32 acpi_hw_get_mode(void)
* system does not support mode transition. * system does not support mode transition.
*/ */
if (!acpi_gbl_FADT.smi_command) { if (!acpi_gbl_FADT.smi_command) {
return_VALUE(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} }
status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_VALUE(ACPI_SYS_MODE_LEGACY); return_UINT32(ACPI_SYS_MODE_LEGACY);
} }
if (value) { if (value) {
return_VALUE(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} else { } else {
return_VALUE(ACPI_SYS_MODE_LEGACY); return_UINT32(ACPI_SYS_MODE_LEGACY);
} }
} }
......
...@@ -112,10 +112,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) ...@@ -112,10 +112,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
if (!node) { if (!node) {
ACPI_WARNING((AE_INFO, "Null Node parameter")); ACPI_WARNING((AE_INFO, "Null Node parameter"));
return_VALUE(ACPI_TYPE_ANY); return_UINT8(ACPI_TYPE_ANY);
} }
return_VALUE(node->type); return_UINT8(node->type);
} }
/******************************************************************************* /*******************************************************************************
...@@ -140,10 +140,10 @@ u32 acpi_ns_local(acpi_object_type type) ...@@ -140,10 +140,10 @@ u32 acpi_ns_local(acpi_object_type type)
/* Type code out of range */ /* Type code out of range */
ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type));
return_VALUE(ACPI_NS_NORMAL); return_UINT32(ACPI_NS_NORMAL);
} }
return_VALUE(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); return_UINT32(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -108,7 +108,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) ...@@ -108,7 +108,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
/* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
package_length |= (aml[0] & byte_zero_mask); package_length |= (aml[0] & byte_zero_mask);
return_VALUE(package_length); return_UINT32(package_length);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -214,7 +214,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, ...@@ -214,7 +214,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
(space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
return_VALUE(0); return_UINT32(0);
} }
range_info = acpi_gbl_address_range_list[space_id]; range_info = acpi_gbl_address_range_list[space_id];
...@@ -256,7 +256,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, ...@@ -256,7 +256,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
range_info = range_info->next; range_info = range_info->next;
} }
return_VALUE(overlap_count); return_UINT32(overlap_count);
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -324,9 +324,9 @@ ...@@ -324,9 +324,9 @@
/* Helper macro */ /* Helper macro */
#define ACPI_TRACE_ENTRY(name, function, cast, param) \ #define ACPI_TRACE_ENTRY(name, function, type, param) \
ACPI_FUNCTION_NAME (name) \ ACPI_FUNCTION_NAME (name) \
function (ACPI_DEBUG_PARAMETERS, cast (param)) function (ACPI_DEBUG_PARAMETERS, (type) (param))
/* The actual entry trace macros */ /* The actual entry trace macros */
...@@ -335,13 +335,13 @@ ...@@ -335,13 +335,13 @@
acpi_ut_trace (ACPI_DEBUG_PARAMETERS) acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \ #define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer) ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer)
#define ACPI_FUNCTION_TRACE_U32(name, value) \ #define ACPI_FUNCTION_TRACE_U32(name, value) \
ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value) ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value)
#define ACPI_FUNCTION_TRACE_STR(name, string) \ #define ACPI_FUNCTION_TRACE_STR(name, string) \
ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string) ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, char *, string)
#define ACPI_FUNCTION_ENTRY() \ #define ACPI_FUNCTION_ENTRY() \
acpi_ut_track_stack_ptr() acpi_ut_track_stack_ptr()
...@@ -355,16 +355,37 @@ ...@@ -355,16 +355,37 @@
* *
* One of the FUNCTION_TRACE macros above must be used in conjunction * One of the FUNCTION_TRACE macros above must be used in conjunction
* with these macros so that "_AcpiFunctionName" is defined. * with these macros so that "_AcpiFunctionName" is defined.
*
* There are two versions of most of the return macros. The default version is
* safer, since it avoids side-effects by guaranteeing that the argument will
* not be evaluated twice.
*
* A less-safe version of the macros is provided for optional use if the
* compiler uses excessive CPU stack (for example, this may happen in the
* debug case if code optimzation is disabled.)
*/ */
/* Exit trace helper macro */ /* Exit trace helper macro */
#define ACPI_TRACE_EXIT(function, cast, param) \ #ifndef ACPI_SIMPLE_RETURN_MACROS
#define ACPI_TRACE_EXIT(function, type, param) \
ACPI_DO_WHILE0 ({ \
register type _param = (type) (param); \
function (ACPI_DEBUG_PARAMETERS, _param); \
return (_param); \
})
#else /* Use original less-safe macros */
#define ACPI_TRACE_EXIT(function, type, param) \
ACPI_DO_WHILE0 ({ \ ACPI_DO_WHILE0 ({ \
function (ACPI_DEBUG_PARAMETERS, cast (param)); \ function (ACPI_DEBUG_PARAMETERS, (type) (param)); \
return ((param)); \ return (param); \
}) })
#endif /* ACPI_SIMPLE_RETURN_MACROS */
/* The actual exit macros */ /* The actual exit macros */
#define return_VOID \ #define return_VOID \
...@@ -374,13 +395,19 @@ ...@@ -374,13 +395,19 @@
}) })
#define return_ACPI_STATUS(status) \ #define return_ACPI_STATUS(status) \
ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status) ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status)
#define return_PTR(pointer) \ #define return_PTR(pointer) \
ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer) ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer)
#define return_VALUE(value) \ #define return_VALUE(value) \
ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value) ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value)
#define return_UINT32(value) \
ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value)
#define return_UINT8(value) \
ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value)
/* Conditional execution */ /* Conditional execution */
...@@ -428,8 +455,10 @@ ...@@ -428,8 +455,10 @@
#define return_VOID return #define return_VOID return
#define return_ACPI_STATUS(s) return(s) #define return_ACPI_STATUS(s) return(s)
#define return_VALUE(s) return(s)
#define return_PTR(s) return(s) #define return_PTR(s) return(s)
#define return_VALUE(s) return(s)
#define return_UINT8(s) return(s)
#define return_UINT32(s) return(s)
#endif /* ACPI_DEBUG_OUTPUT */ #endif /* ACPI_DEBUG_OUTPUT */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册