From c144c0a8cc5328d9684b7622181196873f88a793 Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Mon, 18 Jul 2022 09:59:02 +0200 Subject: [PATCH] setup: make cpu_frequency value globally available Signed-off-by: Pawel Wieczorkiewicz --- common/setup.c | 9 +++++---- include/setup.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/setup.c b/common/setup.c index a1bc1ce6..6700f784 100644 --- a/common/setup.c +++ b/common/setup.c @@ -64,6 +64,8 @@ boot_flags_t boot_flags; +unsigned long cpu_frequency; + #define QEMU_CONSOLE_PORT 0x0e9 static void __text_init init_console(void) { @@ -123,15 +125,14 @@ static void __text_init map_bios_area(void) { static void display_cpu_info(void) { char cpu_identifier[49]; - unsigned long freq; if (!cpu_vendor_string(cpu_identifier)) return; printk("CPU: %.48s\n", cpu_identifier); - freq = get_cpu_freq(cpu_identifier); - if (freq > 0) - printk("Frequency: %lu MHz\n", freq / MHZ(1)); + cpu_frequency = get_cpu_freq(cpu_identifier); + if (cpu_frequency > 0) + printk("Frequency: %lu MHz\n", cpu_frequency / MHZ(1)); } static void display_banner(void) { draw_logo(); } diff --git a/include/setup.h b/include/setup.h index cfa2bf12..9b6d4cc2 100644 --- a/include/setup.h +++ b/include/setup.h @@ -39,6 +39,7 @@ struct boot_flags { typedef struct boot_flags boot_flags_t; extern char cpu_identifier[49]; +extern unsigned long cpu_frequency; extern boot_flags_t boot_flags; /* Static declarations */