From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02C6735F185 for ; Mon, 13 Jul 2026 05:45:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783921534; cv=none; b=jdj0MHFcRPsmVCGI6gUjdmNEoiy3FYXmc3TAmZ4W8Qlok2VBAaZQWwq/R0rSgHrZ9AFkNme75ZuTBBylkNOhF/w7xD+k7pw6ftazBTDHdT+Alh8QS/yJ286Y7+PDpXtl26jRjmnluAWz7yh5aXOMQxSB6X4srJcNJx88FUTur8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783921534; c=relaxed/simple; bh=AEP4uxI1zCb4UVGFWZ3wz6W2Yh9643nHoAhpfQmZJ8w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HZ2QeSbXS+po2b55DwqOwAPECt423hBdJdG8eCsqUUbujy+9Ih5OfvpIoTX01j5D6znRBLnxXCJQiHX/K+9UpHUSVj5nIZhE33D2dTziSo61z7+QQLOfINvz2GDyK/SCBAZMHgpV5DoWBs2OOCEj5WAzxgiYHEDCUXS9Os4fH2g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=starlabs.systems; spf=pass smtp.mailfrom=starlabs.systems; dkim=pass (2048-bit key) header.d=starlabs-systems.20251104.gappssmtp.com header.i=@starlabs-systems.20251104.gappssmtp.com header.b=AuELKndw; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=starlabs.systems Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starlabs.systems Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=starlabs-systems.20251104.gappssmtp.com header.i=@starlabs-systems.20251104.gappssmtp.com header.b="AuELKndw" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-47f36a122fdso766038f8f.2 for ; Sun, 12 Jul 2026 22:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20251104.gappssmtp.com; s=20251104; t=1783921529; x=1784526329; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xR98/09eXkQIDUktGVg5UEkoPWGYvzdvyoIyKvy+ChM=; b=AuELKndwwfA5eBcK5QqIyK0AXd5bZOD4LK5UzBGYkS+T/2BmU9ROsEtHvKmqxcX5zz tmSBDwkUNFKPXJSSQm3eFsdcGkPDnKx5Ug8FdN8amTyZvLG0+md0psKethppkGOb1d4+ 2DITkoPYUbeCTsIW7s/IHHP679iJzft1N5ZuTV9ooMLQIECHaLmch2PzYbffzwuykzXW s3IJyYp33luI7upCwOnzXwsut+I3IZhWwjnzGwOldbMGcUYy0PYx7O123D/hbfcV1p7h Vz5Ibc8viSVPECS4f3j5/1bt1BGbYQudi8b3oHFmxbvsMlEcIipum+mDtFcoy/Yw8dS6 YImg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783921529; x=1784526329; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=xR98/09eXkQIDUktGVg5UEkoPWGYvzdvyoIyKvy+ChM=; b=Q86ZNwQB4BNYe6wj79zoaX1TxjrscjOK8rcPtXtZobbgbwh68pB2B+9qi2kMUDBpYe VEglSAdWBEPaA/fu7bNpNsnDrnAPIy4nWeN5LQFXC+ZsVyFpyd6PsqSwj5wkacgUp5AR SrBDR18lEKrPA0065D73RYWQO39lDBs4xJe2ZV2PoA2DMRNOho4lj8KhzzsKB+YfHYpE Q/H/5Mj6Lc0B/KgzdhoVJlWh49fI4e1r18oXfzi2rr2NMjtAzC2X5BdlhavIvh8oYxxD Q+1awKaG77fXa6c3BYTf+v4JS1Yo2PYKMD9TshgKbG2Dfir4hsxrxKWYo0M1ZpzmRROa ZkIQ== X-Forwarded-Encrypted: i=1; AHgh+RoCUApuvfXxBJ16FBZK0ZnKxL8a3VIHCymFkp4DMHFpfZBbOur2sLObe39N3iMje/kH7bZ8CMoGxeqAoOE=@vger.kernel.org X-Gm-Message-State: AOJu0YwfOrDLQQ8qZljnuYkty7fdhicyhVjrudfhF51gqLZs8xzI+ieA Ow9OWg3uMedE1ZmMVXl1gWeHkho4G+yK27lctrr/Y6zV3LQY0wFv+fcBtdDZX4j81g== X-Gm-Gg: AfdE7cl6HD+Pkg0Uu5ht81hZLafL2N9cCgrlO9AkwTrha6X+waoStmR358D8XzunR1W z8cejECuDu/lyyjXtW3WFKGbPrp/oItC5eYRq9+19R5vl3xE/76xF3gATiBRpUz1oJtXphU2Bqa L7hQyS5MyWdrKvUH24zJGMch31SYOCv7+JLj9mKfZgKFjL4QYPghSze28xWRxm7thYG8UfVYYKR Ztapkjgm1tXAGh6PXTr6fWkiun5F938aDNiCiQ8DbuEkctdphvzPSpHGagbYoFZ0GIGGLNo9e/r Li1O2TOROnNCuJZK4VqysCeb8hL+PhU4f8iHfT6pPaFizmAU4bqH8dFfTg6YUelrFy6wQ13nyUe VpkP1osGQMygMiWMBEJUtJAb8fXoAZQHPhq20Gf9N/NAJfnHP0/P0zJKYY9zRpIyHRfdWAAWvpe IF1tQqVXyBXen3+6FsA19fnWAUZAA2nfegdjKu6oM= X-Received: by 2002:a5d:5f45:0:b0:475:f100:35fb with SMTP id ffacd0b85a97d-47f2dd42e56mr8303249f8f.56.1783921528987; Sun, 12 Jul 2026 22:45:28 -0700 (PDT) Received: from horizon ([217.155.46.38]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47aa0f21328sm83474963f8f.32.2026.07.12.22.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 22:45:27 -0700 (PDT) From: Sean Rhodes 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 Message-ID: <20260713054526.2902319-1-sean@starlabs.systems> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 +#include +#include ++#include ++#include +#include +#include ++#include +#include +#include +#include +#include +#include -+#include +#include +#include +#include @@ drivers/firmware/coreboot/coreboot-cfr.c (new) +#include +#include + -+#include -+ +#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