projects/linux·commit 9e947d96

Merge tag 'chrome-platform-firmware-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

9e947d96 · Linus Torvalds <[email protected]> · 2026-10-20 15:02:13 -10:00

Pull chrome platform firmware loader updates from Tzung-Bi Shih:
 "New:
   - Rename drivers/firmware/google/ -> drivers/firmware/coreboot/ and
     corresponding Kconfig names
   - Separate firmware_attributes_class from drivers/platform/x86/ to
     drivers/firmware/ so that it is available for non-x86 platforms
   - Add CFR (coreboot form representation) driver to expose the
     attributes via sysfs

  Improvements:
   - Use named initializers for acpi_device_id"

* tag 'chrome-platform-firmware-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  firmware: coreboot: Add CFR firmware attributes driver
  firmware: Move firmware attributes class helper
  firmware: coreboot: Use named initializers for acpi_device_id
  firmware: Rename google firmware directory to coreboot
Commit
9e947d96915af63e28896caae85a81b74855621b
Parents
e5d379e9 · f2e05ce9

Merge commit. Changes below are compared with the first parent: e5d379e9.

Changes

28 files changed · +1326 −55

FileStatusAddDelContent
MAINTAINERSmodified+24−10View file
drivers/firmware/Kconfigmodified+4−1View file
drivers/firmware/Makefilemodified+2−1View file
drivers/firmware/google/Kconfig → drivers/firmware/coreboot/Kconfigrenamed+71−18View file
drivers/firmware/google/Makefile → drivers/firmware/coreboot/Makefilerenamed+6−5View file
drivers/firmware/google/cbmem.c → drivers/firmware/coreboot/cbmem.crenamed+0−0View file
drivers/firmware/coreboot/coreboot-cfr.cadded+1204−0View file
drivers/firmware/google/coreboot_table.c → drivers/firmware/coreboot/coreboot_table.crenamed+2−2View file
drivers/firmware/google/coreboot_table.h → drivers/firmware/coreboot/coreboot_table.hrenamed+0−0View file
drivers/firmware/google/framebuffer-coreboot.c → drivers/firmware/coreboot/framebuffer-coreboot.crenamed+0−0View file
drivers/firmware/google/gsmi.c → drivers/firmware/coreboot/gsmi.crenamed+0−0View file
drivers/firmware/google/memconsole-coreboot.c → drivers/firmware/coreboot/memconsole-coreboot.crenamed+0−0View file
drivers/firmware/google/memconsole-x86-legacy.c → drivers/firmware/coreboot/memconsole-x86-legacy.crenamed+0−0View file
drivers/firmware/google/memconsole.c → drivers/firmware/coreboot/memconsole.crenamed+0−0View file
drivers/firmware/google/memconsole.h → drivers/firmware/coreboot/memconsole.hrenamed+3−3View file
drivers/firmware/google/vpd.c → drivers/firmware/coreboot/vpd.crenamed+0−0View file
drivers/firmware/google/vpd_decode.c → drivers/firmware/coreboot/vpd_decode.crenamed+0−0View file
drivers/firmware/google/vpd_decode.h → drivers/firmware/coreboot/vpd_decode.hrenamed+0−0View file
drivers/platform/x86/firmware_attributes_class.c → drivers/firmware/firmware_attributes_class.crenamed+1−1View file
drivers/platform/x86/Kconfigmodified+0−3View file
drivers/platform/x86/Makefilemodified+0−2View file
drivers/platform/x86/asus-armoury.cmodified+1−1View file
drivers/platform/x86/dell/dell-wmi-sysman/sysman.cmodified+1−1View file
drivers/platform/x86/hp/hp-bioscfg/bioscfg.cmodified+1−1View file
drivers/platform/x86/lenovo/think-lmi.cmodified+1−1View file
drivers/platform/x86/lenovo/wmi-other.cmodified+1−1View file
drivers/platform/x86/samsung-galaxybook.cmodified+1−1View file
drivers/platform/x86/firmware_attributes_class.h → include/linux/firmware_attributes.hrenamed+3−3View file

Only the first 600 diff lines are shown. Download the complete patch.

MAINTAINERS

View file
diff --git a/MAINTAINERS b/MAINTAINERS
index 4f9bcbb..917f3f7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6716,6 +6716,22 @@ F: tools/testing/selftests/cgroup/test_hugetlb_memcg.c
F: tools/testing/selftests/cgroup/test_kmem.c
F: tools/testing/selftests/cgroup/test_memcontrol.c
+COREBOOT CFR FIRMWARE ATTRIBUTES DRIVER
+M: Sean Rhodes <[email protected]>
+S: Maintained
+F: drivers/firmware/coreboot/coreboot-cfr.c
+
+COREBOOT FIRMWARE DRIVERS
+M: Tzung-Bi Shih <[email protected]>
+R: Brian Norris <[email protected]>
+R: Julius Werner <[email protected]>
+S: Maintained
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
+F: drivers/firmware/coreboot/
+F: include/linux/coreboot.h
+
CORETEMP HARDWARE MONITORING DRIVER
S: Orphan
@@ -10196,6 +10212,14 @@ F: include/linux/firewire.h
F: include/uapi/linux/firewire*.h
F: tools/firewire/
+FIRMWARE ATTRIBUTES CLASS
+M: Hans de Goede <[email protected]>
+M: Ilpo Järvinen <[email protected]>
+S: Maintained
+F: drivers/firmware/firmware_attributes_class.c
+F: include/linux/firmware_attributes.h
+
FIRMWARE FRAMEWORK FOR ARMV8-A
M: Sudeep Holla <[email protected]>
L: [email protected] (moderated for non-subscribers)
@@ -11150,16 +11174,6 @@ S: Maintained
F: Documentation/networking/device_drivers/ethernet/google/gve.rst
F: drivers/net/ethernet/google
-GOOGLE FIRMWARE DRIVERS
-M: Tzung-Bi Shih <[email protected]>
-R: Brian Norris <[email protected]>
-R: Julius Werner <[email protected]>
-S: Maintained
-T: git git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
-F: drivers/firmware/google/
-F: include/linux/coreboot.h
-
GOOGLE TENSOR SoC SUPPORT
M: Peter Griffin <[email protected]>
R: André Draszik <[email protected]>

drivers/firmware/Kconfig

View file
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index f1a76d4..43e2e2a 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -8,6 +8,9 @@ menu "Firmware Drivers"
source "drivers/firmware/arm_scmi/Kconfig"
+config FW_ATTR_CLASS
+ tristate
+
config ARM_SCPI_PROTOCOL
tristate "ARM System Control and Power Interface (SCPI) Message Protocol"
depends on ARM || ARM64 || COMPILE_TEST
@@ -300,7 +303,7 @@ source "drivers/firmware/arm_ffa/Kconfig"
source "drivers/firmware/arm_rmm/Kconfig"
source "drivers/firmware/broadcom/Kconfig"
source "drivers/firmware/cirrus/Kconfig"
-source "drivers/firmware/google/Kconfig"
+source "drivers/firmware/coreboot/Kconfig"
source "drivers/firmware/efi/Kconfig"
source "drivers/firmware/imx/Kconfig"
source "drivers/firmware/meson/Kconfig"

drivers/firmware/Makefile

View file
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 54755db..50b3383 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
obj-$(CONFIG_MTK_ADSP_IPC) += mtk-adsp-ipc.o
obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o
+obj-$(CONFIG_FW_ATTR_CLASS) += firmware_attributes_class.o
obj-$(CONFIG_SYSFB) += sysfb.o
obj-$(CONFIG_SYSFB_SIMPLEFB) += sysfb_simplefb.o
obj-$(CONFIG_TH1520_AON_PROTOCOL) += thead,th1520-aon.o
@@ -31,7 +32,7 @@ obj-y += broadcom/
obj-y += cirrus/
obj-y += meson/
obj-y += microchip/
-obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
+obj-$(CONFIG_COREBOOT_FIRMWARE) += coreboot/
obj-y += efi/
obj-y += imx/
obj-y += psci/

drivers/firmware/coreboot/Kconfig

View file
diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/coreboot/Kconfig
similarity index 63%
rename from drivers/firmware/google/Kconfig
rename to drivers/firmware/coreboot/Kconfig
index b78c644..acfc7d1 100644
--- a/drivers/firmware/google/Kconfig
+++ b/drivers/firmware/coreboot/Kconfig
@@ -1,13 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-only
-menuconfig GOOGLE_FIRMWARE
- bool "Google Firmware Drivers"
+menuconfig COREBOOT_FIRMWARE
+ bool "coreboot firmware drivers"
+ default GOOGLE_FIRMWARE
default n
help
- These firmware drivers are used by Google servers,
- Chromebooks and other devices using coreboot firmware.
+ These firmware drivers are used by devices running coreboot
+ firmware, including Chromebooks and some Google servers.
+ They include shared support for coreboot table entries and
+ drivers for CBMEM, framebuffer, firmware console and VPD records.
If in doubt, say "N".
-if GOOGLE_FIRMWARE
+if COREBOOT_FIRMWARE
config GOOGLE_SMI
tristate "SMI interface for Google platforms"
@@ -19,9 +22,10 @@ config GOOGLE_SMI
driver provides an interface for reading and writing NVRAM
variables.
-config GOOGLE_CBMEM
+config COREBOOT_CBMEM
tristate "CBMEM entries in sysfs"
- depends on GOOGLE_COREBOOT_TABLE
+ depends on COREBOOT_TABLE
+ default GOOGLE_CBMEM
help
CBMEM is a downwards-growing memory region created by the
Coreboot BIOS containing tagged data structures from the
@@ -34,9 +38,10 @@ config GOOGLE_CBMEM
memory for each entry in sysfs under
/sys/bus/coreboot/devices/cbmem-<id>.
-config GOOGLE_COREBOOT_TABLE
+config COREBOOT_TABLE
tristate "Coreboot Table Access"
depends on HAS_IOMEM && (ACPI || OF)
+ default GOOGLE_COREBOOT_TABLE
help
This option enables the coreboot_table module, which provides other
firmware modules access to the coreboot table. The coreboot table
@@ -44,42 +49,90 @@ config GOOGLE_COREBOOT_TABLE
device tree node /firmware/coreboot.
If unsure say N.
-config GOOGLE_MEMCONSOLE
+config COREBOOT_CFR
+ tristate "coreboot CFR firmware attributes"
+ depends on EFI
+ depends on COREBOOT_TABLE
+ depends on HAS_IOPORT
+ select CRC32
+ select FW_ATTR_CLASS
+ help
+ This driver parses the coreboot CFR table and exposes runtime EFI
+ variable-backed options through the firmware-attributes sysfs
+ interface.
+
+ If you have a system running coreboot with CFR runtime
+ configuration support, say Y or M here.
+
+config COREBOOT_MEMCONSOLE_COMMON
tristate
- depends on GOOGLE_MEMCONSOLE_X86_LEGACY || GOOGLE_MEMCONSOLE_COREBOOT
+ depends on GOOGLE_MEMCONSOLE_X86_LEGACY || COREBOOT_MEMCONSOLE
+ default GOOGLE_MEMCONSOLE
config GOOGLE_MEMCONSOLE_X86_LEGACY
tristate "Firmware Memory Console - X86 Legacy support"
depends on X86 && ACPI && DMI
- select GOOGLE_MEMCONSOLE
+ select COREBOOT_MEMCONSOLE_COMMON
help
This option enables the kernel to search for a firmware log in
the EBDA on Google servers. If found, this log is exported to
userland in the file /sys/firmware/log.
+ This driver is limited to x86 systems that expose the legacy
+ Google EBDA console format.
-config GOOGLE_FRAMEBUFFER_COREBOOT
+config COREBOOT_FRAMEBUFFER
tristate "Coreboot Framebuffer"
- depends on GOOGLE_COREBOOT_TABLE
+ depends on COREBOOT_TABLE
+ default GOOGLE_FRAMEBUFFER_COREBOOT
help
This option enables the kernel to search for a framebuffer in
the coreboot table. If found, it is registered with a platform
device of type coreboot-framebuffer. Using the old device of
type simple-framebuffer is deprecated.
-config GOOGLE_MEMCONSOLE_COREBOOT
+config COREBOOT_MEMCONSOLE
tristate "Firmware Memory Console"
- depends on GOOGLE_COREBOOT_TABLE
- select GOOGLE_MEMCONSOLE
+ depends on COREBOOT_TABLE
+ select COREBOOT_MEMCONSOLE_COMMON
+ default GOOGLE_MEMCONSOLE_COREBOOT
help
This option enables the kernel to search for a firmware log in
the coreboot table. If found, this log is exported to userland
in the file /sys/firmware/log.
+ This is the coreboot-table backed variant of the firmware memory
+ console driver.
config GOOGLE_VPD
tristate "Vital Product Data"
- depends on GOOGLE_COREBOOT_TABLE
+ depends on COREBOOT_TABLE
help
This option enables the kernel to expose the content of Google VPD
under /sys/firmware/vpd.
+ VPD records carry firmware-provided key/value data used by
+ Google devices.
+
+endif # COREBOOT_FIRMWARE
+
+config GOOGLE_FIRMWARE
+ bool
+ transitional
+
+config GOOGLE_CBMEM
+ tristate
+ transitional
+
+config GOOGLE_COREBOOT_TABLE
+ tristate
+ transitional
+
+config GOOGLE_MEMCONSOLE
+ tristate
+ transitional
+
+config GOOGLE_FRAMEBUFFER_COREBOOT
+ tristate
+ transitional
-endif # GOOGLE_FIRMWARE
+config GOOGLE_MEMCONSOLE_COREBOOT
+ tristate
+ transitional

drivers/firmware/coreboot/Makefile

View file
diff --git a/drivers/firmware/google/Makefile b/drivers/firmware/coreboot/Makefile
similarity index 52%
rename from drivers/firmware/google/Makefile
rename to drivers/firmware/coreboot/Makefile
index 8151e32..a08d167 100644
--- a/drivers/firmware/google/Makefile
+++ b/drivers/firmware/coreboot/Makefile
@@ -1,14 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
-obj-$(CONFIG_GOOGLE_COREBOOT_TABLE) += coreboot_table.o
-obj-$(CONFIG_GOOGLE_FRAMEBUFFER_COREBOOT) += framebuffer-coreboot.o
-obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
-obj-$(CONFIG_GOOGLE_MEMCONSOLE_COREBOOT) += memconsole-coreboot.o
+obj-$(CONFIG_COREBOOT_TABLE) += coreboot_table.o
+obj-$(CONFIG_COREBOOT_CFR) += coreboot-cfr.o
+obj-$(CONFIG_COREBOOT_FRAMEBUFFER) += framebuffer-coreboot.o
+obj-$(CONFIG_COREBOOT_MEMCONSOLE_COMMON) += memconsole.o
+obj-$(CONFIG_COREBOOT_MEMCONSOLE) += memconsole-coreboot.o
obj-$(CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY) += memconsole-x86-legacy.o
# Must come after coreboot_table.o, as this driver depends on that bus type.
-obj-$(CONFIG_GOOGLE_CBMEM) += cbmem.o
+obj-$(CONFIG_COREBOOT_CBMEM) += cbmem.o
vpd-sysfs-y := vpd.o vpd_decode.o
obj-$(CONFIG_GOOGLE_VPD) += vpd-sysfs.o

drivers/firmware/coreboot/cbmem.c

View file
diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/coreboot/cbmem.c
similarity index 100%
rename from drivers/firmware/google/cbmem.c
rename to drivers/firmware/coreboot/cbmem.c

drivers/firmware/coreboot/coreboot-cfr.c

View file
diff --git a/drivers/firmware/coreboot/coreboot-cfr.c b/drivers/firmware/coreboot/coreboot-cfr.c
new file mode 100644
index 0000000..2d9ea5d
--- /dev/null
+++ b/drivers/firmware/coreboot/coreboot-cfr.c
@@ -0,0 +1,1204 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * coreboot CFR firmware attributes driver.
+ *
+ * Parses LB_TAG_CFR_ROOT records from the coreboot table and exposes
+ * runtime EFI variable-backed options through the firmware-attributes class.
+ */
+
+#include <linux/array_size.h>
+#include <linux/bitops.h>
+#include <linux/cleanup.h>
+#include <linux/compiler_attributes.h>
+#include <linux/container_of.h>
+#include <linux/crc32.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/kstrtox.h>
+#include <linux/limits.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/sysfs.h>
+#include <linux/types.h>
+
+#include "coreboot_table.h"
+
+#define DRIVER_NAME "coreboot-cfr"
+
+#define LB_TAG_CFR_ROOT 0x47
+#define CFR_VERSION 0
+
+enum cfr_tags {
+ CFR_TAG_OPTION_FORM = 1,
+ CFR_TAG_ENUM_VALUE = 2,
+ CFR_TAG_OPTION_ENUM = 3,
+ CFR_TAG_OPTION_NUMBER = 4,
+ CFR_TAG_OPTION_BOOL = 5,
+ CFR_TAG_VARCHAR_OPT_NAME = 7,
+ CFR_TAG_VARCHAR_UI_NAME = 8,
+ CFR_TAG_RUNTIME_APPLY = 13,
+};
+
+enum cfr_option_flags {
+ CFR_OPTFLAG_READONLY = BIT(0),
+ CFR_OPTFLAG_INACTIVE = BIT(1),
+ CFR_OPTFLAG_SUPPRESS = BIT(2),
+ CFR_OPTFLAG_VOLATILE = BIT(3),
+ CFR_OPTFLAG_RUNTIME = BIT(4),
+};
+
+enum cfr_runtime_apply_method {
+ CFR_RUNTIME_APPLY_NONE = 0,
+ CFR_RUNTIME_APPLY_APM_CNT = 1,
+};
+
+struct lb_cfr {
+ u32 tag;
+ u32 size;
+ u32 version;
+ u32 checksum;
+} __packed;
+
+struct lb_cfr_varbinary {
+ u32 tag;
+ u32 size;
+ u32 data_length;
+} __packed;
+
+struct lb_cfr_enum_value {
+ u32 tag;
+ u32 size;
+ u32 value;
+} __packed;
+
+struct lb_cfr_runtime_apply {
+ u32 tag;
+ u32 size;
+ u32 method;
+ u32 id;
+} __packed;
+
+struct lb_cfr_numeric_option {
+ u32 tag;
+ u32 size;
+ cb_u64 object_id;
+ cb_u64 dependency_id;
+ u32 flags;
+ u32 default_value;
+ u32 min;
+ u32 max;
+ u32 step;
+ u32 display_flags;
+} __packed;
+
+struct lb_cfr_option_form {
+ u32 tag;
+ u32 size;
+ cb_u64 object_id;
+ cb_u64 dependency_id;
+ u32 flags;
+} __packed;
+
+#define COREBOOT_CFR_OPT_SKIP_FLAGS \
+ (CFR_OPTFLAG_SUPPRESS | CFR_OPTFLAG_VOLATILE)
+
+#define COREBOOT_CFR_OPT_READ_ONLY_FLAGS \
+ (CFR_OPTFLAG_READONLY | CFR_OPTFLAG_INACTIVE)
+
+#define COREBOOT_CFR_EFI_ATTRS \
+ (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | \
+ EFI_VARIABLE_RUNTIME_ACCESS)
+
+#define COREBOOT_CFR_APM_CNT_PORT 0xb2
+#define COREBOOT_CFR_APM_STS_PORT 0xb3
+#define COREBOOT_CFR_APM_APPLY_CMD 0xe3
+#define COREBOOT_CFR_MAX_FORM_DEPTH 16
+
+static efi_guid_t coreboot_cfr_guid = EFI_GUID(0xceae4c1d, 0x335b, 0x4685,
+ 0xa4, 0xa0, 0xfc, 0x4a,
+ 0x94, 0xee, 0xa0, 0x85);
+
+enum coreboot_cfr_setting_type {
+ COREBOOT_CFR_SETTING_ENUM,
+ COREBOOT_CFR_SETTING_NUMBER,
+ COREBOOT_CFR_SETTING_BOOL,
+};
+
+struct coreboot_cfr_enum {
+ char *label;
+ u32 value;
+};
+
+struct coreboot_cfr_setting {
+ struct kobject kobj;
+ struct list_head node;
+ struct coreboot_cfr_drvdata *drvdata;
+ enum coreboot_cfr_setting_type type;
+ char *name;
+ char *display_name;
+ struct coreboot_cfr_enum *values;
+ unsigned int n_values;
+ u32 default_value;
+ u32 min;
+ u32 max;
+ u32 step;
+ u32 runtime_apply_method;
+ u32 runtime_apply_id;
+ bool read_only;
+};
+
+struct coreboot_cfr_drvdata {
+ struct device *class_dev;
+ struct kset *attrs_kset;
+ struct list_head settings;
+ /* Serializes EFI variable writes and the matching runtime apply hook. */
+ struct mutex lock;
+ bool efi_writes_supported;
+ bool pending_reboot;
+};
+
+struct coreboot_cfr_iterator {
+ const u8 *cursor;
+ size_t remaining;
+};
+
+static struct coreboot_cfr_setting *to_coreboot_cfr_setting(struct kobject *kobj)
+{
+ return container_of(kobj, struct coreboot_cfr_setting, kobj);
+}
+
+static bool coreboot_cfr_string_is_valid_name(const char *name)
+{
+ return name && name[0] && !strchr(name, '/') &&
+ strcmp(name, "pending_reboot") != 0;
+}
+
+static bool coreboot_cfr_string_is_valid_label(const char *label)
+{
+ return label && !strchr(label, ';') && !strchr(label, '\n');
+}
+
+static char *coreboot_cfr_string_dup(const struct lb_cfr_varbinary *str)
+{
+ const char *data = (const char *)(str + 1);
+ size_t len = str->data_length;
+
+ if (len && !data[len - 1])
+ len--;
+
+ return kmemdup_nul(data, len, GFP_KERNEL);
+}
+
+static const struct coreboot_table_entry *
+coreboot_cfr_next_entry(struct coreboot_cfr_iterator *iterator)
+{
+ const struct coreboot_table_entry *entry;
+
+ if (!iterator->remaining)
+ return NULL;
+
+ if (iterator->remaining < sizeof(*entry))
+ return ERR_PTR(-EINVAL);
+
+ entry = (const struct coreboot_table_entry *)iterator->cursor;
+ if (entry->size < sizeof(*entry) || entry->size > iterator->remaining)
+ return ERR_PTR(-EINVAL);
+
+ iterator->cursor += entry->size;
+ iterator->remaining -= entry->size;
+
+ return entry;
+}
+
+static const struct coreboot_table_entry *
+coreboot_cfr_child_entry(const void *base, size_t len, u32 tag)
+{
+ struct coreboot_cfr_iterator iterator = {
+ .cursor = base,
+ .remaining = len,
+ };
+ const struct coreboot_table_entry *entry;
+
+ for (;;) {
+ entry = coreboot_cfr_next_entry(&iterator);
+ if (IS_ERR_OR_NULL(entry))
+ return entry;
+
+ if (entry->tag == tag)
+ return entry;
+ }
+}
+
+static const struct lb_cfr_varbinary *
+coreboot_cfr_child_string(const void *base, size_t len, u32 tag)
+{
+ const struct lb_cfr_varbinary *str;
+ const struct coreboot_table_entry *entry;
+
+ entry = coreboot_cfr_child_entry(base, len, tag);
+ if (IS_ERR(entry))
+ return ERR_CAST(entry);
+ if (!entry)
+ return NULL;
+
+ if (entry->size < sizeof(*str))
+ return ERR_PTR(-EINVAL);
+
+ str = (const struct lb_cfr_varbinary *)entry;
+ if (str->data_length > entry->size - sizeof(*str))
+ return ERR_PTR(-EINVAL);
+
+ return str;
+}
+
+static const struct lb_cfr_runtime_apply *
+coreboot_cfr_child_runtime_apply(const void *base, size_t len)
+{
+ const struct lb_cfr_runtime_apply *runtime_apply;
+ const struct coreboot_table_entry *entry;
+
+ entry = coreboot_cfr_child_entry(base, len, CFR_TAG_RUNTIME_APPLY);
+ if (IS_ERR(entry))
+ return ERR_CAST(entry);
+ if (!entry)
+ return NULL;
+
+ if (entry->size < sizeof(*runtime_apply))
+ return ERR_PTR(-EINVAL);
+
+ runtime_apply = (const struct lb_cfr_runtime_apply *)entry;
+ if (runtime_apply->method == CFR_RUNTIME_APPLY_APM_CNT &&
+ runtime_apply->id > U8_MAX)
+ return ERR_PTR(-EINVAL);
+
+ return runtime_apply;
+}
+
+static efi_char16_t *coreboot_cfr_efi_name(const char *name)
+{
+ size_t len, i;
+
+ len = strlen(name);
+ if (len >= EFI_VAR_NAME_LEN)
+ return ERR_PTR(-ENAMETOOLONG);
+
+ efi_char16_t *efi_name __free(kfree) =
+ kcalloc(len + 1, sizeof(*efi_name), GFP_KERNEL);
+ if (!efi_name)
+ return ERR_PTR(-ENOMEM);
+
+ for (i = 0; i < len; i++) {
+ if (!isascii(name[i]))
+ return ERR_PTR(-EINVAL);
+ efi_name[i] = name[i];
+ }

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/coreboot_table.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/coreboot_table.h

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/framebuffer-coreboot.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/gsmi.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/memconsole-coreboot.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/memconsole-x86-legacy.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/memconsole.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/memconsole.h

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/vpd.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/vpd_decode.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/coreboot/vpd_decode.h

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/firmware_attributes_class.c

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/asus-armoury.c

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/dell/dell-wmi-sysman/sysman.c

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/hp/hp-bioscfg/bioscfg.c

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/lenovo/think-lmi.c

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/lenovo/wmi-other.c

View file

This diff is incomplete. Download the complete patch.

drivers/platform/x86/samsung-galaxybook.c

View file

This diff is incomplete. Download the complete patch.

include/linux/firmware_attributes.h

View file

This diff is incomplete. Download the complete patch.