diff --git a/hypervisor/Makefile b/hypervisor/Makefile index 8408c0a00..e1dd39d7a 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -240,7 +240,6 @@ endif HW_C_SRCS += hw/pci.c HW_C_SRCS += arch/x86/configs/vm_config.c HW_C_SRCS += boot/acpi_base.c -HW_C_SRCS += boot/cmdline.c # ACPI parsing component # This part should be isolated from FuSa Cert ifeq ($(CONFIG_ACPI_PARSE_ENABLED),y) diff --git a/hypervisor/arch/x86/init.c b/hypervisor/arch/x86/init.c index 6533bdb32..d627a01df 100644 --- a/hypervisor/arch/x86/init.c +++ b/hypervisor/arch/x86/init.c @@ -88,8 +88,6 @@ void init_primary_pcpu(void) init_acrn_multiboot_info(); - parse_hv_cmdline(); - init_debug_pre(); init_pcpu_pre(true); diff --git a/hypervisor/boot/cmdline.c b/hypervisor/boot/cmdline.c deleted file mode 100644 index 8496140ed..000000000 --- a/hypervisor/boot/cmdline.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2018 Intel Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#include -#include -#include - -void parse_hv_cmdline(void) -{ - const char *start = NULL, *end = NULL; - struct acrn_multiboot_info *mbi = &acrn_mbi; - - if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) { - start = mbi->mi_cmdline; - } - - while ((start != NULL) && ((*start) != '\0')) { - while ((*start) == ' ') - start++; - if ((*start) != '\0') { - end = start + 1; - while ((*end != ' ') && ((*end) != '\0')) - end++; - - if (!handle_dbg_cmd(start, (int32_t)(end - start))) { - /* if not handled by handle_dbg_cmd, it can be handled further */ - } - start = end; - } - } - -} diff --git a/hypervisor/boot/include/multiboot.h b/hypervisor/boot/include/multiboot.h index 4ddad0c25..8a5172d8d 100644 --- a/hypervisor/boot/include/multiboot.h +++ b/hypervisor/boot/include/multiboot.h @@ -76,18 +76,10 @@ struct acrn_multiboot_info { struct efi_info mi_efi_info; }; -/* - * The extern declaration for acrn_mbi is for cmdline.c use only, other functions should use - * get_multiboot_info() API to access struct acrn_mbi because it has explict @post condition - */ -extern struct acrn_multiboot_info acrn_mbi; - void init_acrn_multiboot_info(void); struct acrn_multiboot_info *get_multiboot_info(void); int32_t sanitize_multiboot_info(void); -void parse_hv_cmdline(void); - #endif /* ASSEMBLER */ #endif /* MULTIBOOT_H */ diff --git a/hypervisor/boot/multiboot/multiboot.c b/hypervisor/boot/multiboot/multiboot.c index 049f12a73..7e1cad479 100644 --- a/hypervisor/boot/multiboot/multiboot.c +++ b/hypervisor/boot/multiboot/multiboot.c @@ -64,7 +64,7 @@ struct multiboot_info { uint32_t unused_mi_vbe_interface_len; }; -struct acrn_multiboot_info acrn_mbi = { 0U }; +static struct acrn_multiboot_info acrn_mbi = { 0U }; static int32_t mbi_status; diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index 3456e80dc..2123f1c4b 100644 --- a/hypervisor/debug/console.c +++ b/hypervisor/debug/console.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include struct hv_timer console_timer; @@ -22,8 +24,38 @@ struct hv_timer console_timer; #define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */ uint16_t console_vmid = ACRN_INVALID_VMID; +static void parse_hvdbg_cmdline(void) +{ + const char *start = NULL; + const char *end = NULL; + struct acrn_multiboot_info *mbi = get_multiboot_info(); + + if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) { + start = mbi->mi_cmdline; + } + + while ((start != NULL) && ((*start) != '\0')) { + while ((*start) == ' ') + start++; + if ((*start) != '\0') { + end = start + 1; + while ((*end != ' ') && ((*end) != '\0')) + end++; + + if (!handle_dbg_cmd(start, (int32_t)(end - start))) { + /* if not handled by handle_dbg_cmd, it can be handled further */ + } + start = end; + } + } + +} + void console_init(void) { + /*Parse cmdline to get UART setting*/ + parse_hvdbg_cmdline(); + /* * Enable UART as early as possible. * Then we could use printf for debugging on early boot stage.