drivers/acpi/acpica/hwgpe.c

Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/hwgpe.c

File Facts

System
Linux kernel
Corpus path
drivers/acpi/acpica/hwgpe.c
Extension
.c
Size
18406 bytes
Lines
684
Domain
Driver Families
Bucket
drivers/acpi
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct acpi_gpe_block_status_context {
	struct acpi_gpe_register_info *gpe_skip_register_info;
	u8 gpe_skip_mask;
	u8 retval;
};

/******************************************************************************
 *
 * FUNCTION:    acpi_hw_get_gpe_block_status
 *
 * PARAMETERS:  gpe_xrupt_info      - GPE Interrupt info
 *              gpe_block           - Gpe Block info
 *              context             - GPE list walk context data
 *
 * RETURN:      Success
 *
 * DESCRIPTION: Produce a combined GPE status bits mask for the given block.
 *
 ******************************************************************************/

static acpi_status
acpi_hw_get_gpe_block_status(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
			     struct acpi_gpe_block_info *gpe_block,
			     void *context)
{
	struct acpi_gpe_block_status_context *c = context;
	struct acpi_gpe_register_info *gpe_register_info;
	u64 in_enable, in_status;
	acpi_status status;
	u8 ret_mask;
	u32 i;

	/* Examine each GPE Register within the block */

	for (i = 0; i < gpe_block->register_count; i++) {
		gpe_register_info = &gpe_block->register_info[i];

		status = acpi_hw_gpe_read(&in_enable,
					  &gpe_register_info->enable_address);
		if (ACPI_FAILURE(status)) {
			continue;
		}

		status = acpi_hw_gpe_read(&in_status,
					  &gpe_register_info->status_address);
		if (ACPI_FAILURE(status)) {
			continue;
		}

		ret_mask = in_enable & in_status;
		if (ret_mask && c->gpe_skip_register_info == gpe_register_info) {
			ret_mask &= ~c->gpe_skip_mask;
		}
		c->retval |= ret_mask;
	}

	return (AE_OK);
}

/******************************************************************************
 *
 * FUNCTION:    acpi_hw_disable_all_gpes
 *
 * PARAMETERS:  None
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
 *
 ******************************************************************************/

acpi_status acpi_hw_disable_all_gpes(void)
{
	acpi_status status;

	ACPI_FUNCTION_TRACE(hw_disable_all_gpes);

	status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL);
	return_ACPI_STATUS(status);
}

/******************************************************************************
 *
 * FUNCTION:    acpi_hw_enable_all_runtime_gpes
 *
 * PARAMETERS:  None
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks

Annotation

Implementation Notes