git: 966e53a4e563 - main - linker: Add MODINFOMD_SPLASH type

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 11 Jul 2024 06:50:41 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=966e53a4e563da36d62edf57c2b0007921fec8dd

commit 966e53a4e563da36d62edf57c2b0007921fec8dd
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2024-07-09 12:37:08 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-07-11 06:47:21 +0000

    linker: Add MODINFOMD_SPLASH type
    
    This mod type and structure holds the splash screen data and metadata.
    
    Differential Revision:  https://reviews.freebsd.org/D45930
    Reviewed by:            tsoome
    Sponsored by:           Beckhoff Automation GmbH & Co. KG
---
 sys/kern/subr_module.c |  9 +++++++++
 sys/sys/linker.h       |  1 +
 sys/sys/splash.h       | 17 +++++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c
index 829655ed4fb0..7f56ed72e1ac 100644
--- a/sys/kern/subr_module.c
+++ b/sys/kern/subr_module.c
@@ -293,6 +293,7 @@ preload_bootstrap_relocate(vm_offset_t offset)
 	    switch (hdr[0]) {
 	    case MODINFO_ADDR:
 	    case MODINFO_METADATA|MODINFOMD_FONT:
+	    case MODINFO_METADATA|MODINFOMD_SPLASH:
 	    case MODINFO_METADATA|MODINFOMD_SSYM:
 	    case MODINFO_METADATA|MODINFOMD_ESYM:
 		ptr = (vm_offset_t *)(curp + (sizeof(uint32_t) * 2));
@@ -423,6 +424,11 @@ preload_modinfo_type(struct sbuf *sbp, int type)
 	case MODINFOMD_FONT:
 		sbuf_cat(sbp, "MODINFOMD_FONT");
 		break;
+#endif
+#ifdef MODINFOMD_SPLASH
+	case MODINFOMD_SPLASH:
+		sbuf_cat(sbp, "MODINFOMD_SPLASH");
+		break;
 #endif
 	default:
 		sbuf_cat(sbp, "unrecognized metadata type");
@@ -475,6 +481,9 @@ preload_modinfo_value(struct sbuf *sbp, uint32_t *bptr, int type, int len)
 #endif
 #ifdef MODINFOMD_FONT
 	case MODINFO_METADATA | MODINFOMD_FONT:
+#endif
+#ifdef MODINFOMD_SPLASH
+	case MODINFO_METADATA | MODINFOMD_SPLASH:
 #endif
 		sbuf_print_vmoffset(sbp, *(vm_offset_t *)bptr);
 		break;
diff --git a/sys/sys/linker.h b/sys/sys/linker.h
index 06e950f7affe..a316aa26d0eb 100644
--- a/sys/sys/linker.h
+++ b/sys/sys/linker.h
@@ -248,6 +248,7 @@ void linker_kldload_unbusy(int flags);
 #define MODINFOMD_FW_HANDLE	0x000c		/* Firmware dependent handle */
 #define MODINFOMD_KEYBUF	0x000d		/* Crypto key intake buffer */
 #define MODINFOMD_FONT		0x000e		/* Console font */
+#define MODINFOMD_SPLASH	0x000f		/* Console splash screen */
 #define MODINFOMD_NOCOPY	0x8000		/* don't copy this metadata to the kernel */
 
 #define MODINFOMD_DEPLIST	(0x4001 | MODINFOMD_NOCOPY)	/* depends on */
diff --git a/sys/sys/splash.h b/sys/sys/splash.h
new file mode 100644
index 000000000000..ec1e140b88bd
--- /dev/null
+++ b/sys/sys/splash.h
@@ -0,0 +1,17 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2024 Beckhoff Automation GmbH & Co. KG
+ *
+ */
+
+#ifndef _SYS_SPLASH_H_
+#define	_SYS_SPLASH_H_
+
+struct splash_info {
+	uint32_t si_width;
+	uint32_t si_height;
+	uint32_t si_depth;
+};
+
+#endif	/* _SYS_SPLASH_H_ */