Skip to content

Commit 8dcb448

Browse files
nate-desimonerafaeljw
authored andcommitted
ACPI: FPDT: expose FBPT and S3PT subtables via sysfs
Add sysfs files at /sys/firmware/acpi/fpdt/FBPT and /sys/firmware/acpi/fpdt/S3PT that expose the raw contents of the FPDT subtables. Note that /sys/firmware/acpi/tables/FPDT only provides the top level table, not the subtables. Adding access to the subtables enables a usage model similar to /sys/firmware/dmi/tables/DMI, allowing userspace tools to interpret newer record types (e.g. String Event Records, Microcontroller Boot Performance Data Records, etc.) defined in recent ACPI specifications [1] without requiring kernel changes. Link: https://uefi.org/specs/ACPI/6.6/05_ACPI_Software_Programming_Model.html#performance-event-record-types [1] Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> [ rjw: Changelog edits ] Link: https://patch.msgid.link/20260324231456.701-2-nathaniel.l.desimone@intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 9b776dd commit 8dcb448

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

drivers/acpi/acpi_fpdt.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ static const struct attribute_group boot_attr_group = {
141141
.name = "boot",
142142
};
143143

144+
static BIN_ATTR(FBPT, 0400, sysfs_bin_attr_simple_read, NULL, 0);
145+
static BIN_ATTR(S3PT, 0400, sysfs_bin_attr_simple_read, NULL, 0);
146+
144147
static struct kobject *fpdt_kobj;
145148

146149
#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT
@@ -254,9 +257,34 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
254257
break;
255258
}
256259
}
260+
261+
if (subtable_type == SUBTABLE_FBPT) {
262+
bin_attr_FBPT.private = subtable_header;
263+
bin_attr_FBPT.size = length;
264+
result = sysfs_create_bin_file(fpdt_kobj, &bin_attr_FBPT);
265+
if (result)
266+
pr_warn("Failed to create FBPT sysfs attribute.\n");
267+
} else if (subtable_type == SUBTABLE_S3PT) {
268+
bin_attr_S3PT.private = subtable_header;
269+
bin_attr_S3PT.size = length;
270+
result = sysfs_create_bin_file(fpdt_kobj, &bin_attr_S3PT);
271+
if (result)
272+
pr_warn("Failed to create S3PT sysfs attribute.\n");
273+
}
274+
257275
return 0;
258276

259277
err:
278+
if (bin_attr_FBPT.private) {
279+
sysfs_remove_bin_file(fpdt_kobj, &bin_attr_FBPT);
280+
bin_attr_FBPT.private = NULL;
281+
}
282+
283+
if (bin_attr_S3PT.private) {
284+
sysfs_remove_bin_file(fpdt_kobj, &bin_attr_S3PT);
285+
bin_attr_S3PT.private = NULL;
286+
}
287+
260288
if (record_boot)
261289
sysfs_remove_group(fpdt_kobj, &boot_attr_group);
262290

0 commit comments

Comments
 (0)