From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 4/5] video: simplefb-fixup: add stdout-path mode to register_simplefb param
Date: Mon, 13 Apr 2026 12:06:59 +0200 [thread overview]
Message-ID: <20260413100710.1459468-4-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260413100710.1459468-1-a.fatoum@barebox.org>
Replace the boolean register_simplefb parameter with a three-value enum:
disabled - no simplefb DT node (previous value 0)
enabled - create simplefb DT node (previous value 1)
stdout-path - create simplefb DT node and set /chosen/stdout-path
The stdout-path mode tells the OS to use the framebuffer as its boot
console.
On OpenBSD arm64, fdt_find_cons("simple-framebuffer") reads
/chosen/stdout-path, resolves it to the node, and if compatible matches,
passes it to simplefb_init_cons() which calls wsdisplay_cnattach().
Without stdout-path being set, OpenBSD's bootloader efi_console() never
writes it because efi_cons (CN_MIDPRI) wins the cninit() probe over
efi_fb (CN_LOWPRI), leaving the kernel without a console path.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
.../migration-guides/migration-master.rst | 11 +++++
drivers/video/simplefb-fixup.c | 46 ++++++++++++++++---
include/fb.h | 4 +-
3 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/Documentation/migration-guides/migration-master.rst b/Documentation/migration-guides/migration-master.rst
index 2833c12081fb..6324e940c2ba 100644
--- a/Documentation/migration-guides/migration-master.rst
+++ b/Documentation/migration-guides/migration-master.rst
@@ -1,5 +1,16 @@
:orphan:
+register_simplefb parameter
+---------------------------
+
+The ``register_simplefb`` parameter on framebuffer devices has changed from
+boolean to an enum with values ``disabled``, ``enabled``, and ``stdout-path``.
+
+Scripts that **read** the parameter will now receive ``"disabled"`` or
+``"enabled"`` instead of ``"0"`` or ``"1"``.
+
+Scripts that **write** ``"0"`` or ``"1"`` continue to work.
+
CONFIG_CRYPTO_PUBLIC_KEYS
-------------------------
diff --git a/drivers/video/simplefb-fixup.c b/drivers/video/simplefb-fixup.c
index ab85d2282efc..694131631850 100644
--- a/drivers/video/simplefb-fixup.c
+++ b/drivers/video/simplefb-fixup.c
@@ -25,6 +25,16 @@
*/
static const struct simplefb_format simplefb_formats[] = SIMPLEFB_FORMATS;
+enum simplefb_mode {
+ SIMPLEFB_DISABLED,
+ SIMPLEFB_ENABLED,
+ SIMPLEFB_STDOUT_PATH,
+};
+
+static const char * const simplefb_mode_names[] = {
+ "disabled", "enabled", "stdout-path",
+};
+
static bool simplefb_bitfield_cmp(const struct fb_bitfield *a,
const struct fb_bitfield *b)
{
@@ -64,7 +74,8 @@ static const struct simplefb_format *simplefb_find_mode(const struct fb_info *fb
}
static int simplefb_create_node(struct device_node *root,
- const struct fb_info *fbi, const char *format)
+ const struct fb_info *fbi, const char *format,
+ bool set_stdout_path)
{
struct device_node *node;
phys_addr_t screen_base;
@@ -124,7 +135,27 @@ static int simplefb_create_node(struct device_node *root,
if (ret < 0)
return ret;
- return of_property_write_string(node, "status", "okay");
+ ret = of_property_write_string(node, "status", "okay");
+ if (ret < 0)
+ return ret;
+
+ /*
+ * Set stdout-path in /chosen to point to this framebuffer if not
+ * already set. This lets the OS (e.g. OpenBSD) know to use
+ * the framebuffer as its boot console rather than falling back to
+ * serial.
+ */
+ if (set_stdout_path) {
+ struct device_node *chosen;
+
+ chosen = of_create_node(root, "/chosen");
+ if (!chosen)
+ return -ENOMEM;
+
+ of_property_write_string(chosen, "stdout-path", "/framebuffer");
+ }
+
+ return 0;
}
static int simplefb_of_fixup(struct device_node *root, void *ctx)
@@ -134,7 +165,7 @@ static int simplefb_of_fixup(struct device_node *root, void *ctx)
int ret;
/* only create node if we are requested to */
- if (!info->register_simplefb)
+ if (info->register_simplefb == SIMPLEFB_DISABLED)
return 0;
/* do not create node for disabled framebuffers */
@@ -147,7 +178,8 @@ static int simplefb_of_fixup(struct device_node *root, void *ctx)
return -EINVAL;
}
- ret = simplefb_create_node(root, info, mode->name);
+ ret = simplefb_create_node(root, info, mode->name,
+ info->register_simplefb == SIMPLEFB_STDOUT_PATH);
if (ret)
dev_err(&info->dev, "failed to create node: %d\n", ret);
else
@@ -158,8 +190,10 @@ static int simplefb_of_fixup(struct device_node *root, void *ctx)
int fb_register_simplefb(struct fb_info *info)
{
- dev_add_param_bool(&info->dev, "register_simplefb",
- NULL, NULL, &info->register_simplefb, NULL);
+ dev_add_param_enum(&info->dev, "register_simplefb",
+ NULL, NULL, &info->register_simplefb,
+ simplefb_mode_names, ARRAY_SIZE(simplefb_mode_names),
+ NULL);
return of_register_fixup(simplefb_of_fixup, info);
}
diff --git a/include/fb.h b/include/fb.h
index 1e3b330ab725..c2826ae9f261 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -186,9 +186,7 @@ struct fb_info {
int enabled;
int p_enable;
- int register_simplefb; /* If true a simplefb device node will
- * be created.
- */
+ int register_simplefb; /* enum simplefb_mode */
int shadowfb;
struct fb_info *base_plane;
--
2.47.3
next prev parent reply other threads:[~2026-04-13 10:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 10:06 [PATCH 1/5] video: simplefb: add r5g5b5a1 and x8b8g8r8 formats to SIMPLEFB_FORMATS Ahmad Fatoum
2026-04-13 10:06 ` [PATCH 2/5] video: simplefb-fixup: use shared SIMPLEFB_FORMATS table Ahmad Fatoum
2026-04-13 10:06 ` [PATCH 3/5] parameter: allow enum params to be set by numeric index Ahmad Fatoum
2026-04-13 10:06 ` Ahmad Fatoum [this message]
2026-04-13 10:07 ` [PATCH 5/5] Documentation: add OpenBSD booting guide Ahmad Fatoum
2026-04-13 12:48 ` [PATCH 1/5] video: simplefb: add r5g5b5a1 and x8b8g8r8 formats to SIMPLEFB_FORMATS Sascha Hauer
2026-04-13 14:56 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260413100710.1459468-4-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox