summaryrefslogtreecommitdiff
path: root/drivers/firmware/google
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-02-17 16:56:21 +0100
committerThomas Zimmermann <tzimmermann@suse.de>2026-02-20 14:38:24 +0100
commita29a1f0ec8d69ee917a9d4c84b844df0decff0ef (patch)
tree991d11fc4d9e50cff28951fd79bbb09105413562 /drivers/firmware/google
parentb3728905dca29ea4e00c0587f27c3a637b13b2d8 (diff)
drm/sysfb: corebootdrm: Add DRM driver for coreboot framebuffers
Add corebootdrm, a DRM driver for coreboot framebuffers. The driver supports a pre-initialized framebuffer with various packed RGB formats. The driver code is fairly small and uses the same logic as the other sysfb drivers. Most of the implementation comes from existing sysfb helpers. Until now, coreboot relied on simpledrm or simplefb for boot-up graphics output. Initialize the platform device for corebootdrm in the same place in framebuffer_probe(). With a later commit, the simple-framebuffer should be removed. v4: - sort include statements (Tzung-Bi) v3: - comment on _HAS_LFB semantics (Tzung-Bi) - fix typo in commit description (Tzung-Bi) - comment on simple-framebuffer being obsolete for coreboot v2: - reimplement as platform driver - limit resources and mappings to known framebuffer memory; no page alignment - create corebootdrm device from coreboot framebuffer code Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Acked-by: Julius Werner <jwerner@chromium.org> Acked-by: Tzung-Bi Shih <tzungbi@kernel.org> # coreboot Link: https://patch.msgid.link/20260217155836.96267-12-tzimmermann@suse.de
Diffstat (limited to 'drivers/firmware/google')
-rw-r--r--drivers/firmware/google/Kconfig3
-rw-r--r--drivers/firmware/google/framebuffer-coreboot.c22
2 files changed, 21 insertions, 4 deletions
diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig
index 3ab3e089328b..b78c644fa253 100644
--- a/drivers/firmware/google/Kconfig
+++ b/drivers/firmware/google/Kconfig
@@ -63,7 +63,8 @@ config 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 simple-framebuffer.
+ device of type coreboot-framebuffer. Using the old device of
+ type simple-framebuffer is deprecated.
config GOOGLE_MEMCONSOLE_COREBOOT
tristate "Firmware Memory Console"
diff --git a/drivers/firmware/google/framebuffer-coreboot.c b/drivers/firmware/google/framebuffer-coreboot.c
index fab3f28655d3..2c63a9bd0dcb 100644
--- a/drivers/firmware/google/framebuffer-coreboot.c
+++ b/drivers/firmware/google/framebuffer-coreboot.c
@@ -76,22 +76,23 @@ static struct device *framebuffer_parent_dev(struct resource *res)
return NULL;
}
-static const struct simplefb_format formats[] = SIMPLEFB_FORMATS;
-
static int framebuffer_probe(struct coreboot_device *dev)
{
- int i;
struct lb_framebuffer *fb = &dev->framebuffer;
struct device *parent;
struct platform_device *pdev;
struct resource res;
int ret;
+#if !IS_ENABLED(CONFIG_DRM_COREBOOTDRM)
struct simplefb_platform_data pdata = {
.width = fb->x_resolution,
.height = fb->y_resolution,
.stride = fb->bytes_per_line,
.format = NULL,
};
+ int i;
+ static const struct simplefb_format formats[] = SIMPLEFB_FORMATS;
+#endif
/*
* On coreboot systems, the advertised LB_TAG_FRAMEBUFFER entry
@@ -118,6 +119,20 @@ static int framebuffer_probe(struct coreboot_device *dev)
if (IS_ERR(parent))
return PTR_ERR(parent);
+#if IS_ENABLED(CONFIG_DRM_COREBOOTDRM)
+ pdev = platform_device_register_resndata(parent, "coreboot-framebuffer", 0,
+ &res, 1, fb, fb->size);
+ if (IS_ERR(pdev)) {
+ pr_warn("coreboot: could not register framebuffer\n");
+ ret = PTR_ERR(pdev);
+ goto out_put_device_parent;
+ }
+#else
+ /*
+ * FIXME: Coreboot systems should use a driver that binds to
+ * coreboot-framebuffer devices. Remove support for
+ * simple-framebuffer at some point.
+ */
for (i = 0; i < ARRAY_SIZE(formats); ++i) {
if (fb->bits_per_pixel == formats[i].bits_per_pixel &&
fb->red_mask_pos == formats[i].red.offset &&
@@ -142,6 +157,7 @@ static int framebuffer_probe(struct coreboot_device *dev)
pr_warn("coreboot: could not register framebuffer\n");
goto out_put_device_parent;
}
+#endif
ret = 0;