// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: exconvrt - Object conversion routines * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acinterp.h" #include "amlcode.h" #define _COMPONENT … ACPI_MODULE_NAME("exconvrt") /* Local prototypes */ static u32 acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length, u8 leading_zeros); /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_integer * * PARAMETERS: obj_desc - Object to be converted. Must be an * Integer, Buffer, or String * result_desc - Where the new Integer object is returned * implicit_conversion - Used for string conversion * * RETURN: Status * * DESCRIPTION: Convert an ACPI Object to an integer. * ******************************************************************************/ acpi_status acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc, u32 implicit_conversion) { … } /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_buffer * * PARAMETERS: obj_desc - Object to be converted. Must be an * Integer, Buffer, or String * result_desc - Where the new buffer object is returned * * RETURN: Status * * DESCRIPTION: Convert an ACPI Object to a Buffer * ******************************************************************************/ acpi_status acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc) { … } /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_ascii * * PARAMETERS: integer - Value to be converted * base - ACPI_STRING_DECIMAL or ACPI_STRING_HEX * string - Where the string is returned * data_width - Size of data item to be converted, in bytes * leading_zeros - Allow leading zeros * * RETURN: Actual string length * * DESCRIPTION: Convert an ACPI Integer to a hex or decimal string * ******************************************************************************/ static u32 acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width, u8 leading_zeros) { … } /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_string * * PARAMETERS: obj_desc - Object to be converted. Must be an * Integer, Buffer, or String * result_desc - Where the string object is returned * type - String flags (base and conversion type) * * RETURN: Status * * DESCRIPTION: Convert an ACPI Object to a string. Supports both implicit * and explicit conversions and related rules. * ******************************************************************************/ acpi_status acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, union acpi_operand_object ** result_desc, u32 type) { … } /******************************************************************************* * * FUNCTION: acpi_ex_convert_to_target_type * * PARAMETERS: destination_type - Current type of the destination * source_desc - Source object to be converted. * result_desc - Where the converted object is returned * walk_state - Current method state * * RETURN: Status * * DESCRIPTION: Implements "implicit conversion" rules for storing an object. * ******************************************************************************/ acpi_status acpi_ex_convert_to_target_type(acpi_object_type destination_type, union acpi_operand_object *source_desc, union acpi_operand_object **result_desc, struct acpi_walk_state *walk_state) { … }