// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: evhandler - Support for Address Space handlers * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acevents.h" #include "acnamesp.h" #include "acinterp.h" #define _COMPONENT … ACPI_MODULE_NAME("evhandler") /* Local prototypes */ static acpi_status acpi_ev_install_handler(acpi_handle obj_handle, u32 level, void *context, void **return_value); /* These are the address spaces that will get default handlers */ u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = …; /******************************************************************************* * * FUNCTION: acpi_ev_install_region_handlers * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Installs the core subsystem default address space handlers. * ******************************************************************************/ acpi_status acpi_ev_install_region_handlers(void) { … } /******************************************************************************* * * FUNCTION: acpi_ev_has_default_handler * * PARAMETERS: node - Namespace node for the device * space_id - The address space ID * * RETURN: TRUE if default handler is installed, FALSE otherwise * * DESCRIPTION: Check if the default handler is installed for the requested * space ID. * ******************************************************************************/ u8 acpi_ev_has_default_handler(struct acpi_namespace_node *node, acpi_adr_space_type space_id) { … } /******************************************************************************* * * FUNCTION: acpi_ev_install_handler * * PARAMETERS: walk_namespace callback * * DESCRIPTION: This routine installs an address handler into objects that are * of type Region or Device. * * If the Object is a Device, and the device has a handler of * the same type then the search is terminated in that branch. * * This is because the existing handler is closer in proximity * to any more regions than the one we are trying to install. * ******************************************************************************/ static acpi_status acpi_ev_install_handler(acpi_handle obj_handle, u32 level, void *context, void **return_value) { … } /******************************************************************************* * * FUNCTION: acpi_ev_find_region_handler * * PARAMETERS: space_id - The address space ID * handler_obj - Head of the handler object list * * RETURN: Matching handler object. NULL if space ID not matched * * DESCRIPTION: Search a handler object list for a match on the address * space ID. * ******************************************************************************/ union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type space_id, union acpi_operand_object *handler_obj) { … } /******************************************************************************* * * FUNCTION: acpi_ev_install_space_handler * * PARAMETERS: node - Namespace node for the device * space_id - The address space ID * handler - Address of the handler * setup - Address of the setup function * context - Value passed to the handler on each access * * RETURN: Status * * DESCRIPTION: Install a handler for all op_regions of a given space_id. * Assumes namespace is locked * ******************************************************************************/ acpi_status acpi_ev_install_space_handler(struct acpi_namespace_node *node, acpi_adr_space_type space_id, acpi_adr_space_handler handler, acpi_adr_space_setup setup, void *context) { … }