0
0
mirror of https://github.com/edk2-porting/edk2-msm synced 2024-11-25 19:46:16 +00:00
edk2-msm/Platform/RenegadePkg/Application/Reboot2PayloadApp/Reboot2PayloadApp.c
Molly Sophia eeec8ef583 RenegadePkg: Introduce Reboot2PayloadApp
This is used to choose to reboot to payload in SimpleInit boot menu
An lua version is also included but not used for now

Signed-off-by: Molly Sophia <mollysophia379@gmail.com>
2023-02-13 22:49:54 +08:00

30 lines
769 B
C

#include <Uefi.h>
#include <Library/ArmLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/CacheMaintenanceLib.h>
#define LINUX_BOOT_ACQUIRED_MAGIC 0x5241
EFI_STATUS
EFIAPI
Reboot2PayloadAppEntryPoint(
IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{
UINT16* ptr = (UINT16*)0x17FE00000;
for(int i = 0; i < 128; i++) {
*(ptr + i) = LINUX_BOOT_ACQUIRED_MAGIC;
}
WriteBackInvalidateDataCacheRange(ptr, 256);
gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
CpuDeadLoop();
return EFI_SUCCESS;
}