aboutsummaryrefslogtreecommitdiff
path: root/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
diff options
context:
space:
mode:
Diffstat (limited to 'Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c')
-rw-r--r--Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
index b4e0e1b..f4878f2 100644
--- a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
+++ b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
@@ -104,6 +104,8 @@ enum {
};
STATIC UINTN mBoardId;
+STATIC UINTN mRebootUpdated;
+STATIC UINTN mRebootReason;
STATIC EMBEDDED_GPIO *mGpio;
@@ -593,6 +595,10 @@ VirtualKeyboardQuery (
if ((VirtualKey == NULL) || (mGpio == NULL)) {
return FALSE;
}
+ // If current reason doesn't match the initial one, it's updated by fastboot.
+ if (MmioRead32 (ADB_REBOOT_ADDRESS) != mRebootReason) {
+ mRebootUpdated = 1;
+ }
if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
goto Done;
} else {
@@ -617,7 +623,9 @@ VirtualKeyboardClear (
if (VirtualKey == NULL) {
return EFI_INVALID_PARAMETER;
}
- if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
+ // Only clear the reboot flag that is set before reboot.
+ if ((MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) &&
+ (mRebootUpdated == 0)) {
MmioWrite32 (ADB_REBOOT_ADDRESS, ADB_REBOOT_NONE);
WriteBackInvalidateDataCacheRange ((VOID *)ADB_REBOOT_ADDRESS, 4);
}
@@ -648,6 +656,9 @@ HiKey960EntryPoint (
InitPeripherals ();
+ // Record the reboot reason if it exists
+ mRebootReason = MmioRead32 (ADB_REBOOT_ADDRESS);
+
//
// Create an event belonging to the "gEfiEndOfDxeEventGroupGuid" group.
// The "OnEndOfDxe()" function is declared as the call back function.