mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Rhodes <sean@starlabs.systems>
To: tzungbi@kernel.org
Cc: hansg@kernel.org, ilpo.jarvinen@linux.intel.com,
	corentin.chary@gmail.com, luke@ljones.dev,
	denis.benato@linux.dev, prasanth.ksr@dell.com,
	jorge.lopez2@hp.com, mpearson-lenovo@squebb.ca,
	derekjohn.clark@gmail.com, josh@joshuagrisham.com,
	briannorris@chromium.org, jwerner@chromium.org,
	tzimmermann@suse.de, javierm@redhat.com, kees@kernel.org,
	u.kleine-koenig@baylibre.com, mst@redhat.com,
	chenhuacai@kernel.org, wenst@chromium.org,
	florian.fainelli@broadcom.com, titouan.ameline@gmail.com,
	linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com,
	chrome-platform@lists.linux.dev
Subject: [PATCH v5 0/3] firmware: Add coreboot CFR firmware attributes driver
Date: Mon, 13 Jul 2026 06:45:23 +0100	[thread overview]
Message-ID: <20260713054526.2902319-1-sean@starlabs.systems> (raw)
In-Reply-To: <CABtds-0uN8WW2SkDzwYf8cbQGZnx=Y8Nocs-ebMYB0KWOiX_Kw@mail.gmail.com>

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

  reply	other threads:[~2026-07-13  5:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 16:39 [PATCH v4 " Sean Rhodes
2026-07-13  5:45 ` Sean Rhodes [this message]
2026-07-13  5:45   ` [PATCH v5 1/3] firmware: Move firmware attributes class helper Sean Rhodes
2026-07-13  7:13     ` Derek J. Clark
2026-07-13  5:45   ` [PATCH v5 2/3] firmware: Rename google firmware directory to coreboot Sean Rhodes
2026-07-13  5:45   ` [PATCH v5 3/3] firmware: coreboot: Add CFR firmware attributes driver Sean Rhodes
2026-07-13  8:13   ` [PATCH v6 0/3] firmware: Add coreboot " Sean Rhodes
2026-07-13  8:13     ` [PATCH v6 1/3] firmware: Move firmware attributes class helper Sean Rhodes
2026-07-13 10:03       ` Derek J. Clark
2026-07-15 12:11         ` Oliver Lin
2026-07-13  8:13     ` [PATCH v6 2/3] firmware: Rename google firmware directory to coreboot Sean Rhodes
2026-07-13  8:13     ` [PATCH v6 3/3] firmware: coreboot: Add CFR firmware attributes driver Sean Rhodes
2026-07-17  5:53       ` Tzung-Bi Shih
2026-07-13  9:53     ` [PATCH v6 0/3] firmware: Add coreboot " Derek J. Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260713054526.2902319-1-sean@starlabs.systems \
    --to=sean@starlabs.systems \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=briannorris@chromium.org \
    --cc=chenhuacai@kernel.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=corentin.chary@gmail.com \
    --cc=denis.benato@linux.dev \
    --cc=derekjohn.clark@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=javierm@redhat.com \
    --cc=jorge.lopez2@hp.com \
    --cc=josh@joshuagrisham.com \
    --cc=jwerner@chromium.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=mst@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=prasanth.ksr@dell.com \
    --cc=titouan.ameline@gmail.com \
    --cc=tzimmermann@suse.de \
    --cc=tzungbi@kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®