drivers/acpi/acpi_fpdt.c

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

File Facts

System
Linux kernel
Corpus path
drivers/acpi/acpi_fpdt.c
Extension
.c
Size
8532 bytes
Lines
345
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 fpdt_subtable_entry {
	u16 type;		/* refer to enum fpdt_subtable_type */
	u8 length;
	u8 revision;
	u32 reserved;
	u64 address;		/* physical address of the S3PT/FBPT table */
};

struct fpdt_subtable_header {
	u32 signature;
	u32 length;
};

enum fpdt_record_type {
	RECORD_S3_RESUME,
	RECORD_S3_SUSPEND,
	RECORD_BOOT,
};

struct fpdt_record_header {
	u16 type;		/* refer to enum fpdt_record_type */
	u8 length;
	u8 revision;
};

struct resume_performance_record {
	struct fpdt_record_header header;
	u32 resume_count;
	u64 resume_prev;
	u64 resume_avg;
} __attribute__((packed));

struct boot_performance_record {
	struct fpdt_record_header header;
	u32 reserved;
	u64 firmware_start;
	u64 bootloader_load;
	u64 bootloader_launch;
	u64 exitbootservice_start;
	u64 exitbootservice_end;
} __attribute__((packed));

struct suspend_performance_record {
	struct fpdt_record_header header;
	u64 suspend_start;
	u64 suspend_end;
} __attribute__((packed));


static struct resume_performance_record *record_resume;
static struct suspend_performance_record *record_suspend;
static struct boot_performance_record *record_boot;

#define FPDT_ATTR(phase, name)	\
static ssize_t name##_show(struct kobject *kobj,	\
		 struct kobj_attribute *attr, char *buf)	\
{	\
	return sprintf(buf, "%llu\n", record_##phase->name);	\
}	\
static struct kobj_attribute name##_attr =	\
__ATTR(name##_ns, 0444, name##_show, NULL)

FPDT_ATTR(resume, resume_prev);
FPDT_ATTR(resume, resume_avg);
FPDT_ATTR(suspend, suspend_start);
FPDT_ATTR(suspend, suspend_end);
FPDT_ATTR(boot, firmware_start);
FPDT_ATTR(boot, bootloader_load);
FPDT_ATTR(boot, bootloader_launch);
FPDT_ATTR(boot, exitbootservice_start);
FPDT_ATTR(boot, exitbootservice_end);

static ssize_t resume_count_show(struct kobject *kobj,
				 struct kobj_attribute *attr, char *buf)
{
	return sprintf(buf, "%u\n", record_resume->resume_count);
}

static struct kobj_attribute resume_count_attr =
__ATTR_RO(resume_count);

static struct attribute *resume_attrs[] = {
	&resume_count_attr.attr,
	&resume_prev_attr.attr,
	&resume_avg_attr.attr,
	NULL
};

static const struct attribute_group resume_attr_group = {
	.attrs = resume_attrs,

Annotation

Implementation Notes