Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 2020 21:16:54 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361297 - in head/sys/mips: atheros atheros/ar531x cavium include mediatek mips
Message-ID:  <202005202116.04KLGsdC089676@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed May 20 21:16:54 2020
New Revision: 361297
URL: https://svnweb.freebsd.org/changeset/base/361297

Log:
  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 <machine/md_var.h> in
  place of duplicated declarations in various source files.
  
  Reviewed by:	brooks
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D24936

Modified:
  head/sys/mips/atheros/ar531x/ar5315_machdep.c
  head/sys/mips/atheros/ar71xx_machdep.c
  head/sys/mips/cavium/octeon_machdep.c
  head/sys/mips/include/md_var.h
  head/sys/mips/mediatek/mtk_soc.c
  head/sys/mips/mips/cpu.c
  head/sys/mips/mips/machdep.c

Modified: head/sys/mips/atheros/ar531x/ar5315_machdep.c
==============================================================================
--- head/sys/mips/atheros/ar531x/ar5315_machdep.c	Wed May 20 21:15:43 2020	(r361296)
+++ head/sys/mips/atheros/ar531x/ar5315_machdep.c	Wed May 20 21:16:54 2020	(r361297)
@@ -148,8 +148,6 @@ SYSCTL_STRING(_hw_device, OID_AUTO, revision, CTLFLAG_
 	   "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)

Modified: head/sys/mips/atheros/ar71xx_machdep.c
==============================================================================
--- head/sys/mips/atheros/ar71xx_machdep.c	Wed May 20 21:15:43 2020	(r361296)
+++ head/sys/mips/atheros/ar71xx_machdep.c	Wed May 20 21:16:54 2020	(r361297)
@@ -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)

Modified: head/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- head/sys/mips/cavium/octeon_machdep.c	Wed May 20 21:15:43 2020	(r361296)
+++ head/sys/mips/cavium/octeon_machdep.c	Wed May 20 21:16:54 2020	(r361297)
@@ -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[] = {

Modified: head/sys/mips/include/md_var.h
==============================================================================
--- head/sys/mips/include/md_var.h	Wed May 20 21:15:43 2020	(r361296)
+++ head/sys/mips/include/md_var.h	Wed May 20 21:16:54 2020	(r361297)
@@ -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;

Modified: head/sys/mips/mediatek/mtk_soc.c
==============================================================================
--- head/sys/mips/mediatek/mtk_soc.c	Wed May 20 21:15:43 2020	(r361296)
+++ head/sys/mips/mediatek/mtk_soc.c	Wed May 20 21:16:54 2020	(r361297)
@@ -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)
 {

Modified: head/sys/mips/mips/cpu.c
==============================================================================
--- head/sys/mips/mips/cpu.c	Wed May 20 21:15:43 2020	(r361296)
+++ head/sys/mips/mips/cpu.c	Wed May 20 21:16:54 2020	(r361297)
@@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$");
 #include <contrib/octeon-sdk/octeon-model.h>
 #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: ");

Modified: head/sys/mips/mips/machdep.c
==============================================================================
--- head/sys/mips/mips/machdep.c	Wed May 20 21:15:43 2020	(r361296)
+++ head/sys/mips/mips/machdep.c	Wed May 20 21:16:54 2020	(r361297)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005202116.04KLGsdC089676>