[PATCH v5 0/3] firmware: Add coreboot CFR firmware attributes driver

From: Sean Rhodes

Date: Mon Jul 13 2026 - 01:45:37 EST


Move the firmware attributes class helper out of platform/x86, rename
the coreboot-table firmware driver directory from google to coreboot, and
add a coreboot CFR firmware attributes driver.

Changes in v5:
- Keep the coreboot CFR include list sorted.
- Move firmware_attributes.h into the sorted include block.
- Store the CFR driver data on the firmware-attributes class device instead
of using a file-global pointer.
- Use the existing (str + 1) pattern when deriving CFR string payload data.

Sean Rhodes (3):
firmware: Move firmware attributes class helper
firmware: Rename google firmware directory to coreboot
firmware: coreboot: Add CFR firmware attributes driver

MAINTAINERS | 18 +-
drivers/firmware/Kconfig | 5 +-
drivers/firmware/Makefile | 3 +-
drivers/firmware/{google => coreboot}/Kconfig | 19 +-
.../firmware/{google => coreboot}/Makefile | 1 +
drivers/firmware/{google => coreboot}/cbmem.c | 0
drivers/firmware/coreboot/coreboot-cfr.c | 1065 +++++++++++++++++
.../{google => coreboot}/coreboot_table.c | 0
.../{google => coreboot}/coreboot_table.h | 0
.../framebuffer-coreboot.c | 0
drivers/firmware/{google => coreboot}/gsmi.c | 0
.../memconsole-coreboot.c | 0
.../memconsole-x86-legacy.c | 0
.../{google => coreboot}/memconsole.c | 0
.../{google => coreboot}/memconsole.h | 6 +-
drivers/firmware/{google => coreboot}/vpd.c | 0
.../{google => coreboot}/vpd_decode.c | 0
.../{google => coreboot}/vpd_decode.h | 0
.../firmware_attributes_class.c | 2 +-
drivers/platform/x86/Kconfig | 3 -
drivers/platform/x86/Makefile | 2 -
drivers/platform/x86/asus-armoury.c | 2 +-
.../x86/dell/dell-wmi-sysman/sysman.c | 2 +-
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 +-
drivers/platform/x86/lenovo/think-lmi.c | 2 +-
drivers/platform/x86/lenovo/wmi-other.c | 2 +-
drivers/platform/x86/samsung-galaxybook.c | 2 +-
.../linux/firmware_attributes.h | 6 +-
28 files changed, 1117 insertions(+), 25 deletions(-)
rename drivers/firmware/{google => coreboot}/Kconfig (83%)
rename drivers/firmware/{google => coreboot}/Makefile (92%)
rename drivers/firmware/{google => coreboot}/cbmem.c (100%)
create mode 100644 drivers/firmware/coreboot/coreboot-cfr.c
rename drivers/firmware/{google => coreboot}/coreboot_table.c (100%)
rename drivers/firmware/{google => coreboot}/coreboot_table.h (100%)
rename drivers/firmware/{google => coreboot}/framebuffer-coreboot.c (100%)
rename drivers/firmware/{google => coreboot}/gsmi.c (100%)
rename drivers/firmware/{google => coreboot}/memconsole-coreboot.c (100%)
rename drivers/firmware/{google => coreboot}/memconsole-x86-legacy.c (100%)
rename drivers/firmware/{google => coreboot}/memconsole.c (100%)
rename drivers/firmware/{google => coreboot}/memconsole.h (82%)
rename drivers/firmware/{google => coreboot}/vpd.c (100%)
rename drivers/firmware/{google => coreboot}/vpd_decode.c (100%)
rename drivers/firmware/{google => coreboot}/vpd_decode.h (100%)
rename drivers/{platform/x86 => firmware}/firmware_attributes_class.c (94%)
rename drivers/platform/x86/firmware_attributes_class.h => include/linux/firmware_attributes.h (60%)

Range-diff against v4:
1: 4a82d0a07612 = 1: 4a82d0a07612 firmware: Move firmware attributes class helper
2: 285b33f805dc = 2: 285b33f805dc firmware: Rename google firmware directory to coreboot
3: 5edcdb4635c2 ! 3: ce91f4da5510 firmware: coreboot: Add CFR firmware attributes driver
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+#include <linux/bitops.h>
+#include <linux/cleanup.h>
+#include <linux/ctype.h>
++#include <linux/device.h>
++#include <linux/device-id/coreboot.h>
+#include <linux/efi.h>
+#include <linux/err.h>
++#include <linux/firmware_attributes.h>
+#include <linux/io.h>
+#include <linux/kdev_t.h>
+#include <linux/kobject.h>
+#include <linux/limits.h>
+#include <linux/list.h>
-+#include <linux/device-id/coreboot.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+#include <linux/sysfs.h>
+#include <linux/types.h>
+
-+#include <linux/firmware_attributes.h>
-+
+#include "coreboot_table.h"
+
+#define DRIVER_NAME "coreboot-cfr"
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+ bool pending_reboot;
+};
+
-+static struct coreboot_cfr_drvdata *coreboot_cfr_data;
-+
+static struct coreboot_cfr_setting *to_coreboot_cfr_setting(struct kobject *kobj)
+{
+ return container_of(kobj, struct coreboot_cfr_setting, kobj);
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+
+static char *coreboot_cfr_string_dup(const struct lb_cfr_varbinary *str)
+{
-+ const char *data = (const char *)str + sizeof(*str);
++ const char *data = (const char *)(str + 1);
+ size_t len = str->data_length;
+
+ if (len && !data[len - 1])
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+static ssize_t pending_reboot_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
-+ return sysfs_emit(buf, "%d\n",
-+ coreboot_cfr_data && coreboot_cfr_data->pending_reboot);
++ struct coreboot_cfr_drvdata *data;
++
++ data = dev_get_drvdata(kobj_to_dev(kobj->parent));
++
++ return sysfs_emit(buf, "%d\n", data->pending_reboot);
+}
+
+static struct kobj_attribute pending_reboot_attr = __ATTR_RO(pending_reboot);
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+ return ret;
+
+ dev_set_drvdata(&dev->dev, data);
-+ coreboot_cfr_data = data;
+
+ data->class_dev = device_create(&firmware_attributes_class, NULL,
+ MKDEV(0, 0), NULL, DRIVER_NAME);
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+ ret = PTR_ERR(data->class_dev);
+ goto err_clear_data;
+ }
++ dev_set_drvdata(data->class_dev, data);
+
+ data->attrs_kset = kset_create_and_add("attributes", NULL,
+ &data->class_dev->kobj);
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+err_unregister_dev:
+ device_unregister(data->class_dev);
+err_clear_data:
-+ if (coreboot_cfr_data == data)
-+ coreboot_cfr_data = NULL;
+ return ret;
+}
+
@@ drivers/firmware/coreboot/coreboot-cfr.c (new)
+ sysfs_remove_file(&data->attrs_kset->kobj, &pending_reboot_attr.attr);
+ kset_unregister(data->attrs_kset);
+ device_unregister(data->class_dev);
-+ if (coreboot_cfr_data == data)
-+ coreboot_cfr_data = NULL;
+}
+
+static const struct coreboot_device_id coreboot_cfr_ids[] = {
--
2.53.0