diff options
author | Haojian Zhuang <haojian.zhuang@linaro.org> | 2018-02-10 19:52:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-10 19:52:23 +0800 |
commit | 28f2641e36a936b97c0187b0ba47a0e2d6315562 (patch) | |
tree | c901b8d57ff8e56db90043629fe5101674708b06 | |
parent | c927fa08e375670f8a96dad2b1e99e56b7363f41 (diff) | |
parent | 4bd897453f5937f01f1ecf6ebda76c0a715be9b0 (diff) | |
download | OpenPlatformPkg-28f2641e36a936b97c0187b0ba47a0e2d6315562.tar.gz |
Merge pull request #97 from hzhuang1/warn_2
Platform/HiKey960: add warning message
-rw-r--r-- | Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c | 14 | ||||
-rw-r--r-- | Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf | 1 | ||||
-rw-r--r-- | Platforms/Hisilicon/HiKey960/Include/Hi3660.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c index 6ef1c3d..b4e0e1b 100644 --- a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c +++ b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c @@ -29,6 +29,7 @@ #include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/PrintLib.h>
+#include <Library/SerialPortLib.h>
#include <Library/TimerLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
@@ -96,6 +97,12 @@ typedef struct { CHAR16 UnicodeSN[SERIAL_NUMBER_SIZE];
} RANDOM_SERIAL_NUMBER;
+enum {
+ BOOT_MODE_RECOVERY = 0,
+ BOOT_MODE_NORMAL,
+ BOOT_MODE_MASK = 1,
+};
+
STATIC UINTN mBoardId;
STATIC EMBEDDED_GPIO *mGpio;
@@ -348,6 +355,13 @@ OnEndOfDxe ( IN VOID *Context
)
{
+ UINT32 BootMode;
+
+ BootMode = MmioRead32 (SCTRL_BAK_DATA0) & BOOT_MODE_MASK;
+ if (BootMode == BOOT_MODE_RECOVERY) {
+ SerialPortWrite ((UINT8 *)"WARNING: CAN NOT BOOT KERNEL IN RECOVERY MODE!\r\n", 48);
+ SerialPortWrite ((UINT8 *)"Switch to normal boot mode, then reboot to boot kernel.\r\n", 57);
+ }
}
EFI_STATUS
diff --git a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf index df668a8..f9c0c94 100644 --- a/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf +++ b/Platforms/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf @@ -39,6 +39,7 @@ NonDiscoverableDeviceRegistrationLib
PcdLib
PrintLib
+ SerialPortLib
TimerLib
UefiBootServicesTableLib
UefiDriverEntryPoint
diff --git a/Platforms/Hisilicon/HiKey960/Include/Hi3660.h b/Platforms/Hisilicon/HiKey960/Include/Hi3660.h index 939f7f0..0d810d8 100644 --- a/Platforms/Hisilicon/HiKey960/Include/Hi3660.h +++ b/Platforms/Hisilicon/HiKey960/Include/Hi3660.h @@ -30,6 +30,8 @@ #define SCTRL_SCFPLLCTRL0 (SCTRL_REG_BASE + 0x120)
#define SCTRL_SCFPLLCTRL0_FPLL0_EN (1 << 0)
+#define SCTRL_BAK_DATA0 (SCTRL_REG_BASE + 0x40C)
+
#define USB3OTG_BC_REG_BASE 0xFF200000
#define USB3OTG_CTRL0 (USB3OTG_BC_REG_BASE + 0x000)
|