Merge branch 'acpica'

* acpica: (41 commits)
  ACPICA: Update version to 20160422
  ACPICA: Move all ASCII utilities to a common file
  ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support for acpi_hw_write()
  ACPICA: ACPI 2.0, Hardware: Add access_width/bit_offset support in acpi_hw_read()
  ACPICA: Executer: Introduce a set of macros to handle bit width mask generation
  ACPICA: Hardware: Add optimized access bit width support
  ACPICA: Utilities: Add ACPI_IS_ALIGNED() macro
  ACPICA: Renamed some #defined flag constants for clarity
  ACPICA: ACPI 6.0, tools/iasl: Add support for new resource descriptors
  ACPICA: ACPI 6.0: Update _BIX support for new package element
  ACPICA: ACPI 6.1: Support for new PCCT subtable
  ACPICA: Refactor evaluate_object to reduce nesting
  ACPICA: Divergence: remove unwanted spaces for typedef
  ACPICA: Update version to 20160318
  ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated before _REG evaluations
  ACPICA: Events: Fix an issue that _REG association can happen before namespace is initialized
  ACPICA: Tables: Fix wrong MLC condition for dynamic table loading
  ACPICA: Interpreter: Fix wrong conditions for acpi_ev_install_region_handlers() invocation
  ACPICA: Hardware: Enhance acpi_hw_validate_register() with access_width/bit_offset awareness
  Utilities: Fix missing parentheses in ACPI_GET_BITS()/ACPI_SET_BITS()
  ...
This commit is contained in:
Rafael J. Wysocki 2016-05-16 16:44:15 +02:00
commit 407aa3ff6f
129 changed files with 1957 additions and 1289 deletions

View file

@ -43,6 +43,7 @@ acpi-y += \
evxfregn.o evxfregn.o
acpi-y += \ acpi-y += \
exconcat.o \
exconfig.o \ exconfig.o \
exconvrt.o \ exconvrt.o \
excreate.o \ excreate.o \
@ -149,6 +150,7 @@ acpi-y += \
acpi-y += \ acpi-y += \
utaddress.o \ utaddress.o \
utalloc.o \ utalloc.o \
utascii.o \
utbuffer.o \ utbuffer.o \
utcopy.o \ utcopy.o \
utexcep.o \ utexcep.o \

View file

@ -53,7 +53,7 @@
#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
struct acpi_db_command_info { struct acpi_db_command_info {
char *name; /* Command Name */ const char *name; /* Command Name */
u8 min_args; /* Minimum arguments required */ u8 min_args; /* Minimum arguments required */
}; };
@ -64,7 +64,7 @@ struct acpi_db_command_help {
}; };
struct acpi_db_argument_info { struct acpi_db_argument_info {
char *name; /* Argument Name */ const char *name; /* Argument Name */
}; };
struct acpi_db_execute_walk { struct acpi_db_execute_walk {

View file

@ -72,6 +72,7 @@ acpi_status acpi_ev_init_global_lock_handler(void);
ACPI_HW_DEPENDENT_RETURN_OK(acpi_status ACPI_HW_DEPENDENT_RETURN_OK(acpi_status
acpi_ev_acquire_global_lock(u16 timeout)) acpi_ev_acquire_global_lock(u16 timeout))
ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void)) ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void))
acpi_status acpi_ev_remove_global_lock_handler(void); acpi_status acpi_ev_remove_global_lock_handler(void);
/* /*
@ -198,8 +199,6 @@ void
acpi_ev_detach_region(union acpi_operand_object *region_obj, acpi_ev_detach_region(union acpi_operand_object *region_obj,
u8 acpi_ns_is_locked); u8 acpi_ns_is_locked);
void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj);
void void
acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
acpi_adr_space_type space_id, u32 function); acpi_adr_space_type space_id, u32 function);

View file

@ -187,6 +187,8 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS]; extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS]; extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
extern const char acpi_gbl_lower_hex_digits[];
extern const char acpi_gbl_upper_hex_digits[];
extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
#ifdef ACPI_DBG_TRACK_ALLOCATIONS #ifdef ACPI_DBG_TRACK_ALLOCATIONS
@ -361,6 +363,15 @@ ACPI_GLOBAL(u32, acpi_gbl_num_objects);
#endif /* ACPI_DEBUGGER */ #endif /* ACPI_DEBUGGER */
#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
#endif
/***************************************************************************** /*****************************************************************************
* *
* Application globals * Application globals

View file

@ -67,7 +67,7 @@
typedef const struct acpi_exdump_info { typedef const struct acpi_exdump_info {
u8 opcode; u8 opcode;
u8 offset; u8 offset;
char *name; const char *name;
} acpi_exdump_info; } acpi_exdump_info;

View file

@ -395,11 +395,12 @@ union acpi_predefined_info {
/* Return object auto-repair info */ /* Return object auto-repair info */
typedef acpi_status(*acpi_object_converter) (struct acpi_namespace_node * scope, typedef acpi_status (*acpi_object_converter) (struct acpi_namespace_node *
union acpi_operand_object scope,
*original_object, union acpi_operand_object *
union acpi_operand_object original_object,
**converted_object); union acpi_operand_object **
converted_object);
struct acpi_simple_repair_info { struct acpi_simple_repair_info {
char name[ACPI_NAME_SIZE]; char name[ACPI_NAME_SIZE];
@ -541,8 +542,8 @@ struct acpi_gpe_device_info {
typedef acpi_status (*acpi_gpe_callback) (struct acpi_gpe_xrupt_info * typedef acpi_status (*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
gpe_xrupt_info, gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, struct acpi_gpe_block_info *
void *context); gpe_block, void *context);
/* Information about each particular fixed event */ /* Information about each particular fixed event */
@ -660,7 +661,8 @@ typedef
acpi_status (*acpi_parse_downwards) (struct acpi_walk_state * walk_state, acpi_status (*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
union acpi_parse_object ** out_op); union acpi_parse_object ** out_op);
typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); typedef
acpi_status (*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
/* Global handlers for AML Notifies */ /* Global handlers for AML Notifies */
@ -700,7 +702,8 @@ union acpi_generic_state {
* *
****************************************************************************/ ****************************************************************************/
typedef acpi_status(*acpi_execute_op) (struct acpi_walk_state * walk_state); typedef
acpi_status (*acpi_execute_op) (struct acpi_walk_state * walk_state);
/* Address Range info block */ /* Address Range info block */
@ -854,7 +857,7 @@ struct acpi_parse_state {
/* Parse object flags */ /* Parse object flags */
#define ACPI_PARSEOP_GENERIC 0x01 #define ACPI_PARSEOP_GENERIC 0x01
#define ACPI_PARSEOP_NAMED 0x02 #define ACPI_PARSEOP_NAMED_OBJECT 0x02
#define ACPI_PARSEOP_DEFERRED 0x04 #define ACPI_PARSEOP_DEFERRED 0x04
#define ACPI_PARSEOP_BYTELIST 0x08 #define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_STACK 0x10 #define ACPI_PARSEOP_IN_STACK 0x10
@ -864,11 +867,11 @@ struct acpi_parse_state {
/* Parse object disasm_flags */ /* Parse object disasm_flags */
#define ACPI_PARSEOP_IGNORE 0x01 #define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMLIST 0x02 #define ACPI_PARSEOP_PARAMETER_LIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_PREDEF_CHECKED 0x08 #define ACPI_PARSEOP_PREDEFINED_CHECKED 0x08
#define ACPI_PARSEOP_CLOSING_PAREN 0x10 #define ACPI_PARSEOP_CLOSING_PAREN 0x10
#define ACPI_PARSEOP_COMPOUND 0x20 #define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x20
#define ACPI_PARSEOP_ASSIGNMENT 0x40 #define ACPI_PARSEOP_ASSIGNMENT 0x40
#define ACPI_PARSEOP_ELSEIF 0x80 #define ACPI_PARSEOP_ELSEIF 0x80
@ -1096,6 +1099,7 @@ struct acpi_external_list {
#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */ #define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */
#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */ #define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */
#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */ #define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */
#define ACPI_EXT_ORIGIN_FROM_OPCODE 0x10 /* External came from a External() opcode */
struct acpi_external_file { struct acpi_external_file {
char *path; char *path;

View file

@ -260,14 +260,31 @@
#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1)) #define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
/* Generic (power-of-two) rounding */
#define ACPI_IS_ALIGNED(a, s) (((a) & ((s) - 1)) == 0)
#define ACPI_IS_POWER_OF_TWO(a) ACPI_IS_ALIGNED(a, a)
/* /*
* Bitmask creation * Bitmask creation
* Bit positions start at zero. * Bit positions start at zero.
* MASK_BITS_ABOVE creates a mask starting AT the position and above * MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
* MASK_BITS_ABOVE/BELOW accpets a bit offset to create a mask
* MASK_BITS_ABOVE/BELOW_32/64 accpets a bit width to create a mask
* Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler
* differences with the shift operator
*/ */
#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position)))) #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position))))
#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position))) #define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position)))
#define ACPI_MASK_BITS_ABOVE_32(width) ((u32) ACPI_MASK_BITS_ABOVE(width))
#define ACPI_MASK_BITS_BELOW_32(width) ((u32) ACPI_MASK_BITS_BELOW(width))
#define ACPI_MASK_BITS_ABOVE_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \
ACPI_UINT64_MAX : \
ACPI_MASK_BITS_ABOVE(width))
#define ACPI_MASK_BITS_BELOW_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \
(u64) 0 : \
ACPI_MASK_BITS_BELOW(width))
/* Bitfields within ACPI registers */ /* Bitfields within ACPI registers */
@ -283,10 +300,10 @@
/* Generic bitfield macros and masks */ /* Generic bitfield macros and masks */
#define ACPI_GET_BITS(source_ptr, position, mask) \ #define ACPI_GET_BITS(source_ptr, position, mask) \
((*source_ptr >> position) & mask) ((*(source_ptr) >> (position)) & (mask))
#define ACPI_SET_BITS(target_ptr, position, mask, value) \ #define ACPI_SET_BITS(target_ptr, position, mask, value) \
(*target_ptr |= ((value & mask) << position)) (*(target_ptr) |= (((value) & (mask)) << (position)))
#define ACPI_1BIT_MASK 0x00000001 #define ACPI_1BIT_MASK 0x00000001
#define ACPI_2BIT_MASK 0x00000003 #define ACPI_2BIT_MASK 0x00000003

View file

@ -206,9 +206,10 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level); void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
void void
acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component); acpi_ns_dump_pathname(acpi_handle handle,
const char *msg, u32 level, u32 component);
void acpi_ns_print_pathname(u32 num_segments, char *pathname); void acpi_ns_print_pathname(u32 num_segments, const char *pathname);
acpi_status acpi_status
acpi_ns_dump_one_object(acpi_handle obj_handle, acpi_ns_dump_one_object(acpi_handle obj_handle,

View file

@ -139,7 +139,7 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
*/ */
const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
char *acpi_ps_get_opcode_name(u16 opcode); const char *acpi_ps_get_opcode_name(u16 opcode);
u8 acpi_ps_get_argument_count(u32 op_type); u8 acpi_ps_get_argument_count(u32 op_type);

View file

@ -129,7 +129,8 @@ enum acpi_return_package_types {
ACPI_PTYPE2_REV_FIXED = 9, ACPI_PTYPE2_REV_FIXED = 9,
ACPI_PTYPE2_FIX_VAR = 10, ACPI_PTYPE2_FIX_VAR = 10,
ACPI_PTYPE2_VAR_VAR = 11, ACPI_PTYPE2_VAR_VAR = 11,
ACPI_PTYPE2_UUID_PAIR = 12 ACPI_PTYPE2_UUID_PAIR = 12,
ACPI_PTYPE_CUSTOM = 13
}; };
/* Support macros for users of the predefined info table */ /* Support macros for users of the predefined info table */
@ -340,7 +341,7 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
{{"_BIX", METHOD_0ARGS, {{"_BIX", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */ METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, PACKAGE_INFO(ACPI_PTYPE_CUSTOM, ACPI_RTYPE_INTEGER, 16,
ACPI_RTYPE_STRING, 4, 0), ACPI_RTYPE_STRING, 4, 0),
{{"_BLT", {{"_BLT",
@ -523,6 +524,9 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0), PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
{{"_FIT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, /* ACPI 6.0 */
{{"_FIX", METHOD_0ARGS, {{"_FIX", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0), PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
@ -1053,6 +1057,12 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING |
ACPI_RTYPE_BUFFER)}}, ACPI_RTYPE_BUFFER)}},
{{"_WPC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
{{"_WPP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */ PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */
}; };
#else #else

View file

@ -124,7 +124,7 @@ typedef enum {
typedef const struct acpi_rsdump_info { typedef const struct acpi_rsdump_info {
u8 opcode; u8 opcode;
u8 offset; u8 offset;
char *name; const char *name;
const char **pointer; const char **pointer;
} acpi_rsdump_info; } acpi_rsdump_info;
@ -209,7 +209,7 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
acpi_status acpi_status
acpi_rs_get_method_data(acpi_handle handle, acpi_rs_get_method_data(acpi_handle handle,
char *path, struct acpi_buffer *ret_buffer); const char *path, struct acpi_buffer *ret_buffer);
acpi_status acpi_status
acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,

View file

@ -184,7 +184,7 @@ struct acpi_evaluate_info {
/* The first 3 elements are passed by the caller to acpi_ns_evaluate */ /* The first 3 elements are passed by the caller to acpi_ns_evaluate */
struct acpi_namespace_node *prefix_node; /* Input: starting node */ struct acpi_namespace_node *prefix_node; /* Input: starting node */
char *relative_pathname; /* Input: path relative to prefix_node */ const char *relative_pathname; /* Input: path relative to prefix_node */
union acpi_operand_object **parameters; /* Input: argument list */ union acpi_operand_object **parameters; /* Input: argument list */
struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */ struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */

View file

@ -161,8 +161,6 @@ acpi_tb_install_fixed_table(acpi_physical_address address,
acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address); acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
u8 acpi_is_valid_signature(char *signature);
/* /*
* tbxfload * tbxfload
*/ */

View file

@ -166,6 +166,15 @@ struct acpi_pkg_info {
#define DB_DWORD_DISPLAY 4 #define DB_DWORD_DISPLAY 4
#define DB_QWORD_DISPLAY 8 #define DB_QWORD_DISPLAY 8
/*
* utascii - ASCII utilities
*/
u8 acpi_ut_valid_nameseg(char *signature);
u8 acpi_ut_valid_name_char(char character, u32 position);
void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count);
/* /*
* utnonansi - Non-ANSI C library functions * utnonansi - Non-ANSI C library functions
*/ */
@ -175,7 +184,14 @@ void acpi_ut_strlwr(char *src_string);
int acpi_ut_stricmp(char *string1, char *string2); int acpi_ut_stricmp(char *string1, char *string2);
acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer); acpi_status
acpi_ut_strtoul64(char *string,
u32 base, u32 max_integer_byte_width, u64 *ret_integer);
/* Values for max_integer_byte_width above */
#define ACPI_MAX32_BYTE_WIDTH 4
#define ACPI_MAX64_BYTE_WIDTH 8
/* /*
* utglobal - Global data structures and procedures * utglobal - Global data structures and procedures
@ -266,7 +282,8 @@ acpi_ut_trace(u32 line_number,
void void
acpi_ut_trace_ptr(u32 line_number, acpi_ut_trace_ptr(u32 line_number,
const char *function_name, const char *function_name,
const char *module_name, u32 component_id, void *pointer); const char *module_name,
u32 component_id, const void *pointer);
void void
acpi_ut_trace_u32(u32 line_number, acpi_ut_trace_u32(u32 line_number,
@ -276,7 +293,8 @@ acpi_ut_trace_u32(u32 line_number,
void void
acpi_ut_trace_str(u32 line_number, acpi_ut_trace_str(u32 line_number,
const char *function_name, const char *function_name,
const char *module_name, u32 component_id, char *string); const char *module_name,
u32 component_id, const char *string);
void void
acpi_ut_exit(u32 line_number, acpi_ut_exit(u32 line_number,
@ -335,12 +353,12 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
*/ */
acpi_status acpi_status
acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
char *path, const char *path,
u32 expected_return_btypes, u32 expected_return_btypes,
union acpi_operand_object **return_desc); union acpi_operand_object **return_desc);
acpi_status acpi_status
acpi_ut_evaluate_numeric_object(char *object_name, acpi_ut_evaluate_numeric_object(const char *object_name,
struct acpi_namespace_node *device_node, struct acpi_namespace_node *device_node,
u64 *value); u64 *value);
@ -526,7 +544,7 @@ void acpi_ut_set_integer_width(u8 revision);
void void
acpi_ut_display_init_pathname(u8 type, acpi_ut_display_init_pathname(u8 type,
struct acpi_namespace_node *obj_handle, struct acpi_namespace_node *obj_handle,
char *path); const char *path);
#endif #endif
/* /*
@ -570,10 +588,6 @@ void acpi_ut_print_string(char *string, u16 max_length);
void ut_convert_backslashes(char *pathname); void ut_convert_backslashes(char *pathname);
#endif #endif
u8 acpi_ut_valid_acpi_name(char *name);
u8 acpi_ut_valid_acpi_char(char character, u32 position);
void acpi_ut_repair_name(char *name); void acpi_ut_repair_name(char *name);
#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
@ -628,7 +642,7 @@ void acpi_ut_dump_allocation_info(void);
void acpi_ut_dump_allocations(u32 component, const char *module); void acpi_ut_dump_allocations(u32 component, const char *module);
acpi_status acpi_status
acpi_ut_create_list(char *list_name, acpi_ut_create_list(const char *list_name,
u16 object_size, struct acpi_memory_list **return_cache); u16 object_size, struct acpi_memory_list **return_cache);
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ #endif /* ACPI_DBG_TRACK_ALLOCATIONS */

View file

@ -277,7 +277,9 @@ acpi_db_convert_to_object(acpi_object_type type,
default: default:
object->type = ACPI_TYPE_INTEGER; object->type = ACPI_TYPE_INTEGER;
status = acpi_ut_strtoul64(string, 16, &object->integer.value); status =
acpi_ut_strtoul64(string, 16, acpi_gbl_integer_byte_width,
&object->integer.value);
break; break;
} }

View file

@ -57,12 +57,12 @@ static u32 acpi_db_get_line(char *input_buffer);
static u32 acpi_db_match_command(char *user_command); static u32 acpi_db_match_command(char *user_command);
static void acpi_db_display_command_info(char *command, u8 display_all); static void acpi_db_display_command_info(const char *command, u8 display_all);
static void acpi_db_display_help(char *command); static void acpi_db_display_help(char *command);
static u8 static u8
acpi_db_match_command_help(char *command, acpi_db_match_command_help(const char *command,
const struct acpi_db_command_help *help); const struct acpi_db_command_help *help);
/* /*
@ -348,7 +348,7 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
******************************************************************************/ ******************************************************************************/
static u8 static u8
acpi_db_match_command_help(char *command, acpi_db_match_command_help(const char *command,
const struct acpi_db_command_help *help) const struct acpi_db_command_help *help)
{ {
char *invocation = help->invocation; char *invocation = help->invocation;
@ -402,7 +402,7 @@ acpi_db_match_command_help(char *command,
* *
******************************************************************************/ ******************************************************************************/
static void acpi_db_display_command_info(char *command, u8 display_all) static void acpi_db_display_command_info(const char *command, u8 display_all)
{ {
const struct acpi_db_command_help *next; const struct acpi_db_command_help *next;
u8 matched; u8 matched;
@ -656,8 +656,9 @@ static u32 acpi_db_match_command(char *user_command)
} }
for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++) { for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++) {
if (strstr(acpi_gbl_db_commands[i].name, user_command) == if (strstr
acpi_gbl_db_commands[i].name) { (ACPI_CAST_PTR(char, acpi_gbl_db_commands[i].name),
user_command) == acpi_gbl_db_commands[i].name) {
return (i); return (i);
} }
} }

View file

@ -709,7 +709,7 @@ acpi_db_integrity_walk(acpi_handle obj_handle,
return (AE_OK); return (AE_OK);
} }
if (!acpi_ut_valid_acpi_name(node->name.ascii)) { if (!acpi_ut_valid_nameseg(node->name.ascii)) {
acpi_os_printf("Invalid AcpiName for Node %p\n", node); acpi_os_printf("Invalid AcpiName for Node %p\n", node);
return (AE_OK); return (AE_OK);
} }

View file

@ -56,8 +56,6 @@ acpi_status acpi_db_second_pass_parse(union acpi_parse_object *root);
void acpi_db_dump_buffer(u32 address); void acpi_db_dump_buffer(u32 address);
#endif #endif
static char *gbl_hex_to_ascii = "0123456789ABCDEF";
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_db_match_argument * FUNCTION: acpi_db_match_argument
@ -82,8 +80,9 @@ acpi_db_match_argument(char *user_argument,
} }
for (i = 0; arguments[i].name; i++) { for (i = 0; arguments[i].name; i++) {
if (strstr(arguments[i].name, user_argument) == if (strstr(ACPI_CAST_PTR(char, arguments[i].name),
arguments[i].name) { ACPI_CAST_PTR(char,
user_argument)) == arguments[i].name) {
return (i); return (i);
} }
} }
@ -339,7 +338,7 @@ void acpi_db_uint32_to_hex_string(u32 value, char *buffer)
buffer[8] = '\0'; buffer[8] = '\0';
for (i = 7; i >= 0; i--) { for (i = 7; i >= 0; i--) {
buffer[i] = gbl_hex_to_ascii[value & 0x0F]; buffer[i] = acpi_gbl_upper_hex_digits[value & 0x0F];
value = value >> 4; value = value >> 4;
} }
} }

View file

@ -490,8 +490,8 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
status = status =
acpi_ds_create_index_field(op, acpi_ds_create_index_field(op,
(acpi_handle) arg-> (acpi_handle)arg->common.
common.node, walk_state); node, walk_state);
break; break;
case AML_BANK_FIELD_OP: case AML_BANK_FIELD_OP:

View file

@ -99,8 +99,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_queue_notify_request(struct acpi_namespace_node * node, acpi_ev_queue_notify_request(struct acpi_namespace_node *node, u32 notify_value)
u32 notify_value)
{ {
union acpi_operand_object *obj_desc; union acpi_operand_object *obj_desc;
union acpi_operand_object *handler_list_head = NULL; union acpi_operand_object *handler_list_head = NULL;

View file

@ -524,52 +524,6 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ev_associate_reg_method
*
* PARAMETERS: region_obj - Region object
*
* RETURN: Status
*
* DESCRIPTION: Find and associate _REG method to a region
*
******************************************************************************/
void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj)
{
acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
struct acpi_namespace_node *method_node;
struct acpi_namespace_node *node;
union acpi_operand_object *region_obj2;
acpi_status status;
ACPI_FUNCTION_TRACE(ev_associate_reg_method);
region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2) {
return_VOID;
}
node = region_obj->region.node->parent;
/* Find any "_REG" method associated with this region definition */
status =
acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
&method_node);
if (ACPI_SUCCESS(status)) {
/*
* The _REG method is optional and there can be only one per region
* definition. This will be executed when the handler is attached
* or removed
*/
region_obj2->extra.method_REG = method_node;
}
return_VOID;
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ev_execute_reg_method * FUNCTION: acpi_ev_execute_reg_method
@ -589,18 +543,42 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
struct acpi_evaluate_info *info; struct acpi_evaluate_info *info;
union acpi_operand_object *args[3]; union acpi_operand_object *args[3];
union acpi_operand_object *region_obj2; union acpi_operand_object *region_obj2;
const acpi_name *reg_name_ptr =
ACPI_CAST_PTR(acpi_name, METHOD_NAME__REG);
struct acpi_namespace_node *method_node;
struct acpi_namespace_node *node;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE(ev_execute_reg_method); ACPI_FUNCTION_TRACE(ev_execute_reg_method);
if (!acpi_gbl_namespace_initialized ||
region_obj->region.handler == NULL) {
return_ACPI_STATUS(AE_OK);
}
region_obj2 = acpi_ns_get_secondary_object(region_obj); region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2) { if (!region_obj2) {
return_ACPI_STATUS(AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST);
} }
if (region_obj2->extra.method_REG == NULL || /*
region_obj->region.handler == NULL || * Find any "_REG" method associated with this region definition.
!acpi_gbl_namespace_initialized) { * The method should always be updated as this function may be
* invoked after a namespace change.
*/
node = region_obj->region.node->parent;
status =
acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
&method_node);
if (ACPI_SUCCESS(status)) {
/*
* The _REG method is optional and there can be only one per
* region definition. This will be executed when the handler is
* attached or removed.
*/
region_obj2->extra.method_REG = method_node;
}
if (region_obj2->extra.method_REG == NULL) {
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }

View file

@ -518,7 +518,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
acpi_ev_associate_reg_method(region_obj);
region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
node = region_obj->region.node->parent; node = region_obj->region.node->parent;

View file

@ -0,0 +1,439 @@
/******************************************************************************
*
* Module Name: exconcat - Concatenate-type AML operators
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#include "acinterp.h"
#include "amlresrc.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exconcat")
/* Local Prototypes */
static acpi_status
acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc);
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_concatenate
*
* PARAMETERS: operand0 - First source object
* operand1 - Second source object
* actual_return_desc - Where to place the return object
* walk_state - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Concatenate two objects with the ACPI-defined conversion
* rules as necessary.
* NOTE:
* Per the ACPI spec (up to 6.1), Concatenate only supports Integer,
* String, and Buffer objects. However, we support all objects here
* as an extension. This improves the usefulness of both Concatenate
* and the Printf/Fprintf macros. The extension returns a string
* describing the object type for the other objects.
* 02/2016.
*
******************************************************************************/
acpi_status
acpi_ex_do_concatenate(union acpi_operand_object *operand0,
union acpi_operand_object *operand1,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state)
{
union acpi_operand_object *local_operand0 = operand0;
union acpi_operand_object *local_operand1 = operand1;
union acpi_operand_object *temp_operand1 = NULL;
union acpi_operand_object *return_desc;
char *buffer;
acpi_object_type operand0_type;
acpi_object_type operand1_type;
acpi_status status;
ACPI_FUNCTION_TRACE(ex_do_concatenate);
/* Operand 0 preprocessing */
switch (operand0->common.type) {
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
operand0_type = operand0->common.type;
break;
default:
/* For all other types, get the "object type" string */
status =
acpi_ex_convert_to_object_type_string(operand0,
&local_operand0);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
operand0_type = ACPI_TYPE_STRING;
break;
}
/* Operand 1 preprocessing */
switch (operand1->common.type) {
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
operand1_type = operand1->common.type;
break;
default:
/* For all other types, get the "object type" string */
status =
acpi_ex_convert_to_object_type_string(operand1,
&local_operand1);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
operand1_type = ACPI_TYPE_STRING;
break;
}
/*
* Convert the second operand if necessary. The first operand (0)
* determines the type of the second operand (1) (See the Data Types
* section of the ACPI specification). Both object types are
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism.
*/
switch (operand0_type) {
case ACPI_TYPE_INTEGER:
status =
acpi_ex_convert_to_integer(local_operand1, &temp_operand1,
16);
break;
case ACPI_TYPE_BUFFER:
status =
acpi_ex_convert_to_buffer(local_operand1, &temp_operand1);
break;
case ACPI_TYPE_STRING:
switch (operand1_type) {
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/* Other types have already been converted to string */
status =
acpi_ex_convert_to_string(local_operand1,
&temp_operand1,
ACPI_IMPLICIT_CONVERT_HEX);
break;
default:
status = AE_OK;
break;
}
break;
default:
ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
operand0->common.type));
status = AE_AML_INTERNAL;
}
if (ACPI_FAILURE(status)) {
goto cleanup;
}
/* Take care with any newly created operand objects */
if ((local_operand1 != operand1) && (local_operand1 != temp_operand1)) {
acpi_ut_remove_reference(local_operand1);
}
local_operand1 = temp_operand1;
/*
* Both operands are now known to be the same object type
* (Both are Integer, String, or Buffer), and we can now perform
* the concatenation.
*
* There are three cases to handle, as per the ACPI spec:
*
* 1) Two Integers concatenated to produce a new Buffer
* 2) Two Strings concatenated to produce a new String
* 3) Two Buffers concatenated to produce a new Buffer
*/
switch (operand0_type) {
case ACPI_TYPE_INTEGER:
/* Result of two Integers is a Buffer */
/* Need enough buffer space for two integers */
return_desc = acpi_ut_create_buffer_object((acpi_size)
ACPI_MUL_2
(acpi_gbl_integer_byte_width));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
buffer = (char *)return_desc->buffer.pointer;
/* Copy the first integer, LSB first */
memcpy(buffer, &operand0->integer.value,
acpi_gbl_integer_byte_width);
/* Copy the second integer (LSB first) after the first */
memcpy(buffer + acpi_gbl_integer_byte_width,
&local_operand1->integer.value,
acpi_gbl_integer_byte_width);
break;
case ACPI_TYPE_STRING:
/* Result of two Strings is a String */
return_desc = acpi_ut_create_string_object(((acpi_size)
local_operand0->
string.length +
local_operand1->
string.length));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
buffer = return_desc->string.pointer;
/* Concatenate the strings */
strcpy(buffer, local_operand0->string.pointer);
strcat(buffer, local_operand1->string.pointer);
break;
case ACPI_TYPE_BUFFER:
/* Result of two Buffers is a Buffer */
return_desc = acpi_ut_create_buffer_object(((acpi_size)
operand0->buffer.
length +
local_operand1->
buffer.length));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
buffer = (char *)return_desc->buffer.pointer;
/* Concatenate the buffers */
memcpy(buffer, operand0->buffer.pointer,
operand0->buffer.length);
memcpy(buffer + operand0->buffer.length,
local_operand1->buffer.pointer,
local_operand1->buffer.length);
break;
default:
/* Invalid object type, should not happen here */
ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
operand0->common.type));
status = AE_AML_INTERNAL;
goto cleanup;
}
*actual_return_desc = return_desc;
cleanup:
if (local_operand0 != operand0) {
acpi_ut_remove_reference(local_operand0);
}
if (local_operand1 != operand1) {
acpi_ut_remove_reference(local_operand1);
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_convert_to_object_type_string
*
* PARAMETERS: obj_desc - Object to be converted
* return_desc - Where to place the return object
*
* RETURN: Status
*
* DESCRIPTION: Convert an object of arbitrary type to a string object that
* contains the namestring for the object. Used for the
* concatenate operator.
*
******************************************************************************/
static acpi_status
acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc)
{
union acpi_operand_object *return_desc;
const char *type_string;
type_string = acpi_ut_get_type_name(obj_desc->common.type);
return_desc = acpi_ut_create_string_object(((acpi_size)strlen(type_string) + 9)); /* 9 For "[ Object]" */
if (!return_desc) {
return (AE_NO_MEMORY);
}
strcpy(return_desc->string.pointer, "[");
strcat(return_desc->string.pointer, type_string);
strcat(return_desc->string.pointer, " Object]");
*result_desc = return_desc;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_concat_template
*
* PARAMETERS: operand0 - First source object
* operand1 - Second source object
* actual_return_desc - Where to place the return object
* walk_state - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Concatenate two resource templates
*
******************************************************************************/
acpi_status
acpi_ex_concat_template(union acpi_operand_object *operand0,
union acpi_operand_object *operand1,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state)
{
acpi_status status;
union acpi_operand_object *return_desc;
u8 *new_buf;
u8 *end_tag;
acpi_size length0;
acpi_size length1;
acpi_size new_length;
ACPI_FUNCTION_TRACE(ex_concat_template);
/*
* Find the end_tag descriptor in each resource template.
* Note1: returned pointers point TO the end_tag, not past it.
* Note2: zero-length buffers are allowed; treated like one end_tag
*/
/* Get the length of the first resource template */
status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
/* Get the length of the second resource template */
status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
/* Combine both lengths, minimum size will be 2 for end_tag */
new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
/* Create a new buffer object for the result (with one end_tag) */
return_desc = acpi_ut_create_buffer_object(new_length);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/*
* Copy the templates to the new buffer, 0 first, then 1 follows. One
* end_tag descriptor is copied from Operand1.
*/
new_buf = return_desc->buffer.pointer;
memcpy(new_buf, operand0->buffer.pointer, length0);
memcpy(new_buf + length0, operand1->buffer.pointer, length1);
/* Insert end_tag and set the checksum to zero, means "ignore checksum" */
new_buf[new_length - 1] = 0;
new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
/* Return the completed resource template */
*actual_return_desc = return_desc;
return_ACPI_STATUS(AE_OK);
}

View file

@ -118,7 +118,9 @@ acpi_ex_add_table(u32 table_index,
/* Execute any module-level code that was found in the table */ /* Execute any module-level code that was found in the table */
acpi_ex_exit_interpreter(); acpi_ex_exit_interpreter();
if (acpi_gbl_group_module_level_code) {
acpi_ns_exec_module_code_list(); acpi_ns_exec_module_code_list();
}
acpi_ex_enter_interpreter(); acpi_ex_enter_interpreter();
/* /*

View file

@ -124,7 +124,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
* of ACPI 3.0) is that the to_integer() operator allows both decimal * of ACPI 3.0) is that the to_integer() operator allows both decimal
* and hexadecimal strings (hex prefixed with "0x"). * and hexadecimal strings (hex prefixed with "0x").
*/ */
status = acpi_ut_strtoul64((char *)pointer, flags, &result); status = acpi_ut_strtoul64((char *)pointer, flags,
acpi_gbl_integer_byte_width,
&result);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View file

@ -55,9 +55,9 @@ ACPI_MODULE_NAME("exdump")
*/ */
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */ /* Local prototypes */
static void acpi_ex_out_string(char *title, char *value); static void acpi_ex_out_string(const char *title, const char *value);
static void acpi_ex_out_pointer(char *title, void *value); static void acpi_ex_out_pointer(const char *title, const void *value);
static void static void
acpi_ex_dump_object(union acpi_operand_object *obj_desc, acpi_ex_dump_object(union acpi_operand_object *obj_desc,
@ -365,8 +365,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
struct acpi_exdump_info *info) struct acpi_exdump_info *info)
{ {
u8 *target; u8 *target;
char *name; const char *name;
const char *reference_name;
u8 count; u8 count;
union acpi_operand_object *start; union acpi_operand_object *start;
union acpi_operand_object *data = NULL; union acpi_operand_object *data = NULL;
@ -459,9 +458,9 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
case ACPI_EXD_REFERENCE: case ACPI_EXD_REFERENCE:
reference_name = acpi_ut_get_reference_name(obj_desc);
acpi_ex_out_string("Class Name", acpi_ex_out_string("Class Name",
ACPI_CAST_PTR(char, reference_name)); acpi_ut_get_reference_name
(obj_desc));
acpi_ex_dump_reference_obj(obj_desc); acpi_ex_dump_reference_obj(obj_desc);
break; break;
@ -934,12 +933,12 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
* *
******************************************************************************/ ******************************************************************************/
static void acpi_ex_out_string(char *title, char *value) static void acpi_ex_out_string(const char *title, const char *value)
{ {
acpi_os_printf("%20s : %s\n", title, value); acpi_os_printf("%20s : %s\n", title, value);
} }
static void acpi_ex_out_pointer(char *title, void *value) static void acpi_ex_out_pointer(const char *title, const void *value)
{ {
acpi_os_printf("%20s : %p\n", title, value); acpi_os_printf("%20s : %p\n", title, value);
} }

View file

@ -897,17 +897,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width);
/* /* Create the bitmasks used for bit insertion */
* Create the bitmasks used for bit insertion.
* Note: This if/else is used to bypass compiler differences with the
* shift operator
*/
if (access_bit_width == ACPI_INTEGER_BIT_SIZE) {
width_mask = ACPI_UINT64_MAX;
} else {
width_mask = ACPI_MASK_BITS_ABOVE(access_bit_width);
}
width_mask = ACPI_MASK_BITS_ABOVE_64(access_bit_width);
mask = width_mask & mask = width_mask &
ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);

View file

@ -45,7 +45,6 @@
#include "accommon.h" #include "accommon.h"
#include "acinterp.h" #include "acinterp.h"
#include "amlcode.h" #include "amlcode.h"
#include "amlresrc.h"
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exmisc") ACPI_MODULE_NAME("exmisc")
@ -138,295 +137,6 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ex_concat_template
*
* PARAMETERS: operand0 - First source object
* operand1 - Second source object
* actual_return_desc - Where to place the return object
* walk_state - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Concatenate two resource templates
*
******************************************************************************/
acpi_status
acpi_ex_concat_template(union acpi_operand_object *operand0,
union acpi_operand_object *operand1,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state)
{
acpi_status status;
union acpi_operand_object *return_desc;
u8 *new_buf;
u8 *end_tag;
acpi_size length0;
acpi_size length1;
acpi_size new_length;
ACPI_FUNCTION_TRACE(ex_concat_template);
/*
* Find the end_tag descriptor in each resource template.
* Note1: returned pointers point TO the end_tag, not past it.
* Note2: zero-length buffers are allowed; treated like one end_tag
*/
/* Get the length of the first resource template */
status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
/* Get the length of the second resource template */
status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
/* Combine both lengths, minimum size will be 2 for end_tag */
new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
/* Create a new buffer object for the result (with one end_tag) */
return_desc = acpi_ut_create_buffer_object(new_length);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/*
* Copy the templates to the new buffer, 0 first, then 1 follows. One
* end_tag descriptor is copied from Operand1.
*/
new_buf = return_desc->buffer.pointer;
memcpy(new_buf, operand0->buffer.pointer, length0);
memcpy(new_buf + length0, operand1->buffer.pointer, length1);
/* Insert end_tag and set the checksum to zero, means "ignore checksum" */
new_buf[new_length - 1] = 0;
new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
/* Return the completed resource template */
*actual_return_desc = return_desc;
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_concatenate
*
* PARAMETERS: operand0 - First source object
* operand1 - Second source object
* actual_return_desc - Where to place the return object
* walk_state - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
*
******************************************************************************/
acpi_status
acpi_ex_do_concatenate(union acpi_operand_object *operand0,
union acpi_operand_object *operand1,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state)
{
union acpi_operand_object *local_operand1 = operand1;
union acpi_operand_object *return_desc;
char *new_buf;
const char *type_string;
acpi_status status;
ACPI_FUNCTION_TRACE(ex_do_concatenate);
/*
* Convert the second operand if necessary. The first operand
* determines the type of the second operand, (See the Data Types
* section of the ACPI specification.) Both object types are
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism.
*/
switch (operand0->common.type) {
case ACPI_TYPE_INTEGER:
status =
acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
break;
case ACPI_TYPE_STRING:
/*
* Per the ACPI spec, Concatenate only supports int/str/buf.
* However, we support all objects here as an extension.
* This improves the usefulness of the Printf() macro.
* 12/2015.
*/
switch (operand1->common.type) {
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
status =
acpi_ex_convert_to_string(operand1, &local_operand1,
ACPI_IMPLICIT_CONVERT_HEX);
break;
default:
/*
* Just emit a string containing the object type.
*/
type_string =
acpi_ut_get_type_name(operand1->common.type);
local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */
if (!local_operand1) {
status = AE_NO_MEMORY;
goto cleanup;
}
strcpy(local_operand1->string.pointer, "[");
strcat(local_operand1->string.pointer, type_string);
strcat(local_operand1->string.pointer, " Object]");
status = AE_OK;
break;
}
break;
case ACPI_TYPE_BUFFER:
status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
break;
default:
ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
operand0->common.type));
status = AE_AML_INTERNAL;
}
if (ACPI_FAILURE(status)) {
goto cleanup;
}
/*
* Both operands are now known to be the same object type
* (Both are Integer, String, or Buffer), and we can now perform the
* concatenation.
*/
/*
* There are three cases to handle:
*
* 1) Two Integers concatenated to produce a new Buffer
* 2) Two Strings concatenated to produce a new String
* 3) Two Buffers concatenated to produce a new Buffer
*/
switch (operand0->common.type) {
case ACPI_TYPE_INTEGER:
/* Result of two Integers is a Buffer */
/* Need enough buffer space for two integers */
return_desc = acpi_ut_create_buffer_object((acpi_size)
ACPI_MUL_2
(acpi_gbl_integer_byte_width));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
new_buf = (char *)return_desc->buffer.pointer;
/* Copy the first integer, LSB first */
memcpy(new_buf, &operand0->integer.value,
acpi_gbl_integer_byte_width);
/* Copy the second integer (LSB first) after the first */
memcpy(new_buf + acpi_gbl_integer_byte_width,
&local_operand1->integer.value,
acpi_gbl_integer_byte_width);
break;
case ACPI_TYPE_STRING:
/* Result of two Strings is a String */
return_desc = acpi_ut_create_string_object(((acpi_size)
operand0->string.
length +
local_operand1->
string.length));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
new_buf = return_desc->string.pointer;
/* Concatenate the strings */
strcpy(new_buf, operand0->string.pointer);
strcat(new_buf, local_operand1->string.pointer);
break;
case ACPI_TYPE_BUFFER:
/* Result of two Buffers is a Buffer */
return_desc = acpi_ut_create_buffer_object(((acpi_size)
operand0->buffer.
length +
local_operand1->
buffer.length));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
}
new_buf = (char *)return_desc->buffer.pointer;
/* Concatenate the buffers */
memcpy(new_buf, operand0->buffer.pointer,
operand0->buffer.length);
memcpy(new_buf + operand0->buffer.length,
local_operand1->buffer.pointer,
local_operand1->buffer.length);
break;
default:
/* Invalid object type, should not happen here */
ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
operand0->common.type));
status = AE_AML_INTERNAL;
goto cleanup;
}
*actual_return_desc = return_desc;
cleanup:
if (local_operand1 != operand1) {
acpi_ut_remove_reference(local_operand1);
}
return_ACPI_STATUS(status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_do_math_op * FUNCTION: acpi_ex_do_math_op

View file

@ -178,7 +178,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
for (index = 0; for (index = 0;
(index < ACPI_NAME_SIZE) (index < ACPI_NAME_SIZE)
&& (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { && (acpi_ut_valid_name_char(*aml_address, 0)); index++) {
char_buf[index] = *aml_address++; char_buf[index] = *aml_address++;
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
} }

View file

@ -301,8 +301,8 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
* *
* FUNCTION: acpi_ex_eisa_id_to_string * FUNCTION: acpi_ex_eisa_id_to_string
* *
* PARAMETERS: compressed_id - EISAID to be converted * PARAMETERS: out_string - Where to put the converted string (8 bytes)
* out_string - Where to put the converted string (8 bytes) * compressed_id - EISAID to be converted
* *
* RETURN: None * RETURN: None
* *
@ -354,7 +354,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id)
* possible 64-bit integer. * possible 64-bit integer.
* value - Value to be converted * value - Value to be converted
* *
* RETURN: None, string * RETURN: Converted string in out_string
* *
* DESCRIPTION: Convert a 64-bit integer to decimal string representation. * DESCRIPTION: Convert a 64-bit integer to decimal string representation.
* Assumes string buffer is large enough to hold the string. The * Assumes string buffer is large enough to hold the string. The
@ -384,9 +384,9 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
* FUNCTION: acpi_ex_pci_cls_to_string * FUNCTION: acpi_ex_pci_cls_to_string
* *
* PARAMETERS: out_string - Where to put the converted string (7 bytes) * PARAMETERS: out_string - Where to put the converted string (7 bytes)
* PARAMETERS: class_code - PCI class code to be converted (3 bytes) * class_code - PCI class code to be converted (3 bytes)
* *
* RETURN: None * RETURN: Converted string in out_string
* *
* DESCRIPTION: Convert 3-bytes PCI class code to string representation. * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
* Return buffer must be large enough to hold the string. The * Return buffer must be large enough to hold the string. The
@ -417,7 +417,7 @@ void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
* *
* PARAMETERS: space_id - ID to be validated * PARAMETERS: space_id - ID to be validated
* *
* RETURN: TRUE if valid/supported ID. * RETURN: TRUE if space_id is a valid/supported ID.
* *
* DESCRIPTION: Validate an operation region space_ID. * DESCRIPTION: Validate an operation region space_ID.
* *

View file

@ -51,6 +51,10 @@ ACPI_MODULE_NAME("hwregs")
#if (!ACPI_REDUCED_HARDWARE) #if (!ACPI_REDUCED_HARDWARE)
/* Local Prototypes */ /* Local Prototypes */
static u8
acpi_hw_get_access_bit_width(struct acpi_generic_address *reg,
u8 max_bit_width);
static acpi_status static acpi_status
acpi_hw_read_multiple(u32 *value, acpi_hw_read_multiple(u32 *value,
struct acpi_generic_address *register_a, struct acpi_generic_address *register_a,
@ -63,6 +67,48 @@ acpi_hw_write_multiple(u32 value,
#endif /* !ACPI_REDUCED_HARDWARE */ #endif /* !ACPI_REDUCED_HARDWARE */
/******************************************************************************
*
* FUNCTION: acpi_hw_get_access_bit_width
*
* PARAMETERS: reg - GAS register structure
* max_bit_width - Max bit_width supported (32 or 64)
*
* RETURN: Status
*
* DESCRIPTION: Obtain optimal access bit width
*
******************************************************************************/
static u8
acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
{
u64 address;
if (!reg->access_width) {
/*
* Detect old register descriptors where only the bit_width field
* makes senses. The target address is copied to handle possible
* alignment issues.
*/
ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!reg->bit_offset && reg->bit_width &&
ACPI_IS_POWER_OF_TWO(reg->bit_width) &&
ACPI_IS_ALIGNED(reg->bit_width, 8) &&
ACPI_IS_ALIGNED(address, reg->bit_width)) {
return (reg->bit_width);
} else {
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
return (32);
} else {
return (max_bit_width);
}
}
} else {
return (1 << (reg->access_width + 2));
}
}
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: acpi_hw_validate_register * FUNCTION: acpi_hw_validate_register
@ -83,6 +129,8 @@ acpi_status
acpi_hw_validate_register(struct acpi_generic_address *reg, acpi_hw_validate_register(struct acpi_generic_address *reg,
u8 max_bit_width, u64 *address) u8 max_bit_width, u64 *address)
{ {
u8 bit_width;
u8 access_width;
/* Must have a valid pointer to a GAS structure */ /* Must have a valid pointer to a GAS structure */
@ -109,23 +157,25 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
return (AE_SUPPORT); return (AE_SUPPORT);
} }
/* Validate the bit_width */ /* Validate the access_width */
if ((reg->bit_width != 8) && if (reg->access_width > 4) {
(reg->bit_width != 16) &&
(reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unsupported register bit width: 0x%X", "Unsupported register access width: 0x%X",
reg->bit_width)); reg->access_width));
return (AE_SUPPORT); return (AE_SUPPORT);
} }
/* Validate the bit_offset. Just a warning for now. */ /* Validate the bit_width, convert access_width into number of bits */
if (reg->bit_offset != 0) { access_width = acpi_hw_get_access_bit_width(reg, max_bit_width);
bit_width =
ACPI_ROUND_UP(reg->bit_offset + reg->bit_width, access_width);
if (max_bit_width < bit_width) {
ACPI_WARNING((AE_INFO, ACPI_WARNING((AE_INFO,
"Unsupported register bit offset: 0x%X", "Requested bit width 0x%X is smaller than register bit width 0x%X",
reg->bit_offset)); max_bit_width, bit_width));
return (AE_SUPPORT);
} }
return (AE_OK); return (AE_OK);
@ -145,17 +195,19 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
* 64-bit values is not needed. * 64-bit values is not needed.
* *
* LIMITATIONS: <These limitations also apply to acpi_hw_write> * LIMITATIONS: <These limitations also apply to acpi_hw_write>
* bit_width must be exactly 8, 16, or 32.
* space_ID must be system_memory or system_IO. * space_ID must be system_memory or system_IO.
* bit_offset and access_width are currently ignored, as there has
* not been a need to implement these.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
{ {
u64 address; u64 address;
u8 access_width;
u32 bit_width;
u8 bit_offset;
u64 value64; u64 value64;
u32 value32;
u8 index;
acpi_status status; acpi_status status;
ACPI_FUNCTION_NAME(hw_read); ACPI_FUNCTION_NAME(hw_read);
@ -167,28 +219,75 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
return (status); return (status);
} }
/* Initialize entire 32-bit return value to zero */ /*
* Initialize entire 32-bit return value to zero, convert access_width
* into number of bits based
*/
*value = 0; *value = 0;
access_width = acpi_hw_get_access_bit_width(reg, 32);
bit_width = reg->bit_offset + reg->bit_width;
bit_offset = reg->bit_offset;
/* /*
* Two address spaces supported: Memory or IO. PCI_Config is * Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient * not supported here because the GAS structure is insufficient
*/ */
index = 0;
while (bit_width) {
if (bit_offset >= access_width) {
value32 = 0;
bit_offset -= access_width;
} else {
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
status = acpi_os_read_memory((acpi_physical_address) status =
address, &value64, reg->bit_width); acpi_os_read_memory((acpi_physical_address)
address +
*value = (u32)value64; index *
ACPI_DIV_8
(access_width),
&value64, access_width);
value32 = (u32)value64;
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
status = acpi_hw_read_port((acpi_io_address) status = acpi_hw_read_port((acpi_io_address)
address, value, reg->bit_width); address +
index *
ACPI_DIV_8
(access_width),
&value32,
access_width);
}
/*
* Use offset style bit masks because:
* bit_offset < access_width/bit_width < access_width, and
* access_width is ensured to be less than 32-bits by
* acpi_hw_validate_register().
*/
if (bit_offset) {
value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
bit_offset = 0;
}
if (bit_width < access_width) {
value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
}
}
/*
* Use offset style bit writes because "Index * AccessWidth" is
* ensured to be less than 32-bits by acpi_hw_validate_register().
*/
ACPI_SET_BITS(value, index * access_width,
ACPI_MASK_BITS_ABOVE_32(access_width), value32);
bit_width -=
bit_width > access_width ? access_width : bit_width;
index++;
} }
ACPI_DEBUG_PRINT((ACPI_DB_IO, ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
*value, reg->bit_width, ACPI_FORMAT_UINT64(address), *value, access_width, ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id))); acpi_ut_get_region_name(reg->space_id)));
return (status); return (status);
@ -212,6 +311,12 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
{ {
u64 address; u64 address;
u8 access_width;
u32 bit_width;
u8 bit_offset;
u64 value64;
u32 new_value32, old_value32;
u8 index;
acpi_status status; acpi_status status;
ACPI_FUNCTION_NAME(hw_write); ACPI_FUNCTION_NAME(hw_write);
@ -223,23 +328,145 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
return (status); return (status);
} }
/* Convert access_width into number of bits based */
access_width = acpi_hw_get_access_bit_width(reg, 32);
bit_width = reg->bit_offset + reg->bit_width;
bit_offset = reg->bit_offset;
/* /*
* Two address spaces supported: Memory or IO. PCI_Config is * Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient * not supported here because the GAS structure is insufficient
*/ */
index = 0;
while (bit_width) {
/*
* Use offset style bit reads because "Index * AccessWidth" is
* ensured to be less than 32-bits by acpi_hw_validate_register().
*/
new_value32 = ACPI_GET_BITS(&value, index * access_width,
ACPI_MASK_BITS_ABOVE_32
(access_width));
if (bit_offset >= access_width) {
bit_offset -= access_width;
} else {
/*
* Use offset style bit masks because access_width is ensured
* to be less than 32-bits by acpi_hw_validate_register() and
* bit_offset/bit_width is less than access_width here.
*/
if (bit_offset) {
new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
}
if (bit_width < access_width) {
new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
}
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
status = acpi_os_write_memory((acpi_physical_address) if (bit_offset || bit_width < access_width) {
address, (u64)value, /*
reg->bit_width); * Read old values in order not to modify the bits that
* are beyond the register bit_width/bit_offset setting.
*/
status =
acpi_os_read_memory((acpi_physical_address)
address +
index *
ACPI_DIV_8
(access_width),
&value64,
access_width);
old_value32 = (u32)value64;
/*
* Use offset style bit masks because access_width is
* ensured to be less than 32-bits by
* acpi_hw_validate_register() and bit_offset/bit_width is
* less than access_width here.
*/
if (bit_offset) {
old_value32 &=
ACPI_MASK_BITS_ABOVE
(bit_offset);
bit_offset = 0;
}
if (bit_width < access_width) {
old_value32 &=
ACPI_MASK_BITS_BELOW
(bit_width);
}
new_value32 |= old_value32;
}
value64 = (u64)new_value32;
status =
acpi_os_write_memory((acpi_physical_address)
address +
index *
ACPI_DIV_8
(access_width),
value64, access_width);
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
if (bit_offset || bit_width < access_width) {
/*
* Read old values in order not to modify the bits that
* are beyond the register bit_width/bit_offset setting.
*/
status =
acpi_hw_read_port((acpi_io_address)
address +
index *
ACPI_DIV_8
(access_width),
&old_value32,
access_width);
/*
* Use offset style bit masks because access_width is
* ensured to be less than 32-bits by
* acpi_hw_validate_register() and bit_offset/bit_width is
* less than access_width here.
*/
if (bit_offset) {
old_value32 &=
ACPI_MASK_BITS_ABOVE
(bit_offset);
bit_offset = 0;
}
if (bit_width < access_width) {
old_value32 &=
ACPI_MASK_BITS_BELOW
(bit_width);
}
new_value32 |= old_value32;
}
status = acpi_hw_write_port((acpi_io_address) status = acpi_hw_write_port((acpi_io_address)
address, value, reg->bit_width); address +
index *
ACPI_DIV_8
(access_width),
new_value32,
access_width);
}
}
/*
* Index * access_width is ensured to be less than 32-bits by
* acpi_hw_validate_register().
*/
bit_width -=
bit_width > access_width ? access_width : bit_width;
index++;
} }
ACPI_DEBUG_PRINT((ACPI_DB_IO, ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
value, reg->bit_width, ACPI_FORMAT_UINT64(address), value, access_width, ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id))); acpi_ut_get_region_name(reg->space_id)));
return (status); return (status);

View file

@ -91,8 +91,7 @@ acpi_status acpi_reset(void)
* compatibility with other ACPI implementations that have allowed * compatibility with other ACPI implementations that have allowed
* BIOS code with bad register width values to go unnoticed. * BIOS code with bad register width values to go unnoticed.
*/ */
status = status = acpi_os_write_port((acpi_io_address)reset_reg->address,
acpi_os_write_port((acpi_io_address) reset_reg->address,
acpi_gbl_FADT.reset_value, acpi_gbl_FADT.reset_value,
ACPI_RESET_REGISTER_WIDTH); ACPI_RESET_REGISTER_WIDTH);
} else { } else {
@ -504,9 +503,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
* Evaluate the \_Sx namespace object containing the register values * Evaluate the \_Sx namespace object containing the register values
* for this state * for this state
*/ */
info->relative_pathname = ACPI_CAST_PTR(char, info->relative_pathname = acpi_gbl_sleep_state_names[sleep_state];
acpi_gbl_sleep_state_names
[sleep_state]);
status = acpi_ns_evaluate(info); status = acpi_ns_evaluate(info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {

View file

@ -107,9 +107,10 @@ acpi_status acpi_ns_root_initialize(void)
continue; continue;
} }
status = acpi_ns_lookup(NULL, init_val->name, init_val->type, status =
ACPI_IMODE_LOAD_PASS2, acpi_ns_lookup(NULL, (char *)init_val->name, init_val->type,
ACPI_NS_NO_UPSEARCH, NULL, &new_node); ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
NULL, &new_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"Could not create predefined name %s", "Could not create predefined name %s",

View file

@ -79,7 +79,8 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
/* String-to-Integer conversion */ /* String-to-Integer conversion */
status = acpi_ut_strtoul64(original_object->string.pointer, status = acpi_ut_strtoul64(original_object->string.pointer,
ACPI_ANY_BASE, &value); ACPI_ANY_BASE,
acpi_gbl_integer_byte_width, &value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }

View file

@ -81,7 +81,7 @@ acpi_ns_get_max_depth(acpi_handle obj_handle,
* *
******************************************************************************/ ******************************************************************************/
void acpi_ns_print_pathname(u32 num_segments, char *pathname) void acpi_ns_print_pathname(u32 num_segments, const char *pathname)
{ {
u32 i; u32 i;
@ -114,6 +114,9 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
acpi_os_printf("]\n"); acpi_os_printf("]\n");
} }
#ifdef ACPI_OBSOLETE_FUNCTIONS
/* Not used at this time, perhaps later */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_dump_pathname * FUNCTION: acpi_ns_dump_pathname
@ -131,7 +134,8 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
******************************************************************************/ ******************************************************************************/
void void
acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) acpi_ns_dump_pathname(acpi_handle handle,
const char *msg, u32 level, u32 component)
{ {
ACPI_FUNCTION_TRACE(ns_dump_pathname); ACPI_FUNCTION_TRACE(ns_dump_pathname);
@ -148,6 +152,7 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
acpi_os_printf("\n"); acpi_os_printf("\n");
return_VOID; return_VOID;
} }
#endif
/******************************************************************************* /*******************************************************************************
* *

View file

@ -140,6 +140,7 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_device_walk_info info; struct acpi_device_walk_info info;
acpi_handle handle;
ACPI_FUNCTION_TRACE(ns_initialize_devices); ACPI_FUNCTION_TRACE(ns_initialize_devices);
@ -190,6 +191,27 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
info.num_INI++; info.num_INI++;
} }
/*
* Execute \_SB._INI.
* There appears to be a strict order requirement for \_SB._INI,
* which should be evaluated before any _REG evaluations.
*/
status = acpi_get_handle(NULL, "\\_SB", &handle);
if (ACPI_SUCCESS(status)) {
memset(info.evaluate_info, 0,
sizeof(struct acpi_evaluate_info));
info.evaluate_info->prefix_node = handle;
info.evaluate_info->relative_pathname =
METHOD_NAME__INI;
info.evaluate_info->parameters = NULL;
info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
status = acpi_ns_evaluate(info.evaluate_info);
if (ACPI_SUCCESS(status)) {
info.num_INI++;
}
}
} }
/* /*
@ -198,6 +220,12 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
* Note: Any objects accessed by the _REG methods will be automatically * Note: Any objects accessed by the _REG methods will be automatically
* initialized, even if they contain executable AML (see the call to * initialized, even if they contain executable AML (see the call to
* acpi_ns_initialize_objects below). * acpi_ns_initialize_objects below).
*
* Note: According to the ACPI specification, we actually needn't execute
* _REG for system_memory/system_io operation regions, but for PCI_Config
* operation regions, it is required to evaluate _REG for those on a PCI
* root bus that doesn't contain _BBN object. So this code is kept here
* in order not to break things.
*/ */
if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@ -592,8 +620,11 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
* Note: We know there is an _INI within this subtree, but it may not be * Note: We know there is an _INI within this subtree, but it may not be
* under this particular device, it may be lower in the branch. * under this particular device, it may be lower in the branch.
*/ */
if (!ACPI_COMPARE_NAME(device_node->name.ascii, "_SB_") ||
device_node->parent != acpi_gbl_root_node) {
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
(ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); (ACPI_TYPE_METHOD, device_node,
METHOD_NAME__INI));
memset(info, 0, sizeof(struct acpi_evaluate_info)); memset(info, 0, sizeof(struct acpi_evaluate_info));
info->prefix_node = device_node; info->prefix_node = device_node;
@ -602,7 +633,6 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
info->flags = ACPI_IGNORE_RETURN_VALUE; info->flags = ACPI_IGNORE_RETURN_VALUE;
status = acpi_ns_evaluate(info); status = acpi_ns_evaluate(info);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
walk_info->num_INI++; walk_info->num_INI++;
} }
@ -614,11 +644,13 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
char *scope_name = char *scope_name =
acpi_ns_get_normalized_pathname(device_node, TRUE); acpi_ns_get_normalized_pathname(device_node, TRUE);
ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", ACPI_EXCEPTION((AE_INFO, status,
"during %s._INI execution",
scope_name)); scope_name));
ACPI_FREE(scope_name); ACPI_FREE(scope_name);
} }
#endif #endif
}
/* Ignore errors from above */ /* Ignore errors from above */

View file

@ -123,8 +123,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
acpi_ns_delete_namespace_by_owner(acpi_gbl_root_table_list. acpi_ns_delete_namespace_by_owner(acpi_gbl_root_table_list.
tables[table_index].owner_id); tables[table_index].owner_id);
acpi_tb_release_owner_id(table_index);
acpi_tb_release_owner_id(table_index);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View file

@ -62,6 +62,10 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
u32 count1, u32 count1,
u8 type2, u32 count2, u32 start_index); u8 type2, u32 count2, u32 start_index);
static acpi_status
acpi_ns_custom_package(struct acpi_evaluate_info *info,
union acpi_operand_object **elements, u32 count);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_check_package * FUNCTION: acpi_ns_check_package
@ -135,6 +139,11 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
* PTYPE2 packages contain subpackages * PTYPE2 packages contain subpackages
*/ */
switch (package->ret_info.type) { switch (package->ret_info.type) {
case ACPI_PTYPE_CUSTOM:
status = acpi_ns_custom_package(info, elements, count);
break;
case ACPI_PTYPE1_FIXED: case ACPI_PTYPE1_FIXED:
/* /*
* The package count is fixed and there are no subpackages * The package count is fixed and there are no subpackages
@ -179,6 +188,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
elements++; elements++;
} }
break; break;
@ -225,6 +235,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
return (status); return (status);
} }
} }
elements++; elements++;
} }
break; break;
@ -569,11 +580,13 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info,
if (sub_package->package.count < expected_count) { if (sub_package->package.count < expected_count) {
goto package_too_small; goto package_too_small;
} }
if (sub_package->package.count < if (sub_package->package.count <
package->ret_info.count1) { package->ret_info.count1) {
expected_count = package->ret_info.count1; expected_count = package->ret_info.count1;
goto package_too_small; goto package_too_small;
} }
if (expected_count == 0) { if (expected_count == 0) {
/* /*
* Either the num_entries element was originally zero or it was * Either the num_entries element was originally zero or it was
@ -620,6 +633,83 @@ package_too_small:
return (AE_AML_OPERAND_VALUE); return (AE_AML_OPERAND_VALUE);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ns_custom_package
*
* PARAMETERS: info - Method execution information block
* elements - Pointer to the package elements array
* count - Element count for the package
*
* RETURN: Status
*
* DESCRIPTION: Check a returned package object for the correct count and
* correct type of all sub-objects.
*
* NOTE: Currently used for the _BIX method only. When needed for two or more
* methods, probably a detect/dispatch mechanism will be required.
*
******************************************************************************/
static acpi_status
acpi_ns_custom_package(struct acpi_evaluate_info *info,
union acpi_operand_object **elements, u32 count)
{
u32 expected_count;
u32 version;
acpi_status status = AE_OK;
ACPI_FUNCTION_NAME(ns_custom_package);
/* Get version number, must be Integer */
if ((*elements)->common.type != ACPI_TYPE_INTEGER) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Return Package has invalid object type for version number"));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
version = (u32)(*elements)->integer.value;
expected_count = 21; /* Version 1 */
if (version == 0) {
expected_count = 20; /* Version 0 */
}
if (count < expected_count) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
info->node_flags,
"Return Package is too small - found %u elements, expected %u",
count, expected_count));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
} else if (count > expected_count) {
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
"%s: Return Package is larger than needed - "
"found %u, expected %u\n",
info->full_pathname, count, expected_count));
}
/* Validate all elements of the returned package */
status = acpi_ns_check_package_elements(info, elements,
ACPI_RTYPE_INTEGER, 16,
ACPI_RTYPE_STRING, 4, 0);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Version 1 has a single trailing integer */
if (version > 0) {
status = acpi_ns_check_package_elements(info, elements + 20,
ACPI_RTYPE_INTEGER, 1,
0, 0, 20);
}
return_ACPI_STATUS(status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_check_package_elements * FUNCTION: acpi_ns_check_package_elements
@ -661,6 +751,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
this_element++; this_element++;
} }
@ -671,6 +762,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
this_element++; this_element++;
} }

View file

@ -55,8 +55,8 @@ ACPI_MODULE_NAME("nsrepair2")
*/ */
typedef typedef
acpi_status (*acpi_repair_function) (struct acpi_evaluate_info * info, acpi_status (*acpi_repair_function) (struct acpi_evaluate_info * info,
union acpi_operand_object union acpi_operand_object **
**return_object_ptr); return_object_ptr);
typedef struct acpi_repair_info { typedef struct acpi_repair_info {
char name[ACPI_NAME_SIZE]; char name[ACPI_NAME_SIZE];

View file

@ -280,13 +280,12 @@ acpi_evaluate_object(acpi_handle handle,
info->parameters[info->param_count] = NULL; info->parameters[info->param_count] = NULL;
} }
#if 0 #ifdef _FUTURE_FEATURE
/* /*
* Begin incoming argument count analysis. Check for too few args * Begin incoming argument count analysis. Check for too few args
* and too many args. * and too many args.
*/ */
switch (acpi_ns_get_type(info->node)) { switch (acpi_ns_get_type(info->node)) {
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
@ -370,10 +369,15 @@ acpi_evaluate_object(acpi_handle handle,
* If we are expecting a return value, and all went well above, * If we are expecting a return value, and all went well above,
* copy the return value to an external object. * copy the return value to an external object.
*/ */
if (return_buffer) { if (!return_buffer) {
goto cleanup_return_object;
}
if (!info->return_object) { if (!info->return_object) {
return_buffer->length = 0; return_buffer->length = 0;
} else { goto cleanup;
}
if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) == if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
ACPI_DESC_TYPE_NAMED) { ACPI_DESC_TYPE_NAMED) {
/* /*
@ -389,7 +393,9 @@ acpi_evaluate_object(acpi_handle handle,
return_buffer->length = 0; return_buffer->length = 0;
} }
if (ACPI_SUCCESS(status)) { if (ACPI_FAILURE(status)) {
goto cleanup_return_object;
}
/* Dereference Index and ref_of references */ /* Dereference Index and ref_of references */
@ -397,16 +403,13 @@ acpi_evaluate_object(acpi_handle handle,
/* Get the size of the returned object */ /* Get the size of the returned object */
status = status = acpi_ut_get_object_size(info->return_object,
acpi_ut_get_object_size(info->return_object,
&buffer_space_needed); &buffer_space_needed);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Validate/Allocate/Clear caller buffer */ /* Validate/Allocate/Clear caller buffer */
status = status = acpi_ut_initialize_buffer(return_buffer,
acpi_ut_initialize_buffer
(return_buffer,
buffer_space_needed); buffer_space_needed);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* /*
@ -415,22 +418,18 @@ acpi_evaluate_object(acpi_handle handle,
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Needed buffer size %X, %s\n", "Needed buffer size %X, %s\n",
(u32) (u32)buffer_space_needed,
buffer_space_needed, acpi_format_exception(status)));
acpi_format_exception
(status)));
} else { } else {
/* We have enough space for the object, build it */ /* We have enough space for the object, build it */
status = status =
acpi_ut_copy_iobject_to_eobject acpi_ut_copy_iobject_to_eobject(info->return_object,
(info->return_object,
return_buffer); return_buffer);
} }
} }
}
} cleanup_return_object:
}
if (info->return_object) { if (info->return_object) {
/* /*

View file

@ -158,7 +158,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
* *
******************************************************************************/ ******************************************************************************/
char *acpi_ps_get_opcode_name(u16 opcode) const char *acpi_ps_get_opcode_name(u16 opcode)
{ {
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)

View file

@ -128,7 +128,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml)
if (op_info->flags & AML_DEFER) { if (op_info->flags & AML_DEFER) {
flags = ACPI_PARSEOP_DEFERRED; flags = ACPI_PARSEOP_DEFERRED;
} else if (op_info->flags & AML_NAMED) { } else if (op_info->flags & AML_NAMED) {
flags = ACPI_PARSEOP_NAMED; flags = ACPI_PARSEOP_NAMED_OBJECT;
} else if (opcode == AML_INT_BYTELIST_OP) { } else if (opcode == AML_INT_BYTELIST_OP) {
flags = ACPI_PARSEOP_BYTELIST; flags = ACPI_PARSEOP_BYTELIST;
} }

View file

@ -52,17 +52,17 @@ ACPI_MODULE_NAME("rsdump")
* All functions in this module are used by the AML Debugger only * All functions in this module are used by the AML Debugger only
*/ */
/* Local prototypes */ /* Local prototypes */
static void acpi_rs_out_string(char *title, char *value); static void acpi_rs_out_string(const char *title, const char *value);
static void acpi_rs_out_integer8(char *title, u8 value); static void acpi_rs_out_integer8(const char *title, u8 value);
static void acpi_rs_out_integer16(char *title, u16 value); static void acpi_rs_out_integer16(const char *title, u16 value);
static void acpi_rs_out_integer32(char *title, u32 value); static void acpi_rs_out_integer32(const char *title, u32 value);
static void acpi_rs_out_integer64(char *title, u64 value); static void acpi_rs_out_integer64(const char *title, u64 value);
static void acpi_rs_out_title(char *title); static void acpi_rs_out_title(const char *title);
static void acpi_rs_dump_byte_list(u16 length, u8 *data); static void acpi_rs_dump_byte_list(u16 length, u8 *data);
@ -208,7 +208,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
{ {
u8 *target = NULL; u8 *target = NULL;
u8 *previous_target; u8 *previous_target;
char *name; const char *name;
u8 count; u8 count;
/* First table entry must contain the table length (# of table entries) */ /* First table entry must contain the table length (# of table entries) */
@ -248,10 +248,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
case ACPI_RSD_UINT8: case ACPI_RSD_UINT8:
if (table->pointer) { if (table->pointer) {
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name,
table-> table->pointer[*target]);
pointer
[*target]));
} else { } else {
acpi_rs_out_integer8(name, ACPI_GET8(target)); acpi_rs_out_integer8(name, ACPI_GET8(target));
} }
@ -276,26 +274,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
case ACPI_RSD_1BITFLAG: case ACPI_RSD_1BITFLAG:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name,
table-> table->pointer[*target & 0x01]);
pointer[*target &
0x01]));
break; break;
case ACPI_RSD_2BITFLAG: case ACPI_RSD_2BITFLAG:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name,
table-> table->pointer[*target & 0x03]);
pointer[*target &
0x03]));
break; break;
case ACPI_RSD_3BITFLAG: case ACPI_RSD_3BITFLAG:
acpi_rs_out_string(name, ACPI_CAST_PTR(char, acpi_rs_out_string(name,
table-> table->pointer[*target & 0x07]);
pointer[*target &
0x07]));
break; break;
case ACPI_RSD_SHORTLIST: case ACPI_RSD_SHORTLIST:
@ -481,7 +473,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
* *
******************************************************************************/ ******************************************************************************/
static void acpi_rs_out_string(char *title, char *value) static void acpi_rs_out_string(const char *title, const char *value)
{ {
acpi_os_printf("%27s : %s", title, value); acpi_os_printf("%27s : %s", title, value);
@ -491,30 +483,30 @@ static void acpi_rs_out_string(char *title, char *value)
acpi_os_printf("\n"); acpi_os_printf("\n");
} }
static void acpi_rs_out_integer8(char *title, u8 value) static void acpi_rs_out_integer8(const char *title, u8 value)
{ {
acpi_os_printf("%27s : %2.2X\n", title, value); acpi_os_printf("%27s : %2.2X\n", title, value);
} }
static void acpi_rs_out_integer16(char *title, u16 value) static void acpi_rs_out_integer16(const char *title, u16 value)
{ {
acpi_os_printf("%27s : %4.4X\n", title, value); acpi_os_printf("%27s : %4.4X\n", title, value);
} }
static void acpi_rs_out_integer32(char *title, u32 value) static void acpi_rs_out_integer32(const char *title, u32 value)
{ {
acpi_os_printf("%27s : %8.8X\n", title, value); acpi_os_printf("%27s : %8.8X\n", title, value);
} }
static void acpi_rs_out_integer64(char *title, u64 value) static void acpi_rs_out_integer64(const char *title, u64 value)
{ {
acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
} }
static void acpi_rs_out_title(char *title) static void acpi_rs_out_title(const char *title)
{ {
acpi_os_printf("%27s : ", title); acpi_os_printf("%27s : ", title);

View file

@ -330,19 +330,20 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.connection_sharing),"ConnectionSharing", acpi_gbl_shr_decode}, \
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \
{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \
{ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL}, {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL},
struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = { struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[11] = {
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus), {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
"Common Serial Bus", NULL}, "Common Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS ACPI_RS_DUMP_COMMON_SERIAL_BUS
}; };
struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = { struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[14] = {
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus), {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
"I2C Serial Bus", NULL}, "I2C Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
@ -355,7 +356,7 @@ struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
"SlaveAddress", NULL}, "SlaveAddress", NULL},
}; };
struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = { struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[18] = {
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus), {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
"Spi Serial Bus", NULL}, "Spi Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
@ -376,7 +377,7 @@ struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
"ConnectionSpeed", NULL}, "ConnectionSpeed", NULL},
}; };
struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = { struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[20] = {
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus), {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
"Uart Serial Bus", NULL}, "Uart Serial Bus", NULL},
ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG, ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,

View file

@ -151,7 +151,7 @@ struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
* *
******************************************************************************/ ******************************************************************************/
struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = { struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus), ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)}, ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
@ -177,6 +177,11 @@ struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
AML_OFFSET(common_serial_bus.flags), AML_OFFSET(common_serial_bus.flags),
1}, 1},
{ACPI_RSC_1BITFLAG,
ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
AML_OFFSET(common_serial_bus.flags),
2},
{ACPI_RSC_MOVE8, {ACPI_RSC_MOVE8,
ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
AML_OFFSET(common_serial_bus.type_revision_id), AML_OFFSET(common_serial_bus.type_revision_id),
@ -237,7 +242,7 @@ struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
* *
******************************************************************************/ ******************************************************************************/
struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = { struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
ACPI_RS_SIZE(struct acpi_resource_spi_serialbus), ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)}, ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
@ -263,6 +268,11 @@ struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
AML_OFFSET(common_serial_bus.flags), AML_OFFSET(common_serial_bus.flags),
1}, 1},
{ACPI_RSC_1BITFLAG,
ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
AML_OFFSET(common_serial_bus.flags),
2},
{ACPI_RSC_MOVE8, {ACPI_RSC_MOVE8,
ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
AML_OFFSET(common_serial_bus.type_revision_id), AML_OFFSET(common_serial_bus.type_revision_id),
@ -339,7 +349,7 @@ struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
* *
******************************************************************************/ ******************************************************************************/
struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = { struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
ACPI_RS_SIZE(struct acpi_resource_uart_serialbus), ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)}, ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
@ -365,6 +375,11 @@ struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = {
AML_OFFSET(common_serial_bus.flags), AML_OFFSET(common_serial_bus.flags),
1}, 1},
{ACPI_RSC_1BITFLAG,
ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
AML_OFFSET(common_serial_bus.flags),
2},
{ACPI_RSC_MOVE8, {ACPI_RSC_MOVE8,
ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
AML_OFFSET(common_serial_bus.type_revision_id), AML_OFFSET(common_serial_bus.type_revision_id),

View file

@ -671,7 +671,7 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
acpi_status acpi_status
acpi_rs_get_method_data(acpi_handle handle, acpi_rs_get_method_data(acpi_handle handle,
char *path, struct acpi_buffer *ret_buffer) const char *path, struct acpi_buffer *ret_buffer)
{ {
union acpi_operand_object *obj_desc; union acpi_operand_object *obj_desc;
acpi_status status; acpi_status status;

View file

@ -401,7 +401,7 @@ acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature)
ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY,
"%4.4s 0x%8.8X%8.8X" "%4.4s 0x%8.8X%8.8X"
" Attempted table install failed", " Attempted table install failed",
acpi_ut_valid_acpi_name(table_desc-> acpi_ut_valid_nameseg(table_desc->
signature. signature.
ascii) ? ascii) ?
table_desc->signature.ascii : "????", table_desc->signature.ascii : "????",
@ -467,8 +467,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
if (acpi_gbl_root_table_list.tables) { if (acpi_gbl_root_table_list.tables) {
memcpy(tables, acpi_gbl_root_table_list.tables, memcpy(tables, acpi_gbl_root_table_list.tables,
(acpi_size) table_count * (acpi_size)table_count * sizeof(struct acpi_table_desc));
sizeof(struct acpi_table_desc));
if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
ACPI_FREE(acpi_gbl_root_table_list.tables); ACPI_FREE(acpi_gbl_root_table_list.tables);

View file

@ -53,7 +53,7 @@ static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 space_id, u8 space_id,
u8 byte_width, u8 byte_width,
u64 address, char *register_name, u8 flags); u64 address, const char *register_name, u8 flags);
static void acpi_tb_convert_fadt(void); static void acpi_tb_convert_fadt(void);
@ -65,7 +65,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64);
/* Table for conversion of FADT to common internal format and FADT validation */ /* Table for conversion of FADT to common internal format and FADT validation */
typedef struct acpi_fadt_info { typedef struct acpi_fadt_info {
char *name; const char *name;
u16 address64; u16 address64;
u16 address32; u16 address32;
u16 length; u16 length;
@ -192,7 +192,7 @@ static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 space_id, u8 space_id,
u8 byte_width, u8 byte_width,
u64 address, char *register_name, u8 flags) u64 address, const char *register_name, u8 flags)
{ {
u8 bit_width; u8 bit_width;
@ -385,14 +385,15 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
{ {
/* /*
* Check if the FADT is larger than the largest table that we expect * Check if the FADT is larger than the largest table that we expect
* (the ACPI 5.0 version). If so, truncate the table, and issue * (typically the current ACPI specification version). If so, truncate
* a warning. * the table, and issue a warning.
*/ */
if (length > sizeof(struct acpi_table_fadt)) { if (length > sizeof(struct acpi_table_fadt)) {
ACPI_BIOS_WARNING((AE_INFO, ACPI_BIOS_WARNING((AE_INFO,
"FADT (revision %u) is longer than ACPI 5.0 version, " "FADT (revision %u) is longer than %s length, "
"truncating length %u to %u", "truncating length %u to %u",
table->revision, length, table->revision, ACPI_FADT_CONFORMANCE,
length,
(u32)sizeof(struct acpi_table_fadt))); (u32)sizeof(struct acpi_table_fadt)));
} }
@ -467,7 +468,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
static void acpi_tb_convert_fadt(void) static void acpi_tb_convert_fadt(void)
{ {
char *name; const char *name;
struct acpi_generic_address *address64; struct acpi_generic_address *address64;
u32 address32; u32 address32;
u8 length; u8 length;
@ -646,9 +647,12 @@ static void acpi_tb_convert_fadt(void)
if ((address64->address && !length) || if ((address64->address && !length) ||
(!address64->address && length)) { (!address64->address && length)) {
ACPI_BIOS_WARNING((AE_INFO, ACPI_BIOS_WARNING((AE_INFO,
"Optional FADT field %s has zero address or length: " "Optional FADT field %s has valid %s but zero %s: "
"0x%8.8X%8.8X/0x%X", "0x%8.8X%8.8X/0x%X", name,
name, (length ? "Length" :
"Address"),
(length ? "Address" :
"Length"),
ACPI_FORMAT_UINT64 ACPI_FORMAT_UINT64
(address64->address), (address64->address),
length)); length));

View file

@ -76,7 +76,7 @@ acpi_tb_find_table(char *signature,
/* Validate the input table signature */ /* Validate the input table signature */
if (!acpi_is_valid_signature(signature)) { if (!acpi_ut_valid_nameseg(signature)) {
return_ACPI_STATUS(AE_BAD_SIGNATURE); return_ACPI_STATUS(AE_BAD_SIGNATURE);
} }

View file

@ -299,7 +299,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,
ACPI_BIOS_ERROR((AE_INFO, ACPI_BIOS_ERROR((AE_INFO,
"Table has invalid signature [%4.4s] (0x%8.8X), " "Table has invalid signature [%4.4s] (0x%8.8X), "
"must be SSDT or OEMx", "must be SSDT or OEMx",
acpi_ut_valid_acpi_name(new_table_desc. acpi_ut_valid_nameseg(new_table_desc.
signature. signature.
ascii) ? ascii) ?
new_table_desc.signature. new_table_desc.signature.

View file

@ -380,30 +380,3 @@ next_table:
acpi_os_unmap_memory(table, length); acpi_os_unmap_memory(table, length);
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/*******************************************************************************
*
* FUNCTION: acpi_is_valid_signature
*
* PARAMETERS: signature - Sig string to be validated
*
* RETURN: TRUE if signature is has 4 valid ACPI characters
*
* DESCRIPTION: Validate an ACPI table signature.
*
******************************************************************************/
u8 acpi_is_valid_signature(char *signature)
{
u32 i;
/* Validate each character in the signature */
for (i = 0; i < ACPI_NAME_SIZE; i++) {
if (!acpi_ut_valid_acpi_char(signature[i], i)) {
return (FALSE);
}
}
return (TRUE);
}

View file

@ -82,7 +82,7 @@ acpi_status __init acpi_load_tables(void)
* their customized default region handlers. * their customized default region handlers.
*/ */
status = acpi_ev_install_region_handlers(); status = acpi_ev_install_region_handlers();
if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"During Region initialization")); "During Region initialization"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);

View file

@ -272,8 +272,7 @@ acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ut_initialize_buffer(struct acpi_buffer * buffer, acpi_ut_initialize_buffer(struct acpi_buffer *buffer, acpi_size required_length)
acpi_size required_length)
{ {
acpi_size input_buffer_length; acpi_size input_buffer_length;

View file

@ -0,0 +1,140 @@
/******************************************************************************
*
* Module Name: utascii - Utility ascii functions
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
/*******************************************************************************
*
* FUNCTION: acpi_ut_valid_nameseg
*
* PARAMETERS: name - The name or table signature to be examined.
* Four characters, does not have to be a
* NULL terminated string.
*
* RETURN: TRUE if signature is has 4 valid ACPI characters
*
* DESCRIPTION: Validate an ACPI table signature.
*
******************************************************************************/
u8 acpi_ut_valid_nameseg(char *name)
{
u32 i;
/* Validate each character in the signature */
for (i = 0; i < ACPI_NAME_SIZE; i++) {
if (!acpi_ut_valid_name_char(name[i], i)) {
return (FALSE);
}
}
return (TRUE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_valid_name_char
*
* PARAMETERS: char - The character to be examined
* position - Byte position (0-3)
*
* RETURN: TRUE if the character is valid, FALSE otherwise
*
* DESCRIPTION: Check for a valid ACPI character. Must be one of:
* 1) Upper case alpha
* 2) numeric
* 3) underscore
*
* We allow a '!' as the last character because of the ASF! table
*
******************************************************************************/
u8 acpi_ut_valid_name_char(char character, u32 position)
{
if (!((character >= 'A' && character <= 'Z') ||
(character >= '0' && character <= '9') || (character == '_'))) {
/* Allow a '!' in the last position */
if (character == '!' && position == 3) {
return (TRUE);
}
return (FALSE);
}
return (TRUE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_check_and_repair_ascii
*
* PARAMETERS: name - Ascii string
* count - Number of characters to check
*
* RETURN: None
*
* DESCRIPTION: Ensure that the requested number of characters are printable
* Ascii characters. Sets non-printable and null chars to <space>.
*
******************************************************************************/
void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count)
{
u32 i;
for (i = 0; i < count; i++) {
repaired_name[i] = (char)name[i];
if (!name[i]) {
return;
}
if (!isprint(name[i])) {
repaired_name[i] = ' ';
}
}
}

View file

@ -184,8 +184,7 @@ acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status acpi_os_release_object(struct acpi_memory_list *cache, void *object)
acpi_os_release_object(struct acpi_memory_list * cache, void *object)
{ {
acpi_status status; acpi_status status;

View file

@ -51,13 +51,9 @@
ACPI_MODULE_NAME("utdebug") ACPI_MODULE_NAME("utdebug")
#ifdef ACPI_DEBUG_OUTPUT #ifdef ACPI_DEBUG_OUTPUT
static acpi_thread_id acpi_gbl_prev_thread_id = (acpi_thread_id) 0xFFFFFFFF; static acpi_thread_id acpi_gbl_previous_thread_id = (acpi_thread_id) 0xFFFFFFFF;
static char *acpi_gbl_fn_entry_str = "----Entry"; static const char *acpi_gbl_function_entry_prefix = "----Entry";
static char *acpi_gbl_fn_exit_str = "----Exit-"; static const char *acpi_gbl_function_exit_prefix = "----Exit-";
/* Local prototypes */
static const char *acpi_ut_trim_function_name(const char *function_name);
/******************************************************************************* /*******************************************************************************
* *
@ -178,14 +174,14 @@ acpi_debug_print(u32 requested_debug_level,
* Thread tracking and context switch notification * Thread tracking and context switch notification
*/ */
thread_id = acpi_os_get_thread_id(); thread_id = acpi_os_get_thread_id();
if (thread_id != acpi_gbl_prev_thread_id) { if (thread_id != acpi_gbl_previous_thread_id) {
if (ACPI_LV_THREADS & acpi_dbg_level) { if (ACPI_LV_THREADS & acpi_dbg_level) {
acpi_os_printf acpi_os_printf
("\n**** Context Switch from TID %u to TID %u ****\n\n", ("\n**** Context Switch from TID %u to TID %u ****\n\n",
(u32)acpi_gbl_prev_thread_id, (u32)thread_id); (u32)acpi_gbl_previous_thread_id, (u32)thread_id);
} }
acpi_gbl_prev_thread_id = thread_id; acpi_gbl_previous_thread_id = thread_id;
acpi_gbl_nesting_level = 0; acpi_gbl_nesting_level = 0;
} }
@ -287,7 +283,8 @@ acpi_ut_trace(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, line_number, function_name, module_name,
component_id, "%s\n", acpi_gbl_fn_entry_str); component_id, "%s\n",
acpi_gbl_function_entry_prefix);
} }
} }
@ -312,7 +309,8 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace)
void void
acpi_ut_trace_ptr(u32 line_number, acpi_ut_trace_ptr(u32 line_number,
const char *function_name, const char *function_name,
const char *module_name, u32 component_id, void *pointer) const char *module_name,
u32 component_id, const void *pointer)
{ {
acpi_gbl_nesting_level++; acpi_gbl_nesting_level++;
@ -323,8 +321,8 @@ acpi_ut_trace_ptr(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, line_number, function_name, module_name,
component_id, "%s %p\n", acpi_gbl_fn_entry_str, component_id, "%s %p\n",
pointer); acpi_gbl_function_entry_prefix, pointer);
} }
} }
@ -348,7 +346,7 @@ acpi_ut_trace_ptr(u32 line_number,
void void
acpi_ut_trace_str(u32 line_number, acpi_ut_trace_str(u32 line_number,
const char *function_name, const char *function_name,
const char *module_name, u32 component_id, char *string) const char *module_name, u32 component_id, const char *string)
{ {
acpi_gbl_nesting_level++; acpi_gbl_nesting_level++;
@ -359,8 +357,8 @@ acpi_ut_trace_str(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, line_number, function_name, module_name,
component_id, "%s %s\n", acpi_gbl_fn_entry_str, component_id, "%s %s\n",
string); acpi_gbl_function_entry_prefix, string);
} }
} }
@ -396,7 +394,7 @@ acpi_ut_trace_u32(u32 line_number,
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, line_number, function_name, module_name,
component_id, "%s %08X\n", component_id, "%s %08X\n",
acpi_gbl_fn_entry_str, integer); acpi_gbl_function_entry_prefix, integer);
} }
} }
@ -427,7 +425,8 @@ acpi_ut_exit(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, line_number, function_name, module_name,
component_id, "%s\n", acpi_gbl_fn_exit_str); component_id, "%s\n",
acpi_gbl_function_exit_prefix);
} }
if (acpi_gbl_nesting_level) { if (acpi_gbl_nesting_level) {
@ -467,14 +466,14 @@ acpi_ut_status_exit(u32 line_number,
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, line_number, function_name,
module_name, component_id, "%s %s\n", module_name, component_id, "%s %s\n",
acpi_gbl_fn_exit_str, acpi_gbl_function_exit_prefix,
acpi_format_exception(status)); acpi_format_exception(status));
} else { } else {
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, line_number, function_name,
module_name, component_id, module_name, component_id,
"%s ****Exception****: %s\n", "%s ****Exception****: %s\n",
acpi_gbl_fn_exit_str, acpi_gbl_function_exit_prefix,
acpi_format_exception(status)); acpi_format_exception(status));
} }
} }
@ -514,7 +513,7 @@ acpi_ut_value_exit(u32 line_number,
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, line_number, function_name, module_name,
component_id, "%s %8.8X%8.8X\n", component_id, "%s %8.8X%8.8X\n",
acpi_gbl_fn_exit_str, acpi_gbl_function_exit_prefix,
ACPI_FORMAT_UINT64(value)); ACPI_FORMAT_UINT64(value));
} }
@ -552,8 +551,8 @@ acpi_ut_ptr_exit(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS, acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, line_number, function_name, module_name,
component_id, "%s %p\n", acpi_gbl_fn_exit_str, component_id, "%s %p\n",
ptr); acpi_gbl_function_exit_prefix, ptr);
} }
if (acpi_gbl_nesting_level) { if (acpi_gbl_nesting_level) {

View file

@ -446,7 +446,7 @@ const char *acpi_ut_get_mutex_name(u32 mutex_id)
/* Names for Notify() values, used for debug output */ /* Names for Notify() values, used for debug output */
static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = { static const char *acpi_gbl_generic_notify[ACPI_GENERIC_NOTIFY_MAX + 1] = {
/* 00 */ "Bus Check", /* 00 */ "Bus Check",
/* 01 */ "Device Check", /* 01 */ "Device Check",
/* 02 */ "Device Wake", /* 02 */ "Device Wake",
@ -460,48 +460,52 @@ static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = {
/* 0A */ "Reserved", /* 0A */ "Reserved",
/* 0B */ "System Locality Update", /* 0B */ "System Locality Update",
/* 0C */ "Shutdown Request", /* 0C */ "Shutdown Request",
/* Reserved in ACPI 6.0 */
/* 0D */ "System Resource Affinity Update" /* 0D */ "System Resource Affinity Update"
}; };
static const char *acpi_gbl_device_notify[4] = { static const char *acpi_gbl_device_notify[5] = {
/* 80 */ "Status Change", /* 80 */ "Status Change",
/* 81 */ "Information Change", /* 81 */ "Information Change",
/* 82 */ "Device-Specific Change", /* 82 */ "Device-Specific Change",
/* 83 */ "Device-Specific Change" /* 83 */ "Device-Specific Change",
/* 84 */ "Reserved"
}; };
static const char *acpi_gbl_processor_notify[4] = { static const char *acpi_gbl_processor_notify[5] = {
/* 80 */ "Performance Capability Change", /* 80 */ "Performance Capability Change",
/* 81 */ "C-State Change", /* 81 */ "C-State Change",
/* 82 */ "Throttling Capability Change", /* 82 */ "Throttling Capability Change",
/* 83 */ "Device-Specific Change" /* 83 */ "Guaranteed Change",
/* 84 */ "Minimum Excursion"
}; };
static const char *acpi_gbl_thermal_notify[4] = { static const char *acpi_gbl_thermal_notify[5] = {
/* 80 */ "Thermal Status Change", /* 80 */ "Thermal Status Change",
/* 81 */ "Thermal Trip Point Change", /* 81 */ "Thermal Trip Point Change",
/* 82 */ "Thermal Device List Change", /* 82 */ "Thermal Device List Change",
/* 83 */ "Thermal Relationship Change" /* 83 */ "Thermal Relationship Change",
/* 84 */ "Reserved"
}; };
const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type) const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type)
{ {
/* 00 - 0D are common to all object types */ /* 00 - 0D are "common to all object types" (from ACPI Spec) */
if (notify_value <= ACPI_NOTIFY_MAX) { if (notify_value <= ACPI_GENERIC_NOTIFY_MAX) {
return (acpi_gbl_generic_notify[notify_value]); return (acpi_gbl_generic_notify[notify_value]);
} }
/* 0D - 7F are reserved */ /* 0E - 7F are reserved */
if (notify_value <= ACPI_MAX_SYS_NOTIFY) { if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
return ("Reserved"); return ("Reserved");
} }
/* 80 - 83 are per-object-type */ /* 80 - 84 are per-object-type */
if (notify_value <= 0x83) { if (notify_value <= ACPI_SPECIFIC_NOTIFY_MAX) {
switch (type) { switch (type) {
case ACPI_TYPE_ANY: case ACPI_TYPE_ANY:
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:

View file

@ -69,7 +69,7 @@ ACPI_MODULE_NAME("uteval")
acpi_status acpi_status
acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
char *path, const char *path,
u32 expected_return_btypes, u32 expected_return_btypes,
union acpi_operand_object **return_desc) union acpi_operand_object **return_desc)
{ {
@ -204,7 +204,7 @@ cleanup:
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ut_evaluate_numeric_object(char *object_name, acpi_ut_evaluate_numeric_object(const char *object_name,
struct acpi_namespace_node *device_node, struct acpi_namespace_node *device_node,
u64 *value) u64 *value)
{ {

View file

@ -80,6 +80,11 @@ const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
"_S4D" "_S4D"
}; };
/* Hex-to-ascii */
const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
/******************************************************************************* /*******************************************************************************
* *
* Namespace globals * Namespace globals
@ -221,6 +226,49 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
}; };
#endif /* !ACPI_REDUCED_HARDWARE */ #endif /* !ACPI_REDUCED_HARDWARE */
#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
/* to_pld macro: compile/disassemble strings */
const char *acpi_gbl_pld_panel_list[] = {
"TOP",
"BOTTOM",
"LEFT",
"RIGHT",
"FRONT",
"BACK",
"UNKNOWN",
NULL
};
const char *acpi_gbl_pld_vertical_position_list[] = {
"UPPER",
"CENTER",
"LOWER",
NULL
};
const char *acpi_gbl_pld_horizontal_position_list[] = {
"LEFT",
"CENTER",
"RIGHT",
NULL
};
const char *acpi_gbl_pld_shape_list[] = {
"ROUND",
"OVAL",
"SQUARE",
"VERTICALRECTANGLE",
"HORIZONTALRECTANGLE",
"VERTICALTRAPEZOID",
"HORIZONTALTRAPEZOID",
"UNKNOWN",
"CHAMFERED",
NULL
};
#endif
/* Public globals */ /* Public globals */
ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)

View file

@ -361,7 +361,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
void void
acpi_ut_display_init_pathname(u8 type, acpi_ut_display_init_pathname(u8 type,
struct acpi_namespace_node *obj_handle, struct acpi_namespace_node *obj_handle,
char *path) const char *path)
{ {
acpi_status status; acpi_status status;
struct acpi_buffer buffer; struct acpi_buffer buffer;

View file

@ -206,36 +206,40 @@ acpi_ut_safe_strncat(char *dest,
* FUNCTION: acpi_ut_strtoul64 * FUNCTION: acpi_ut_strtoul64
* *
* PARAMETERS: string - Null terminated string * PARAMETERS: string - Null terminated string
* base - Radix of the string: 16 or ACPI_ANY_BASE; * base - Radix of the string: 16 or 10 or
* ACPI_ANY_BASE means 'in behalf of to_integer' * ACPI_ANY_BASE
* ret_integer - Where the converted integer is returned * max_integer_byte_width - Maximum allowable integer,in bytes:
* 4 or 8 (32 or 64 bits)
* ret_integer - Where the converted integer is
* returned
* *
* RETURN: Status and Converted value * RETURN: Status and Converted value
* *
* DESCRIPTION: Convert a string into an unsigned value. Performs either a * DESCRIPTION: Convert a string into an unsigned value. Performs either a
* 32-bit or 64-bit conversion, depending on the current mode * 32-bit or 64-bit conversion, depending on the input integer
* of the interpreter. * size (often the current mode of the interpreter).
* *
* NOTES: acpi_gbl_integer_byte_width should be set to the proper width. * NOTES: Negative numbers are not supported, as they are not supported
* by ACPI.
*
* acpi_gbl_integer_byte_width should be set to the proper width.
* For the core ACPICA code, this width depends on the DSDT * For the core ACPICA code, this width depends on the DSDT
* version. For iASL, the default byte width is always 8. * version. For iASL, the default byte width is always 8 for the
* parser, but error checking is performed later to flag cases
* where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
* *
* Does not support Octal strings, not needed at this time. * Does not support Octal strings, not needed at this time.
* *
* There is an earlier version of the function after this one,
* below. It is slightly different than this one, and the two
* may eventually may need to be merged. (01/2016).
*
******************************************************************************/ ******************************************************************************/
acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer) acpi_status
acpi_ut_strtoul64(char *string,
u32 base, u32 max_integer_byte_width, u64 *ret_integer)
{ {
u32 this_digit = 0; u32 this_digit = 0;
u64 return_value = 0; u64 return_value = 0;
u64 quotient; u64 quotient;
u64 dividend; u64 dividend;
u32 to_integer_op = (base == ACPI_ANY_BASE);
u32 mode32 = (acpi_gbl_integer_byte_width == 4);
u8 valid_digits = 0; u8 valid_digits = 0;
u8 sign_of0x = 0; u8 sign_of0x = 0;
u8 term = 0; u8 term = 0;
@ -244,6 +248,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
switch (base) { switch (base) {
case ACPI_ANY_BASE: case ACPI_ANY_BASE:
case 10:
case 16: case 16:
break; break;
@ -265,9 +270,9 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
string++; string++;
} }
if (to_integer_op) { if (base == ACPI_ANY_BASE) {
/* /*
* Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.
* We need to determine if it is decimal or hexadecimal. * We need to determine if it is decimal or hexadecimal.
*/ */
if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) { if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) {
@ -284,7 +289,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
/* Any string left? Check that '0x' is not followed by white space. */ /* Any string left? Check that '0x' is not followed by white space. */
if (!(*string) || isspace((int)*string) || *string == '\t') { if (!(*string) || isspace((int)*string) || *string == '\t') {
if (to_integer_op) { if (base == ACPI_ANY_BASE) {
goto error_exit; goto error_exit;
} else { } else {
goto all_done; goto all_done;
@ -292,10 +297,11 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
} }
/* /*
* Perform a 32-bit or 64-bit conversion, depending upon the current * Perform a 32-bit or 64-bit conversion, depending upon the input
* execution mode of the interpreter * byte width
*/ */
dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; dividend = (max_integer_byte_width <= ACPI_MAX32_BYTE_WIDTH) ?
ACPI_UINT32_MAX : ACPI_UINT64_MAX;
/* Main loop: convert the string to a 32- or 64-bit integer */ /* Main loop: convert the string to a 32- or 64-bit integer */
@ -323,7 +329,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
} }
if (term) { if (term) {
if (to_integer_op) { if (base == ACPI_ANY_BASE) {
goto error_exit; goto error_exit;
} else { } else {
break; break;
@ -338,12 +344,13 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
valid_digits++; valid_digits++;
if (sign_of0x if (sign_of0x && ((valid_digits > 16) ||
&& ((valid_digits > 16) ((valid_digits > 8)
|| ((valid_digits > 8) && mode32))) { && (max_integer_byte_width <=
ACPI_MAX32_BYTE_WIDTH)))) {
/* /*
* This is to_integer operation case. * This is to_integer operation case.
* No any restrictions for string-to-integer conversion, * No restrictions for string-to-integer conversion,
* see ACPI spec. * see ACPI spec.
*/ */
goto error_exit; goto error_exit;
@ -355,7 +362,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
&quotient, NULL); &quotient, NULL);
if (return_value > quotient) { if (return_value > quotient) {
if (to_integer_op) { if (base == ACPI_ANY_BASE) {
goto error_exit; goto error_exit;
} else { } else {
break; break;
@ -378,7 +385,8 @@ all_done:
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
error_exit: error_exit:
/* Base was set/validated above */
/* Base was set/validated above (10 or 16) */
if (base == 10) { if (base == 10) {
return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT); return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
@ -388,8 +396,7 @@ error_exit:
} }
#ifdef _OBSOLETE_FUNCTIONS #ifdef _OBSOLETE_FUNCTIONS
/* TBD: use version in ACPICA main code base? */ /* Removed: 01/2016 */
/* DONE: 01/2016 */
/******************************************************************************* /*******************************************************************************
* *

View file

@ -67,11 +67,6 @@ static char *acpi_ut_format_number(char *string,
static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper); static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper);
/* Module globals */
static const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
static const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ut_bound_string_length * FUNCTION: acpi_ut_bound_string_length

View file

@ -143,73 +143,6 @@ void acpi_ut_print_string(char *string, u16 max_length)
} }
} }
/*******************************************************************************
*
* FUNCTION: acpi_ut_valid_acpi_char
*
* PARAMETERS: char - The character to be examined
* position - Byte position (0-3)
*
* RETURN: TRUE if the character is valid, FALSE otherwise
*
* DESCRIPTION: Check for a valid ACPI character. Must be one of:
* 1) Upper case alpha
* 2) numeric
* 3) underscore
*
* We allow a '!' as the last character because of the ASF! table
*
******************************************************************************/
u8 acpi_ut_valid_acpi_char(char character, u32 position)
{
if (!((character >= 'A' && character <= 'Z') ||
(character >= '0' && character <= '9') || (character == '_'))) {
/* Allow a '!' in the last position */
if (character == '!' && position == 3) {
return (TRUE);
}
return (FALSE);
}
return (TRUE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_valid_acpi_name
*
* PARAMETERS: name - The name to be examined. Does not have to
* be NULL terminated string.
*
* RETURN: TRUE if the name is valid, FALSE otherwise
*
* DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
* 1) Upper case alpha
* 2) numeric
* 3) underscore
*
******************************************************************************/
u8 acpi_ut_valid_acpi_name(char *name)
{
u32 i;
ACPI_FUNCTION_ENTRY();
for (i = 0; i < ACPI_NAME_SIZE; i++) {
if (!acpi_ut_valid_acpi_char(name[i], i)) {
return (FALSE);
}
}
return (TRUE);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ut_repair_name * FUNCTION: acpi_ut_repair_name
@ -253,7 +186,7 @@ void acpi_ut_repair_name(char *name)
/* Check each character in the name */ /* Check each character in the name */
for (i = 0; i < ACPI_NAME_SIZE; i++) { for (i = 0; i < ACPI_NAME_SIZE; i++) {
if (acpi_ut_valid_acpi_char(name[i], i)) { if (acpi_ut_valid_name_char(name[i], i)) {
continue; continue;
} }

View file

@ -90,7 +90,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ut_create_list(char *list_name, acpi_ut_create_list(const char *list_name,
u16 object_size, struct acpi_memory_list **return_cache) u16 object_size, struct acpi_memory_list **return_cache)
{ {
struct acpi_memory_list *cache; struct acpi_memory_list *cache;

View file

@ -582,7 +582,7 @@ static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
acpi_status acpi_status
acpi_os_predefined_override(const struct acpi_predefined_names *init_val, acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
char **new_val) acpi_string *new_val)
{ {
if (!init_val || !new_val) if (!init_val || !new_val)
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;

View file

@ -96,7 +96,7 @@ acpi_physical_address acpi_os_get_root_pointer(void);
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
acpi_status acpi_status
acpi_os_predefined_override(const struct acpi_predefined_names *init_val, acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
char **new_val); acpi_string *new_val);
#endif #endif
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override

View file

@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20160108 #define ACPI_CA_VERSION 0x20160422
#include <acpi/acconfig.h> #include <acpi/acconfig.h>
#include <acpi/actypes.h> #include <acpi/actypes.h>
@ -484,8 +484,8 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void)) ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
acpi_find_root_pointer(acpi_physical_address * acpi_find_root_pointer(acpi_physical_address
rsdp_address)) *rsdp_address))
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_EXTERNAL_RETURN_STATUS(acpi_status
acpi_get_table_header(acpi_string signature, acpi_get_table_header(acpi_string signature,
u32 instance, u32 instance,
@ -938,6 +938,7 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(void
ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1) ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
void ACPI_INTERNAL_VAR_XFACE void ACPI_INTERNAL_VAR_XFACE
acpi_log_error(const char *format, ...)) acpi_log_error(const char *format, ...))
acpi_status acpi_initialize_debugger(void); acpi_status acpi_initialize_debugger(void);
void acpi_terminate_debugger(void); void acpi_terminate_debugger(void);

View file

@ -417,6 +417,7 @@ struct acpi_resource_gpio {
u8 type; \ u8 type; \
u8 producer_consumer; /* For values, see Producer/Consumer above */\ u8 producer_consumer; /* For values, see Producer/Consumer above */\
u8 slave_mode; \ u8 slave_mode; \
u8 connection_sharing; \
u8 type_revision_id; \ u8 type_revision_id; \
u16 type_data_length; \ u16 type_data_length; \
u16 vendor_length; \ u16 vendor_length; \

View file

@ -223,7 +223,7 @@ struct acpi_table_facs {
/******************************************************************************* /*******************************************************************************
* *
* FADT - Fixed ACPI Description Table (Signature "FACP") * FADT - Fixed ACPI Description Table (Signature "FACP")
* Version 4 * Version 6
* *
******************************************************************************/ ******************************************************************************/
@ -413,4 +413,6 @@ struct acpi_table_desc {
#define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id)) #define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id))
#define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt)) #define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt))
#define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)"
#endif /* __ACTBL_H__ */ #endif /* __ACTBL_H__ */

View file

@ -236,7 +236,8 @@ enum acpi_einj_actions {
ACPI_EINJ_CHECK_BUSY_STATUS = 6, ACPI_EINJ_CHECK_BUSY_STATUS = 6,
ACPI_EINJ_GET_COMMAND_STATUS = 7, ACPI_EINJ_GET_COMMAND_STATUS = 7,
ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8, ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */ ACPI_EINJ_GET_EXECUTE_TIMINGS = 9,
ACPI_EINJ_ACTION_RESERVED = 10, /* 10 and greater are reserved */
ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */
}; };
@ -348,7 +349,8 @@ enum acpi_erst_actions {
ACPI_ERST_GET_ERROR_RANGE = 13, ACPI_ERST_GET_ERROR_RANGE = 13,
ACPI_ERST_GET_ERROR_LENGTH = 14, ACPI_ERST_GET_ERROR_LENGTH = 14,
ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, ACPI_ERST_GET_ERROR_ATTRIBUTES = 15,
ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */ ACPI_ERST_EXECUTE_TIMINGS = 16,
ACPI_ERST_ACTION_RESERVED = 17 /* 17 and greater are reserved */
}; };
/* Values for Instruction field above */ /* Values for Instruction field above */
@ -427,7 +429,8 @@ enum acpi_hest_types {
ACPI_HEST_TYPE_AER_ENDPOINT = 7, ACPI_HEST_TYPE_AER_ENDPOINT = 7,
ACPI_HEST_TYPE_AER_BRIDGE = 8, ACPI_HEST_TYPE_AER_BRIDGE = 8,
ACPI_HEST_TYPE_GENERIC_ERROR = 9, ACPI_HEST_TYPE_GENERIC_ERROR = 9,
ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10,
ACPI_HEST_TYPE_RESERVED = 11 /* 11 and greater are reserved */
}; };
/* /*
@ -506,7 +509,11 @@ enum acpi_hest_notify_types {
ACPI_HEST_NOTIFY_NMI = 4, ACPI_HEST_NOTIFY_NMI = 4,
ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */
ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */
ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */ ACPI_HEST_NOTIFY_GPIO = 7, /* ACPI 6.0 */
ACPI_HEST_NOTIFY_SEA = 8, /* ACPI 6.1 */
ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */
ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */
ACPI_HEST_NOTIFY_RESERVED = 11 /* 11 and greater are reserved */
}; };
/* Values for config_write_enable bitfield above */ /* Values for config_write_enable bitfield above */
@ -603,6 +610,24 @@ struct acpi_hest_generic {
u32 error_block_length; u32 error_block_length;
}; };
/* 10: Generic Hardware Error Source, version 2 */
struct acpi_hest_generic_v2 {
struct acpi_hest_header header;
u16 related_source_id;
u8 reserved;
u8 enabled;
u32 records_to_preallocate;
u32 max_sections_per_record;
u32 max_raw_data_length;
struct acpi_generic_address error_status_address;
struct acpi_hest_notify notify;
u32 error_block_length;
struct acpi_generic_address read_ack_register;
u64 read_ack_preserve;
u64 read_ack_write;
};
/* Generic Error Status block */ /* Generic Error Status block */
struct acpi_hest_generic_status { struct acpi_hest_generic_status {
@ -634,6 +659,33 @@ struct acpi_hest_generic_data {
u8 fru_text[20]; u8 fru_text[20];
}; };
/* Extension for revision 0x0300 */
struct acpi_hest_generic_data_v300 {
u8 section_type[16];
u32 error_severity;
u16 revision;
u8 validation_bits;
u8 flags;
u32 error_data_length;
u8 fru_id[16];
u8 fru_text[20];
u64 time_stamp;
};
/* Values for error_severity above */
#define ACPI_HEST_GEN_ERROR_RECOVERABLE 0
#define ACPI_HEST_GEN_ERROR_FATAL 1
#define ACPI_HEST_GEN_ERROR_CORRECTED 2
#define ACPI_HEST_GEN_ERROR_NONE 3
/* Flags for validation_bits above */
#define ACPI_HEST_GEN_VALID_FRU_ID (1)
#define ACPI_HEST_GEN_VALID_FRU_STRING (1<<1)
#define ACPI_HEST_GEN_VALID_TIMESTAMP (1<<2)
/******************************************************************************* /*******************************************************************************
* *
* MADT - Multiple APIC Description Table * MADT - Multiple APIC Description Table
@ -934,7 +986,7 @@ struct acpi_msct_proximity {
/******************************************************************************* /*******************************************************************************
* *
* NFIT - NVDIMM Interface Table (ACPI 6.0) * NFIT - NVDIMM Interface Table (ACPI 6.0+)
* Version 1 * Version 1
* *
******************************************************************************/ ******************************************************************************/
@ -1015,6 +1067,7 @@ struct acpi_nfit_memory_map {
#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */ #define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */
#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ #define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */
#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ #define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */
#define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */
/* 2: Interleave Structure */ /* 2: Interleave Structure */
@ -1046,7 +1099,10 @@ struct acpi_nfit_control_region {
u16 subsystem_vendor_id; u16 subsystem_vendor_id;
u16 subsystem_device_id; u16 subsystem_device_id;
u16 subsystem_revision_id; u16 subsystem_revision_id;
u8 reserved[6]; /* Reserved, must be zero */ u8 valid_fields;
u8 manufacturing_location;
u16 manufacturing_date;
u8 reserved[2]; /* Reserved, must be zero */
u32 serial_number; u32 serial_number;
u16 code; u16 code;
u16 windows; u16 windows;
@ -1063,6 +1119,10 @@ struct acpi_nfit_control_region {
#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */ #define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */
/* valid_fields bits */
#define ACPI_NFIT_CONTROL_MFG_INFO_VALID (1) /* Manufacturing fields are valid */
/* 5: NVDIMM Block Data Window Region Structure */ /* 5: NVDIMM Block Data Window Region Structure */
struct acpi_nfit_data_region { struct acpi_nfit_data_region {

View file

@ -321,7 +321,7 @@ struct acpi_csrt_descriptor {
* DBG2 - Debug Port Table 2 * DBG2 - Debug Port Table 2
* Version 0 (Both main table and subtables) * Version 0 (Both main table and subtables)
* *
* Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012. * Conforms to "Microsoft Debug Port Table 2 (DBG2)", December 10, 2015
* *
******************************************************************************/ ******************************************************************************/
@ -371,6 +371,11 @@ struct acpi_dbg2_device {
#define ACPI_DBG2_16550_COMPATIBLE 0x0000 #define ACPI_DBG2_16550_COMPATIBLE 0x0000
#define ACPI_DBG2_16550_SUBSET 0x0001 #define ACPI_DBG2_16550_SUBSET 0x0001
#define ACPI_DBG2_ARM_PL011 0x0003
#define ACPI_DBG2_ARM_SBSA_32BIT 0x000D
#define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E
#define ACPI_DBG2_ARM_DCC 0x000F
#define ACPI_DBG2_BCM2835 0x0010
#define ACPI_DBG2_1394_STANDARD 0x0000 #define ACPI_DBG2_1394_STANDARD 0x0000
@ -399,7 +404,7 @@ struct acpi_table_dbgp {
* Version 1 * Version 1
* *
* Conforms to "Intel Virtualization Technology for Directed I/O", * Conforms to "Intel Virtualization Technology for Directed I/O",
* Version 2.2, Sept. 2013 * Version 2.3, October 2014
* *
******************************************************************************/ ******************************************************************************/
@ -413,6 +418,8 @@ struct acpi_table_dmar {
/* Masks for Flags field above */ /* Masks for Flags field above */
#define ACPI_DMAR_INTR_REMAP (1) #define ACPI_DMAR_INTR_REMAP (1)
#define ACPI_DMAR_X2APIC_OPT_OUT (1<<1)
#define ACPI_DMAR_X2APIC_MODE (1<<2)
/* DMAR subtable header */ /* DMAR subtable header */
@ -655,7 +662,7 @@ struct acpi_ibft_target {
* IORT - IO Remapping Table * IORT - IO Remapping Table
* *
* Conforms to "IO Remapping Table System Software on ARM Platforms", * Conforms to "IO Remapping Table System Software on ARM Platforms",
* Document number: ARM DEN 0049A, 2015 * Document number: ARM DEN 0049B, October 2015
* *
******************************************************************************/ ******************************************************************************/
@ -685,7 +692,8 @@ enum acpi_iort_node_type {
ACPI_IORT_NODE_ITS_GROUP = 0x00, ACPI_IORT_NODE_ITS_GROUP = 0x00,
ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
ACPI_IORT_NODE_SMMU = 0x03 ACPI_IORT_NODE_SMMU = 0x03,
ACPI_IORT_NODE_SMMU_V3 = 0x04
}; };
struct acpi_iort_id_mapping { struct acpi_iort_id_mapping {
@ -775,6 +783,23 @@ struct acpi_iort_smmu {
#define ACPI_IORT_SMMU_DVM_SUPPORTED (1) #define ACPI_IORT_SMMU_DVM_SUPPORTED (1)
#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) #define ACPI_IORT_SMMU_COHERENT_WALK (1<<1)
struct acpi_iort_smmu_v3 {
u64 base_address; /* SMMUv3 base address */
u32 flags;
u32 reserved;
u64 vatos_address;
u32 model; /* O: generic SMMUv3 */
u32 event_gsiv;
u32 pri_gsiv;
u32 gerr_gsiv;
u32 sync_gsiv;
};
/* Masks for Flags field above */
#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (1<<1)
/******************************************************************************* /*******************************************************************************
* *
* IVRS - I/O Virtualization Reporting Structure * IVRS - I/O Virtualization Reporting Structure
@ -1102,10 +1127,10 @@ struct acpi_table_slic {
/******************************************************************************* /*******************************************************************************
* *
* SPCR - Serial Port Console Redirection table * SPCR - Serial Port Console Redirection table
* Version 1 * Version 2
* *
* Conforms to "Serial Port Console Redirection Table", * Conforms to "Serial Port Console Redirection Table",
* Version 1.00, January 11, 2002 * Version 1.03, August 10, 2015
* *
******************************************************************************/ ******************************************************************************/
@ -1137,6 +1162,8 @@ struct acpi_table_spcr {
#define ACPI_SPCR_DO_NOT_DISABLE (1) #define ACPI_SPCR_DO_NOT_DISABLE (1)
/* Values for Interface Type: See the definition of the DBG2 table */
/******************************************************************************* /*******************************************************************************
* *
* SPMI - Server Platform Management Interface table * SPMI - Server Platform Management Interface table

View file

@ -184,7 +184,7 @@ struct acpi_table_fpdt {
struct acpi_table_header header; /* Common ACPI table header */ struct acpi_table_header header; /* Common ACPI table header */
}; };
/* FPDT subtable header */ /* FPDT subtable header (Performance Record Structure) */
struct acpi_fpdt_header { struct acpi_fpdt_header {
u16 type; u16 type;
@ -205,6 +205,57 @@ enum acpi_fpdt_type {
/* 0: Firmware Basic Boot Performance Record */ /* 0: Firmware Basic Boot Performance Record */
struct acpi_fpdt_boot_pointer {
struct acpi_fpdt_header header;
u8 reserved[4];
u64 address;
};
/* 1: S3 Performance Table Pointer Record */
struct acpi_fpdt_s3pt_pointer {
struct acpi_fpdt_header header;
u8 reserved[4];
u64 address;
};
/*
* S3PT - S3 Performance Table. This table is pointed to by the
* S3 Pointer Record above.
*/
struct acpi_table_s3pt {
u8 signature[4]; /* "S3PT" */
u32 length;
};
/*
* S3PT Subtables (Not part of the actual FPDT)
*/
/* Values for Type field in S3PT header */
enum acpi_s3pt_type {
ACPI_S3PT_TYPE_RESUME = 0,
ACPI_S3PT_TYPE_SUSPEND = 1,
ACPI_FPDT_BOOT_PERFORMANCE = 2
};
struct acpi_s3pt_resume {
struct acpi_fpdt_header header;
u32 resume_count;
u64 full_resume;
u64 average_resume;
};
struct acpi_s3pt_suspend {
struct acpi_fpdt_header header;
u64 suspend_start;
u64 suspend_end;
};
/*
* FPDT Boot Performance Record (Not part of the actual FPDT)
*/
struct acpi_fpdt_boot { struct acpi_fpdt_boot {
struct acpi_fpdt_header header; struct acpi_fpdt_header header;
u8 reserved[4]; u8 reserved[4];
@ -215,52 +266,6 @@ struct acpi_fpdt_boot {
u64 exit_services_exit; u64 exit_services_exit;
}; };
/* 1: S3 Performance Table Pointer Record */
struct acpi_fpdt_s3pt_ptr {
struct acpi_fpdt_header header;
u8 reserved[4];
u64 address;
};
/*
* S3PT - S3 Performance Table. This table is pointed to by the
* FPDT S3 Pointer Record above.
*/
struct acpi_table_s3pt {
u8 signature[4]; /* "S3PT" */
u32 length;
};
/*
* S3PT Subtables
*/
struct acpi_s3pt_header {
u16 type;
u8 length;
u8 revision;
};
/* Values for Type field above */
enum acpi_s3pt_type {
ACPI_S3PT_TYPE_RESUME = 0,
ACPI_S3PT_TYPE_SUSPEND = 1
};
struct acpi_s3pt_resume {
struct acpi_s3pt_header header;
u32 resume_count;
u64 full_resume;
u64 average_resume;
};
struct acpi_s3pt_suspend {
struct acpi_s3pt_header header;
u64 suspend_start;
u64 suspend_end;
};
/******************************************************************************* /*******************************************************************************
* *
* GTDT - Generic Timer Description Table (ACPI 5.1) * GTDT - Generic Timer Description Table (ACPI 5.1)
@ -476,7 +481,8 @@ struct acpi_table_pcct {
enum acpi_pcct_type { enum acpi_pcct_type {
ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
ACPI_PCCT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */
ACPI_PCCT_TYPE_RESERVED = 3 /* 3 and greater are reserved */
}; };
/* /*
@ -515,6 +521,26 @@ struct acpi_pcct_hw_reduced {
u16 min_turnaround_time; u16 min_turnaround_time;
}; };
/* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
struct acpi_pcct_hw_reduced_type2 {
struct acpi_subtable_header header;
u32 doorbell_interrupt;
u8 flags;
u8 reserved;
u64 base_address;
u64 length;
struct acpi_generic_address doorbell_register;
u64 preserve_mask;
u64 write_mask;
u32 latency;
u32 max_access_rate;
u16 min_turnaround_time;
struct acpi_generic_address doorbell_ack_register;
u64 ack_preserve_mask;
u64 ack_write_mask;
};
/* Values for doorbell flags above */ /* Values for doorbell flags above */
#define ACPI_PCCT_INTERRUPT_POLARITY (1) #define ACPI_PCCT_INTERRUPT_POLARITY (1)

View file

@ -630,7 +630,8 @@ typedef u64 acpi_integer;
#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C #define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C
#define ACPI_NOTIFY_AFFINITY_UPDATE (u8) 0x0D #define ACPI_NOTIFY_AFFINITY_UPDATE (u8) 0x0D
#define ACPI_NOTIFY_MAX 0x0D #define ACPI_GENERIC_NOTIFY_MAX 0x0D
#define ACPI_SPECIFIC_NOTIFY_MAX 0x84
/* /*
* Types associated with ACPI names and objects. The first group of * Types associated with ACPI names and objects. The first group of
@ -994,7 +995,7 @@ struct acpi_buffer {
* Predefined Namespace items * Predefined Namespace items
*/ */
struct acpi_predefined_names { struct acpi_predefined_names {
char *name; const char *name;
u8 type; u8 type;
char *val; char *val;
}; };
@ -1071,7 +1072,8 @@ void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
typedef typedef
void (*acpi_object_handler) (acpi_handle object, void *data); void (*acpi_object_handler) (acpi_handle object, void *data);
typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); typedef
acpi_status (*acpi_init_handler) (acpi_handle object, u32 function);
#define ACPI_INIT_DEVICE_INI 1 #define ACPI_INIT_DEVICE_INI 1
@ -1227,7 +1229,7 @@ struct acpi_mem_space_context {
* struct acpi_memory_list is used only if the ACPICA local cache is enabled * struct acpi_memory_list is used only if the ACPICA local cache is enabled
*/ */
struct acpi_memory_list { struct acpi_memory_list {
char *list_name; const char *list_name;
void *list_head; void *list_head;
u16 object_size; u16 object_size;
u16 max_depth; u16 max_depth;

View file

@ -66,17 +66,28 @@
* *
*****************************************************************************/ *****************************************************************************/
/* Common application configuration. All single threaded except for acpi_exec. */
#if (defined ACPI_ASL_COMPILER) || \
(defined ACPI_BIN_APP) || \
(defined ACPI_DUMP_APP) || \
(defined ACPI_HELP_APP) || \
(defined ACPI_NAMES_APP) || \
(defined ACPI_SRC_APP) || \
(defined ACPI_XTRACT_APP) || \
(defined ACPI_EXAMPLE_APP)
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#endif
/* iASL configuration */ /* iASL configuration */
#ifdef ACPI_ASL_COMPILER #ifdef ACPI_ASL_COMPILER
#define ACPI_APPLICATION
#define ACPI_DEBUG_OUTPUT #define ACPI_DEBUG_OUTPUT
#define ACPI_CONSTANT_EVAL_ONLY #define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_LARGE_NAMESPACE_NODE #define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY #define ACPI_DATA_TABLE_DISASSEMBLY
#define ACPI_SINGLE_THREADED
#define ACPI_32BIT_PHYSICAL_ADDRESS #define ACPI_32BIT_PHYSICAL_ADDRESS
#define ACPI_DISASSEMBLER 1 #define ACPI_DISASSEMBLER 1
#endif #endif
@ -89,21 +100,6 @@
#define ACPI_DBG_TRACK_ALLOCATIONS #define ACPI_DBG_TRACK_ALLOCATIONS
#endif #endif
/*
* acpi_bin/acpi_dump/acpi_help/acpi_names/acpi_src/acpi_xtract/Example
* configuration. All single threaded.
*/
#if (defined ACPI_BIN_APP) || \
(defined ACPI_DUMP_APP) || \
(defined ACPI_HELP_APP) || \
(defined ACPI_NAMES_APP) || \
(defined ACPI_SRC_APP) || \
(defined ACPI_XTRACT_APP) || \
(defined ACPI_EXAMPLE_APP)
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#endif
/* acpi_help configuration. Error messages disabled. */ /* acpi_help configuration. Error messages disabled. */
#ifdef ACPI_HELP_APP #ifdef ACPI_HELP_APP
@ -138,11 +134,16 @@
#define ACPI_REDUCED_HARDWARE 1 #define ACPI_REDUCED_HARDWARE 1
#endif #endif
/* Linkable ACPICA library */ /* Linkable ACPICA library. Two versions, one with full debug. */
#ifdef ACPI_LIBRARY #ifdef ACPI_LIBRARY
#define ACPI_USE_LOCAL_CACHE #define ACPI_USE_LOCAL_CACHE
#define ACPI_FULL_DEBUG #define ACPI_DEBUGGER 1
#define ACPI_DISASSEMBLER 1
#ifdef _DEBUG
#define ACPI_DEBUG_OUTPUT
#endif
#endif #endif
/* Common for all ACPICA applications */ /* Common for all ACPICA applications */
@ -218,6 +219,9 @@
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
#include "achaiku.h" #include "achaiku.h"
#elif defined(__QNX__)
#include "acqnx.h"
#else #else
/* Unknown environment */ /* Unknown environment */

View file

@ -1,54 +0,0 @@
/******************************************************************************
*
* Name: acmsvcex.h - Extra VC specific defines, etc.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACMSVCEX_H__
#define __ACMSVCEX_H__
/* Debug support. */
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */
#include <crtdbg.h>
#endif
#endif /* __ACMSVCEX_H__ */

View file

@ -1,49 +0,0 @@
/******************************************************************************
*
* Name: acwinex.h - Extra OS specific defines, etc.
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACWINEX_H__
#define __ACWINEX_H__
/* Windows uses VC */
#endif /* __ACWINEX_H__ */

View file

@ -863,8 +863,7 @@ osl_get_bios_table(char *signature,
(acpi_physical_address)gbl_rsdp. (acpi_physical_address)gbl_rsdp.
rsdt_physical_address; rsdt_physical_address;
} else { } else {
table_address = table_address = (acpi_physical_address)gbl_rsdp_address;
(acpi_physical_address) gbl_rsdp_address;
signature = ACPI_SIG_RSDP; signature = ACPI_SIG_RSDP;
} }

View file

@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
#if defined(_dragon_fly) || defined(_free_BSD) #if defined(_dragon_fly) || defined(_free_BSD) || defined(_QNX)
#define MMAP_FLAGS MAP_SHARED #define MMAP_FLAGS MAP_SHARED
#else #else
#define MMAP_FLAGS MAP_PRIVATE #define MMAP_FLAGS MAP_PRIVATE

View file

@ -31,6 +31,7 @@ TOOL_OBJS = \
osunixxf.o\ osunixxf.o\
tbprint.o\ tbprint.o\
tbxfroot.o\ tbxfroot.o\
utascii.o\
utbuffer.o\ utbuffer.o\
utdebug.o\ utdebug.o\
utexcep.o\ utexcep.o\

View file

@ -68,7 +68,7 @@ u8 ap_is_valid_header(struct acpi_table_header *table)
/* Make sure signature is all ASCII and a valid ACPI name */ /* Make sure signature is all ASCII and a valid ACPI name */
if (!acpi_ut_valid_acpi_name(table->signature)) { if (!acpi_ut_valid_nameseg(table->signature)) {
acpi_log_error("Table signature (0x%8.8X) is invalid\n", acpi_log_error("Table signature (0x%8.8X) is invalid\n",
*(u32 *)table->signature); *(u32 *)table->signature);
return (FALSE); return (FALSE);
@ -286,7 +286,8 @@ int ap_dump_table_by_address(char *ascii_address)
/* Convert argument to an integer physical address */ /* Convert argument to an integer physical address */
status = acpi_ut_strtoul64(ascii_address, 0, &long_address); status = acpi_ut_strtoul64(ascii_address, ACPI_ANY_BASE,
ACPI_MAX64_BYTE_WIDTH, &long_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_log_error("%s: Could not convert to a physical address\n", acpi_log_error("%s: Could not convert to a physical address\n",
ascii_address); ascii_address);
@ -406,6 +407,12 @@ int ap_dump_table_from_file(char *pathname)
return (-1); return (-1);
} }
if (!acpi_ut_valid_nameseg(table->signature)) {
acpi_log_error
("No valid ACPI signature was found in input file %s\n",
pathname);
}
/* File must be at least as long as the table length */ /* File must be at least as long as the table length */
if (table->length > file_size) { if (table->length > file_size) {

View file

@ -209,7 +209,8 @@ static int ap_do_options(int argc, char **argv)
case 'r': /* Dump tables from specified RSDP */ case 'r': /* Dump tables from specified RSDP */
status = status =
acpi_ut_strtoul64(acpi_gbl_optarg, 0, acpi_ut_strtoul64(acpi_gbl_optarg, ACPI_ANY_BASE,
ACPI_MAX64_BYTE_WIDTH,
&gbl_rsdp_base); &gbl_rsdp_base);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_log_error acpi_log_error