drivers/acpi/x86/s2idle.c
Source file repositories/reference/linux-study-clean/drivers/acpi/x86/s2idle.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/x86/s2idle.c- Extension
.c- Size
- 18239 bytes
- Lines
- 683
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/device.hlinux/dmi.hlinux/suspend.h../sleep.h
Detected Declarations
struct lpi_device_infostruct lpi_device_constraintstruct lpi_constraintsstruct lpi_device_constraint_amdstruct amd_lps0_hid_device_datafunction lpi_device_get_constraints_amdfunction lpi_device_get_constraintsfunction lpi_check_constraintsfunction for_each_lpi_constraintfunction acpi_s2idle_vendor_amdfunction acpi_sleep_run_lps0_dsmfunction validate_dsmfunction lps0_device_attachfunction acpi_s2idle_begin_lps0function acpi_s2idle_prepare_late_lps0function list_for_each_entryfunction acpi_s2idle_check_lps0function list_for_each_entryfunction acpi_s2idle_restore_early_lps0function acpi_s2idle_setupfunction acpi_register_lps0_devfunction acpi_unregister_lps0_devexport acpi_register_lps0_devexport acpi_unregister_lps0_dev
Annotated Snippet
struct lpi_device_info {
char *name;
int enabled;
union acpi_object *package;
};
/* Constraint package structure */
struct lpi_device_constraint {
int uid;
int min_dstate;
int function_states;
};
struct lpi_constraints {
acpi_handle handle;
int min_dstate;
};
/* AMD Constraint package structure */
struct lpi_device_constraint_amd {
char *name;
int enabled;
int function_states;
int min_dstate;
};
static LIST_HEAD(lps0_s2idle_devops_head);
static struct lpi_constraints *lpi_constraints_table;
static int lpi_constraints_table_size;
static int rev_id;
#define for_each_lpi_constraint(entry) \
for (int i = 0; \
entry = &lpi_constraints_table[i], i < lpi_constraints_table_size; \
i++)
static void lpi_device_get_constraints_amd(void)
{
union acpi_object *out_obj;
int i, j, k;
out_obj = acpi_evaluate_dsm_typed(lps0_device_handle, &lps0_dsm_guid,
rev_id, ACPI_LPS0_GET_DEVICE_CONSTRAINTS,
NULL, ACPI_TYPE_PACKAGE);
acpi_handle_debug(lps0_device_handle, "_DSM function 1 eval %s\n",
out_obj ? "successful" : "failed");
if (!out_obj)
return;
for (i = 0; i < out_obj->package.count; i++) {
union acpi_object *package = &out_obj->package.elements[i];
if (package->type == ACPI_TYPE_PACKAGE) {
if (lpi_constraints_table) {
acpi_handle_err(lps0_device_handle,
"Duplicate constraints list\n");
goto free_acpi_buffer;
}
lpi_constraints_table = kzalloc_objs(*lpi_constraints_table,
package->package.count);
if (!lpi_constraints_table)
goto free_acpi_buffer;
acpi_handle_debug(lps0_device_handle,
"LPI: constraints list begin:\n");
for (j = 0; j < package->package.count; j++) {
union acpi_object *info_obj = &package->package.elements[j];
struct lpi_device_constraint_amd dev_info = {};
struct lpi_constraints *list;
acpi_status status;
list = &lpi_constraints_table[lpi_constraints_table_size];
for (k = 0; k < info_obj->package.count; k++) {
union acpi_object *obj = &info_obj->package.elements[k];
switch (k) {
case 0:
dev_info.enabled = obj->integer.value;
break;
case 1:
dev_info.name = obj->string.pointer;
break;
case 2:
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/device.h`, `linux/dmi.h`, `linux/suspend.h`, `../sleep.h`.
- Detected declarations: `struct lpi_device_info`, `struct lpi_device_constraint`, `struct lpi_constraints`, `struct lpi_device_constraint_amd`, `struct amd_lps0_hid_device_data`, `function lpi_device_get_constraints_amd`, `function lpi_device_get_constraints`, `function lpi_check_constraints`, `function for_each_lpi_constraint`, `function acpi_s2idle_vendor_amd`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.