git: 014edaa360ce - stable/14 - linker: Add MODINFOMD_SPLASH type

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Mon, 29 Jul 2024 16:38:34 UTC
The branch stable/14 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=014edaa360ce7c4f28371e167b2ec33a9f2773b2

commit 014edaa360ce7c4f28371e167b2ec33a9f2773b2
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2024-07-09 12:37:08 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-07-29 16:37:42 +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
    
    (cherry picked from commit 966e53a4e563da36d62edf57c2b0007921fec8dd)
    
    splash: Add sys/types.h
    
    To fix make test-includes
    
    Fixes:          966e53a4e563 ("linker: Add MODINFOMD_SPLASH type")
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    
    (cherry picked from commit e4fc2fd62a5e4afebfc466868eb3b17f9ba0ad57)
---
 sys/kern/subr_module.c |  9 +++++++++
 sys/sys/linker.h       |  1 +
 sys/sys/splash.h       | 19 +++++++++++++++++++
 3 files changed, 29 insertions(+)

diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c
index 5ab41809aa89..66bf3334b771 100644
--- a/sys/kern/subr_module.c
+++ b/sys/kern/subr_module.c
@@ -294,6 +294,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));
@@ -424,6 +425,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");
@@ -476,6 +482,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 461a32d5529b..be127e6ded48 100644
--- a/sys/sys/linker.h
+++ b/sys/sys/linker.h
@@ -242,6 +242,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..0bbc5a2bd574
--- /dev/null
+++ b/sys/sys/splash.h
@@ -0,0 +1,19 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2024 Beckhoff Automation GmbH & Co. KG
+ *
+ */
+
+#ifndef _SYS_SPLASH_H_
+#define	_SYS_SPLASH_H_
+
+#include <sys/types.h>
+
+struct splash_info {
+	uint32_t si_width;
+	uint32_t si_height;
+	uint32_t si_depth;
+};
+
+#endif	/* _SYS_SPLASH_H_ */