From nobody Thu Aug 27 18:51:53 2026 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 4847C3AC0DE for ; Mon, 17 Aug 2026 21:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003698; cv=none; b=GlO9h1gm8nDVgUrIizQoKjuvADyL6K/ZdZE6aI/RdEKeRFJycjjchz8uKZVqcqQ4+AZSssOHiZW67bAa0yKoPl1XQs/YsWad1of42J1SL8JyLFSdQXtWmhb47Z8hxFU/fLseWo7a/K8KNXzGjKeXEze7dGP4ILYzH1BbzKN0tag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003698; c=relaxed/simple; bh=5F+9d6zSwaI23ajpCCP4JCHQTIKUiBdtuz68jRALsbE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mdAWZVRou01x43ReKaO0BXfb5wd6dNqYPWUV92LaXmrscS1BLoqmRHDC5Jn8G3bt4zjZrqYMW6gmi/zl828uwC8yweiVnSjMkGxJp2lLF0SOtNuSR0gcWYrRq/LvWFYEUfNpXL9XpWmv2KifcKoGQAKlgxViHBzVUQ6ffKz1cAo= 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=APBVfdsO; arc=none smtp.client-ip=209.85.221.53 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="APBVfdsO" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-47fde295992so261769f8f.0 for ; Mon, 17 Aug 2026 14:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20251104.gappssmtp.com; s=20251104; t=1787003694; x=1787608494; 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=eyYlZFVCc06FCgom6L11YucB1au+iuvrVnF7FufZeZ4=; b=APBVfdsO2S7FI1ll7hZDeoUhGmZNmeYl9VkQwYg7/6B33T239c5vmLlzbZHmrCn0DT Wg1dR38TydJfjiSCeONdzxNpNjD3y3iBowrwYAiUIMncL98x4+jwGu0rN+CkNkXqjsgn U0rrp2nSFYf8Jaf5ybuSuPzySoQ1X9SwHbdz05NIh2jwLKcSnANEZ4kCd5qWWSJeWH6P 7vm/hyH0GLLEhJK2/Karlviijh4pJ/1Yfyc21ZRvO3uV8eYimhRxWXUQRsRI7ojCaw0l TYLYiaOBDl4iM2QDvrQ+GuB5o/3fnZ29a4hX1TE35HpKLI4t6M27fr/KBXFf5S61jf6I jNlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787003694; x=1787608494; 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=eyYlZFVCc06FCgom6L11YucB1au+iuvrVnF7FufZeZ4=; b=DsezKbsHnxsFcgwOnqOS0BieaXW7QL3GrezNULHYlQSDOwcETqE4c2O+AVnYtXa7w8 8NLN7lC05S7EkaihlNfobptDohi99bpdrQuXmrFOzDWtLE1Z/Km01X97VObNqaf1dMhh 92NunxcU0nABtco022Y5uxoR1q14FaDB4zU0SOJ8eqK5mFr6nkwKHYH0Yipd2GtUUucz AntzoRGiWDqspA7jQuE/VUKN81cPdMmjFeuaTakxJNSyeyJ2ro7CYYDFo2w/3TtuJ7LM JVg7c3OyxXBI0v6J3r3+Trg0+nGj0LOqXpyU0+QY3lc2UiKtlBCvNcrGYVynUzwtmWlW 4g1Q== X-Forwarded-Encrypted: i=1; AHgh+RqZmfzpTWH79Xpafxu84KY9WFNYZbzHtwXJSkSWvMBHNXRWsaqNycnpTb+FxNZEIxcrdea1x5gmoCaHBlQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzzNsRHD71JOAceozflGQUOWjXpajoJZZ8neziYG+NEzYV7ZxIF 6T0/6LigKauzgjylvPwmkY4YhtHXNlBytGSYk6kV8eu4tagfbndPgNPu/wWn1AcHZg== X-Gm-Gg: AR+sD12aGfOZndXZ/ejkZ3SO92D37SDqNuKEG+jrZgg+Po2iVvOa3H/3l75RDnd46de SlqQMUHwEDP4nMC6E7PNCe3nca+mx6xVVqtCt5PbmLOY09Io9tehEMxwghumkcacrFxcPXLgEgp Yp4SXArCO9cGyFsUi+GcPu7J1ikZGJzm+iCxd8QD6n70IXITJD8I61nbUBhZTUWon+FaxxkcWU0 aggGzMkjjNqv20VgWPwUPMT/s6tTSiPL0IA8OwBPPxb0zsBTPhZfTmUHwBoW1KumfucCt0LlPAZ lNGOrNwG8RXGx11SeYtcb27gIGpsgzUCDK6nf1XLCIX5Y8A6HH9OnGqXvmkd4IyhGACY1ts7TDD v+DCrIrI2g3XRpEpzokvMJ5zER53HxO+0fKp/59CMRKkGVagF4IpvIzytwLZW6DQ7aA6dKqZjTG ObbfNvMk141X0n0/1TsbYl9805eUGPxBVDPhKPZfoRM181fR0qYT2126C6s3g7CmEvU1caX6DVf WuZZTLuTtnrfQ== X-Received: by 2002:a05:6000:4028:b0:47f:fcff:6b05 with SMTP id ffacd0b85a97d-482aab887d9mr1314805f8f.13.1787003694601; Mon, 17 Aug 2026 14:54:54 -0700 (PDT) Received: from horizon ([217.155.46.38]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5a3b3f0sm6060954f8f.14.2026.08.17.14.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 14:54:53 -0700 (PDT) From: Sean Rhodes To: chrome-platform@lists.linux.dev Cc: Corentin Chary , "Luke D. Jones" , Denis Benato , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Prasanth Ksr , Jorge Lopez , Mark Pearson , "Derek J. Clark" , Joshua Grisham , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, Sean Rhodes , "Michael S. Tsirkin" , Chen-Yu Tsai , Huacai Chen , Tzung-Bi Shih , Brian Norris , Julius Werner , Thomas Zimmermann , Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , David Airlie , Simona Vetter , Florian Fainelli , Takashi Sakamoto , Bjorn Helgaas , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= , Titouan Ameline de Cadeville , Kees Cook , Danilo Krummrich , dri-devel@lists.freedesktop.org, Krzysztof Kozlowski , Bjorn Andersson , Dmitry Baryshkov , Geert Uytterhoeven , Arnd Bergmann , Eric Biggers , Luca Weiss , Michal Simek , Sven Peter , linux-kernel@vger.kernel.org, oliver@liuxiaozhen.dev Subject: [PATCH v13 RESEND 1/5] platform/x86: Sort firmware attributes class includes Date: Mon, 17 Aug 2026 22:54:47 +0100 Message-ID: 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: quoted-printable Content-Type: text/plain; charset="utf-8" Move firmware_attributes_class.h into the main include block and sort the affected includes. This lets the header move replace each include in place. Suggested-by: Derek J. Clark Signed-off-by: Sean Rhodes --- drivers/platform/x86/asus-armoury.c | 2 +- drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 9 +++++---- drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 9 +++++---- drivers/platform/x86/lenovo/think-lmi.c | 5 +++-- drivers/platform/x86/lenovo/wmi-other.c | 2 +- drivers/platform/x86/samsung-galaxybook.c | 3 ++- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asu= s-armoury.c index 495dc1e31d40..f3d8c5a85762 100644 --- a/drivers/platform/x86/asus-armoury.c +++ b/drivers/platform/x86/asus-armoury.c @@ -20,6 +20,7 @@ #include #include #include +#include "firmware_attributes_class.h" #include #include #include @@ -34,7 +35,6 @@ #include =20 #include "asus-armoury.h" -#include "firmware_attributes_class.h" =20 #define ASUS_NB_WMI_EVENT_GUID "0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C" =20 diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/p= latform/x86/dell/dell-wmi-sysman/sysman.c index ab46a023cc34..4ff9003c6589 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c @@ -8,18 +8,19 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt =20 #include -#include #include -#include +#include "../../firmware_attributes_class.h" +#include #include +#include +#include #include #include #include + #include "dell-wmi-sysman.h" -#include "../../firmware_attributes_class.h" =20 #define MAX_TYPES 4 -#include =20 struct wmi_sysman_priv wmi_priv =3D { .mutex =3D __MUTEX_INITIALIZER(wmi_priv.mutex), diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platfor= m/x86/hp/hp-bioscfg/bioscfg.c index 27fd6cd21529..1965a329be48 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c @@ -7,16 +7,17 @@ =20 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt =20 +#include +#include "../../firmware_attributes_class.h" #include -#include #include +#include +#include #include #include #include + #include "bioscfg.h" -#include "../../firmware_attributes_class.h" -#include -#include =20 MODULE_AUTHOR("Jorge Lopez "); MODULE_DESCRIPTION("HP BIOS Configuration Driver"); diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86= /lenovo/think-lmi.c index e215e86e3db7..9e4b3e973de9 100644 --- a/drivers/platform/x86/lenovo/think-lmi.c +++ b/drivers/platform/x86/lenovo/think-lmi.c @@ -13,14 +13,15 @@ =20 #include #include +#include #include +#include "../firmware_attributes_class.h" #include #include #include #include -#include #include -#include "../firmware_attributes_class.h" + #include "think-lmi.h" =20 static bool debug_support; diff --git a/drivers/platform/x86/lenovo/wmi-other.c b/drivers/platform/x86= /lenovo/wmi-other.c index fbb32bf404f2..fdebaa0a9992 100644 --- a/drivers/platform/x86/lenovo/wmi-other.c +++ b/drivers/platform/x86/lenovo/wmi-other.c @@ -33,6 +33,7 @@ #include #include #include +#include "../firmware_attributes_class.h" #include #include #include @@ -50,7 +51,6 @@ #include "wmi-capdata.h" #include "wmi-events.h" #include "wmi-helpers.h" -#include "../firmware_attributes_class.h" =20 #define LENOVO_OTHER_MODE_GUID "DC2A8805-3A8C-41BA-A6F7-092E0089CD3B" =20 diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x= 86/samsung-galaxybook.c index 6382af0b106c..74103c00b0c8 100644 --- a/drivers/platform/x86/samsung-galaxybook.c +++ b/drivers/platform/x86/samsung-galaxybook.c @@ -14,6 +14,7 @@ #include #include #include +#include "firmware_attributes_class.h" #include #include #include @@ -27,8 +28,8 @@ #include #include #include + #include -#include "firmware_attributes_class.h" =20 #define DRIVER_NAME "samsung-galaxybook" From nobody Thu Aug 27 18:51:53 2026 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 4FE7E3BB9EB for ; Mon, 17 Aug 2026 21:54:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003700; cv=none; b=cNzcfor7k2h4g9pokyGugh/HUChHA6Kv7QfiaywqN5swK/0+sb6ab0cRU71106SKcq1v4ZNpiU0uqGeoLmLHr5HTXCc4uLvsPhU9Yg/OP/KH/GwS9V98JLu5hiFuYzIgcpiLHlK+xB54mUDA2F60WeHhCviX5kbFd0W9Kb58qPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003700; c=relaxed/simple; bh=gjt8epnPZiAsA9E0iBPBetoNoaC4NO0jnZiK9mjcUog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QfJEqD0sIuY6yxw2x33+0hoOGXdsJN7rz1Vs4Vw6TEDs+pg8K36Hr7SYXVtKfo3shWM1olplyVLx/co+ysTuEvCOo33EMoilhdrh9JRgjm0bGtCpcykgxV0SngAjbL6B7Nv6a4xQ9e5BECo7d/6mRfqOpbOYRQ5IIjWRxZ1DdvM= 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=l5tnL62a; arc=none smtp.client-ip=209.85.221.41 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="l5tnL62a" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-471eeac43bfso3422293f8f.3 for ; Mon, 17 Aug 2026 14:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20251104.gappssmtp.com; s=20251104; t=1787003696; x=1787608496; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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=bABVww2WvQf7prUNY3MOf4Vzl0WF/IV0auCAcHBQEGA=; b=l5tnL62aOofRfMNIx8c9zJgACWRjSVUQYG3aLixdlufAxEmh5hW1bt0Rqq/Fd9dJNZ sFxouh88IOZnL2zF0jI8AsayuBzMWtJoUaTRgGg5OBxh4wi9X0INMiMkWYMqWqns6izB ncR8nqVrlLEp1+t3fcoKaKskOjwyNXTXJPaOJH592dD1VmY0jnQZbTTseYYMhs8AJBMY JBPq6KZZHtwOeu+ZAViLuWZQ2mMFZynEBm76bwpbLogCVoxX00lT9p8bu4MOgeZ59hbI pWVcROKhptcsO7/g3Llm5xaSLo1UiKKZeDnn16Y87x1HGISLvpC7juX10Jbq7QEnOpiN A3Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787003696; x=1787608496; h=content-transfer-encoding:content-type: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=bABVww2WvQf7prUNY3MOf4Vzl0WF/IV0auCAcHBQEGA=; b=Oi2C+4AIlnbo+otZHdtLjfV2i1wDb3UnmaYSuYdz7K+ldyuWeLB0vU3mNVWlL/0Eh0 jojnrn9Ay4qzlMa1UA9AB/gNjgQVHQv1XWrlm/5fs6hfiiKs9IAd57nAdqGGVrqN54K5 6kkdpyjOfHiB7rQP1OzJdJ9csu1tguxtHAhEIDJwt75uyr2Vll6p5TQzP9XPlg6Fi6Sg Zf1bsDs4sxkfAbVrZBFUoAE4yIcVAO7OQjCOhQ/G4XN99OFQ0ruHU4ZnNjycjZa5IelM t7n21V63lJqKwZZ97GjcoojTwK6jIpleJJIakJOk1NsRdvmsNx0NbyJYmX9z57mD2H2T AD6Q== X-Forwarded-Encrypted: i=1; AHgh+RoLwkgN8Lu9i541HMvEOlnfoi8rWpG8yxbSZw8yCi9dewtYOzR0SBWP8XnxdmeyKNkCQJG1RxgUYBXk29U=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5IzdrScslmFD3dQiw+g07mh5nrfo43jOHKSvF93/IHDrXwd/E yG5KiYjohirpQZW4WglMutMTSdS30bJoffykIigTTfJyZuXqWVSr95KilKz2hInSaw== X-Gm-Gg: AR+sD12iYDoLNQZsOR53lRe+9N+6TM0uQViaPV0rsX8djGxTmQahnbC+uzQlH4eJA34 GEgFMnjOg3qaJhveJkpm/pqFP8DQ4gLb/fHHvNdiCvZbGffaS8vvrG5I/Lht8VW5oD9eQhjlXjD LD4gYnR1aHJRnkvW2iKJKRdXLHnraXo/9XYBaxIBVFsdluDvvxMTLAEYtbc3gh0oxc0yqU5ZRv4 9NuRPQ3Ubf2Obzvi4j364yWYM34Ydkhv+f+BJITYgT6VnqSmzEcVJMWO2QIKBYCHUKSph/iYQtU dSSzSKa2X1aIqmpXny8WKF305rDT6TMyR3R2p4Z4kZ8taJkRhnZHRodmnyhSN264/hfdGkuDA5F NFfbNPdg+usXprVGSftjcOj/RPtSJX+ZtDwn7ihuNGslEbNYnBj1LzHzvvidmOl8fctY8kQa75q ADSXhMOV4dQFHckHfsqHHkUf8HZC82OnEqEvZxAlu4oRr1uik9IUEsTb9F8S8QLvjCzx42F52Bf w1aECoyLIaTiw== X-Received: by 2002:a05:6000:46d7:b0:481:512b:f0e7 with SMTP id ffacd0b85a97d-4816077eabemr28693202f8f.17.1787003695976; Mon, 17 Aug 2026 14:54:55 -0700 (PDT) Received: from horizon ([217.155.46.38]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5a3b3f0sm6060954f8f.14.2026.08.17.14.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 14:54:55 -0700 (PDT) From: Sean Rhodes To: chrome-platform@lists.linux.dev Cc: Corentin Chary , "Luke D. Jones" , Denis Benato , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Prasanth Ksr , Jorge Lopez , Mark Pearson , "Derek J. Clark" , Joshua Grisham , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, Sean Rhodes , "Michael S. Tsirkin" , Chen-Yu Tsai , Huacai Chen , Tzung-Bi Shih , Brian Norris , Julius Werner , Thomas Zimmermann , Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , David Airlie , Simona Vetter , Florian Fainelli , Takashi Sakamoto , Bjorn Helgaas , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= , Titouan Ameline de Cadeville , Kees Cook , Danilo Krummrich , dri-devel@lists.freedesktop.org, Krzysztof Kozlowski , Bjorn Andersson , Dmitry Baryshkov , Geert Uytterhoeven , Arnd Bergmann , Eric Biggers , Luca Weiss , Michal Simek , Sven Peter , linux-kernel@vger.kernel.org, oliver@liuxiaozhen.dev Subject: [PATCH v13 RESEND 2/5] firmware: Move firmware attributes class helper Date: Mon, 17 Aug 2026 22:54:48 +0100 Message-ID: <32797a9b0cd6d06cad78833aafe7e1d619c88b8b.1787003659.git.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Move the firmware attributes class helper from drivers/platform/x86 to drivers/firmware and expose its class declaration through a public Linux header. The helper is not x86-specific. Keeping it in firmware lets coreboot firmware drivers use the standard firmware-attributes ABI without living under platform/x86. Reviewed-by: Mark Pearson Reviewed-by: Derek J. Clark Tested-by: Oliver Lin Signed-off-by: Sean Rhodes --- MAINTAINERS | 8 ++++++++ drivers/firmware/Kconfig | 3 +++ drivers/firmware/Makefile | 1 + .../x86 =3D> firmware}/firmware_attributes_class.c | 2 +- drivers/platform/x86/Kconfig | 3 --- drivers/platform/x86/Makefile | 2 -- drivers/platform/x86/asus-armoury.c | 2 +- drivers/platform/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 +++--- 13 files changed, 22 insertions(+), 15 deletions(-) rename drivers/{platform/x86 =3D> firmware}/firmware_attributes_class.c (9= 4%) rename drivers/platform/x86/firmware_attributes_class.h =3D> include/linux= /firmware_attributes.h (60%) diff --git a/MAINTAINERS b/MAINTAINERS index 8014b9f8253e..caef5ab15a4c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10106,6 +10106,14 @@ F: include/linux/firewire.h F: include/uapi/linux/firewire*.h F: tools/firewire/ =20 +FIRMWARE ATTRIBUTES CLASS +M: Hans de Goede +M: Ilpo J=C3=A4rvinen +L: platform-driver-x86@vger.kernel.org +S: Maintained +F: drivers/firmware/firmware_attributes_class.c +F: include/linux/firmware_attributes.h + FIRMWARE FRAMEWORK FOR ARMV8-A M: Sudeep Holla L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 12dc70254842..78a239f8bbef 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -8,6 +8,9 @@ menu "Firmware Drivers" =20 source "drivers/firmware/arm_scmi/Kconfig" =20 +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 diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 4ddec2820c96..385b6e8b7fc6 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) +=3D memmap.o obj-$(CONFIG_MTK_ADSP_IPC) +=3D mtk-adsp-ipc.o obj-$(CONFIG_RASPBERRYPI_FIRMWARE) +=3D raspberrypi.o obj-$(CONFIG_FW_CFG_SYSFS) +=3D qemu_fw_cfg.o +obj-$(CONFIG_FW_ATTR_CLASS) +=3D firmware_attributes_class.o obj-$(CONFIG_SYSFB) +=3D sysfb.o obj-$(CONFIG_SYSFB_SIMPLEFB) +=3D sysfb_simplefb.o obj-$(CONFIG_TH1520_AON_PROTOCOL) +=3D thead,th1520-aon.o diff --git a/drivers/platform/x86/firmware_attributes_class.c b/drivers/fir= mware/firmware_attributes_class.c similarity index 94% rename from drivers/platform/x86/firmware_attributes_class.c rename to drivers/firmware/firmware_attributes_class.c index 736e96c186d9..503ecc288086 100644 --- a/drivers/platform/x86/firmware_attributes_class.c +++ b/drivers/firmware/firmware_attributes_class.c @@ -3,7 +3,7 @@ /* Firmware attributes class helper module */ =20 #include -#include "firmware_attributes_class.h" +#include =20 const struct class firmware_attributes_class =3D { .name =3D "firmware-attributes", diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index b54b5212b204..beed14c38b54 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -926,9 +926,6 @@ config DASHARO_ACPI =20 source "drivers/platform/x86/x86-android-tablets/Kconfig" =20 -config FW_ATTR_CLASS - tristate - config INTEL_IMR bool "Intel Isolated Memory Region support" depends on X86_INTEL_QUARK && IOSF_MBI diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 872ac3842391..cab20a4145e3 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -63,8 +63,6 @@ obj-$(CONFIG_X86_PLATFORM_DRIVERS_HP) +=3D hp/ # Hewlett Packard Enterprise obj-$(CONFIG_UV_SYSFS) +=3D uv_sysfs.o =20 -obj-$(CONFIG_FW_ATTR_CLASS) +=3D firmware_attributes_class.o - # IBM Thinkpad (before 2005) obj-$(CONFIG_IBM_RTL) +=3D ibm_rtl.o obj-$(CONFIG_SENSORS_HDAPS) +=3D hdaps.o diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asu= s-armoury.c index f3d8c5a85762..e6af93608ec5 100644 --- a/drivers/platform/x86/asus-armoury.c +++ b/drivers/platform/x86/asus-armoury.c @@ -20,7 +20,7 @@ #include #include #include -#include "firmware_attributes_class.h" +#include #include #include #include diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/p= latform/x86/dell/dell-wmi-sysman/sysman.c index 4ff9003c6589..963b3473991d 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c @@ -9,7 +9,7 @@ =20 #include #include -#include "../../firmware_attributes_class.h" +#include #include #include #include diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platfor= m/x86/hp/hp-bioscfg/bioscfg.c index 1965a329be48..f13f21580acd 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c @@ -8,7 +8,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt =20 #include -#include "../../firmware_attributes_class.h" +#include #include #include #include diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86= /lenovo/think-lmi.c index 9e4b3e973de9..4437785aa1f2 100644 --- a/drivers/platform/x86/lenovo/think-lmi.c +++ b/drivers/platform/x86/lenovo/think-lmi.c @@ -15,7 +15,7 @@ #include #include #include -#include "../firmware_attributes_class.h" +#include #include #include #include diff --git a/drivers/platform/x86/lenovo/wmi-other.c b/drivers/platform/x86= /lenovo/wmi-other.c index fdebaa0a9992..b175971bb308 100644 --- a/drivers/platform/x86/lenovo/wmi-other.c +++ b/drivers/platform/x86/lenovo/wmi-other.c @@ -33,7 +33,7 @@ #include #include #include -#include "../firmware_attributes_class.h" +#include #include #include #include diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x= 86/samsung-galaxybook.c index 74103c00b0c8..3911f60c23ea 100644 --- a/drivers/platform/x86/samsung-galaxybook.c +++ b/drivers/platform/x86/samsung-galaxybook.c @@ -14,7 +14,7 @@ #include #include #include -#include "firmware_attributes_class.h" +#include #include #include #include diff --git a/drivers/platform/x86/firmware_attributes_class.h b/include/lin= ux/firmware_attributes.h similarity index 60% rename from drivers/platform/x86/firmware_attributes_class.h rename to include/linux/firmware_attributes.h index d27abe54fcf9..d4026ba1fcc2 100644 --- a/drivers/platform/x86/firmware_attributes_class.h +++ b/include/linux/firmware_attributes.h @@ -2,11 +2,11 @@ =20 /* Firmware attributes class helper module */ =20 -#ifndef FW_ATTR_CLASS_H -#define FW_ATTR_CLASS_H +#ifndef _LINUX_FIRMWARE_ATTRIBUTES_H +#define _LINUX_FIRMWARE_ATTRIBUTES_H =20 #include =20 extern const struct class firmware_attributes_class; =20 -#endif /* FW_ATTR_CLASS_H */ +#endif /* _LINUX_FIRMWARE_ATTRIBUTES_H */ From nobody Thu Aug 27 18:51:53 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 E78C93AF662 for ; Mon, 17 Aug 2026 21:54:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003702; cv=none; b=i3RRURtlePz0u+CwAH/wPFGIOabn6dgId3G6ZqfUFqWmyVbk3y7CE4Vtkqqdhvea9+/nqtW9kpW8F4ayvp4Y+MDhh5TicZYeeHmmxoSamkOkoP75dBIDrIT7pBFW9YoHazt9rgHCJOnb/gABM7z0zFA+8pwhb0KmP7xWhDaVrSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003702; c=relaxed/simple; bh=evBeKKkJVTvBJKKhOYCY4qDw+suUNw7N1qE6ebU98jM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UqC3mIrKXQwfFi0bAl8WTHypTzQh3vQNuGyQ3eKDtLsCCXePTtw4EjZ0xBk2Qh0r8LkKAuz3R+b0/4MNktCSXMB/7SIz2jfhnCiYQbquFn3L5J+bOFbv+44zF25TamF3+c7ebylIzgECe5d/RWx1YPzb/93CzxrNFKD59S4PRdc= 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=V560JWZj; arc=none smtp.client-ip=209.85.221.43 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="V560JWZj" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-47362928f65so3778824f8f.2 for ; Mon, 17 Aug 2026 14:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20251104.gappssmtp.com; s=20251104; t=1787003698; x=1787608498; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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=9x7uXMYzzPJu6LY6LMr/n8ilhZ5Lcr3gAl8Pm0/Hths=; b=V560JWZj/GBVIS9TbnoTwxfc8nElSej8tjYjHYwf1lh4Htdtv3yPRWnZHjcsWRe/uR s3HOcXLxT7kwFS6ALxSqT0v9GroWVzwGrkAS4AWmnzopA8ISsIH8bXlNPvcWjAjxwlKY qZFpqSX/cXuyeY5ti5yD1eTL9YH6XWNti/8qIeETNBcgNpAQLaMo+SQIGOkVAEJ0PkN6 1MlhFke+T7LdcEQTjkcE2uE8DGxDWLmET+N+pAaGT6EPJXb7peRgMPdnOqv1SbKGA7g1 iGYSd1nHyrA+jCs9vn+VbIiQyAJDpOGZk0cimDiR8Tp3r+kIQBk0yxj3hFPCxICmT0CT 67kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787003698; x=1787608498; h=content-transfer-encoding:content-type: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=9x7uXMYzzPJu6LY6LMr/n8ilhZ5Lcr3gAl8Pm0/Hths=; b=s3qiusFkySkVzmmUhiyuMOCWM+oZOLISWVMx9GBJc1grH+9p9idA9a74cOrO6fkdzI VHBoqrzVn5F1dkMG751hfzic676j9eHXDq9+hpsut6DnHs7g7FIpGnCJfm+Xkz4diJlK ChbRGgm92xrSiwMvR8JuafYh9atMA8ylN+pJ2pgDcIFO0oUQucljkpMAzkJQLIM4rIXp cJ5j0uQlMFeYs5rnw9VXw/rth62TuV5+E71ng3mSKJttm97XmBbHW0y7joV4lczi/V2n kEXZSP4J2CcfwPzrxi63W9wRJeV5e6a4PwE/Yw6wm1iQhVg/DVMxXlV0B/ll4A7Z5HKm lfbA== X-Forwarded-Encrypted: i=1; AHgh+Rofei9uJ1QzO2+SZr+llEKJwnxD7aBWn7swuoWPsBRYqMWhzVCOQ+DMBYbjxkWUPIgtg0iZFUdUoNFpd4s=@vger.kernel.org X-Gm-Message-State: AOJu0YwRRYF6qu7lec+7KEfnhu4PTkcZ5LkiGJTUlXT+nK620sdAT/b6 +/sZxE7fpE9d99lj0sAnTYgyiOh5QSyBS0zVSPODENtH7O2hxUjYtd2mKAF5gCAZHQ== X-Gm-Gg: AR+sD11Y+8LfrwNJj5sKAxvhj6pJw1PzUrMBY5UGOYGjcIdtm+NYZ7Sl5blUdDz8YHR 7YxfjPaRrJvP93Q9c08snzYU5u5dglZsmZs+FUjjvB7bry9AfgQOxx+Lwr9I9SqC3LuSJcwNDMR PNW7PDRE+xqVpF/+ce5T4kXD1GsPwUgRM4X+e9kr97ZeS2ASP/C4CQFmxGLPgbPDPo+3fMqJWJ0 wsGclBVUoSMk8g7yrdEoZ/5ifCArTEZdxPa0SgYVy918XEXOXwHNlHkRmPRRCaMWgonvgt32UlF Jf5wMs4PTq5WHju42D7qcmIknDsd2ULT6kIvLzC4zxN2aiFbjgYAwx1YVO/zyVOnNzjKbxQX66f 9igVO0DUyT/h/uBKhpiYK4VtHrrP28OF+HSD8CJWu+Alon0wpElSqU33qY0rfrSFgWs7R0X9TIT wEJB/yedKsonMpt9MP9TTlwOVTtsBlTc6VNgMpO1noJ/xjWNRPhFYQCj8XsqvMxXFn2P08S0lws 0EL66x4TmAZSA== X-Received: by 2002:a05:6000:4210:b0:47f:9254:d453 with SMTP id ffacd0b85a97d-482a90782b2mr4754092f8f.8.1787003698061; Mon, 17 Aug 2026 14:54:58 -0700 (PDT) Received: from horizon ([217.155.46.38]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5a3b3f0sm6060954f8f.14.2026.08.17.14.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 14:54:57 -0700 (PDT) From: Sean Rhodes To: chrome-platform@lists.linux.dev Cc: Corentin Chary , "Luke D. Jones" , Denis Benato , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Prasanth Ksr , Jorge Lopez , Mark Pearson , "Derek J. Clark" , Joshua Grisham , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, Sean Rhodes , "Michael S. Tsirkin" , Chen-Yu Tsai , Huacai Chen , Tzung-Bi Shih , Brian Norris , Julius Werner , Thomas Zimmermann , Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , David Airlie , Simona Vetter , Florian Fainelli , Takashi Sakamoto , Bjorn Helgaas , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= , Titouan Ameline de Cadeville , Kees Cook , Danilo Krummrich , dri-devel@lists.freedesktop.org, Krzysztof Kozlowski , Bjorn Andersson , Dmitry Baryshkov , Geert Uytterhoeven , Arnd Bergmann , Eric Biggers , Luca Weiss , Michal Simek , Sven Peter , linux-kernel@vger.kernel.org, oliver@liuxiaozhen.dev Subject: [PATCH v13 RESEND 3/5] firmware: Rename google firmware directory to coreboot Date: Mon, 17 Aug 2026 22:54:49 +0100 Message-ID: <557d363a779c3c03bfe939dc2fefd6a4265fa7ad.1787003659.git.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Most drivers in drivers/firmware/google are coreboot table drivers rather than Google-specific firmware drivers. Rename the directory to coreboot and update the Kconfig prompt, build path and maintainer entry. Rename the generic firmware Kconfig symbols to CONFIG_COREBOOT_* at the same time so new configurations describe the firmware interface rather than one vendor. Keep the old CONFIG_GOOGLE_* names as transitional symbols so existing configurations keep selecting the same drivers during the rename. Leave defconfig updates to a separate patch so the configuration churn is easy to review independently. Suggested-by: Julius Werner Signed-off-by: Sean Rhodes --- MAINTAINERS | 20 ++--- drivers/firmware/Kconfig | 2 +- drivers/firmware/Makefile | 2 +- drivers/firmware/{google =3D> coreboot}/Kconfig | 74 ++++++++++++++----- .../firmware/{google =3D> coreboot}/Makefile | 10 +-- drivers/firmware/{google =3D> coreboot}/cbmem.c | 0 .../{google =3D> coreboot}/coreboot_table.c | 0 .../{google =3D> coreboot}/coreboot_table.h | 0 .../framebuffer-coreboot.c | 0 drivers/firmware/{google =3D> coreboot}/gsmi.c | 0 .../memconsole-coreboot.c | 0 .../memconsole-x86-legacy.c | 0 .../{google =3D> coreboot}/memconsole.c | 0 .../{google =3D> coreboot}/memconsole.h | 6 +- drivers/firmware/{google =3D> coreboot}/vpd.c | 0 .../{google =3D> coreboot}/vpd_decode.c | 0 .../{google =3D> coreboot}/vpd_decode.h | 0 drivers/gpu/drm/sysfb/Kconfig | 2 +- 18 files changed, 77 insertions(+), 39 deletions(-) rename drivers/firmware/{google =3D> coreboot}/Kconfig (64%) rename drivers/firmware/{google =3D> coreboot}/Makefile (51%) rename drivers/firmware/{google =3D> coreboot}/cbmem.c (100%) rename drivers/firmware/{google =3D> coreboot}/coreboot_table.c (100%) rename drivers/firmware/{google =3D> coreboot}/coreboot_table.h (100%) rename drivers/firmware/{google =3D> coreboot}/framebuffer-coreboot.c (100= %) rename drivers/firmware/{google =3D> coreboot}/gsmi.c (100%) rename drivers/firmware/{google =3D> coreboot}/memconsole-coreboot.c (100%) rename drivers/firmware/{google =3D> coreboot}/memconsole-x86-legacy.c (10= 0%) rename drivers/firmware/{google =3D> coreboot}/memconsole.c (100%) rename drivers/firmware/{google =3D> coreboot}/memconsole.h (82%) rename drivers/firmware/{google =3D> coreboot}/vpd.c (100%) rename drivers/firmware/{google =3D> coreboot}/vpd_decode.c (100%) rename drivers/firmware/{google =3D> coreboot}/vpd_decode.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index caef5ab15a4c..6f3717a5a2e7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6657,6 +6657,16 @@ 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 =20 +COREBOOT FIRMWARE DRIVERS +M: Tzung-Bi Shih +R: Brian Norris +R: Julius Werner +L: chrome-platform@lists.linux.dev +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 L: linux-hwmon@vger.kernel.org S: Orphan @@ -11065,16 +11075,6 @@ S: Maintained F: Documentation/networking/device_drivers/ethernet/google/gve.rst F: drivers/net/ethernet/google =20 -GOOGLE FIRMWARE DRIVERS -M: Tzung-Bi Shih -R: Brian Norris -R: Julius Werner -L: chrome-platform@lists.linux.dev -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 R: Andr=C3=A9 Draszik diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 78a239f8bbef..4df0a0ad18b8 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -293,7 +293,7 @@ endif # TURRIS_MOX_RWTM source "drivers/firmware/arm_ffa/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" diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 385b6e8b7fc6..f8da96382680 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -30,7 +30,7 @@ obj-y +=3D broadcom/ obj-y +=3D cirrus/ obj-y +=3D meson/ obj-y +=3D microchip/ -obj-$(CONFIG_GOOGLE_FIRMWARE) +=3D google/ +obj-$(CONFIG_COREBOOT_FIRMWARE) +=3D coreboot/ obj-y +=3D efi/ obj-y +=3D imx/ obj-y +=3D psci/ diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/coreboot/Kc= onfig similarity index 64% rename from drivers/firmware/google/Kconfig rename to drivers/firmware/coreboot/Kconfig index b78c644fa253..d273bd836245 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". =20 -if GOOGLE_FIRMWARE +if COREBOOT_FIRMWARE =20 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. =20 -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-. =20 -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,75 @@ config GOOGLE_COREBOOT_TABLE device tree node /firmware/coreboot. If unsure say N. =20 -config GOOGLE_MEMCONSOLE +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 =20 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. =20 -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. =20 -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. =20 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 =20 -endif # GOOGLE_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 + +config GOOGLE_MEMCONSOLE_COREBOOT + tristate + transitional diff --git a/drivers/firmware/google/Makefile b/drivers/firmware/coreboot/M= akefile similarity index 51% rename from drivers/firmware/google/Makefile rename to drivers/firmware/coreboot/Makefile index 8151e323cc43..e681f274417a 100644 --- a/drivers/firmware/google/Makefile +++ b/drivers/firmware/coreboot/Makefile @@ -1,14 +1,14 @@ # SPDX-License-Identifier: GPL-2.0 =20 obj-$(CONFIG_GOOGLE_SMI) +=3D gsmi.o -obj-$(CONFIG_GOOGLE_COREBOOT_TABLE) +=3D coreboot_table.o -obj-$(CONFIG_GOOGLE_FRAMEBUFFER_COREBOOT) +=3D framebuffer-coreboot.o -obj-$(CONFIG_GOOGLE_MEMCONSOLE) +=3D memconsole.o -obj-$(CONFIG_GOOGLE_MEMCONSOLE_COREBOOT) +=3D memconsole-coreboot.o +obj-$(CONFIG_COREBOOT_TABLE) +=3D coreboot_table.o +obj-$(CONFIG_COREBOOT_FRAMEBUFFER) +=3D framebuffer-coreboot.o +obj-$(CONFIG_COREBOOT_MEMCONSOLE_COMMON) +=3D memconsole.o +obj-$(CONFIG_COREBOOT_MEMCONSOLE) +=3D memconsole-coreboot.o obj-$(CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY) +=3D memconsole-x86-legacy.o =20 # Must come after coreboot_table.o, as this driver depends on that bus typ= e. -obj-$(CONFIG_GOOGLE_CBMEM) +=3D cbmem.o +obj-$(CONFIG_COREBOOT_CBMEM) +=3D cbmem.o =20 vpd-sysfs-y :=3D vpd.o vpd_decode.o obj-$(CONFIG_GOOGLE_VPD) +=3D vpd-sysfs.o diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/coreboot/cb= mem.c similarity index 100% rename from drivers/firmware/google/cbmem.c rename to drivers/firmware/coreboot/cbmem.c diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/co= reboot/coreboot_table.c similarity index 100% rename from drivers/firmware/google/coreboot_table.c rename to drivers/firmware/coreboot/coreboot_table.c diff --git a/drivers/firmware/google/coreboot_table.h b/drivers/firmware/co= reboot/coreboot_table.h similarity index 100% rename from drivers/firmware/google/coreboot_table.h rename to drivers/firmware/coreboot/coreboot_table.h diff --git a/drivers/firmware/google/framebuffer-coreboot.c b/drivers/firmw= are/coreboot/framebuffer-coreboot.c similarity index 100% rename from drivers/firmware/google/framebuffer-coreboot.c rename to drivers/firmware/coreboot/framebuffer-coreboot.c diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/coreboot/gsm= i.c similarity index 100% rename from drivers/firmware/google/gsmi.c rename to drivers/firmware/coreboot/gsmi.c diff --git a/drivers/firmware/google/memconsole-coreboot.c b/drivers/firmwa= re/coreboot/memconsole-coreboot.c similarity index 100% rename from drivers/firmware/google/memconsole-coreboot.c rename to drivers/firmware/coreboot/memconsole-coreboot.c diff --git a/drivers/firmware/google/memconsole-x86-legacy.c b/drivers/firm= ware/coreboot/memconsole-x86-legacy.c similarity index 100% rename from drivers/firmware/google/memconsole-x86-legacy.c rename to drivers/firmware/coreboot/memconsole-x86-legacy.c diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/corebo= ot/memconsole.c similarity index 100% rename from drivers/firmware/google/memconsole.c rename to drivers/firmware/coreboot/memconsole.c diff --git a/drivers/firmware/google/memconsole.h b/drivers/firmware/corebo= ot/memconsole.h similarity index 82% rename from drivers/firmware/google/memconsole.h rename to drivers/firmware/coreboot/memconsole.h index aaff2b72b606..58899c2abaaa 100644 --- a/drivers/firmware/google/memconsole.h +++ b/drivers/firmware/coreboot/memconsole.h @@ -7,8 +7,8 @@ * Copyright 2017 Google Inc. */ =20 -#ifndef __FIRMWARE_GOOGLE_MEMCONSOLE_H -#define __FIRMWARE_GOOGLE_MEMCONSOLE_H +#ifndef __FIRMWARE_COREBOOT_MEMCONSOLE_H +#define __FIRMWARE_COREBOOT_MEMCONSOLE_H =20 #include =20 @@ -33,4 +33,4 @@ int memconsole_sysfs_init(void); */ void memconsole_exit(void); =20 -#endif /* __FIRMWARE_GOOGLE_MEMCONSOLE_H */ +#endif /* __FIRMWARE_COREBOOT_MEMCONSOLE_H */ diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/coreboot/vpd.c similarity index 100% rename from drivers/firmware/google/vpd.c rename to drivers/firmware/coreboot/vpd.c diff --git a/drivers/firmware/google/vpd_decode.c b/drivers/firmware/corebo= ot/vpd_decode.c similarity index 100% rename from drivers/firmware/google/vpd_decode.c rename to drivers/firmware/coreboot/vpd_decode.c diff --git a/drivers/firmware/google/vpd_decode.h b/drivers/firmware/corebo= ot/vpd_decode.h similarity index 100% rename from drivers/firmware/google/vpd_decode.h rename to drivers/firmware/coreboot/vpd_decode.h diff --git a/drivers/gpu/drm/sysfb/Kconfig b/drivers/gpu/drm/sysfb/Kconfig index 2559ead6cf1f..34d3fa8b30c9 100644 --- a/drivers/gpu/drm/sysfb/Kconfig +++ b/drivers/gpu/drm/sysfb/Kconfig @@ -10,7 +10,7 @@ config DRM_SYSFB_HELPER config DRM_COREBOOTDRM tristate "Coreboot framebuffer driver" depends on DRM && MMU - depends on GOOGLE_FRAMEBUFFER_COREBOOT + depends on COREBOOT_FRAMEBUFFER select APERTURE_HELPERS select DRM_CLIENT_SELECTION select DRM_GEM_SHMEM_HELPER From nobody Thu Aug 27 18:51:53 2026 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 A686A3B9949 for ; Mon, 17 Aug 2026 21:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003708; cv=none; b=KbMxtmaHgoZ9bcXVya21Y2aEVZXR8cu7Q01uzOdRT4tIyVQQb/FV3b0UhGOJqcdrF/bsDPk1AqMYPP8q17PA6X69TeCZTSXhyLH09lOp8qlBTlqhKkyRqOgNVGL6n5H1C0PU1049t90kxFvx8jKTJsS3MIHgofnhu4wD0F9aMhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003708; c=relaxed/simple; bh=aMUhJfuyUrNdIBo6ha+dAue2tvR6YUJKvhrhhkXO6uA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iJKLS5LCaxap5hn2RAN0E7TbS9DnWkq/lYzsBeokITBd8AZSk2rNcN9n7LEZPrkAa9MOZkBFZRADRd2NLUduRMUAPIdFp01yql4R91qQJ1Nml1RVIXuv22kxrDqhDRNE1d2Tf4B4tGDhVIkHt/FNe2bQnijlr1LBNFyWlon2gbk= 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=lAApU0r8; arc=none smtp.client-ip=209.85.221.51 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="lAApU0r8" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47f84023916so3709215f8f.3 for ; Mon, 17 Aug 2026 14:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20251104.gappssmtp.com; s=20251104; t=1787003700; x=1787608500; 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=lkBTTDUqnfJDEE3F9+VRDdS42X6HQ2X+HCbzogNzriA=; b=lAApU0r8iICxE2X8j/i9rx/Q6xPGDMhbvvfqPttONsIwg4ieaJFj4wkKqkdUHq8zk7 D0mmY9b3XFJYkDdUYLK0x5CnZGf/K5HxeqK3G29esJyXZ+Arsj8DncBND4WfuDZ0zWMS Rkz4UNJ2bCMO1THiI+pSp2SvHkCuJjmbnhmc3Q/oFS+cXorvYmyw+ovL0AK7p0esTwlr vzfhQPuyY1q9B7RAIIEVs3sH2yycbVVeeQnPn7u2LUKaVthkOcK4FrQv1QDhj29z8gqY jJ1XBkAZyuMstq8in1MnjJw7I7Ho4DkVwWLstasc7IL15ZSqsHGZzW0duwwdZi0/5sk3 JiGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787003700; x=1787608500; 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=lkBTTDUqnfJDEE3F9+VRDdS42X6HQ2X+HCbzogNzriA=; b=KmtyhZ85Q/UrN7zZypsaS4kMusdmyYtp4DN/LunXCQ6s115N0H7CWRjv6GHeUv1F8/ GVIoueWd2CC5jy9QBVQGBe1qvj6z3dQ2k+kkvGWqn4wTEJ1MBVVLTlAKOYK2/85kIl7x C598hiJy7UI4W7lxbF1Ng6jYRoCaIcgD7Sqzji29j9KEdXcG6Feh5RMVtFOvFtd/vJNc zhHBtBkPs36UCASGZQBnRbt6wjaYq8qf0h5o4bNI3VaQVY8lotGzrrNexD1vqk6Jnl3r FKodZdVMdI9lD0komN0Cotgoc9PNorpgiWWrSsYPTX6n88h1Oz7DVXzTbGX4q4imvGoL fpRQ== X-Forwarded-Encrypted: i=1; AHgh+Ro+VYrCWxlWxLkne0WLad/DBg9O6k3dZ3JmSU/negkiQeA0N+mXUZWii8fUwpV/NetfLscuiq6IreR6mS0=@vger.kernel.org X-Gm-Message-State: AOJu0Yyr5txSre9RUF548C2gUzY5cs0VQeGOfMDGhBjRvjRSSzT66Af6 4ROn1vl000sGYkTPqGKhYxGzuY5xmL5h/DYetVIp4wyfSIDOO+2j5R2RQ1reWepULQ== X-Gm-Gg: AR+sD136NP3sLSGsalCckWDBQmq82PVvQj4oWQjNSvEhc+YiCauitQunHWDa8mX1qXv 9Txqg25x3g5JvG74wer7K481KavcdDhmqkdAfWRdxLOzy9qzjfNpZSn7VEElqrUiE8UC1u05oZO k0QQBJoScVUdpmFZJImqLI11VySle0NTliWWZr83WyAyRZbVuDmGjBTXk1pp/brYb2gJ7efulLM ptiMlgZb6qCFA5NWNfF/+izNiW56nIWQYb1vmwkiDv+hmRexqZbS1nmX+TAD81SQs9zT9u06635 4F82QMsAXy8nmMkm6mZBHTU4SJcxz+kuIKYEczELGqXtG/ekIbYea/l2sHA0C5FhxYNUBiNsEY1 Ohn19w8fOKSuty5/zS/xajkF4PCFIuEeCucxu838gVtFiY+BM/eiB5+d1wdgR8U31377fNU6tTQ vOspGBy1P/36X+EhByxHGhUTTg2Tg1DyyYZ/YVORtZq7HKY9XNlPmkKzLhVkPC/IXVzZxl0dMcX Elbvdl2LgQ6Sg== X-Received: by 2002:adf:f2c6:0:b0:47f:97e9:fe60 with SMTP id ffacd0b85a97d-482a90c53e6mr4548710f8f.15.1787003699572; Mon, 17 Aug 2026 14:54:59 -0700 (PDT) Received: from horizon ([217.155.46.38]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5a3b3f0sm6060954f8f.14.2026.08.17.14.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 14:54:58 -0700 (PDT) From: Sean Rhodes To: chrome-platform@lists.linux.dev Cc: Corentin Chary , "Luke D. Jones" , Denis Benato , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Prasanth Ksr , Jorge Lopez , Mark Pearson , "Derek J. Clark" , Joshua Grisham , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, Sean Rhodes , "Michael S. Tsirkin" , Chen-Yu Tsai , Huacai Chen , Tzung-Bi Shih , Brian Norris , Julius Werner , Thomas Zimmermann , Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , David Airlie , Simona Vetter , Florian Fainelli , Takashi Sakamoto , Bjorn Helgaas , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= , Titouan Ameline de Cadeville , Kees Cook , Danilo Krummrich , dri-devel@lists.freedesktop.org, Krzysztof Kozlowski , Bjorn Andersson , Dmitry Baryshkov , Geert Uytterhoeven , Arnd Bergmann , Eric Biggers , Luca Weiss , Michal Simek , Sven Peter , linux-kernel@vger.kernel.org, oliver@liuxiaozhen.dev Subject: [PATCH v13 RESEND 4/5] firmware: coreboot: Add CFR firmware attributes driver Date: Mon, 17 Aug 2026 22:54:50 +0100 Message-ID: <7a4f1d3acada743fb1e7315498d0754571b96126.1787003659.git.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: quoted-printable Content-Type: text/plain; charset="utf-8" coreboot can publish a CFR tree in its coreboot table to describe firmware setup options. Add a firmware-attributes driver for that table entry under the coreboot firmware driver directory. The driver exposes runtime EFI variable-backed boolean, enum and integer settings through the firmware-attributes ABI. It only registers settings with readable runtime EFI variables, skips suppressed, volatile, dependency-gated and non-runtime options, and keeps read-only or inactive options read-only in sysfs. For settings with an APM_CNT runtime-apply record, write the EFI variable and ask firmware to apply the setting immediately with an I/O port SMI command. If firmware reports a failure, restore the old EFI variable value. Settings without a runtime apply hook keep the EFI variable update and set pending_reboot. Depend on HAS_IOPORT because APM_CNT uses legacy I/O ports. Tested on a Star Labs Byte with firmware 26.07: runtime APM_CNT apply was verified with power_led, and reboot-needed behavior was verified with debug_level. Link: https://doc.coreboot.org/drivers/cfr.html Link: https://doc.coreboot.org/drivers/cfr_internal.html Signed-off-by: Sean Rhodes --- MAINTAINERS | 6 + drivers/firmware/coreboot/Kconfig | 15 + drivers/firmware/coreboot/Makefile | 1 + drivers/firmware/coreboot/coreboot-cfr.c | 1204 ++++++++++++++++++++++ 4 files changed, 1226 insertions(+) create mode 100644 drivers/firmware/coreboot/coreboot-cfr.c diff --git a/MAINTAINERS b/MAINTAINERS index 6f3717a5a2e7..c5a77afdf89a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6657,6 +6657,12 @@ 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 =20 +COREBOOT CFR FIRMWARE ATTRIBUTES DRIVER +M: Sean Rhodes +L: chrome-platform@lists.linux.dev +S: Maintained +F: drivers/firmware/coreboot/coreboot-cfr.c + COREBOOT FIRMWARE DRIVERS M: Tzung-Bi Shih R: Brian Norris diff --git a/drivers/firmware/coreboot/Kconfig b/drivers/firmware/coreboot/= Kconfig index d273bd836245..acfc7d187228 100644 --- a/drivers/firmware/coreboot/Kconfig +++ b/drivers/firmware/coreboot/Kconfig @@ -49,6 +49,21 @@ config COREBOOT_TABLE device tree node /firmware/coreboot. If unsure say N. =20 +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 || COREBOOT_MEMCONSOLE diff --git a/drivers/firmware/coreboot/Makefile b/drivers/firmware/coreboot= /Makefile index e681f274417a..a08d167a95a8 100644 --- a/drivers/firmware/coreboot/Makefile +++ b/drivers/firmware/coreboot/Makefile @@ -2,6 +2,7 @@ =20 obj-$(CONFIG_GOOGLE_SMI) +=3D gsmi.o obj-$(CONFIG_COREBOOT_TABLE) +=3D coreboot_table.o +obj-$(CONFIG_COREBOOT_CFR) +=3D coreboot-cfr.o obj-$(CONFIG_COREBOOT_FRAMEBUFFER) +=3D framebuffer-coreboot.o obj-$(CONFIG_COREBOOT_MEMCONSOLE_COMMON) +=3D memconsole.o obj-$(CONFIG_COREBOOT_MEMCONSOLE) +=3D memconsole-coreboot.o diff --git a/drivers/firmware/coreboot/coreboot-cfr.c b/drivers/firmware/co= reboot/coreboot-cfr.c new file mode 100644 index 000000000000..2d9ea5d213d8 --- /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 cla= ss. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 =3D 1, + CFR_TAG_ENUM_VALUE =3D 2, + CFR_TAG_OPTION_ENUM =3D 3, + CFR_TAG_OPTION_NUMBER =3D 4, + CFR_TAG_OPTION_BOOL =3D 5, + CFR_TAG_VARCHAR_OPT_NAME =3D 7, + CFR_TAG_VARCHAR_UI_NAME =3D 8, + CFR_TAG_RUNTIME_APPLY =3D 13, +}; + +enum cfr_option_flags { + CFR_OPTFLAG_READONLY =3D BIT(0), + CFR_OPTFLAG_INACTIVE =3D BIT(1), + CFR_OPTFLAG_SUPPRESS =3D BIT(2), + CFR_OPTFLAG_VOLATILE =3D BIT(3), + CFR_OPTFLAG_RUNTIME =3D BIT(4), +}; + +enum cfr_runtime_apply_method { + CFR_RUNTIME_APPLY_NONE =3D 0, + CFR_RUNTIME_APPLY_APM_CNT =3D 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 =3D EFI_GUID(0xceae4c1d, 0x335b, 0x468= 5, + 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") !=3D 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 =3D (const char *)(str + 1); + size_t len =3D 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 =3D (const struct coreboot_table_entry *)iterator->cursor; + if (entry->size < sizeof(*entry) || entry->size > iterator->remaining) + return ERR_PTR(-EINVAL); + + iterator->cursor +=3D entry->size; + iterator->remaining -=3D 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 =3D { + .cursor =3D base, + .remaining =3D len, + }; + const struct coreboot_table_entry *entry; + + for (;;) { + entry =3D coreboot_cfr_next_entry(&iterator); + if (IS_ERR_OR_NULL(entry)) + return entry; + + if (entry->tag =3D=3D 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 =3D 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 =3D (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 =3D 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 =3D (const struct lb_cfr_runtime_apply *)entry; + if (runtime_apply->method =3D=3D 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 =3D strlen(name); + if (len >=3D EFI_VAR_NAME_LEN) + return ERR_PTR(-ENAMETOOLONG); + + efi_char16_t *efi_name __free(kfree) =3D + kcalloc(len + 1, sizeof(*efi_name), GFP_KERNEL); + if (!efi_name) + return ERR_PTR(-ENOMEM); + + for (i =3D 0; i < len; i++) { + if (!isascii(name[i])) + return ERR_PTR(-EINVAL); + efi_name[i] =3D name[i]; + } + + return no_free_ptr(efi_name); +} + +/* Caller must hold the efivar lock. */ +static int coreboot_cfr_read_efi_value(efi_char16_t *efi_name, u32 *value, + u32 *attrs) +{ + unsigned long size =3D sizeof(__le32); + efi_status_t status; + __le32 data; + u32 attr; + + status =3D efivar_get_variable(efi_name, &coreboot_cfr_guid, &attr, + &size, &data); + if (status !=3D EFI_SUCCESS) + return efi_status_to_err(status); + + if (size !=3D sizeof(data)) + return -EINVAL; + + if (!(attr & EFI_VARIABLE_RUNTIME_ACCESS)) + return -EOPNOTSUPP; + + *value =3D le32_to_cpu(data); + if (attrs) + *attrs =3D attr; + + return 0; +} + +static int coreboot_cfr_read_value(const struct coreboot_cfr_setting *sett= ing, + u32 *value, u32 *attrs) +{ + efi_char16_t *efi_name __free(kfree) =3D + coreboot_cfr_efi_name(setting->name); + int ret; + + if (IS_ERR(efi_name)) + return PTR_ERR(no_free_ptr(efi_name)); + + ret =3D efivar_lock(); + if (ret) + return ret; + + ret =3D coreboot_cfr_read_efi_value(efi_name, value, attrs); + efivar_unlock(); + + return ret; +} + +/* Caller must hold the efivar lock. */ +static int coreboot_cfr_write_efi_value(efi_char16_t *efi_name, u32 value, + u32 attrs) +{ + efi_status_t status; + __le32 data; + + if (!efivar_supports_writes()) + return -EROFS; + + data =3D cpu_to_le32(value); + status =3D efivar_set_variable_locked(efi_name, &coreboot_cfr_guid, attrs, + sizeof(data), &data, false); + if (status !=3D EFI_SUCCESS) + return efi_status_to_err(status); + + return 0; +} + +static int coreboot_cfr_apply_runtime(struct coreboot_cfr_setting *setting) +{ + u8 status; + + if (setting->runtime_apply_method !=3D CFR_RUNTIME_APPLY_APM_CNT) + return -EOPNOTSUPP; + + outb((u8)setting->runtime_apply_id, COREBOOT_CFR_APM_STS_PORT); + outb(COREBOOT_CFR_APM_APPLY_CMD, COREBOOT_CFR_APM_CNT_PORT); + status =3D inb(COREBOOT_CFR_APM_STS_PORT); + if (status) + return -EIO; + + return 0; +} + +static int coreboot_cfr_write_value(struct coreboot_cfr_setting *setting, + u32 value) +{ + efi_char16_t *efi_name; + u32 attrs; + u32 old; + int restore_ret; + int ret; + + if (setting->read_only) + return -EACCES; + + efi_name =3D coreboot_cfr_efi_name(setting->name); + if (IS_ERR(efi_name)) + return PTR_ERR(efi_name); + + mutex_lock(&setting->drvdata->lock); + + ret =3D efivar_lock(); + if (ret) + goto out_unlock_mutex; + + ret =3D coreboot_cfr_read_efi_value(efi_name, &old, &attrs); + if (ret) + goto out_unlock_efi; + + if ((attrs & COREBOOT_CFR_EFI_ATTRS) !=3D COREBOOT_CFR_EFI_ATTRS) { + ret =3D -EOPNOTSUPP; + goto out_unlock_efi; + } + + if (old =3D=3D value) + goto out_unlock_efi; + + ret =3D coreboot_cfr_write_efi_value(efi_name, value, attrs); + if (ret) + goto out_unlock_efi; + + ret =3D coreboot_cfr_apply_runtime(setting); + if (ret =3D=3D -EOPNOTSUPP) { + /* EFI changed; firmware will consume it after reboot. */ + setting->drvdata->pending_reboot =3D true; + ret =3D 0; + } else if (ret) { + restore_ret =3D coreboot_cfr_write_efi_value(efi_name, old, attrs); + if (restore_ret) { + setting->drvdata->pending_reboot =3D true; + ret =3D restore_ret; + } else { + goto out_unlock_efi; + } + } + + efivar_unlock(); + kobject_uevent(&setting->drvdata->class_dev->kobj, KOBJ_CHANGE); + mutex_unlock(&setting->drvdata->lock); + kfree(efi_name); + return ret; + +out_unlock_efi: + efivar_unlock(); +out_unlock_mutex: + mutex_unlock(&setting->drvdata->lock); + kfree(efi_name); + return ret; +} + +static const char * +coreboot_cfr_label_from_value(const struct coreboot_cfr_setting *setting, + u32 value) +{ + unsigned int i; + + for (i =3D 0; i < setting->n_values; i++) { + if (setting->values[i].value =3D=3D value) + return setting->values[i].label; + } + + return NULL; +} + +static int coreboot_cfr_parse_value(struct coreboot_cfr_setting *setting, + const char *label, u32 *value_out) +{ + unsigned int i; + + for (i =3D 0; i < setting->n_values; i++) { + if (!sysfs_streq(label, setting->values[i].label)) + continue; + + *value_out =3D setting->values[i].value; + return 0; + } + + return kstrtou32(label, 0, value_out); +} + +static bool coreboot_cfr_value_is_valid(struct coreboot_cfr_setting *setti= ng, + u32 value) +{ + u32 delta; + + if (setting->type !=3D COREBOOT_CFR_SETTING_NUMBER) { + /* Enum and bool values are valid only if they have a label. */ + return coreboot_cfr_label_from_value(setting, value); + } + + if (value < setting->min || value > setting->max) + return false; + + if (!setting->step) + return true; + + delta =3D value - setting->min; + return delta % setting->step =3D=3D 0; +} + +static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + + if (setting->type =3D=3D COREBOOT_CFR_SETTING_NUMBER) + return sysfs_emit(buf, "integer\n"); + + return sysfs_emit(buf, "enumeration\n"); +} + +static ssize_t display_name_language_code_show(struct kobject *kobj, + struct kobj_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, "en_US.UTF-8\n"); +} + +static ssize_t display_name_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + + return sysfs_emit(buf, "%s\n", setting->display_name); +} + +static ssize_t possible_values_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + ssize_t len =3D 0; + unsigned int i; + + for (i =3D 0; i < setting->n_values; i++) { + len +=3D sysfs_emit_at(buf, len, "%s%s", i ? ";" : "", + setting->values[i].label); + } + + len +=3D sysfs_emit_at(buf, len, "\n"); + return len; +} + +static ssize_t min_value_show(struct kobject *kobj, struct kobj_attribute = *attr, + char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + + return sysfs_emit(buf, "%u\n", setting->min); +} + +static ssize_t max_value_show(struct kobject *kobj, struct kobj_attribute = *attr, + char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + + return sysfs_emit(buf, "%u\n", setting->max); +} + +static ssize_t scalar_increment_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + + return sysfs_emit(buf, "%u\n", setting->step); +} + +static ssize_t default_value_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + const char *label; + + if (setting->type =3D=3D COREBOOT_CFR_SETTING_NUMBER) + return sysfs_emit(buf, "%u\n", setting->default_value); + + label =3D coreboot_cfr_label_from_value(setting, setting->default_value); + if (!label) + return sysfs_emit(buf, "%u\n", setting->default_value); + + return sysfs_emit(buf, "%s\n", label); +} + +static ssize_t current_value_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + const char *label; + u32 value; + int ret; + + ret =3D coreboot_cfr_read_value(setting, &value, NULL); + if (ret) + return ret; + + if (setting->type =3D=3D COREBOOT_CFR_SETTING_NUMBER) + return sysfs_emit(buf, "%u\n", value); + + label =3D coreboot_cfr_label_from_value(setting, value); + if (!label) + return -EINVAL; + + return sysfs_emit(buf, "%s\n", label); +} + +static ssize_t current_value_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t count) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + u32 value; + int ret; + + ret =3D coreboot_cfr_parse_value(setting, buf, &value); + if (ret) + return ret; + + if (!coreboot_cfr_value_is_valid(setting, value)) + return -EINVAL; + + ret =3D coreboot_cfr_write_value(setting, value); + if (ret) + return ret; + + return count; +} + +static struct kobj_attribute type_attr =3D __ATTR_RO(type); +static struct kobj_attribute display_name_language_code_attr =3D + __ATTR_RO(display_name_language_code); +static struct kobj_attribute display_name_attr =3D __ATTR_RO(display_name); +static struct kobj_attribute possible_values_attr =3D __ATTR_RO(possible_v= alues); +static struct kobj_attribute min_value_attr =3D __ATTR_RO(min_value); +static struct kobj_attribute max_value_attr =3D __ATTR_RO(max_value); +static struct kobj_attribute scalar_increment_attr =3D __ATTR_RO(scalar_in= crement); +static struct kobj_attribute default_value_attr =3D __ATTR_RO(default_valu= e); +static struct kobj_attribute current_value_attr =3D __ATTR_RW(current_valu= e); + +static struct attribute *coreboot_cfr_setting_attrs[] =3D { + &type_attr.attr, + &display_name_language_code_attr.attr, + &display_name_attr.attr, + &possible_values_attr.attr, + &min_value_attr.attr, + &max_value_attr.attr, + &scalar_increment_attr.attr, + &default_value_attr.attr, + ¤t_value_attr.attr, + NULL, +}; + +static umode_t coreboot_cfr_attr_is_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct coreboot_cfr_setting *setting =3D to_coreboot_cfr_setting(kobj); + + if (setting->type =3D=3D COREBOOT_CFR_SETTING_NUMBER && + attr =3D=3D &possible_values_attr.attr) + return 0; + + if (setting->type !=3D COREBOOT_CFR_SETTING_NUMBER && + (attr =3D=3D &min_value_attr.attr || attr =3D=3D &max_value_attr.attr= || + attr =3D=3D &scalar_increment_attr.attr)) + return 0; + + if (setting->read_only && attr =3D=3D ¤t_value_attr.attr) + return 0444; + + return attr->mode; +} + +static const struct attribute_group coreboot_cfr_setting_group =3D { + .attrs =3D coreboot_cfr_setting_attrs, + .is_visible =3D coreboot_cfr_attr_is_visible, +}; + +static void coreboot_cfr_free_setting(struct coreboot_cfr_setting *setting) +{ + unsigned int i; + + for (i =3D 0; i < setting->n_values; i++) + kfree(setting->values[i].label); + + kfree(setting->values); + kfree(setting->display_name); + kfree(setting->name); + kfree(setting); +} + +static void coreboot_cfr_setting_release(struct kobject *kobj) +{ + coreboot_cfr_free_setting(to_coreboot_cfr_setting(kobj)); +} + +static const struct kobj_type coreboot_cfr_setting_ktype =3D { + .release =3D coreboot_cfr_setting_release, + .sysfs_ops =3D &kobj_sysfs_ops, +}; + +static ssize_t pending_reboot_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct device *dev =3D kobj_to_dev(kobj->parent); + struct coreboot_cfr_drvdata *data; + + data =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", data->pending_reboot); +} + +static struct kobj_attribute pending_reboot_attr =3D __ATTR_RO(pending_reb= oot); + +static int coreboot_cfr_copy_bool_values(struct coreboot_cfr_setting *sett= ing) +{ + static const struct coreboot_cfr_enum bool_values[] =3D { + { .label =3D "Disabled", .value =3D 0 }, + { .label =3D "Enabled", .value =3D 1 }, + }; + unsigned int i; + + setting->values =3D kcalloc(ARRAY_SIZE(bool_values), sizeof(*setting->val= ues), + GFP_KERNEL); + if (!setting->values) + return -ENOMEM; + + for (i =3D 0; i < ARRAY_SIZE(bool_values); i++) { + setting->values[i].label =3D kstrdup(bool_values[i].label, + GFP_KERNEL); + if (!setting->values[i].label) + return -ENOMEM; + setting->values[i].value =3D bool_values[i].value; + setting->n_values++; + } + + return 0; +} + +static int coreboot_cfr_count_enum_values(const void *base, size_t len) +{ + struct coreboot_cfr_iterator iterator =3D { + .cursor =3D base, + .remaining =3D len, + }; + const struct coreboot_table_entry *entry; + int count =3D 0; + + for (;;) { + entry =3D coreboot_cfr_next_entry(&iterator); + if (IS_ERR(entry)) + return PTR_ERR(entry); + if (!entry) + return count; + + if (entry->tag =3D=3D CFR_TAG_ENUM_VALUE) + count++; + } +} + +static int coreboot_cfr_copy_enum_values(struct coreboot_cfr_setting *sett= ing, + const void *base, size_t len) +{ + struct coreboot_cfr_iterator iterator =3D { + .cursor =3D base, + .remaining =3D len, + }; + const struct lb_cfr_enum_value *enum_value; + const struct lb_cfr_varbinary *label; + const struct coreboot_table_entry *entry; + struct coreboot_cfr_enum *value; + int count; + + count =3D coreboot_cfr_count_enum_values(base, len); + if (count <=3D 0) + return count ?: -EINVAL; + + setting->values =3D kcalloc(count, sizeof(*setting->values), GFP_KERNEL); + if (!setting->values) + return -ENOMEM; + + for (;;) { + entry =3D coreboot_cfr_next_entry(&iterator); + if (IS_ERR(entry)) + return PTR_ERR(entry); + if (!entry) + return 0; + + if (entry->tag !=3D CFR_TAG_ENUM_VALUE) + continue; + + if (entry->size < sizeof(*enum_value)) + return -EINVAL; + + enum_value =3D (const struct lb_cfr_enum_value *)entry; + label =3D coreboot_cfr_child_string(enum_value + 1, + enum_value->size - sizeof(*enum_value), + CFR_TAG_VARCHAR_UI_NAME); + if (IS_ERR(label)) + return PTR_ERR(label); + if (!label) + return -EINVAL; + + value =3D &setting->values[setting->n_values]; + value->label =3D coreboot_cfr_string_dup(label); + if (!value->label) + return -ENOMEM; + if (!coreboot_cfr_string_is_valid_label(value->label)) { + kfree(value->label); + value->label =3D NULL; + return -EINVAL; + } + + value->value =3D enum_value->value; + setting->n_values++; + } +} + +static bool +coreboot_cfr_possible_values_fit(const struct coreboot_cfr_setting *settin= g) +{ + size_t len =3D 1; /* Trailing newline. */ + size_t label_len; + unsigned int i; + + for (i =3D 0; i < setting->n_values; i++) { + if (len >=3D PAGE_SIZE) + return false; + + if (i) + len++; + + label_len =3D strlen(setting->values[i].label); + if (label_len >=3D PAGE_SIZE - len) + return false; + + len +=3D label_len; + } + + return true; +} + +static int coreboot_cfr_setting_is_usable(struct coreboot_cfr_setting *set= ting) +{ + u32 value; + int ret; + + ret =3D coreboot_cfr_read_value(setting, &value, NULL); + if (ret) + return ret; + + if (!coreboot_cfr_value_is_valid(setting, value)) + return -EINVAL; + + return 0; +} + +static int coreboot_cfr_register_setting(struct coreboot_cfr_drvdata *data, + struct coreboot_cfr_setting *setting) +{ + int ret; + + ret =3D kobject_init_and_add(&setting->kobj, &coreboot_cfr_setting_ktype, + &data->attrs_kset->kobj, "%s", setting->name); + if (ret) + goto err_put_kobj; + + ret =3D sysfs_create_group(&setting->kobj, &coreboot_cfr_setting_group); + if (ret) + goto err_put_kobj; + + list_add_tail(&setting->node, &data->settings); + return 0; + +err_put_kobj: + kobject_put(&setting->kobj); + return ret; +} + +static int coreboot_cfr_add_numeric_option(struct coreboot_cfr_drvdata *da= ta, + const struct lb_cfr_numeric_option *option, + bool parent_read_only) +{ + const struct lb_cfr_varbinary *name; + const struct lb_cfr_varbinary *display_name; + const struct lb_cfr_runtime_apply *runtime_apply; + const void *child_base =3D option + 1; + struct coreboot_cfr_setting *setting; + size_t child_len =3D option->size - sizeof(*option); + int ret; + + if (!(option->flags & CFR_OPTFLAG_RUNTIME)) + return 0; + + if (option->flags & COREBOOT_CFR_OPT_SKIP_FLAGS) + return 0; + + if (option->dependency_id) + return 0; + + setting =3D kzalloc_obj(*setting, GFP_KERNEL); + if (!setting) + return -ENOMEM; + + INIT_LIST_HEAD(&setting->node); + setting->drvdata =3D data; + setting->default_value =3D option->default_value; + setting->min =3D option->min; + setting->max =3D option->max; + setting->step =3D option->step ?: 1; + setting->read_only =3D + (option->flags & COREBOOT_CFR_OPT_READ_ONLY_FLAGS) || + !data->efi_writes_supported || parent_read_only; + + runtime_apply =3D coreboot_cfr_child_runtime_apply(child_base, child_len); + if (IS_ERR(runtime_apply)) { + ret =3D PTR_ERR(runtime_apply); + goto err_put_setting; + } + + if (runtime_apply && runtime_apply->method =3D=3D CFR_RUNTIME_APPLY_APM_C= NT) { + setting->runtime_apply_method =3D runtime_apply->method; + setting->runtime_apply_id =3D runtime_apply->id; + } + + name =3D coreboot_cfr_child_string(child_base, child_len, + CFR_TAG_VARCHAR_OPT_NAME); + if (IS_ERR(name)) { + ret =3D PTR_ERR(name); + goto err_put_setting; + } + if (!name) { + ret =3D -EINVAL; + goto err_put_setting; + } + + setting->name =3D coreboot_cfr_string_dup(name); + if (!setting->name) { + ret =3D -ENOMEM; + goto err_put_setting; + } + + if (!coreboot_cfr_string_is_valid_name(setting->name)) { + ret =3D -EINVAL; + goto err_put_setting; + } + + display_name =3D coreboot_cfr_child_string(child_base, child_len, + CFR_TAG_VARCHAR_UI_NAME); + if (IS_ERR(display_name)) { + ret =3D PTR_ERR(display_name); + goto err_put_setting; + } + if (display_name) + setting->display_name =3D coreboot_cfr_string_dup(display_name); + else + setting->display_name =3D kstrdup(setting->name, GFP_KERNEL); + if (!setting->display_name) { + ret =3D -ENOMEM; + goto err_put_setting; + } + + switch (option->tag) { + case CFR_TAG_OPTION_BOOL: + setting->type =3D COREBOOT_CFR_SETTING_BOOL; + setting->min =3D 0; + setting->max =3D 1; + setting->step =3D 1; + ret =3D coreboot_cfr_copy_bool_values(setting); + break; + case CFR_TAG_OPTION_ENUM: + setting->type =3D COREBOOT_CFR_SETTING_ENUM; + ret =3D coreboot_cfr_copy_enum_values(setting, child_base, + child_len); + break; + case CFR_TAG_OPTION_NUMBER: + setting->type =3D COREBOOT_CFR_SETTING_NUMBER; + if (setting->max < setting->min) + ret =3D -EINVAL; + else + ret =3D 0; + break; + default: + ret =3D -EINVAL; + break; + } + + if (ret) + goto err_put_setting; + /* possible_values must be returned completely in one sysfs read. */ + if (setting->type !=3D COREBOOT_CFR_SETTING_NUMBER && + !coreboot_cfr_possible_values_fit(setting)) { + ret =3D 0; + goto err_put_setting; + } + + ret =3D coreboot_cfr_setting_is_usable(setting); + if (ret) { + /* + * CFR may describe options without a matching, readable runtime + * EFI variable. Skip those, but propagate transient EFI failures. + */ + if (ret =3D=3D -ENOENT || ret =3D=3D -EINVAL || ret =3D=3D -EOPNOTSUPP || + ret =3D=3D -ENAMETOOLONG) + ret =3D 0; + goto err_put_setting; + } + + /* The kobject release callback owns setting after this call. */ + return coreboot_cfr_register_setting(data, setting); + +err_put_setting: + coreboot_cfr_free_setting(setting); + return ret; +} + +static int coreboot_cfr_parse_records(struct coreboot_cfr_drvdata *data, + const void *base, size_t len, + unsigned int depth, + bool parent_read_only) +{ + struct coreboot_cfr_iterator iterator =3D { + .cursor =3D base, + .remaining =3D len, + }; + const struct lb_cfr_option_form *form; + const struct lb_cfr_numeric_option *option; + const struct coreboot_table_entry *entry; + const void *child_base; + size_t child_len; + int ret; + + for (;;) { + entry =3D coreboot_cfr_next_entry(&iterator); + if (IS_ERR(entry)) + return PTR_ERR(entry); + if (!entry) + return 0; + + switch (entry->tag) { + case CFR_TAG_OPTION_FORM: + if (entry->size < sizeof(struct lb_cfr_option_form)) + return -EINVAL; + + form =3D (const struct lb_cfr_option_form *)entry; + if (form->dependency_id || + form->flags & CFR_OPTFLAG_SUPPRESS) + break; + + if (depth >=3D COREBOOT_CFR_MAX_FORM_DEPTH) + return -E2BIG; + + child_base =3D form + 1; + child_len =3D entry->size - sizeof(struct lb_cfr_option_form); + ret =3D coreboot_cfr_parse_records(data, child_base, + child_len, depth + 1, + parent_read_only || + (form->flags & + COREBOOT_CFR_OPT_READ_ONLY_FLAGS)); + if (ret) + return ret; + break; + case CFR_TAG_OPTION_ENUM: + case CFR_TAG_OPTION_NUMBER: + case CFR_TAG_OPTION_BOOL: + option =3D (const struct lb_cfr_numeric_option *)entry; + if (entry->size < sizeof(*option)) + return -EINVAL; + ret =3D coreboot_cfr_add_numeric_option(data, option, + parent_read_only); + if (ret) + return ret; + break; + default: + /* Ignore unsupported, child-only and future record types. */ + break; + } + } +} + +static void coreboot_cfr_unregister_settings(struct coreboot_cfr_drvdata *= data) +{ + struct coreboot_cfr_setting *setting, *tmp; + + list_for_each_entry_safe(setting, tmp, &data->settings, node) { + sysfs_remove_group(&setting->kobj, &coreboot_cfr_setting_group); + list_del(&setting->node); + kobject_put(&setting->kobj); + } +} + +static int coreboot_cfr_probe(struct coreboot_device *dev) +{ + const struct lb_cfr *root =3D (const struct lb_cfr *)dev->raw; + struct coreboot_cfr_drvdata *data; + size_t payload_len; + int ret; + + if (dev->entry.size < sizeof(*root)) + return -EINVAL; + + if (root->tag !=3D LB_TAG_CFR_ROOT || root->version !=3D CFR_VERSION) + return -EINVAL; + + if (root->size < sizeof(*root) || root->size > dev->entry.size) + return -EINVAL; + + payload_len =3D root->size - sizeof(*root); + if (crc32_be(0, root + 1, payload_len) !=3D root->checksum) + return -EBADMSG; + + if (!efivar_is_available()) + return -EPROBE_DEFER; + + data =3D devm_kzalloc(&dev->dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + ret =3D efivar_lock(); + if (ret) + return ret; + data->efi_writes_supported =3D efivar_supports_writes(); + efivar_unlock(); + + INIT_LIST_HEAD(&data->settings); + ret =3D devm_mutex_init(&dev->dev, &data->lock); + if (ret) + return ret; + + dev_set_drvdata(&dev->dev, data); + + data->class_dev =3D device_create(&firmware_attributes_class, NULL, + MKDEV(0, 0), NULL, DRIVER_NAME); + if (IS_ERR(data->class_dev)) + return PTR_ERR(data->class_dev); + dev_set_drvdata(data->class_dev, data); + + data->attrs_kset =3D kset_create_and_add("attributes", NULL, + &data->class_dev->kobj); + if (!data->attrs_kset) { + ret =3D -ENOMEM; + goto err_unregister_dev; + } + + ret =3D sysfs_create_file(&data->attrs_kset->kobj, + &pending_reboot_attr.attr); + if (ret) + goto err_unregister_attrs; + + ret =3D coreboot_cfr_parse_records(data, root + 1, payload_len, 0, false); + if (ret) + goto err_unregister_settings; + + if (list_empty(&data->settings)) { + ret =3D -ENODEV; + goto err_unregister_settings; + } + + return 0; + +err_unregister_settings: + coreboot_cfr_unregister_settings(data); + sysfs_remove_file(&data->attrs_kset->kobj, &pending_reboot_attr.attr); +err_unregister_attrs: + kset_unregister(data->attrs_kset); +err_unregister_dev: + device_unregister(data->class_dev); + return ret; +} + +static void coreboot_cfr_remove(struct coreboot_device *dev) +{ + struct coreboot_cfr_drvdata *data =3D dev_get_drvdata(&dev->dev); + + coreboot_cfr_unregister_settings(data); + sysfs_remove_file(&data->attrs_kset->kobj, &pending_reboot_attr.attr); + kset_unregister(data->attrs_kset); + device_unregister(data->class_dev); +} + +static const struct coreboot_device_id coreboot_cfr_ids[] =3D { + { .tag =3D LB_TAG_CFR_ROOT }, + { } +}; +MODULE_DEVICE_TABLE(coreboot, coreboot_cfr_ids); + +static struct coreboot_driver coreboot_cfr_driver =3D { + .probe =3D coreboot_cfr_probe, + .remove =3D coreboot_cfr_remove, + .drv =3D { + .name =3D DRIVER_NAME, + }, + .id_table =3D coreboot_cfr_ids, +}; +module_coreboot_driver(coreboot_cfr_driver); + +MODULE_AUTHOR("Sean Rhodes "); +MODULE_DESCRIPTION("coreboot CFR firmware attributes driver"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("EFIVAR"); From nobody Thu Aug 27 18:51:53 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 7C01C3C5827 for ; Mon, 17 Aug 2026 21:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003706; cv=none; b=o77/jkltvYEaBdVdiERnkQHsWVWl3vo83GHZXPUsUXhypwV/2YpTpw6dK+qEm+81vK5xNoiEc9nLgetQO1+/856uJvT/2V+ZfZihcaxRAusgRaZE17XTuTjHrhjgbBiGEumnFIKqylEar59i7JBzVgh7SwUw9WLj/JB6fAKM97s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787003706; c=relaxed/simple; bh=waubqiuCOYRQ2QTo7ozti7dFGxycb8EqFHbDI6qm6Lk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cSqZpUKR4ZvevpadbzYRZABKvpA7jwm/E0vVhtF5z9KEx/Nz3YpjZfaQfy4KvipqxZ0A2k9Ibq2i2/hq2Qgkby8XFcV9lLosOW9AVc5QsyNOb/kc2Onmh+UPQoDevE1CQE+PkDdiD5haxFUIHxPDDQjquD8XGv/gv3FGRCIYMrM= 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=OWMChSy2; arc=none smtp.client-ip=209.85.221.54 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="OWMChSy2" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-472326ca506so2746723f8f.2 for ; Mon, 17 Aug 2026 14:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20251104.gappssmtp.com; s=20251104; t=1787003701; x=1787608501; 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=waubqiuCOYRQ2QTo7ozti7dFGxycb8EqFHbDI6qm6Lk=; b=OWMChSy2TdxVmn8WVkTcA+sMo5hXnPaubarGO0gaDNcbC6dwDD/5KQ82XLg18KYxRr 3BPSNXVU893Y6b7PO7cM7GptBFNuVyth8GuRKr3uKV0YtXfnCTOFVN3WlRA9TVR/7xOo BvSR9jyK/F1KVYslfq0RABlayh4gdoSSyozuqAmj4N54ISohJ+q6vIJvFClB9fRfrXMZ X2Wy38pzSB0AYrv+hUOVLx5Emg2l0GWjJzNqVmLeKZJSznU2EjjeTOqXMzVwhGbTsxMb gRWqUrT9ST2qYPeFsbl2h+QvvcuYDKrYe7ZEdSnT4ViIUmHPO+rQ5Gx4mcf+Wqhj6oCr Sg8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787003701; x=1787608501; 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=waubqiuCOYRQ2QTo7ozti7dFGxycb8EqFHbDI6qm6Lk=; b=tPAutYMwu4BW6WSgiY9Ez+KqcsFlyXkN6HqCJOXqU0y25QEGXKs4E/mjmzDc4EMcrt w1gf9q8Y9u0aV4dsCGrpYUXq96xlVD8utDXw74gsXJSJtQwnD8YY67m0qwEV5mjcZVRa FBHcx968Y5rRes/hNJciu0BarIjAaLjx13ZvGKjNrcFSdPKsgFSHlpXqB8HVJFOFo8Cd 0u1YkkjwEKBPIyXnPOZzWxKoNG7TH0KXM0M1G5oDOfeE7lDLQT52Gaiy13xDg5I0CR6W ZaPCh9H+oO9CwNbQEXYWIa4PoXOYAxk+nwfhYOHvpP3RmxkikknkOjzGqQQ7pba4UYX3 0Kqw== X-Forwarded-Encrypted: i=1; AHgh+RqICS/Fv/dtqcTbJ4zeY6OMiL8VqEPwX4KTQbPiWFSbcaN0YRz6kdMJ1OJozwn59o/HSIvhtIS/HmgNSX4=@vger.kernel.org X-Gm-Message-State: AOJu0YxysOTE8nxBSC/y/ZcN2BC3kdUuWjvrcaNVG7UsJvlxWIZgTZ9d jb6XYo5r/bG8HdSat8oPb3SE6S7BH9PmiCTI58WwK67DhNsO1pdWjNR2qvXqUU16LQ== X-Gm-Gg: AR+sD11NnI2ukBMf6ZVFtCzbpWyUH62RHmQwg++FNyfW+VoMJHoJhDa21T1/VfiquzZ rac6ZpnD7WDl7pbKxDBmQv7XLyx3Uk3fSwPMGHgvEiLkXOzRc49uMMjj4RHXHyzYDk5zGZWJ7DF Wz/e1LEtMP4erssCKZhDrGmBhqGZc1Lm/1WHN9mIChyiR71V830iKXaYiDjPm77846SU2dUBTww DJYFSVzm+P9tTrLyfvYT9sbiVQu6IPDx+5UJGWgtN3XdU/xAiYUKmqp7mIM3ENuRUCETmZ3Ij98 CxPrU82fNhXWoq3O9wPTkgr5suCuqcg+iQFqN0LSz2CHAtYStxoKx/6livj+aiRSxM61Jyclvqz oSidV+xObV8ZQPKsgltfHxhERfAA9Sl8bAyLIxZ0SA3g5519Jmjur/pIanaI6jvxpqv2VlleVFC yGO3/sh+C7JT3a2Enn1mcjkFZGH7XdY0pQPtkVbBMmcaXbCajuXfvpNJ4J87hNMtc1uRRgLkgFl wLCWO5Mv9ps0w== X-Received: by 2002:a05:6000:4a01:b0:47f:8f8f:e493 with SMTP id ffacd0b85a97d-482a8fe9b5amr6047922f8f.3.1787003701113; Mon, 17 Aug 2026 14:55:01 -0700 (PDT) Received: from horizon ([217.155.46.38]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5a3b3f0sm6060954f8f.14.2026.08.17.14.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 14:55:00 -0700 (PDT) From: Sean Rhodes To: chrome-platform@lists.linux.dev Cc: Corentin Chary , "Luke D. Jones" , Denis Benato , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Prasanth Ksr , Jorge Lopez , Mark Pearson , "Derek J. Clark" , Joshua Grisham , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, Sean Rhodes , "Michael S. Tsirkin" , Chen-Yu Tsai , Huacai Chen , Tzung-Bi Shih , Brian Norris , Julius Werner , Thomas Zimmermann , Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , David Airlie , Simona Vetter , Florian Fainelli , Takashi Sakamoto , Bjorn Helgaas , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= , Titouan Ameline de Cadeville , Kees Cook , Danilo Krummrich , dri-devel@lists.freedesktop.org, Krzysztof Kozlowski , Bjorn Andersson , Dmitry Baryshkov , Geert Uytterhoeven , Arnd Bergmann , Eric Biggers , Luca Weiss , Michal Simek , Sven Peter , linux-kernel@vger.kernel.org, oliver@liuxiaozhen.dev Subject: [PATCH v13 RESEND 5/5] arm64: defconfig: Update coreboot firmware symbols Date: Mon, 17 Aug 2026 22:54:51 +0100 Message-ID: <540bd3107a81da9555655ed2d5a9252ed04a620a.1787003659.git.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: quoted-printable Content-Type: text/plain; charset="utf-8" The generic coreboot firmware Kconfig symbols were renamed from CONFIG_GOOGLE_* to CONFIG_COREBOOT_* while keeping the old names as transitional compatibility symbols. Select the new names directly in the arm64 defconfig so the checked-in defconfig follows the visible Kconfig symbols. Keep this separate from the rename patch so the configuration churn is easy to review independently. Signed-off-by: Sean Rhodes --- arch/arm64/configs/defconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 654a102cb5bc..32ec89a872d9 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -267,9 +267,9 @@ CONFIG_RASPBERRYPI_FIRMWARE=3Dy CONFIG_INTEL_STRATIX10_SERVICE=3Dy CONFIG_INTEL_STRATIX10_RSU=3Dm CONFIG_MTK_ADSP_IPC=3Dm -CONFIG_GOOGLE_FIRMWARE=3Dy -CONFIG_GOOGLE_CBMEM=3Dm -CONFIG_GOOGLE_COREBOOT_TABLE=3Dm +CONFIG_COREBOOT_FIRMWARE=3Dy +CONFIG_COREBOOT_CBMEM=3Dm +CONFIG_COREBOOT_TABLE=3Dm CONFIG_EFI_CAPSULE_LOADER=3Dy CONFIG_IMX_SCU=3Dy CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE=3Dy