Skip to content

Commit

Permalink
Print CPU informtion later in boot.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bsdjhb committed May 20, 2020
1 parent 6adcdf6 commit 2aa1dc7
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 15 deletions.
2 changes: 0 additions & 2 deletions sys/mips/atheros/ar531x/ar5315_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions sys/mips/atheros/ar71xx_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions sys/mips/cavium/octeon_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down
3 changes: 3 additions & 0 deletions sys/mips/include/md_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions sys/mips/mediatek/mtk_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
10 changes: 4 additions & 6 deletions sys/mips/mips/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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: ");
Expand Down
2 changes: 1 addition & 1 deletion sys/mips/mips/machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2aa1dc7

Please sign in to comment.