// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: nsinit - namespace initialization * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" #include "acdispat.h" #include "acinterp.h" #include "acevents.h" #define _COMPONENT … ACPI_MODULE_NAME("nsinit") /* Local prototypes */ static acpi_status acpi_ns_init_one_object(acpi_handle obj_handle, u32 level, void *context, void **return_value); static acpi_status acpi_ns_init_one_device(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value); static acpi_status acpi_ns_find_ini_methods(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value); /******************************************************************************* * * FUNCTION: acpi_ns_initialize_objects * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Walk the entire namespace and perform any necessary * initialization on the objects found therein * ******************************************************************************/ acpi_status acpi_ns_initialize_objects(void) { … } /******************************************************************************* * * FUNCTION: acpi_ns_initialize_devices * * PARAMETERS: None * * RETURN: acpi_status * * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices. * This means running _INI on all present devices. * * Note: We install PCI config space handler on region access, * not here. * ******************************************************************************/ acpi_status acpi_ns_initialize_devices(u32 flags) { … } /******************************************************************************* * * FUNCTION: acpi_ns_init_one_package * * PARAMETERS: obj_handle - Node * level - Current nesting level * context - Not used * return_value - Not used * * RETURN: Status * * DESCRIPTION: Callback from acpi_walk_namespace. Invoked for every package * within the namespace. Used during dynamic load of an SSDT. * ******************************************************************************/ acpi_status acpi_ns_init_one_package(acpi_handle obj_handle, u32 level, void *context, void **return_value) { … } /******************************************************************************* * * FUNCTION: acpi_ns_init_one_object * * PARAMETERS: obj_handle - Node * level - Current nesting level * context - Points to a init info struct * return_value - Not used * * RETURN: Status * * DESCRIPTION: Callback from acpi_walk_namespace. Invoked for every object * within the namespace. * * Currently, the only objects that require initialization are: * 1) Methods * 2) Op Regions * ******************************************************************************/ static acpi_status acpi_ns_init_one_object(acpi_handle obj_handle, u32 level, void *context, void **return_value) { … } /******************************************************************************* * * FUNCTION: acpi_ns_find_ini_methods * * PARAMETERS: acpi_walk_callback * * RETURN: acpi_status * * DESCRIPTION: Called during namespace walk. Finds objects named _INI under * device/processor/thermal objects, and marks the entire subtree * with a SUBTREE_HAS_INI flag. This flag is used during the * subsequent device initialization walk to avoid entire subtrees * that do not contain an _INI. * ******************************************************************************/ static acpi_status acpi_ns_find_ini_methods(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value) { … } /******************************************************************************* * * FUNCTION: acpi_ns_init_one_device * * PARAMETERS: acpi_walk_callback * * RETURN: acpi_status * * DESCRIPTION: This is called once per device soon after ACPI is enabled * to initialize each device. It determines if the device is * present, and if so, calls _INI. * ******************************************************************************/ static acpi_status acpi_ns_init_one_device(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value) { … }