Add CF9 reboot

This is for the debug purpose. Otherwise it will crash when trying to
execute the reboot in hypervisor

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
This commit is contained in:
Zhao Yakui 2019-06-25 09:53:04 +08:00
parent ff9d667b49
commit 8c357a849f

View File

@ -18,6 +18,7 @@
#include <vm.h>
#include <sprintf.h>
#include <logmsg.h>
#include <io.h>
#define TEMP_STR_SIZE 60U
#define MAX_STR_SIZE 256U
@ -1266,11 +1267,26 @@ static int32_t shell_trigger_crash(int32_t argc, char **argv)
{
char str[MAX_STR_SIZE] = {0};
uint8_t reboot_code = 0x0E;
uint8_t cf9;
snprintf(str, MAX_STR_SIZE, "trigger CF9 reboot...\r\n");
shell_puts(str);
cf9 = pio_read8(0xcf9) & ~reboot_code;
pio_write8(cf9|2, 0xcf9); /* Request hard reset */
udelay(50);
/* Actually do the reset */
pio_write8(cf9|reboot_code, 0xcf9);
udelay(50);
(void)argc;
(void)argv;
snprintf(str, MAX_STR_SIZE, "trigger crash, divide by 0 ...\r\n");
shell_puts(str);
asm("movl $0x1, %eax");
asm("movl $0x0, %ecx");
asm("idiv %ecx");