Commit 60764eb3 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'acpica'

* acpica:
  ACPICA: Update version to 20170831
  ACPICA: Update acpi_get_timer for 64-bit interface to acpi_hw_read
  ACPICA: String conversions: Update to add new behaviors
  ACPICA: String conversions: Cleanup/format comments. No functional changes
  ACPICA: Restructure/cleanup all string-to-integer conversion functions
  ACPICA: Header support for the PDTT ACPI table
  ACPICA: acpiexec: Add testability of deferred table verification
  ACPICA: Hardware: Enable 64-bit support of hardware accesses
parents 1be9c3a0 d954f94c
...@@ -178,6 +178,7 @@ acpi-y += \ ...@@ -178,6 +178,7 @@ acpi-y += \
utresrc.o \ utresrc.o \
utstate.o \ utstate.o \
utstring.o \ utstring.o \
utstrsuppt.o \
utstrtoul64.o \ utstrtoul64.o \
utxface.o \ utxface.o \
utxfinit.o \ utxfinit.o \
......
...@@ -66,9 +66,9 @@ acpi_status ...@@ -66,9 +66,9 @@ 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);
acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg); acpi_status acpi_hw_read(u64 *value, struct acpi_generic_address *reg);
acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg); acpi_status acpi_hw_write(u64 value, struct acpi_generic_address *reg);
struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
......
...@@ -101,7 +101,8 @@ typedef const struct acpi_exdump_info { ...@@ -101,7 +101,8 @@ typedef const struct acpi_exdump_info {
*/ */
acpi_status acpi_status
acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, u32 flags); union acpi_operand_object **result_desc,
u32 implicit_conversion);
acpi_status acpi_status
acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
...@@ -424,9 +425,6 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, ...@@ -424,9 +425,6 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
u8 implicit_conversion); u8 implicit_conversion);
#define ACPI_IMPLICIT_CONVERSION TRUE
#define ACPI_NO_IMPLICIT_CONVERSION FALSE
/* /*
* exstoren - resolve/store object * exstoren - resolve/store object
*/ */
......
...@@ -141,6 +141,11 @@ extern const char *acpi_gbl_ptyp_decode[]; ...@@ -141,6 +141,11 @@ extern const char *acpi_gbl_ptyp_decode[];
#define ACPI_MSG_SUFFIX \ #define ACPI_MSG_SUFFIX \
acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
/* Flags to indicate implicit or explicit string-to-integer conversion */
#define ACPI_IMPLICIT_CONVERSION TRUE
#define ACPI_NO_IMPLICIT_CONVERSION FALSE
/* Types for Resource descriptor entries */ /* Types for Resource descriptor entries */
#define ACPI_INVALID_RESOURCE 0 #define ACPI_INVALID_RESOURCE 0
...@@ -197,15 +202,31 @@ void acpi_ut_strlwr(char *src_string); ...@@ -197,15 +202,31 @@ 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 flags, u64 *ret_integer); /*
* utstrsuppt - string-to-integer conversion support functions
*/
acpi_status acpi_ut_convert_octal_string(char *string, u64 *return_value);
acpi_status acpi_ut_convert_decimal_string(char *string, u64 *return_value_ptr);
acpi_status acpi_ut_convert_hex_string(char *string, u64 *return_value_ptr);
char acpi_ut_remove_whitespace(char **string);
char acpi_ut_remove_leading_zeros(char **string);
u8 acpi_ut_detect_hex_prefix(char **string);
u8 acpi_ut_detect_octal_prefix(char **string);
/* /*
* Values for Flags above * utstrtoul64 - string-to-integer conversion functions
* Note: LIMIT values correspond to acpi_gbl_integer_byte_width values (4/8)
*/ */
#define ACPI_STRTOUL_32BIT 0x04 /* 4 bytes */ acpi_status acpi_ut_strtoul64(char *string, u64 *ret_integer);
#define ACPI_STRTOUL_64BIT 0x08 /* 8 bytes */
#define ACPI_STRTOUL_BASE16 0x10 /* Default: Base10/16 */ u64 acpi_ut_explicit_strtoul64(char *string);
u64 acpi_ut_implicit_strtoul64(char *string);
/* /*
* utglobal - Global data structures and procedures * utglobal - Global data structures and procedures
......
...@@ -277,10 +277,7 @@ acpi_db_convert_to_object(acpi_object_type type, ...@@ -277,10 +277,7 @@ 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, status = acpi_ut_strtoul64(string, &object->integer.value);
(acpi_gbl_integer_byte_width |
ACPI_STRTOUL_BASE16),
&object->integer.value);
break; break;
} }
......
...@@ -134,7 +134,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, ...@@ -134,7 +134,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
* object. Implicitly convert the argument if necessary. * object. Implicitly convert the argument if necessary.
*/ */
status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc,
ACPI_STRTOUL_BASE16); ACPI_IMPLICIT_CONVERSION);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto cleanup; goto cleanup;
} }
......
...@@ -390,8 +390,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list) ...@@ -390,8 +390,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list)
struct acpi_gpe_handler_info *gpe_handler_info; struct acpi_gpe_handler_info *gpe_handler_info;
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u8 enabled_status_byte; u8 enabled_status_byte;
u32 status_reg; u64 status_reg;
u32 enable_reg; u64 enable_reg;
acpi_cpu_flags flags; acpi_cpu_flags flags;
u32 i; u32 i;
u32 j; u32 j;
...@@ -472,7 +472,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list) ...@@ -472,7 +472,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list)
gpe_register_info->base_gpe_number, gpe_register_info->base_gpe_number,
gpe_register_info->base_gpe_number + gpe_register_info->base_gpe_number +
(ACPI_GPE_REGISTER_WIDTH - 1), (ACPI_GPE_REGISTER_WIDTH - 1),
status_reg, enable_reg, (u32)status_reg, (u32)enable_reg,
gpe_register_info->enable_for_run, gpe_register_info->enable_for_run,
gpe_register_info->enable_for_wake)); gpe_register_info->enable_for_wake));
......
...@@ -156,7 +156,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, ...@@ -156,7 +156,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
status = status =
acpi_ex_convert_to_integer(local_operand1, &temp_operand1, acpi_ex_convert_to_integer(local_operand1, &temp_operand1,
ACPI_STRTOUL_BASE16); ACPI_IMPLICIT_CONVERSION);
break; break;
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
......
...@@ -57,10 +57,10 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length); ...@@ -57,10 +57,10 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length);
* *
* FUNCTION: acpi_ex_convert_to_integer * FUNCTION: acpi_ex_convert_to_integer
* *
* PARAMETERS: obj_desc - Object to be converted. Must be an * PARAMETERS: obj_desc - Object to be converted. Must be an
* Integer, Buffer, or String * Integer, Buffer, or String
* result_desc - Where the new Integer object is returned * result_desc - Where the new Integer object is returned
* flags - Used for string conversion * implicit_conversion - Used for string conversion
* *
* RETURN: Status * RETURN: Status
* *
...@@ -70,14 +70,14 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length); ...@@ -70,14 +70,14 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length);
acpi_status acpi_status
acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, u32 flags) union acpi_operand_object **result_desc,
u32 implicit_conversion)
{ {
union acpi_operand_object *return_desc; union acpi_operand_object *return_desc;
u8 *pointer; u8 *pointer;
u64 result; u64 result;
u32 i; u32 i;
u32 count; u32 count;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc); ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc);
...@@ -123,12 +123,18 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, ...@@ -123,12 +123,18 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
* hexadecimal as per the ACPI specification. The only exception (as * hexadecimal as per the ACPI specification. The only exception (as
* 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").
*
* Explicit conversion is used only by to_integer.
* All other string-to-integer conversions are implicit conversions.
*/ */
status = acpi_ut_strtoul64(ACPI_CAST_PTR(char, pointer), if (implicit_conversion) {
(acpi_gbl_integer_byte_width | result =
flags), &result); acpi_ut_implicit_strtoul64(ACPI_CAST_PTR
if (ACPI_FAILURE(status)) { (char, pointer));
return_ACPI_STATUS(status); } else {
result =
acpi_ut_explicit_strtoul64(ACPI_CAST_PTR
(char, pointer));
} }
break; break;
...@@ -631,7 +637,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, ...@@ -631,7 +637,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
*/ */
status = status =
acpi_ex_convert_to_integer(source_desc, result_desc, acpi_ex_convert_to_integer(source_desc, result_desc,
ACPI_STRTOUL_BASE16); ACPI_IMPLICIT_CONVERSION);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
......
...@@ -330,7 +330,7 @@ acpi_ex_do_logical_op(u16 opcode, ...@@ -330,7 +330,7 @@ acpi_ex_do_logical_op(u16 opcode,
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
status = acpi_ex_convert_to_integer(operand1, &local_operand1, status = acpi_ex_convert_to_integer(operand1, &local_operand1,
ACPI_STRTOUL_BASE16); ACPI_IMPLICIT_CONVERSION);
break; break;
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
......
...@@ -415,7 +415,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -415,7 +415,7 @@ acpi_ex_resolve_operands(u16 opcode,
* Known as "Implicit Source Operand Conversion" * Known as "Implicit Source Operand Conversion"
*/ */
status = acpi_ex_convert_to_integer(obj_desc, stack_ptr, status = acpi_ex_convert_to_integer(obj_desc, stack_ptr,
ACPI_STRTOUL_BASE16); ACPI_IMPLICIT_CONVERSION);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
......
...@@ -99,7 +99,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) ...@@ -99,7 +99,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
{ {
struct acpi_gpe_register_info *gpe_register_info; struct acpi_gpe_register_info *gpe_register_info;
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 enable_mask; u64 enable_mask;
u32 register_bit; u32 register_bit;
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
...@@ -214,7 +214,7 @@ acpi_status ...@@ -214,7 +214,7 @@ acpi_status
acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info, acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
acpi_event_status *event_status) acpi_event_status *event_status)
{ {
u32 in_byte; u64 in_byte;
u32 register_bit; u32 register_bit;
struct acpi_gpe_register_info *gpe_register_info; struct acpi_gpe_register_info *gpe_register_info;
acpi_event_status local_event_status = 0; acpi_event_status local_event_status = 0;
......
...@@ -220,16 +220,15 @@ acpi_hw_validate_register(struct acpi_generic_address *reg, ...@@ -220,16 +220,15 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Read from either memory or IO space. This is a 32-bit max * DESCRIPTION: Read from either memory or IO space. This is a 64-bit max
* version of acpi_read, used internally since the overhead of * version of acpi_read.
* 64-bit values is not needed.
* *
* LIMITATIONS: <These limitations also apply to acpi_hw_write> * LIMITATIONS: <These limitations also apply to acpi_hw_write>
* space_ID must be system_memory or system_IO. * space_ID must be system_memory or system_IO.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) acpi_status acpi_hw_read(u64 *value, struct acpi_generic_address *reg)
{ {
u64 address; u64 address;
u8 access_width; u8 access_width;
...@@ -244,17 +243,17 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) ...@@ -244,17 +243,17 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
/* Validate contents of the GAS register */ /* Validate contents of the GAS register */
status = acpi_hw_validate_register(reg, 32, &address); status = acpi_hw_validate_register(reg, 64, &address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
/* /*
* Initialize entire 32-bit return value to zero, convert access_width * Initialize entire 64-bit return value to zero, convert access_width
* into number of bits based * into number of bits based
*/ */
*value = 0; *value = 0;
access_width = acpi_hw_get_access_bit_width(address, reg, 32); access_width = acpi_hw_get_access_bit_width(address, reg, 64);
bit_width = reg->bit_offset + reg->bit_width; bit_width = reg->bit_offset + reg->bit_width;
bit_offset = reg->bit_offset; bit_offset = reg->bit_offset;
...@@ -265,7 +264,7 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) ...@@ -265,7 +264,7 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
index = 0; index = 0;
while (bit_width) { while (bit_width) {
if (bit_offset >= access_width) { if (bit_offset >= access_width) {
value32 = 0; value64 = 0;
bit_offset -= access_width; bit_offset -= access_width;
} else { } else {
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
...@@ -276,7 +275,6 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) ...@@ -276,7 +275,6 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
ACPI_DIV_8 ACPI_DIV_8
(access_width), (access_width),
&value64, 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)
...@@ -286,15 +284,16 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) ...@@ -286,15 +284,16 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
(access_width), (access_width),
&value32, &value32,
access_width); access_width);
value64 = (u64)value32;
} }
} }
/* /*
* Use offset style bit writes because "Index * AccessWidth" is * Use offset style bit writes because "Index * AccessWidth" is
* ensured to be less than 32-bits by acpi_hw_validate_register(). * ensured to be less than 64-bits by acpi_hw_validate_register().
*/ */
ACPI_SET_BITS(value, index * access_width, ACPI_SET_BITS(value, index * access_width,
ACPI_MASK_BITS_ABOVE_32(access_width), value32); ACPI_MASK_BITS_ABOVE_64(access_width), value64);
bit_width -= bit_width -=
bit_width > access_width ? access_width : bit_width; bit_width > access_width ? access_width : bit_width;
...@@ -302,8 +301,9 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) ...@@ -302,8 +301,9 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
} }
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%8.8X width %2d from %8.8X%8.8X (%s)\n",
*value, access_width, ACPI_FORMAT_UINT64(address), ACPI_FORMAT_UINT64(*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);
...@@ -318,20 +318,18 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) ...@@ -318,20 +318,18 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Write to either memory or IO space. This is a 32-bit max * DESCRIPTION: Write to either memory or IO space. This is a 64-bit max
* version of acpi_write, used internally since the overhead of * version of acpi_write.
* 64-bit values is not needed.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) acpi_status acpi_hw_write(u64 value, struct acpi_generic_address *reg)
{ {
u64 address; u64 address;
u8 access_width; u8 access_width;
u32 bit_width; u32 bit_width;
u8 bit_offset; u8 bit_offset;
u64 value64; u64 value64;
u32 value32;
u8 index; u8 index;
acpi_status status; acpi_status status;
...@@ -339,14 +337,14 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) ...@@ -339,14 +337,14 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
/* Validate contents of the GAS register */ /* Validate contents of the GAS register */
status = acpi_hw_validate_register(reg, 32, &address); status = acpi_hw_validate_register(reg, 64, &address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
/* Convert access_width into number of bits based */ /* Convert access_width into number of bits based */
access_width = acpi_hw_get_access_bit_width(address, reg, 32); access_width = acpi_hw_get_access_bit_width(address, reg, 64);
bit_width = reg->bit_offset + reg->bit_width; bit_width = reg->bit_offset + reg->bit_width;
bit_offset = reg->bit_offset; bit_offset = reg->bit_offset;
...@@ -358,16 +356,15 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) ...@@ -358,16 +356,15 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
while (bit_width) { while (bit_width) {
/* /*
* Use offset style bit reads because "Index * AccessWidth" is * Use offset style bit reads because "Index * AccessWidth" is
* ensured to be less than 32-bits by acpi_hw_validate_register(). * ensured to be less than 64-bits by acpi_hw_validate_register().
*/ */
value32 = ACPI_GET_BITS(&value, index * access_width, value64 = ACPI_GET_BITS(&value, index * access_width,
ACPI_MASK_BITS_ABOVE_32(access_width)); ACPI_MASK_BITS_ABOVE_64(access_width));
if (bit_offset >= access_width) { if (bit_offset >= access_width) {
bit_offset -= access_width; bit_offset -= access_width;
} else { } else {
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
value64 = (u64)value32;
status = status =
acpi_os_write_memory((acpi_physical_address) acpi_os_write_memory((acpi_physical_address)
address + address +
...@@ -382,7 +379,7 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) ...@@ -382,7 +379,7 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
index * index *
ACPI_DIV_8 ACPI_DIV_8
(access_width), (access_width),
value32, (u32)value64,
access_width); access_width);
} }
} }
...@@ -397,8 +394,9 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) ...@@ -397,8 +394,9 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
} }
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%8.8X width %2d to %8.8X%8.8X (%s)\n",
value, access_width, ACPI_FORMAT_UINT64(address), ACPI_FORMAT_UINT64(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);
...@@ -526,6 +524,7 @@ acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control) ...@@ -526,6 +524,7 @@ acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control)
acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value) acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
{ {
u32 value = 0; u32 value = 0;
u64 value64;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE(hw_register_read); ACPI_FUNCTION_TRACE(hw_register_read);
...@@ -564,12 +563,14 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value) ...@@ -564,12 +563,14 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
status = status =
acpi_hw_read(&value, &acpi_gbl_FADT.xpm2_control_block); acpi_hw_read(&value64, &acpi_gbl_FADT.xpm2_control_block);
value = (u32)value64;
break; break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm_timer_block); status = acpi_hw_read(&value64, &acpi_gbl_FADT.xpm_timer_block);
value = (u32)value64;
break; break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
...@@ -586,7 +587,7 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value) ...@@ -586,7 +587,7 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
} }
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
*return_value = value; *return_value = (u32)value;
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -622,6 +623,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) ...@@ -622,6 +623,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
{ {
acpi_status status; acpi_status status;
u32 read_value; u32 read_value;
u64 read_value64;
ACPI_FUNCTION_TRACE(hw_register_write); ACPI_FUNCTION_TRACE(hw_register_write);
...@@ -685,11 +687,12 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) ...@@ -685,11 +687,12 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
* as per the ACPI spec. * as per the ACPI spec.
*/ */
status = status =
acpi_hw_read(&read_value, acpi_hw_read(&read_value64,
&acpi_gbl_FADT.xpm2_control_block); &acpi_gbl_FADT.xpm2_control_block);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto exit; goto exit;
} }
read_value = (u32)read_value64;
/* Insert the bits to be preserved */ /* Insert the bits to be preserved */
...@@ -745,22 +748,25 @@ acpi_hw_read_multiple(u32 *value, ...@@ -745,22 +748,25 @@ acpi_hw_read_multiple(u32 *value,
{ {
u32 value_a = 0; u32 value_a = 0;
u32 value_b = 0; u32 value_b = 0;
u64 value64;
acpi_status status; acpi_status status;
/* The first register is always required */ /* The first register is always required */
status = acpi_hw_read(&value_a, register_a); status = acpi_hw_read(&value64, register_a);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
value_a = (u32)value64;
/* Second register is optional */ /* Second register is optional */
if (register_b->address) { if (register_b->address) {
status = acpi_hw_read(&value_b, register_b); status = acpi_hw_read(&value64, register_b);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
value_b = (u32)value64;
} }
/* /*
......
...@@ -94,6 +94,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution) ...@@ -94,6 +94,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution)
acpi_status acpi_get_timer(u32 * ticks) acpi_status acpi_get_timer(u32 * ticks)
{ {
acpi_status status; acpi_status status;
u64 timer_value;
ACPI_FUNCTION_TRACE(acpi_get_timer); ACPI_FUNCTION_TRACE(acpi_get_timer);
...@@ -107,7 +108,14 @@ acpi_status acpi_get_timer(u32 * ticks) ...@@ -107,7 +108,14 @@ acpi_status acpi_get_timer(u32 * ticks)
return_ACPI_STATUS(AE_SUPPORT); return_ACPI_STATUS(AE_SUPPORT);
} }
status = acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block); status = acpi_hw_read(&timer_value, &acpi_gbl_FADT.xpm_timer_block);
if (ACPI_SUCCESS(status)) {
/* ACPI PM Timer is defined to be 32 bits (PM_TMR_LEN) */
*ticks = (u32)timer_value;
}
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
......
...@@ -125,76 +125,12 @@ ACPI_EXPORT_SYMBOL(acpi_reset) ...@@ -125,76 +125,12 @@ ACPI_EXPORT_SYMBOL(acpi_reset)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg) acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
{ {
u32 value_lo;
u32 value_hi;
u32 width;
u64 address;
acpi_status status; acpi_status status;
ACPI_FUNCTION_NAME(acpi_read); ACPI_FUNCTION_NAME(acpi_read);
if (!return_value) { status = acpi_hw_read(return_value, reg);
return (AE_BAD_PARAMETER); return (status);
}
/* Validate contents of the GAS register. Allow 64-bit transfers */
status = acpi_hw_validate_register(reg, 64, &address);
if (ACPI_FAILURE(status)) {
return (status);
}
/*
* Two address spaces supported: Memory or I/O. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
status = acpi_os_read_memory((acpi_physical_address)
address, return_value,
reg->bit_width);
if (ACPI_FAILURE(status)) {
return (status);
}
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
value_lo = 0;
value_hi = 0;
width = reg->bit_width;
if (width == 64) {
width = 32; /* Break into two 32-bit transfers */
}
status = acpi_hw_read_port((acpi_io_address)
address, &value_lo, width);
if (ACPI_FAILURE(status)) {
return (status);
}
if (reg->bit_width == 64) {
/* Read the top 32 bits */
status = acpi_hw_read_port((acpi_io_address)
(address + 4), &value_hi,
32);
if (ACPI_FAILURE(status)) {
return (status);
}
}
/* Set the return value only if status is AE_OK */
*return_value = (value_lo | ((u64)value_hi << 32));
}
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n",
ACPI_FORMAT_UINT64(*return_value), reg->bit_width,
ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id)));
return (AE_OK);
} }
ACPI_EXPORT_SYMBOL(acpi_read) ACPI_EXPORT_SYMBOL(acpi_read)
...@@ -213,59 +149,11 @@ ACPI_EXPORT_SYMBOL(acpi_read) ...@@ -213,59 +149,11 @@ ACPI_EXPORT_SYMBOL(acpi_read)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_write(u64 value, struct acpi_generic_address *reg) acpi_status acpi_write(u64 value, struct acpi_generic_address *reg)
{ {
u32 width;
u64 address;
acpi_status status; acpi_status status;
ACPI_FUNCTION_NAME(acpi_write); ACPI_FUNCTION_NAME(acpi_write);
/* Validate contents of the GAS register. Allow 64-bit transfers */ status = acpi_hw_write(value, reg);
status = acpi_hw_validate_register(reg, 64, &address);
if (ACPI_FAILURE(status)) {
return (status);
}
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
status = acpi_os_write_memory((acpi_physical_address)
address, value, reg->bit_width);
if (ACPI_FAILURE(status)) {
return (status);
}
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
width = reg->bit_width;
if (width == 64) {
width = 32; /* Break into two 32-bit transfers */
}
status = acpi_hw_write_port((acpi_io_address)
address, ACPI_LODWORD(value),
width);
if (ACPI_FAILURE(status)) {
return (status);
}
if (reg->bit_width == 64) {
status = acpi_hw_write_port((acpi_io_address)
(address + 4),
ACPI_HIDWORD(value), 32);
if (ACPI_FAILURE(status)) {
return (status);
}
}
}
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n",
ACPI_FORMAT_UINT64(value), reg->bit_width,
ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id)));
return (status); return (status);
} }
......
...@@ -78,8 +78,8 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object, ...@@ -78,8 +78,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_gbl_integer_byte_width, &value); acpi_ut_strtoul64(original_object->string.pointer, &value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
......
...@@ -173,10 +173,13 @@ acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void) ...@@ -173,10 +173,13 @@ acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void)
ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); ACPI_FUNCTION_TRACE(acpi_reallocate_root_table);
/* /*
* Only reallocate the root table if the host provided a static buffer * If there are tables unverified, it is required to reallocate the
* for the table array in the call to acpi_initialize_tables. * root table list to clean up invalid table entries. Otherwise only
* reallocate the root table list if the host provided a static buffer
* for the table array in the call to acpi_initialize_tables().
*/ */
if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { if ((acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) &&
acpi_gbl_enable_table_validation) {
return_ACPI_STATUS(AE_SUPPORT); return_ACPI_STATUS(AE_SUPPORT);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -126,8 +126,12 @@ struct acpi_exception_info { ...@@ -126,8 +126,12 @@ struct acpi_exception_info {
#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) #define AE_NOT_CONFIGURED EXCEP_ENV (0x001C)
#define AE_ACCESS EXCEP_ENV (0x001D) #define AE_ACCESS EXCEP_ENV (0x001D)
#define AE_IO_ERROR EXCEP_ENV (0x001E) #define AE_IO_ERROR EXCEP_ENV (0x001E)
#define AE_NUMERIC_OVERFLOW EXCEP_ENV (0x001F)
#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020)
#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021)
#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022)
#define AE_CODE_ENV_MAX 0x001E #define AE_CODE_ENV_MAX 0x0022
/* /*
* Programmer exceptions * Programmer exceptions
...@@ -263,7 +267,15 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = { ...@@ -263,7 +267,15 @@ static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
EXCEP_TXT("AE_NOT_CONFIGURED", EXCEP_TXT("AE_NOT_CONFIGURED",
"The interface is not part of the current subsystem configuration"), "The interface is not part of the current subsystem configuration"),
EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation"), EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation"),
EXCEP_TXT("AE_IO_ERROR", "An I/O error occurred") EXCEP_TXT("AE_IO_ERROR", "An I/O error occurred"),
EXCEP_TXT("AE_NUMERIC_OVERFLOW",
"Overflow during string-to-integer conversion"),
EXCEP_TXT("AE_HEX_OVERFLOW",
"Overflow during ASCII hex-to-binary conversion"),
EXCEP_TXT("AE_DECIMAL_OVERFLOW",
"Overflow during ASCII decimal-to-binary conversion"),
EXCEP_TXT("AE_OCTAL_OVERFLOW",
"Overflow during ASCII octal-to-binary conversion")
}; };
static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = {
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20170728 #define ACPI_CA_VERSION 0x20170831
#include <acpi/acconfig.h> #include <acpi/acconfig.h>
#include <acpi/actypes.h> #include <acpi/actypes.h>
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ #define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */
#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ #define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
#define ACPI_SIG_PDTT "PDTT" /* Processor Debug Trigger Table */
#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ #define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */
#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
...@@ -1280,6 +1281,35 @@ struct acpi_nfit_flush_address { ...@@ -1280,6 +1281,35 @@ struct acpi_nfit_flush_address {
u64 hint_address[1]; /* Variable length */ u64 hint_address[1]; /* Variable length */
}; };
/*******************************************************************************
*
* PDTT - Processor Debug Trigger Table (ACPI 6.2)
* Version 0
*
******************************************************************************/
struct acpi_table_pdtt {
struct acpi_table_header header; /* Common ACPI table header */
u8 trigger_count;
u8 reserved[3];
u32 array_offset;
};
/*
* PDTT Communication Channel Identifier Structure.
* The number of these structures is defined by trigger_count above,
* starting at array_offset.
*/
struct acpi_pdtt_channel {
u16 sub_channel_id;
};
/* Mask and Flags for above */
#define ACPI_PDTT_SUBCHANNEL_ID_MASK 0x00FF
#define ACPI_PDTT_RUNTIME_TRIGGER (1<<8)
#define ACPI_PPTT_WAIT_COMPLETION (1<<9)
/******************************************************************************* /*******************************************************************************
* *
* PPTT - Processor Properties Topology Table (ACPI 6.2) * PPTT - Processor Properties Topology Table (ACPI 6.2)
......
...@@ -39,6 +39,7 @@ TOOL_OBJS = \ ...@@ -39,6 +39,7 @@ TOOL_OBJS = \
utnonansi.o\ utnonansi.o\
utprint.o\ utprint.o\
utstring.o\ utstring.o\
utstrsuppt.o\
utstrtoul64.o\ utstrtoul64.o\
utxferror.o\ utxferror.o\
oslinuxtbl.o\ oslinuxtbl.o\
......
...@@ -287,8 +287,7 @@ int ap_dump_table_by_address(char *ascii_address) ...@@ -287,8 +287,7 @@ 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, ACPI_STRTOUL_64BIT, status = acpi_ut_strtoul64(ascii_address, &long_address);
&long_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
fprintf(stderr, "%s: Could not convert to a physical address\n", fprintf(stderr, "%s: Could not convert to a physical address\n",
ascii_address); ascii_address);
......
...@@ -208,9 +208,7 @@ static int ap_do_options(int argc, char **argv) ...@@ -208,9 +208,7 @@ 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, acpi_ut_strtoul64(acpi_gbl_optarg, &gbl_rsdp_base);
ACPI_STRTOUL_64BIT,
&gbl_rsdp_base);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
fprintf(stderr, fprintf(stderr,
"%s: Could not convert to a physical address\n", "%s: Could not convert to a physical address\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment