aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2018-03-30 10:51:16 +0800
committerHaojian Zhuang <haojian.zhuang@linaro.org>2018-03-30 10:53:22 +0800
commit5a1a8fc7f0a4bfc9875f716c62eca4fd743ff0d4 (patch)
tree56c599b7f46ee621d16c0d86cf0060b142270bbe
parentd581fc19855088832084d531fcb2c406b0863a84 (diff)
downloadOpenPlatformPkg-5a1a8fc7f0a4bfc9875f716c62eca4fd743ff0d4.tar.gz
Platforms/HiKey960Dxe: check whether reboot reason updated
Need to check whether reboot reason is updated. If it's updated, avoid to clear the reboot reason since it's expected to be working after reboot. If it's not updated, clear the reboot reason. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
-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.