Skip to content

Commit ffaacd9

Browse files
committed
powerpc/prom_init: Pass linux_banner to firmware via option vector 7
Pass the value of linux_banner to firmware via option vector 7. Option vector 7 is described in "LoPAR" Linux on Power Architecture Reference v2.9, in table B.7 on page 824: An ASCII character formatted null terminated string that describes the client operating system. The string shall be human readable and may be displayed on the console. The string can be up to 256 bytes total, including the nul terminator. linux_banner contains lots of information, and should make it possible to identify the exact kernel version that is running: const char linux_banner[] = "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; For example: Linux version 4.15.0-144-generic (buildd@bos02-ppc64el-018) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #148-Ubuntu SMP Sat May 8 02:32:13 UTC 2021 (Ubuntu 4.15.0-144.148-generic 4.15.18) It's also printed at boot to the console/dmesg, which should make it possible to correlate what firmware receives with the console/dmesg on the machine. Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f47d5a4 commit ffaacd9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/powerpc/kernel/prom_init.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/initrd.h>
2828
#include <linux/bitops.h>
2929
#include <linux/pgtable.h>
30+
#include <linux/printk.h>
3031
#include <asm/prom.h>
3132
#include <asm/rtas.h>
3233
#include <asm/page.h>
@@ -944,6 +945,10 @@ struct option_vector6 {
944945
u8 os_name;
945946
} __packed;
946947

948+
struct option_vector7 {
949+
u8 os_id[256];
950+
} __packed;
951+
947952
struct ibm_arch_vec {
948953
struct { u32 mask, val; } pvrs[14];
949954

@@ -966,6 +971,9 @@ struct ibm_arch_vec {
966971

967972
u8 vec6_len;
968973
struct option_vector6 vec6;
974+
975+
u8 vec7_len;
976+
struct option_vector7 vec7;
969977
} __packed;
970978

971979
static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = {
@@ -1112,6 +1120,9 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = {
11121120
.secondary_pteg = 0,
11131121
.os_name = OV6_LINUX,
11141122
},
1123+
1124+
/* option vector 7: OS Identification */
1125+
.vec7_len = VECTOR_LENGTH(sizeof(struct option_vector7)),
11151126
};
11161127

11171128
static struct ibm_arch_vec __prombss ibm_architecture_vec ____cacheline_aligned;
@@ -1340,6 +1351,8 @@ static void __init prom_check_platform_support(void)
13401351
memcpy(&ibm_architecture_vec, &ibm_architecture_vec_template,
13411352
sizeof(ibm_architecture_vec));
13421353

1354+
prom_strscpy_pad(ibm_architecture_vec.vec7.os_id, linux_banner, 256);
1355+
13431356
if (prop_len > 1) {
13441357
int i;
13451358
u8 vec[8];

0 commit comments

Comments
 (0)