From 2aa1dc7e3b637876f4bfdc6b19c35253d922e10a Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 20 May 2020 21:16:54 +0000 Subject: [PATCH] Print CPU informtion later in boot. Match other architectures and print CPU information during cpu_startup(). In particular, this prints the information after the message buffer is initialized which allows it to be retrieved after boot via dmesg(8). While here, add some extern declarations to in place of duplicated declarations in various source files. Reviewed by: brooks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24936 --- sys/mips/atheros/ar531x/ar5315_machdep.c | 2 -- sys/mips/atheros/ar71xx_machdep.c | 2 -- sys/mips/cavium/octeon_machdep.c | 2 -- sys/mips/include/md_var.h | 3 +++ sys/mips/mediatek/mtk_soc.c | 2 -- sys/mips/mips/cpu.c | 10 ++++------ sys/mips/mips/machdep.c | 2 +- 7 files changed, 8 insertions(+), 15 deletions(-) diff --git a/sys/mips/atheros/ar531x/ar5315_machdep.c b/sys/mips/atheros/ar531x/ar5315_machdep.c index 22dc5e1a056f..c0023491ac31 100644 --- a/sys/mips/atheros/ar531x/ar5315_machdep.c +++ b/sys/mips/atheros/ar531x/ar5315_machdep.c @@ -148,8 +148,6 @@ SYSCTL_STRING(_hw_device, OID_AUTO, revision, CTLFLAG_RD, hw_device_revision, 0, "Board revision"); #endif -extern char cpu_model[]; - void platform_start(__register_t a0 __unused, __register_t a1 __unused, __register_t a2 __unused, __register_t a3 __unused) diff --git a/sys/mips/atheros/ar71xx_machdep.c b/sys/mips/atheros/ar71xx_machdep.c index f52760211460..a83277c91973 100644 --- a/sys/mips/atheros/ar71xx_machdep.c +++ b/sys/mips/atheros/ar71xx_machdep.c @@ -275,8 +275,6 @@ ar71xx_platform_check_mac_hints(void) return (0); } -extern char cpu_model[]; - void platform_start(__register_t a0 __unused, __register_t a1 __unused, __register_t a2 __unused, __register_t a3 __unused) diff --git a/sys/mips/cavium/octeon_machdep.c b/sys/mips/cavium/octeon_machdep.c index daa494529d56..6fb24aee3848 100644 --- a/sys/mips/cavium/octeon_machdep.c +++ b/sys/mips/cavium/octeon_machdep.c @@ -97,8 +97,6 @@ struct octeon_feature_description { }; extern int *end; -extern char cpu_model[]; -extern char cpu_board[]; static char octeon_kenv[0x2000]; static const struct octeon_feature_description octeon_feature_descriptions[] = { diff --git a/sys/mips/include/md_var.h b/sys/mips/include/md_var.h index 23ef3baa34da..4bf9c64a8f5b 100644 --- a/sys/mips/include/md_var.h +++ b/sys/mips/include/md_var.h @@ -42,6 +42,8 @@ * Miscellaneous machine-dependent declarations. */ extern long Maxmem; +extern char cpu_board[]; +extern char cpu_model[]; extern char sigcode[]; extern int szsigcode; #if defined(__mips_n32) || defined(__mips_n64) @@ -75,6 +77,7 @@ void mips_cpu_init(void); void mips_pcpu0_init(void); void mips_proc0_init(void); void mips_postboot_fixup(void); +void cpu_identify(void); void cpu_switch_set_userlocal(void) __asm(__STRING(cpu_switch_set_userlocal)); extern int busdma_swi_pending; diff --git a/sys/mips/mediatek/mtk_soc.c b/sys/mips/mediatek/mtk_soc.c index 56e93374db8f..9fd307a92a67 100644 --- a/sys/mips/mediatek/mtk_soc.c +++ b/sys/mips/mediatek/mtk_soc.c @@ -396,8 +396,6 @@ mtk_soc_try_early_detect(void) bus_space_unmap(bst, bsh, MTK_DEFAULT_SIZE); } -extern char cpu_model[]; - void mtk_soc_set_cpu_model(void) { diff --git a/sys/mips/mips/cpu.c b/sys/mips/mips/cpu.c index f2943b941d29..c6da1329ddb4 100644 --- a/sys/mips/mips/cpu.c +++ b/sys/mips/mips/cpu.c @@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$"); #include #endif -static void cpu_identify(void); - struct mips_cpuinfo cpuinfo; #define _ENCODE_INSN(a,b,c,d,e) \ @@ -294,18 +292,16 @@ mips_cpu_init(void) mips_icache_sync_all(); mips_dcache_wbinv_all(); - /* Print some info about CPU */ - cpu_identify(); } -static void +void cpu_identify(void) { uint32_t cfg0, cfg1, cfg2, cfg3; #if defined(CPU_MIPS1004K) || defined (CPU_MIPS74K) || defined (CPU_MIPS24K) uint32_t cfg7; #endif - printf("cpu%d: ", 0); /* XXX per-cpu */ + printf("CPU: "); switch (cpuinfo.cpu_vendor) { case MIPS_PRID_CID_MTI: printf("MIPS Technologies"); @@ -347,6 +343,8 @@ cpu_identify(void) printf("Unknown cid %#x", cpuinfo.cpu_vendor); break; } + if (cpu_model[0] != '\0') + printf(" (%s)", cpu_model); printf(" processor v%d.%d\n", cpuinfo.cpu_rev, cpuinfo.cpu_impl); printf(" MMU: "); diff --git a/sys/mips/mips/machdep.c b/sys/mips/mips/machdep.c index 1d829367e578..909a3e2b907f 100644 --- a/sys/mips/mips/machdep.c +++ b/sys/mips/mips/machdep.c @@ -185,7 +185,7 @@ cpu_startup(void *dummy) if (boothowto & RB_VERBOSE) bootverbose++; - printf("CPU model: %s\n", cpu_model); + cpu_identify(); printf("real memory = %ju (%juK bytes)\n", ptoa((uintmax_t)realmem), ptoa((uintmax_t)realmem) / 1024);