Files
acrn-hypervisor/hypervisor/debug/shell_priv.h
Fei Li 712568f949 shell: split arch special code
Now moved all the guest related (risc-v doesn't support VMs) and x86 specific
commands to x86_shell.c except shell_dump_host_mem.

common for guest.
> -static int32_t shell_list_vm(__unused int32_t argc, __unused char **argv);
> -static int32_t shell_list_vcpu(__unused int32_t argc, __unused char **argv);
> -static int32_t shell_to_vm_console(int32_t argc, char **argv);
  depends on how we map guest memory.
> -static int32_t shell_dump_guest_mem(int32_t argc, char **argv);

common concept but arch special implementation.
> -static int32_t shell_vcpu_dumpreg(int32_t argc, char **argv);
> -static int32_t shell_show_cpu_int(__unused int32_t argc, __unused char **argv);
> -static int32_t shell_show_ptdev_info(__unused int32_t argc, __unused char **argv);
> -static int32_t shell_reboot(int32_t argc, char **argv);

x86 special
> -static int32_t shell_show_vioapic_info(int32_t argc, char **argv);
> -static int32_t shell_show_ioapic_info(__unused int32_t argc, __unused char **argv);
> -static int32_t shell_cpuid(int32_t argc, char **argv);
> -static int32_t shell_rdmsr(int32_t argc, char **argv);
> -static int32_t shell_wrmsr(int32_t argc, char **argv);

common but not added for now.
> -static int32_t shell_dump_host_mem(int32_t argc, char **argv);

Tracked-On: #8805
Signed-off-by: Fei Li <fei1.li@intel.com>
2025-10-14 14:45:12 +08:00

72 lines
2.2 KiB
C

/*
* Copyright (C) 2018-2025 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef SHELL_PRIV_H
#define SHELL_PRIV_H
#include <board_info.h>
#include <spinlock.h>
#include <asm/page.h>
#define SHELL_CMD_MAX_LEN 100U
#define SHELL_STRING_MAX_LEN (PAGE_SIZE << 2U)
#define TEMP_STR_SIZE 60U
#define MAX_STR_SIZE 256U
#define SHELL_LOG_BUF_SIZE (PAGE_SIZE * MAX_PCPU_NUM / 2U)
extern int16_t console_vmid;
extern char shell_log_buf[SHELL_LOG_BUF_SIZE];
/* Shell Command Function */
typedef int32_t (*shell_cmd_fn_t)(int32_t argc, char **argv);
/* Shell Command */
struct shell_cmd {
char *str; /* Command string */
char *cmd_param; /* Command parameter string */
char *help_str; /* Help text associated with the command */
shell_cmd_fn_t fcn; /* Command call-back function */
};
#define MAX_BUFFERED_CMDS 8
/* Shell Control Block */
struct shell {
/* a ring buffer to buffer former commands and use one as current active input */
char buffered_line[MAX_BUFFERED_CMDS][SHELL_CMD_MAX_LEN + 1U];
uint32_t input_line_len; /* Length of current input line */
int32_t input_line_active; /* Active input line index */
int32_t to_select_index; /* used for up/down key to select former cmds */
uint32_t cursor_offset; /* cursor offset position from left input line */
struct shell_cmd *cmds; /* cmds supported */
uint32_t cmd_count; /* Count of cmds supported */
struct shell_cmd *arch_cmds; /* arch cmds supported */
uint32_t arch_cmd_count; /* arch Count of cmds supported */
};
/* Shell Command list with parameters and help description */
#define SHELL_CMD_HELP "help"
#define SHELL_CMD_HELP_PARAM NULL
#define SHELL_CMD_HELP_HELP "Display information about supported hypervisor shell commands"
#define SHELL_CMD_VERSION "version"
#define SHELL_CMD_VERSION_PARAM NULL
#define SHELL_CMD_VERSION_HELP "Display the HV version information"
#define SHELL_CMD_LOG_LVL "loglevel"
#define SHELL_CMD_LOG_LVL_PARAM "[<console_loglevel> [<mem_loglevel> [npk_loglevel]]]"
#define SHELL_CMD_LOG_LVL_HELP "No argument: get the level of logging for the console, memory and npk. Set "\
"the level by giving (up to) 3 parameters between 0 and 6 (verbose)"
void shell_puts(const char *string_ptr);
#endif /* SHELL_PRIV_H */