@@ -182,6 +182,11 @@ [Components.common]
Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
+ #
+ # Virtual Keyboard
+ #
+ EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
+
Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
#
@@ -123,6 +123,11 @@ [FV.FvMain]
INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
+ #
+ # Virtual Keyboard
+ #
+ INF EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
+
INF Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
#
@@ -14,7 +14,8 @@
#include "HiKey960Dxe.h"
-STATIC UINTN mBoardId;
+STATIC UINTN mBoardId;
+STATIC EMBEDDED_GPIO *mGpio;
STATIC
VOID
@@ -142,6 +143,94 @@ OnEndOfDxe (
EFI_STATUS
EFIAPI
+VirtualKeyboardRegister (
+ IN VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gEmbeddedGpioProtocolGuid,
+ NULL,
+ (VOID **) &mGpio
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+VirtualKeyboardReset (
+ IN VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mGpio == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Configure GPIO68 as GPIO function
+ //
+ MmioWrite32 (0xe896c108, 0);
+ Status = mGpio->Set (mGpio, DETECT_SW_FASTBOOT, GPIO_MODE_INPUT);
+ return Status;
+}
+
+BOOLEAN
+EFIAPI
+VirtualKeyboardQuery (
+ IN VIRTUAL_KBD_KEY *VirtualKey
+ )
+{
+ EFI_STATUS Status;
+ UINTN Value = 0;
+
+ if ((VirtualKey == NULL) || (mGpio == NULL)) {
+ return FALSE;
+ }
+ if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
+ goto Done;
+ } else {
+ Status = mGpio->Get (mGpio, DETECT_SW_FASTBOOT, &Value);
+ if (EFI_ERROR (Status) || (Value != 0)) {
+ return FALSE;
+ }
+ }
+Done:
+ VirtualKey->Signature = VIRTUAL_KEYBOARD_KEY_SIGNATURE;
+ VirtualKey->Key.ScanCode = SCAN_NULL;
+ VirtualKey->Key.UnicodeChar = L'f';
+ return TRUE;
+}
+
+EFI_STATUS
+EFIAPI
+VirtualKeyboardClear (
+ IN VIRTUAL_KBD_KEY *VirtualKey
+ )
+{
+ if (VirtualKey == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
+ MmioWrite32 (ADB_REBOOT_ADDRESS, ADB_REBOOT_NONE);
+ WriteBackInvalidateDataCacheRange ((VOID *)ADB_REBOOT_ADDRESS, 4);
+ }
+ return EFI_SUCCESS;
+}
+
+PLATFORM_VIRTUAL_KBD_PROTOCOL mVirtualKeyboard = {
+ VirtualKeyboardRegister,
+ VirtualKeyboardReset,
+ VirtualKeyboardQuery,
+ VirtualKeyboardClear
+};
+
+EFI_STATUS
+EFIAPI
HiKey960EntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -175,5 +264,12 @@ HiKey960EntryPoint (
if (EFI_ERROR (Status)) {
return Status;
}
+
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gPlatformVirtualKeyboardProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mVirtualKeyboard
+ );
return Status;
}
@@ -33,6 +33,9 @@
#include <Library/TimerLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/EmbeddedGpio.h>
+#include <Protocol/PlatformVirtualKeyboard.h>
+
#define ADC_ADCIN0 0
#define ADC_ADCIN1 1
#define ADC_ADCIN2 2
@@ -39,6 +39,7 @@ [LibraryClasses]
[Protocols]
gEmbeddedGpioProtocolGuid
+ gPlatformVirtualKeyboardProtocolGuid
[Guids]
gEfiEndOfDxeEventGroupGuid
Enable virtual keyboard on HiKey960 platform. It checks two conditions, such as pattern in memory and GPIO pin setting. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> --- Platform/Hisilicon/HiKey960/HiKey960.dsc | 5 ++ Platform/Hisilicon/HiKey960/HiKey960.fdf | 5 ++ .../Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c | 98 +++++++++++++++++++++- .../Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.h | 3 + .../Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf | 1 + 5 files changed, 111 insertions(+), 1 deletion(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel