aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2018-03-30 10:54:55 +0800
committerGitHub <noreply@github.com>2018-03-30 10:54:55 +0800
commite9515d96066a90fbc3eb3415d192f12e6177cdfc (patch)
tree56c599b7f46ee621d16c0d86cf0060b142270bbe
parentd581fc19855088832084d531fcb2c406b0863a84 (diff)
parent5a1a8fc7f0a4bfc9875f716c62eca4fd743ff0d4 (diff)
downloadOpenPlatformPkg-e9515d96066a90fbc3eb3415d192f12e6177cdfc.tar.gz
Merge pull request #115 from hzhuang1/reboot_2
Platforms/HiKey960Dxe: check whether reboot reason updated
-rw-r--r--Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
index bb7f80d..f4878f2 100644
--- a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
+++ b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
@@ -104,7 +104,8 @@ enum {
};
STATIC UINTN mBoardId;
-STATIC UINTN mReboot;
+STATIC UINTN mRebootUpdated;
+STATIC UINTN mRebootReason;
STATIC EMBEDDED_GPIO *mGpio;
@@ -594,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 {
@@ -619,7 +624,8 @@ VirtualKeyboardClear (
return EFI_INVALID_PARAMETER;
}
// Only clear the reboot flag that is set before reboot.
- if (mReboot && (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER)) {
+ if ((MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) &&
+ (mRebootUpdated == 0)) {
MmioWrite32 (ADB_REBOOT_ADDRESS, ADB_REBOOT_NONE);
WriteBackInvalidateDataCacheRange ((VOID *)ADB_REBOOT_ADDRESS, 4);
}
@@ -650,10 +656,8 @@ HiKey960EntryPoint (
InitPeripherals ();
- // Record whether the reboot flag was set before reboot
- if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
- mReboot = 1;
- }
+ // Record the reboot reason if it exists
+ mRebootReason = MmioRead32 (ADB_REBOOT_ADDRESS);
//
// Create an event belonging to the "gEfiEndOfDxeEventGroupGuid" group.