// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: exfield - AML execution - field_unit read/write * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acdispat.h" #include "acinterp.h" #include "amlcode.h" #define _COMPONENT … ACPI_MODULE_NAME("exfield") /* * This table maps the various Attrib protocols to the byte transfer * length. Used for the generic serial bus. */ #define ACPI_INVALID_PROTOCOL_ID … #define ACPI_MAX_PROTOCOL_ID … static const u8 acpi_protocol_lengths[] = …; #define PCC_MASTER_SUBSPACE … /* * The following macros determine a given offset is a COMD field. * According to the specification, generic subspaces (types 0-2) contains a * 2-byte COMD field at offset 4 and master subspaces (type 3) contains a 4-byte * COMD field starting at offset 12. */ #define GENERIC_SUBSPACE_COMMAND(a) … #define MASTER_SUBSPACE_COMMAND(a) … /******************************************************************************* * * FUNCTION: acpi_ex_get_protocol_buffer_length * * PARAMETERS: protocol_id - The type of the protocol indicated by region * field access attributes * return_length - Where the protocol byte transfer length is * returned * * RETURN: Status and decoded byte transfer length * * DESCRIPTION: This routine returns the length of the generic_serial_bus * protocol bytes * ******************************************************************************/ acpi_status acpi_ex_get_protocol_buffer_length(u32 protocol_id, u32 *return_length) { … } /******************************************************************************* * * FUNCTION: acpi_ex_read_data_from_field * * PARAMETERS: walk_state - Current execution state * obj_desc - The named field * ret_buffer_desc - Where the return data object is stored * * RETURN: Status * * DESCRIPTION: Read from a named field. Returns either an Integer or a * Buffer, depending on the size of the field and whether if a * field is created by the create_field() operator. * ******************************************************************************/ acpi_status acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, union acpi_operand_object *obj_desc, union acpi_operand_object **ret_buffer_desc) { … } /******************************************************************************* * * FUNCTION: acpi_ex_write_data_to_field * * PARAMETERS: source_desc - Contains data to write * obj_desc - The named field * result_desc - Where the return value is returned, if any * * RETURN: Status * * DESCRIPTION: Write to a named field * ******************************************************************************/ acpi_status acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, union acpi_operand_object *obj_desc, union acpi_operand_object **result_desc) { … }