aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2017-06-13 09:08:19 +0800
committerHaojian Zhuang <haojian.zhuang@linaro.org>2017-06-13 09:08:19 +0800
commit2de299f86541c1aa0e490239193ff8c0f4ad799c (patch)
tree47be33abcc811afadc2dc2c34b4bdf1e00f880c1
parent6fef2b7778116e33c1028e00351192c773335f02 (diff)
downloaddevice_linaro_bootloader_OpenPlatformPkg-2de299f86541c1aa0e490239193ff8c0f4ad799c.tar.gz
device_linaro_bootloader_OpenPlatformPkg-2de299f86541c1aa0e490239193ff8c0f4ad799c.tar.bz2
device_linaro_bootloader_OpenPlatformPkg-2de299f86541c1aa0e490239193ff8c0f4ad799c.zip
Platforms/HiKey: enable ram keyboard
Send out 'f' hotkey if adb reboot bootloader pattern is detected. Then UEFI enters AndroidFastbootApp. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
-rw-r--r--Platforms/Hisilicon/HiKey/HiKey.dsc5
-rw-r--r--Platforms/Hisilicon/HiKey/HiKey.fdf5
-rw-r--r--Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c67
-rw-r--r--Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf2
4 files changed, 78 insertions, 1 deletions
diff --git a/Platforms/Hisilicon/HiKey/HiKey.dsc b/Platforms/Hisilicon/HiKey/HiKey.dsc
index 1cf24eb..67ebdf5 100644
--- a/Platforms/Hisilicon/HiKey/HiKey.dsc
+++ b/Platforms/Hisilicon/HiKey/HiKey.dsc
@@ -421,6 +421,11 @@
#
OpenPlatformPkg/Drivers/Keyboard/GpioKeyboardDxe/GpioKeyboardDxe.inf
+ #
+ # RAM Keyboard
+ #
+ OpenPlatformPkg/Drivers/Keyboard/RamKeyboardDxe/RamKeyboardDxe.inf
+
OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
#
diff --git a/Platforms/Hisilicon/HiKey/HiKey.fdf b/Platforms/Hisilicon/HiKey/HiKey.fdf
index bd80c79..428815f 100644
--- a/Platforms/Hisilicon/HiKey/HiKey.fdf
+++ b/Platforms/Hisilicon/HiKey/HiKey.fdf
@@ -125,6 +125,11 @@ READ_LOCK_STATUS = TRUE
#
INF OpenPlatformPkg/Drivers/Keyboard/GpioKeyboardDxe/GpioKeyboardDxe.inf
+ #
+ # RAM Keyboard
+ #
+ INF OpenPlatformPkg/Drivers/Keyboard/RamKeyboardDxe/RamKeyboardDxe.inf
+
INF OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
#
diff --git a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
index 174dfca..5815c95 100644
--- a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
+++ b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
@@ -27,6 +27,7 @@
#include <Protocol/Abootimg.h>
#include <Protocol/BlockIo.h>
#include <Protocol/PlatformGpioKeyboard.h>
+#include <Protocol/PlatformRamKeyboard.h>
#include <Hi6220.h>
#include <libfdt.h>
@@ -41,6 +42,11 @@
#define DETECT_J15_FASTBOOT 24 // GPIO3_0
+#define ADB_REBOOT_ADDRESS 0x05F01000
+#define ADB_REBOOT_BOOTLOADER 0x77665500
+#define ADB_REBOOT_NONE 0x77665501
+
+
typedef struct {
UINT64 Magic;
UINT64 Data;
@@ -266,6 +272,56 @@ PLATFORM_GPIO_KBD_PROTOCOL mGpioKeyboard = {
EFI_STATUS
EFIAPI
+RamKeyboardRegister (
+ IN OUT RAM_KBD_KEY *RamKey
+ )
+{
+ if (RamKey == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ RamKey->Signature = RAM_KBD_KEY_NEXT_SIGNATURE;
+ RamKey->Base = ADB_REBOOT_ADDRESS;
+ RamKey->Key.ScanCode = SCAN_NULL;
+ RamKey->Key.UnicodeChar = L'f';
+ return EFI_SUCCESS;
+}
+
+BOOLEAN
+EFIAPI
+RamKeyboardQuery (
+ IN RAM_KBD_KEY *RamKey
+ )
+{
+ if ((RamKey == NULL) || (RamKey->Base == 0)) {
+ return FALSE;
+ }
+ if (MmioRead32 (RamKey->Base) != ADB_REBOOT_BOOTLOADER) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+EFI_STATUS
+EFIAPI
+RamKeyboardClear (
+ IN RAM_KBD_KEY *RamKey
+ )
+{
+ if ((RamKey == NULL) || (RamKey->Base == 0)) {
+ return FALSE;
+ }
+ MmioWrite32 (RamKey->Base, ADB_REBOOT_NONE);
+ return EFI_SUCCESS;
+}
+
+PLATFORM_RAM_KBD_PROTOCOL mRamKeyboard = {
+ RamKeyboardRegister,
+ RamKeyboardQuery,
+ RamKeyboardClear
+};
+
+EFI_STATUS
+EFIAPI
HiKeyEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -294,6 +350,15 @@ HiKeyEntryPoint (
EFI_NATIVE_INTERFACE,
&mGpioKeyboard
);
-DEBUG ((DEBUG_ERROR, "#%a, %d, Status:%r\n", __func__, __LINE__, Status));
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gPlatformRamKeyboardProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mRamKeyboard
+ );
return Status;
}
diff --git a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
index dcc2b9e..4b1b8e9 100644
--- a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
+++ b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
@@ -29,6 +29,7 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
OpenPlatformPkg/Drivers/Keyboard/GpioKeyboardDxe/GpioKeyboardDxe.dec
+ OpenPlatformPkg/Drivers/Keyboard/RamKeyboardDxe/RamKeyboardDxe.dec
OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKey.dec
[LibraryClasses]
@@ -52,6 +53,7 @@
gAbootimgProtocolGuid
gEfiBlockIoProtocolGuid
gPlatformGpioKeyboardProtocolGuid
+ gPlatformRamKeyboardProtocolGuid
[Guids]
gEfiEndOfDxeEventGroupGuid