// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /******************************************************************************* * * Module Name: dbcmds - Miscellaneous debug commands and output routines * ******************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acevents.h" #include "acdebug.h" #include "acnamesp.h" #include "acresrc.h" #include "actables.h" #define _COMPONENT … ACPI_MODULE_NAME("dbcmds") /* Local prototypes */ static void acpi_dm_compare_aml_resources(u8 *aml1_buffer, acpi_rsdesc_size aml1_buffer_length, u8 *aml2_buffer, acpi_rsdesc_size aml2_buffer_length); static acpi_status acpi_dm_test_resource_conversion(struct acpi_namespace_node *node, char *name); static acpi_status acpi_db_resource_callback(struct acpi_resource *resource, void *context); static acpi_status acpi_db_device_resources(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value); static void acpi_db_do_one_sleep_state(u8 sleep_state); static char *acpi_db_trace_method_name = …; /******************************************************************************* * * FUNCTION: acpi_db_convert_to_node * * PARAMETERS: in_string - String to convert * * RETURN: Pointer to a NS node * * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or * alphanumeric strings. * ******************************************************************************/ struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string) { … } /******************************************************************************* * * FUNCTION: acpi_db_sleep * * PARAMETERS: object_arg - Desired sleep state (0-5). NULL means * invoke all possible sleep states. * * RETURN: Status * * DESCRIPTION: Simulate sleep/wake sequences * ******************************************************************************/ acpi_status acpi_db_sleep(char *object_arg) { … } /******************************************************************************* * * FUNCTION: acpi_db_do_one_sleep_state * * PARAMETERS: sleep_state - Desired sleep state (0-5) * * RETURN: None * * DESCRIPTION: Simulate a sleep/wake sequence * ******************************************************************************/ static void acpi_db_do_one_sleep_state(u8 sleep_state) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_locks * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display information about internal mutexes. * ******************************************************************************/ void acpi_db_display_locks(void) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_table_info * * PARAMETERS: table_arg - Name of table to be displayed * * RETURN: None * * DESCRIPTION: Display information about loaded tables. Current * implementation displays all loaded tables. * ******************************************************************************/ void acpi_db_display_table_info(char *table_arg) { … } /******************************************************************************* * * FUNCTION: acpi_db_unload_acpi_table * * PARAMETERS: object_name - Namespace pathname for an object that * is owned by the table to be unloaded * * RETURN: None * * DESCRIPTION: Unload an ACPI table, via any namespace node that is owned * by the table. * ******************************************************************************/ void acpi_db_unload_acpi_table(char *object_name) { … } /******************************************************************************* * * FUNCTION: acpi_db_send_notify * * PARAMETERS: name - Name of ACPI object where to send notify * value - Value of the notify to send. * * RETURN: None * * DESCRIPTION: Send an ACPI notification. The value specified is sent to the * named object as an ACPI notify. * ******************************************************************************/ void acpi_db_send_notify(char *name, u32 value) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_interfaces * * PARAMETERS: action_arg - Null, "install", or "remove" * interface_name_arg - Name for install/remove options * * RETURN: None * * DESCRIPTION: Display or modify the global _OSI interface list * ******************************************************************************/ void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_template * * PARAMETERS: buffer_arg - Buffer name or address * * RETURN: None * * DESCRIPTION: Dump a buffer that contains a resource template * ******************************************************************************/ void acpi_db_display_template(char *buffer_arg) { … } /******************************************************************************* * * FUNCTION: acpi_dm_compare_aml_resources * * PARAMETERS: aml1_buffer - Contains first resource list * aml1_buffer_length - Length of first resource list * aml2_buffer - Contains second resource list * aml2_buffer_length - Length of second resource list * * RETURN: None * * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in * order to isolate a miscompare to an individual resource) * ******************************************************************************/ static void acpi_dm_compare_aml_resources(u8 *aml1_buffer, acpi_rsdesc_size aml1_buffer_length, u8 *aml2_buffer, acpi_rsdesc_size aml2_buffer_length) { … } /******************************************************************************* * * FUNCTION: acpi_dm_test_resource_conversion * * PARAMETERS: node - Parent device node * name - resource method name (_CRS) * * RETURN: Status * * DESCRIPTION: Compare the original AML with a conversion of the AML to * internal resource list, then back to AML. * ******************************************************************************/ static acpi_status acpi_dm_test_resource_conversion(struct acpi_namespace_node *node, char *name) { … } /******************************************************************************* * * FUNCTION: acpi_db_resource_callback * * PARAMETERS: acpi_walk_resource_callback * * RETURN: Status * * DESCRIPTION: Simple callback to exercise acpi_walk_resources and * acpi_walk_resource_buffer. * ******************************************************************************/ static acpi_status acpi_db_resource_callback(struct acpi_resource *resource, void *context) { … } /******************************************************************************* * * FUNCTION: acpi_db_device_resources * * PARAMETERS: acpi_walk_callback * * RETURN: Status * * DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object. * ******************************************************************************/ static acpi_status acpi_db_device_resources(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value) { … } /******************************************************************************* * * FUNCTION: acpi_db_display_resources * * PARAMETERS: object_arg - String object name or object pointer. * NULL or "*" means "display resources for * all devices" * * RETURN: None * * DESCRIPTION: Display the resource objects associated with a device. * ******************************************************************************/ void acpi_db_display_resources(char *object_arg) { … } /******************************************************************************* * * FUNCTION: acpi_db_generate_ged * * PARAMETERS: ged_arg - Raw GED number, ascii string * * RETURN: None * * DESCRIPTION: Simulate firing of a GED * ******************************************************************************/ void acpi_db_generate_interrupt(char *gsiv_arg) { … } #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * * FUNCTION: acpi_db_generate_gpe * * PARAMETERS: gpe_arg - Raw GPE number, ascii string * block_arg - GPE block number, ascii string * 0 or 1 for FADT GPE blocks * * RETURN: None * * DESCRIPTION: Simulate firing of a GPE * ******************************************************************************/ void acpi_db_generate_gpe(char *gpe_arg, char *block_arg) { u32 block_number = 0; u32 gpe_number; struct acpi_gpe_event_info *gpe_event_info; gpe_number = strtoul(gpe_arg, NULL, 0); /* * If no block arg, or block arg == 0 or 1, use the FADT-defined * GPE blocks. */ if (block_arg) { block_number = strtoul(block_arg, NULL, 0); if (block_number == 1) { block_number = 0; } } gpe_event_info = acpi_ev_get_gpe_event_info(ACPI_TO_POINTER(block_number), gpe_number); if (!gpe_event_info) { acpi_os_printf("Invalid GPE\n"); return; } (void)acpi_ev_gpe_dispatch(NULL, gpe_event_info, gpe_number); } /******************************************************************************* * * FUNCTION: acpi_db_generate_sci * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Simulate an SCI -- just call the SCI dispatch. * ******************************************************************************/ void acpi_db_generate_sci(void) { acpi_ev_sci_dispatch(); } #endif /* !ACPI_REDUCED_HARDWARE */ /******************************************************************************* * * FUNCTION: acpi_db_trace * * PARAMETERS: enable_arg - ENABLE/AML to enable tracer * DISABLE to disable tracer * method_arg - Method to trace * once_arg - Whether trace once * * RETURN: None * * DESCRIPTION: Control method tracing facility * ******************************************************************************/ void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg) { … }