Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe97d287 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki
Browse files

ACPICA: Restructure/cleanup all string-to-integer conversion functions

ACPICA commit 610046d444ad781cc36673bf1f030abe50cbc61f

Improve adherence to ACPI spec for implicit and explicit conversions
Adds octal support for constants in ASL code
Adds integer overflow errors for constants during ASL compilation
Eliminates most of the existing complex flags parameters
Simplify support for implicit/explicit runtime conversions
Adds one new file, utilities/utstrsuppt.c

Link: https://github.com/acpica/acpica/commit/610046d444ad


Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 81b7cb92
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ acpi-y += \
	utresrc.o	\
	utstate.o	\
	utstring.o	\
	utstrsuppt.o	\
	utstrtoul64.o	\
	utxface.o	\
	utxfinit.o	\
+2 −4
Original line number Diff line number Diff line
@@ -101,7 +101,8 @@ typedef const struct acpi_exdump_info {
 */
acpi_status
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_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,
			     struct acpi_walk_state *walk_state,
			     u8 implicit_conversion);

#define ACPI_IMPLICIT_CONVERSION        TRUE
#define ACPI_NO_IMPLICIT_CONVERSION     FALSE

/*
 * exstoren - resolve/store object
 */
+25 −6
Original line number Diff line number Diff line
@@ -141,6 +141,11 @@ extern const char *acpi_gbl_ptyp_decode[];
#define ACPI_MSG_SUFFIX \
	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 */

#define ACPI_INVALID_RESOURCE           0
@@ -197,15 +202,29 @@ void acpi_ut_strlwr(char *src_string);

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_leading_zeros(char **string);

u8 acpi_ut_detect_hex_prefix(char **string);

u8 acpi_ut_detect_octal_prefix(char **string);

/*
 * Values for Flags above
 * Note: LIMIT values correspond to acpi_gbl_integer_byte_width values (4/8)
 * utstrtoul64 - string-to-integer conversion functions
 */
#define ACPI_STRTOUL_32BIT          0x04	/* 4 bytes */
#define ACPI_STRTOUL_64BIT          0x08	/* 8 bytes */
#define ACPI_STRTOUL_BASE16         0x10	/* Default: Base10/16 */
acpi_status acpi_ut_strtoul64(char *string, u64 *ret_integer);

u64 acpi_ut_explicit_strtoul64(char *string);

u64 acpi_ut_implicit_strtoul64(char *string);

/*
 * utglobal - Global data structures and procedures
+1 −4
Original line number Diff line number Diff line
@@ -277,10 +277,7 @@ acpi_db_convert_to_object(acpi_object_type type,
	default:

		object->type = ACPI_TYPE_INTEGER;
		status = acpi_ut_strtoul64(string,
					   (acpi_gbl_integer_byte_width |
					    ACPI_STRTOUL_BASE16),
					   &object->integer.value);
		status = acpi_ut_strtoul64(string, &object->integer.value);
		break;
	}

+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
	 * object. Implicitly convert the argument if necessary.
	 */
	status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc,
					    ACPI_STRTOUL_BASE16);
					    ACPI_IMPLICIT_CONVERSION);
	if (ACPI_FAILURE(status)) {
		goto cleanup;
	}
Loading