// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acinterp.h" #include "amlcode.h" #define _COMPONENT … ACPI_MODULE_NAME("exnames") /* Local prototypes */ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs); static acpi_status acpi_ex_name_segment(u8 **in_aml_address, char *name_string); /******************************************************************************* * * FUNCTION: acpi_ex_allocate_name_string * * PARAMETERS: prefix_count - Count of parent levels. Special cases: * (-1)==root, 0==none * num_name_segs - count of 4-character name segments * * RETURN: A pointer to the allocated string segment. This segment must * be deleted by the caller. * * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name * string is long enough, and set up prefix if any. * ******************************************************************************/ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) { … } /******************************************************************************* * * FUNCTION: acpi_ex_name_segment * * PARAMETERS: in_aml_address - Pointer to the name in the AML code * name_string - Where to return the name. The name is appended * to any existing string to form a namepath * * RETURN: Status * * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream * ******************************************************************************/ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) { … } /******************************************************************************* * * FUNCTION: acpi_ex_get_name_string * * PARAMETERS: data_type - Object type to be associated with this * name * in_aml_address - Pointer to the namestring in the AML code * out_name_string - Where the namestring is returned * out_name_length - Length of the returned string * * RETURN: Status, namestring and length * * DESCRIPTION: Extract a full namepath from the AML byte stream, * including any prefixes. * ******************************************************************************/ acpi_status acpi_ex_get_name_string(acpi_object_type data_type, u8 * in_aml_address, char **out_name_string, u32 * out_name_length) { … }