Readd hwctrl.h & add argument for reset type

This commit is contained in:
Sam DEMEULEMEESTER
2022-03-17 01:28:38 +01:00
committed by Sam Demeulemeester
parent 2266151fe6
commit de55c0428c

View File

@@ -14,6 +14,7 @@
#include "bootparams.h" #include "bootparams.h"
#include "efi.h" #include "efi.h"
#include "hwctrl.h"
#include "io.h" #include "io.h"
#include "unistd.h" #include "unistd.h"
@@ -24,7 +25,7 @@
extern efi_info_t saved_efi_info; extern efi_info_t saved_efi_info;
static void efi_reset(void) static void efi_reset(uint8_t reset_type)
{ {
static efi_runtime_services_t *rs_table = NULL; static efi_runtime_services_t *rs_table = NULL;
@@ -34,7 +35,7 @@ static void efi_reset(void)
if (system_table_addr != 0) { if (system_table_addr != 0) {
efi64_system_table_t *sys_table = (efi64_system_table_t *)system_table_addr; efi64_system_table_t *sys_table = (efi64_system_table_t *)system_table_addr;
rs_table = (efi_runtime_services_t *)sys_table->runtime_services; rs_table = (efi_runtime_services_t *)sys_table->runtime_services;
rs_table->reset_system(EFI_RESET_COLD, 0, 0); rs_table->reset_system(reset_type, 0, 0);
} }
} }
#endif #endif
@@ -43,7 +44,7 @@ static void efi_reset(void)
if (system_table_addr != 0) { if (system_table_addr != 0) {
efi32_system_table_t *sys_table = (efi32_system_table_t *)system_table_addr; efi32_system_table_t *sys_table = (efi32_system_table_t *)system_table_addr;
rs_table = (efi_runtime_services_t *)(uintptr_t)sys_table->runtime_services; rs_table = (efi_runtime_services_t *)(uintptr_t)sys_table->runtime_services;
rs_table->reset_system(EFI_RESET_COLD, 0, 0); rs_table->reset_system(reset_type, 0, 0);
} }
} }
} }
@@ -52,7 +53,7 @@ void reboot(void)
{ {
if(saved_efi_info.loader_signature) { if(saved_efi_info.loader_signature) {
efi_reset(); efi_reset(EFI_RESET_COLD);
usleep(1000000); usleep(1000000);
} }