MdeModulePkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdeModulePkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:02 -08:00
committed by mergify[bot]
parent 7c7184e201
commit 1436aea4d5
994 changed files with 107608 additions and 101311 deletions

View File

@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "KeyBoard.h"
//
@@ -21,16 +20,15 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponent
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UsbKeyboardComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UsbKeyboardComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UsbKeyboardComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UsbKeyboardComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUsbKeyboardDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUsbKeyboardDriverNameTable[] = {
{ "eng;en", L"Usb Keyboard Driver" },
{ NULL , NULL }
{ NULL, NULL }
};
/**
@@ -145,17 +143,18 @@ UsbKeyboardComponentNameGetDriverName (
EFI_STATUS
EFIAPI
UsbKeyboardComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
USB_KB_DEV *UsbKbDev;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTxtIn;
EFI_USB_IO_PROTOCOL *UsbIoProtocol;
EFI_STATUS Status;
USB_KB_DEV *UsbKbDev;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTxtIn;
EFI_USB_IO_PROTOCOL *UsbIoProtocol;
//
// This is a device driver, so ChildHandle must be NULL.
//
@@ -169,7 +168,7 @@ UsbKeyboardComponentNameGetControllerName (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiUsbIoProtocolGuid,
(VOID **) &UsbIoProtocol,
(VOID **)&UsbIoProtocol,
gUsbKeyboardDriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -188,13 +187,14 @@ UsbKeyboardComponentNameGetControllerName (
if (Status != EFI_ALREADY_STARTED) {
return EFI_UNSUPPORTED;
}
//
// Get the device context
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiSimpleTextInProtocolGuid,
(VOID **) &SimpleTxtIn,
(VOID **)&SimpleTxtIn,
gUsbKeyboardDriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -213,5 +213,4 @@ UsbKeyboardComponentNameGetControllerName (
ControllerName,
(BOOLEAN)(This == &gUsbKeyboardComponentName)
);
}

View File

@@ -13,7 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// USB Keyboard Driver Global Variables
//
EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding = {
USBKeyboardDriverBindingSupported,
USBKeyboardDriverBindingStart,
USBKeyboardDriverBindingStop,
@@ -37,11 +37,11 @@ EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding = {
EFI_STATUS
EFIAPI
USBKeyboardDriverBindingEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
@@ -70,13 +70,13 @@ USBKeyboardDriverBindingEntryPoint (
EFI_STATUS
EFIAPI
USBKeyboardDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_USB_IO_PROTOCOL *UsbIo;
EFI_STATUS Status;
EFI_USB_IO_PROTOCOL *UsbIo;
//
// Check if USB I/O Protocol is attached on the controller handle.
@@ -84,7 +84,7 @@ USBKeyboardDriverBindingSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiUsbIoProtocolGuid,
(VOID **) &UsbIo,
(VOID **)&UsbIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -133,22 +133,22 @@ USBKeyboardDriverBindingSupported (
EFI_STATUS
EFIAPI
USBKeyboardDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_USB_IO_PROTOCOL *UsbIo;
USB_KB_DEV *UsbKeyboardDevice;
UINT8 EndpointNumber;
EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
UINT8 Index;
UINT8 EndpointAddr;
UINT8 PollingInterval;
UINT8 PacketSize;
BOOLEAN Found;
EFI_TPL OldTpl;
EFI_STATUS Status;
EFI_USB_IO_PROTOCOL *UsbIo;
USB_KB_DEV *UsbKeyboardDevice;
UINT8 EndpointNumber;
EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
UINT8 Index;
UINT8 EndpointAddr;
UINT8 PollingInterval;
UINT8 PacketSize;
BOOLEAN Found;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
//
@@ -157,7 +157,7 @@ USBKeyboardDriverBindingStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiUsbIoProtocolGuid,
(VOID **) &UsbIo,
(VOID **)&UsbIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -175,7 +175,7 @@ USBKeyboardDriverBindingStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &UsbKeyboardDevice->DevicePath,
(VOID **)&UsbKeyboardDevice->DevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -184,6 +184,7 @@ USBKeyboardDriverBindingStart (
if (EFI_ERROR (Status)) {
goto ErrorExit;
}
//
// Report that the USB keyboard is being enabled
//
@@ -219,7 +220,6 @@ USBKeyboardDriverBindingStart (
//
Found = FALSE;
for (Index = 0; Index < EndpointNumber; Index++) {
UsbIo->UsbGetEndpointDescriptor (
UsbIo,
Index,
@@ -227,11 +227,12 @@ USBKeyboardDriverBindingStart (
);
if (((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) &&
((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) != 0)) {
((EndpointDescriptor.EndpointAddress & USB_ENDPOINT_DIR_IN) != 0))
{
//
// We only care interrupt endpoint here
//
CopyMem(&UsbKeyboardDevice->IntEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));
CopyMem (&UsbKeyboardDevice->IntEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
Found = TRUE;
break;
}
@@ -258,9 +259,9 @@ USBKeyboardDriverBindingStart (
UsbKeyboardDevice->DevicePath
);
UsbKeyboardDevice->Signature = USB_KB_DEV_SIGNATURE;
UsbKeyboardDevice->SimpleInput.Reset = USBKeyboardReset;
UsbKeyboardDevice->SimpleInput.ReadKeyStroke = USBKeyboardReadKeyStroke;
UsbKeyboardDevice->Signature = USB_KB_DEV_SIGNATURE;
UsbKeyboardDevice->SimpleInput.Reset = USBKeyboardReset;
UsbKeyboardDevice->SimpleInput.ReadKeyStroke = USBKeyboardReadKeyStroke;
UsbKeyboardDevice->SimpleInputEx.Reset = USBKeyboardResetEx;
UsbKeyboardDevice->SimpleInputEx.ReadKeyStrokeEx = USBKeyboardReadKeyStrokeEx;
@@ -280,6 +281,7 @@ USBKeyboardDriverBindingStart (
if (!EFI_ERROR (Status)) {
Status = gBS->SetTimer (UsbKeyboardDevice->TimerEvent, TimerPeriodic, KEYBOARD_TIMER_INTERVAL);
}
if (EFI_ERROR (Status)) {
goto ErrorExit;
}
@@ -338,27 +340,26 @@ USBKeyboardDriverBindingStart (
}
UsbKeyboardDevice->ControllerHandle = Controller;
Status = InitKeyboardLayout (UsbKeyboardDevice);
Status = InitKeyboardLayout (UsbKeyboardDevice);
if (EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
Controller,
&gEfiSimpleTextInProtocolGuid,
&UsbKeyboardDevice->SimpleInput,
&gEfiSimpleTextInputExProtocolGuid,
&UsbKeyboardDevice->SimpleInputEx,
NULL
);
Controller,
&gEfiSimpleTextInProtocolGuid,
&UsbKeyboardDevice->SimpleInput,
&gEfiSimpleTextInputExProtocolGuid,
&UsbKeyboardDevice->SimpleInputEx,
NULL
);
goto ErrorExit;
}
//
// Reset USB Keyboard Device exhaustively.
//
Status = UsbKeyboardDevice->SimpleInputEx.Reset (
&UsbKeyboardDevice->SimpleInputEx,
TRUE
);
&UsbKeyboardDevice->SimpleInputEx,
TRUE
);
if (EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
Controller,
@@ -376,7 +377,7 @@ USBKeyboardDriverBindingStart (
//
EndpointAddr = UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress;
PollingInterval = UsbKeyboardDevice->IntEndpointDescriptor.Interval;
PacketSize = (UINT8) (UsbKeyboardDevice->IntEndpointDescriptor.MaxPacketSize);
PacketSize = (UINT8)(UsbKeyboardDevice->IntEndpointDescriptor.MaxPacketSize);
Status = UsbIo->UsbAsyncInterruptTransfer (
UsbIo,
@@ -419,30 +420,36 @@ USBKeyboardDriverBindingStart (
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS;
//
// Error handler
//
//
// Error handler
//
ErrorExit:
if (UsbKeyboardDevice != NULL) {
if (UsbKeyboardDevice->TimerEvent != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->TimerEvent);
}
if (UsbKeyboardDevice->SimpleInput.WaitForKey != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);
}
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);
}
if (UsbKeyboardDevice->KeyNotifyProcessEvent != NULL) {
gBS->CloseEvent (UsbKeyboardDevice->KeyNotifyProcessEvent);
}
if (UsbKeyboardDevice->KeyboardLayoutEvent != NULL) {
ReleaseKeyboardLayoutResources (UsbKeyboardDevice);
gBS->CloseEvent (UsbKeyboardDevice->KeyboardLayoutEvent);
}
FreePool (UsbKeyboardDevice);
UsbKeyboardDevice = NULL;
}
gBS->CloseProtocol (
Controller,
&gEfiUsbIoProtocolGuid,
@@ -454,10 +461,8 @@ ErrorExit1:
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Stop the USB keyboard device handled by this driver.
@@ -476,20 +481,20 @@ ErrorExit1:
EFI_STATUS
EFIAPI
USBKeyboardDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleInput;
USB_KB_DEV *UsbKeyboardDevice;
EFI_STATUS Status;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleInput;
USB_KB_DEV *UsbKeyboardDevice;
Status = gBS->OpenProtocol (
Controller,
&gEfiSimpleTextInProtocolGuid,
(VOID **) &SimpleInput,
(VOID **)&SimpleInput,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -593,8 +598,8 @@ USBKeyboardDriverBindingStop (
**/
EFI_STATUS
USBKeyboardReadKeyStrokeWorker (
IN OUT USB_KB_DEV *UsbKeyboardDevice,
OUT EFI_KEY_DATA *KeyData
IN OUT USB_KB_DEV *UsbKeyboardDevice,
OUT EFI_KEY_DATA *KeyData
)
{
if (KeyData == NULL) {
@@ -630,12 +635,12 @@ USBKeyboardReadKeyStrokeWorker (
EFI_STATUS
EFIAPI
USBKeyboardReset (
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
{
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (This);
@@ -676,7 +681,6 @@ USBKeyboardReset (
return EFI_SUCCESS;
}
/**
Reads the next keystroke from the input device.
@@ -693,13 +697,13 @@ USBKeyboardReset (
EFI_STATUS
EFIAPI
USBKeyboardReadKeyStroke (
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
OUT EFI_INPUT_KEY *Key
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
OUT EFI_INPUT_KEY *Key
)
{
USB_KB_DEV *UsbKeyboardDevice;
EFI_STATUS Status;
EFI_KEY_DATA KeyData;
USB_KB_DEV *UsbKeyboardDevice;
EFI_STATUS Status;
EFI_KEY_DATA KeyData;
UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (This);
@@ -713,21 +717,23 @@ USBKeyboardReadKeyStroke (
if (EFI_ERROR (Status)) {
return Status;
}
//
// SimpleTextIn Protocol doesn't support partial keystroke;
//
if (KeyData.Key.ScanCode == CHAR_NULL && KeyData.Key.UnicodeChar == SCAN_NULL) {
if ((KeyData.Key.ScanCode == CHAR_NULL) && (KeyData.Key.UnicodeChar == SCAN_NULL)) {
continue;
}
//
// Translate the CTRL-Alpha characters to their corresponding control value
// (ctrl-a = 0x0001 through ctrl-Z = 0x001A)
//
if ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) {
if (KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z') {
KeyData.Key.UnicodeChar = (CHAR16) (KeyData.Key.UnicodeChar - L'a' + 1);
} else if (KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') {
KeyData.Key.UnicodeChar = (CHAR16) (KeyData.Key.UnicodeChar - L'A' + 1);
if ((KeyData.Key.UnicodeChar >= L'a') && (KeyData.Key.UnicodeChar <= L'z')) {
KeyData.Key.UnicodeChar = (CHAR16)(KeyData.Key.UnicodeChar - L'a' + 1);
} else if ((KeyData.Key.UnicodeChar >= L'A') && (KeyData.Key.UnicodeChar <= L'Z')) {
KeyData.Key.UnicodeChar = (CHAR16)(KeyData.Key.UnicodeChar - L'A' + 1);
}
}
@@ -736,7 +742,6 @@ USBKeyboardReadKeyStroke (
}
}
/**
Event notification function registered for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx
and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey.
@@ -748,15 +753,15 @@ USBKeyboardReadKeyStroke (
VOID
EFIAPI
USBKeyboardWaitForKey (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
USB_KB_DEV *UsbKeyboardDevice;
EFI_KEY_DATA KeyData;
EFI_TPL OldTpl;
USB_KB_DEV *UsbKeyboardDevice;
EFI_KEY_DATA KeyData;
EFI_TPL OldTpl;
UsbKeyboardDevice = (USB_KB_DEV *) Context;
UsbKeyboardDevice = (USB_KB_DEV *)Context;
//
// Enter critical section
@@ -778,13 +783,15 @@ USBKeyboardWaitForKey (
UsbKeyboardDevice->EfiKeyQueue.Buffer[UsbKeyboardDevice->EfiKeyQueue.Head],
sizeof (EFI_KEY_DATA)
);
if (KeyData.Key.ScanCode == SCAN_NULL && KeyData.Key.UnicodeChar == CHAR_NULL) {
if ((KeyData.Key.ScanCode == SCAN_NULL) && (KeyData.Key.UnicodeChar == CHAR_NULL)) {
Dequeue (&UsbKeyboardDevice->EfiKeyQueue, &KeyData, sizeof (EFI_KEY_DATA));
continue;
}
gBS->SignalEvent (Event);
break;
}
//
// Leave critical section and return
//
@@ -800,16 +807,16 @@ USBKeyboardWaitForKey (
VOID
EFIAPI
USBKeyboardTimerHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
UINT8 KeyCode;
EFI_KEY_DATA KeyData;
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
UINT8 KeyCode;
EFI_KEY_DATA KeyData;
UsbKeyboardDevice = (USB_KB_DEV *) Context;
UsbKeyboardDevice = (USB_KB_DEV *)Context;
//
// Fetch raw data from the USB keyboard buffer,
@@ -817,7 +824,7 @@ USBKeyboardTimerHandler (
//
Status = USBParseKey (UsbKeyboardDevice, &KeyCode);
if (EFI_ERROR (Status)) {
return ;
return;
}
//
@@ -825,7 +832,7 @@ USBKeyboardTimerHandler (
//
Status = UsbKeyCodeToEfiInputKey (UsbKeyboardDevice, KeyCode, &KeyData);
if (EFI_ERROR (Status)) {
return ;
return;
}
//
@@ -845,17 +852,18 @@ USBKeyboardTimerHandler (
**/
EFI_STATUS
KbdFreeNotifyList (
IN OUT LIST_ENTRY *NotifyList
IN OUT LIST_ENTRY *NotifyList
)
{
KEYBOARD_CONSOLE_IN_EX_NOTIFY *NotifyNode;
LIST_ENTRY *Link;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *NotifyNode;
LIST_ENTRY *Link;
if (NotifyList == NULL) {
return EFI_INVALID_PARAMETER;
}
while (!IsListEmpty (NotifyList)) {
Link = GetFirstNode (NotifyList);
Link = GetFirstNode (NotifyList);
NotifyNode = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);
RemoveEntryList (Link);
FreePool (NotifyNode);
@@ -883,19 +891,23 @@ IsKeyRegistered (
ASSERT (RegsiteredData != NULL && InputData != NULL);
if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) ||
(RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {
(RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar))
{
return FALSE;
}
//
// Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.
//
if (RegsiteredData->KeyState.KeyShiftState != 0 &&
RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {
if ((RegsiteredData->KeyState.KeyShiftState != 0) &&
(RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState))
{
return FALSE;
}
if (RegsiteredData->KeyState.KeyToggleState != 0 &&
RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) {
if ((RegsiteredData->KeyState.KeyToggleState != 0) &&
(RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState))
{
return FALSE;
}
@@ -905,6 +917,7 @@ IsKeyRegistered (
//
// Simple Text Input Ex protocol functions
//
/**
Resets the input device hardware.
@@ -934,8 +947,8 @@ USBKeyboardResetEx (
IN BOOLEAN ExtendedVerification
)
{
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);
@@ -948,7 +961,6 @@ USBKeyboardResetEx (
UsbKeyboardDevice->KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;
return EFI_SUCCESS;
}
/**
@@ -968,11 +980,11 @@ USBKeyboardResetEx (
EFI_STATUS
EFIAPI
USBKeyboardReadKeyStrokeEx (
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
)
{
USB_KB_DEV *UsbKeyboardDevice;
USB_KB_DEV *UsbKeyboardDevice;
if (KeyData == NULL) {
return EFI_INVALID_PARAMETER;
@@ -981,7 +993,6 @@ USBKeyboardReadKeyStrokeEx (
UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);
return USBKeyboardReadKeyStrokeWorker (UsbKeyboardDevice, KeyData);
}
/**
@@ -1005,7 +1016,7 @@ USBKeyboardSetState (
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
)
{
USB_KB_DEV *UsbKeyboardDevice;
USB_KB_DEV *UsbKeyboardDevice;
if (KeyToggleState == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1014,7 +1025,8 @@ USBKeyboardSetState (
UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);
if (((UsbKeyboardDevice->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) ||
((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) {
((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID))
{
return EFI_UNSUPPORTED;
}
@@ -1022,20 +1034,23 @@ USBKeyboardSetState (
// Update the status light
//
UsbKeyboardDevice->ScrollOn = FALSE;
UsbKeyboardDevice->NumLockOn = FALSE;
UsbKeyboardDevice->CapsOn = FALSE;
UsbKeyboardDevice->ScrollOn = FALSE;
UsbKeyboardDevice->NumLockOn = FALSE;
UsbKeyboardDevice->CapsOn = FALSE;
UsbKeyboardDevice->IsSupportPartialKey = FALSE;
if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {
UsbKeyboardDevice->ScrollOn = TRUE;
}
if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {
UsbKeyboardDevice->NumLockOn = TRUE;
}
if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {
UsbKeyboardDevice->CapsOn = TRUE;
}
if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {
UsbKeyboardDevice->IsSupportPartialKey = TRUE;
}
@@ -1045,7 +1060,6 @@ USBKeyboardSetState (
UsbKeyboardDevice->KeyState.KeyToggleState = *KeyToggleState;
return EFI_SUCCESS;
}
/**
@@ -1076,13 +1090,13 @@ USBKeyboardRegisterKeyNotify (
OUT VOID **NotifyHandle
)
{
USB_KB_DEV *UsbKeyboardDevice;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *NewNotify;
LIST_ENTRY *Link;
LIST_ENTRY *NotifyList;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
USB_KB_DEV *UsbKeyboardDevice;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *NewNotify;
LIST_ENTRY *Link;
LIST_ENTRY *NotifyList;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
if (KeyData == NULL || NotifyHandle == NULL || KeyNotificationFunction == NULL) {
if ((KeyData == NULL) || (NotifyHandle == NULL) || (KeyNotificationFunction == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1095,7 +1109,8 @@ USBKeyboardRegisterKeyNotify (
for (Link = GetFirstNode (NotifyList);
!IsNull (NotifyList, Link);
Link = GetNextNode (NotifyList, Link)) {
Link = GetNextNode (NotifyList, Link))
{
CurrentNotify = CR (
Link,
KEYBOARD_CONSOLE_IN_EX_NOTIFY,
@@ -1113,7 +1128,7 @@ USBKeyboardRegisterKeyNotify (
//
// Allocate resource to save the notification function
//
NewNotify = (KEYBOARD_CONSOLE_IN_EX_NOTIFY *) AllocateZeroPool (sizeof (KEYBOARD_CONSOLE_IN_EX_NOTIFY));
NewNotify = (KEYBOARD_CONSOLE_IN_EX_NOTIFY *)AllocateZeroPool (sizeof (KEYBOARD_CONSOLE_IN_EX_NOTIFY));
if (NewNotify == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -1123,11 +1138,9 @@ USBKeyboardRegisterKeyNotify (
CopyMem (&NewNotify->KeyData, KeyData, sizeof (EFI_KEY_DATA));
InsertTailList (&UsbKeyboardDevice->NotifyList, &NewNotify->NotifyEntry);
*NotifyHandle = NewNotify;
return EFI_SUCCESS;
}
/**
@@ -1147,10 +1160,10 @@ USBKeyboardUnregisterKeyNotify (
IN VOID *NotificationHandle
)
{
USB_KB_DEV *UsbKeyboardDevice;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
LIST_ENTRY *Link;
LIST_ENTRY *NotifyList;
USB_KB_DEV *UsbKeyboardDevice;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
LIST_ENTRY *Link;
LIST_ENTRY *NotifyList;
if (NotificationHandle == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1164,7 +1177,8 @@ USBKeyboardUnregisterKeyNotify (
NotifyList = &UsbKeyboardDevice->NotifyList;
for (Link = GetFirstNode (NotifyList);
!IsNull (NotifyList, Link);
Link = GetNextNode (NotifyList, Link)) {
Link = GetNextNode (NotifyList, Link))
{
CurrentNotify = CR (
Link,
KEYBOARD_CONSOLE_IN_EX_NOTIFY,
@@ -1197,19 +1211,19 @@ USBKeyboardUnregisterKeyNotify (
VOID
EFIAPI
KeyNotifyProcessHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
EFI_KEY_DATA KeyData;
LIST_ENTRY *Link;
LIST_ENTRY *NotifyList;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
EFI_TPL OldTpl;
EFI_STATUS Status;
USB_KB_DEV *UsbKeyboardDevice;
EFI_KEY_DATA KeyData;
LIST_ENTRY *Link;
LIST_ENTRY *NotifyList;
KEYBOARD_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
EFI_TPL OldTpl;
UsbKeyboardDevice = (USB_KB_DEV *) Context;
UsbKeyboardDevice = (USB_KB_DEV *)Context;
//
// Invoke notification functions.
@@ -1228,6 +1242,7 @@ KeyNotifyProcessHandler (
if (EFI_ERROR (Status)) {
break;
}
for (Link = GetFirstNode (NotifyList); !IsNull (NotifyList, Link); Link = GetNextNode (NotifyList, Link)) {
CurrentNotify = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);
if (IsKeyRegistered (&CurrentNotify->KeyData, &KeyData)) {
@@ -1236,4 +1251,3 @@ KeyNotifyProcessHandler (
}
}
}

View File

@@ -5,10 +5,10 @@ Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _EFI_USB_KB_H_
#define _EFI_USB_KB_H_
#include <Uefi.h>
#include <Protocol/SimpleTextIn.h>
@@ -34,59 +34,59 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <IndustryStandard/Usb.h>
#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
#define MAX_KEY_ALLOWED 32
#define MAX_KEY_ALLOWED 32
#define HZ 1000 * 1000 * 10
#define USBKBD_REPEAT_DELAY ((HZ) / 2)
#define USBKBD_REPEAT_RATE ((HZ) / 50)
#define HZ 1000 * 1000 * 10
#define USBKBD_REPEAT_DELAY ((HZ) / 2)
#define USBKBD_REPEAT_RATE ((HZ) / 50)
#define CLASS_HID 3
#define SUBCLASS_BOOT 1
#define PROTOCOL_KEYBOARD 1
#define CLASS_HID 3
#define SUBCLASS_BOOT 1
#define PROTOCOL_KEYBOARD 1
#define BOOT_PROTOCOL 0
#define REPORT_PROTOCOL 1
#define BOOT_PROTOCOL 0
#define REPORT_PROTOCOL 1
typedef struct {
BOOLEAN Down;
UINT8 KeyCode;
BOOLEAN Down;
UINT8 KeyCode;
} USB_KEY;
typedef struct {
VOID *Buffer[MAX_KEY_ALLOWED + 1];
UINTN Head;
UINTN Tail;
UINTN ItemSize;
VOID *Buffer[MAX_KEY_ALLOWED + 1];
UINTN Head;
UINTN Tail;
UINTN ItemSize;
} USB_SIMPLE_QUEUE;
#define USB_KB_DEV_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'd')
#define USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'x')
#define USB_KB_DEV_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'd')
#define USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'x')
typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {
UINTN Signature;
EFI_KEY_DATA KeyData;
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
LIST_ENTRY NotifyEntry;
UINTN Signature;
EFI_KEY_DATA KeyData;
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
LIST_ENTRY NotifyEntry;
} KEYBOARD_CONSOLE_IN_EX_NOTIFY;
#define USB_NS_KEY_SIGNATURE SIGNATURE_32 ('u', 'n', 's', 'k')
typedef struct {
UINTN Signature;
LIST_ENTRY Link;
UINTN Signature;
LIST_ENTRY Link;
//
// The number of EFI_NS_KEY_MODIFIER children definitions
//
UINTN KeyCount;
UINTN KeyCount;
//
// NsKey[0] : Non-spacing key
// NsKey[1] ~ NsKey[KeyCount] : Physical keys
//
EFI_KEY_DESCRIPTOR *NsKey;
EFI_KEY_DESCRIPTOR *NsKey;
} USB_NS_KEY;
#define USB_NS_KEY_FORM_FROM_LINK(a) CR (a, USB_NS_KEY, Link, USB_NS_KEY_SIGNATURE)
@@ -95,64 +95,64 @@ typedef struct {
/// Structure to describe USB keyboard device
///
typedef struct {
UINTN Signature;
EFI_HANDLE ControllerHandle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_EVENT DelayedRecoveryEvent;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;
EFI_USB_IO_PROTOCOL *UsbIo;
UINTN Signature;
EFI_HANDLE ControllerHandle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_EVENT DelayedRecoveryEvent;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;
EFI_USB_IO_PROTOCOL *UsbIo;
EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;
EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;
USB_SIMPLE_QUEUE UsbKeyQueue;
USB_SIMPLE_QUEUE EfiKeyQueue;
USB_SIMPLE_QUEUE EfiKeyQueueForNotify;
BOOLEAN CtrlOn;
BOOLEAN AltOn;
BOOLEAN ShiftOn;
BOOLEAN NumLockOn;
BOOLEAN CapsOn;
BOOLEAN ScrollOn;
UINT8 LastKeyCodeArray[8];
UINT8 CurKeyCode;
USB_SIMPLE_QUEUE UsbKeyQueue;
USB_SIMPLE_QUEUE EfiKeyQueue;
USB_SIMPLE_QUEUE EfiKeyQueueForNotify;
BOOLEAN CtrlOn;
BOOLEAN AltOn;
BOOLEAN ShiftOn;
BOOLEAN NumLockOn;
BOOLEAN CapsOn;
BOOLEAN ScrollOn;
UINT8 LastKeyCodeArray[8];
UINT8 CurKeyCode;
EFI_EVENT TimerEvent;
EFI_EVENT TimerEvent;
UINT8 RepeatKey;
EFI_EVENT RepeatTimer;
UINT8 RepeatKey;
EFI_EVENT RepeatTimer;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
BOOLEAN LeftCtrlOn;
BOOLEAN LeftAltOn;
BOOLEAN LeftShiftOn;
BOOLEAN LeftLogoOn;
BOOLEAN RightCtrlOn;
BOOLEAN RightAltOn;
BOOLEAN RightShiftOn;
BOOLEAN RightLogoOn;
BOOLEAN MenuKeyOn;
BOOLEAN SysReqOn;
BOOLEAN AltGrOn;
BOOLEAN LeftCtrlOn;
BOOLEAN LeftAltOn;
BOOLEAN LeftShiftOn;
BOOLEAN LeftLogoOn;
BOOLEAN RightCtrlOn;
BOOLEAN RightAltOn;
BOOLEAN RightShiftOn;
BOOLEAN RightLogoOn;
BOOLEAN MenuKeyOn;
BOOLEAN SysReqOn;
BOOLEAN AltGrOn;
BOOLEAN IsSupportPartialKey;
BOOLEAN IsSupportPartialKey;
EFI_KEY_STATE KeyState;
EFI_KEY_STATE KeyState;
//
// Notification function list
//
LIST_ENTRY NotifyList;
EFI_EVENT KeyNotifyProcessEvent;
LIST_ENTRY NotifyList;
EFI_EVENT KeyNotifyProcessEvent;
//
// Non-spacing key list
//
LIST_ENTRY NsKeyList;
USB_NS_KEY *CurrentNsKey;
EFI_KEY_DESCRIPTOR *KeyConvertionTable;
EFI_EVENT KeyboardLayoutEvent;
LIST_ENTRY NsKeyList;
USB_NS_KEY *CurrentNsKey;
EFI_KEY_DESCRIPTOR *KeyConvertionTable;
EFI_EVENT KeyboardLayoutEvent;
} USB_KB_DEV;
//
@@ -175,23 +175,24 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2;
// So the number of valid non-modifier USB keycodes is 0x62, and the number of
// valid keycodes is 0x6A.
//
#define NUMBER_OF_VALID_NON_MODIFIER_USB_KEYCODE 0x62
#define NUMBER_OF_VALID_USB_KEYCODE 0x6A
#define NUMBER_OF_VALID_NON_MODIFIER_USB_KEYCODE 0x62
#define NUMBER_OF_VALID_USB_KEYCODE 0x6A
//
// 0x0 to 0x3 are reserved for typical keyboard status or keyboard errors.
//
#define USBKBD_VALID_KEYCODE(Key) ((UINT8) (Key) > 3)
#define USBKBD_VALID_KEYCODE(Key) ((UINT8) (Key) > 3)
typedef struct {
UINT8 NumLock : 1;
UINT8 CapsLock : 1;
UINT8 ScrollLock : 1;
UINT8 Resrvd : 5;
UINT8 NumLock : 1;
UINT8 CapsLock : 1;
UINT8 ScrollLock : 1;
UINT8 Resrvd : 5;
} LED_MAP;
//
// Functions of Driver Binding Protocol
//
/**
Check whether USB keyboard driver supports this device.
@@ -206,9 +207,9 @@ typedef struct {
EFI_STATUS
EFIAPI
USBKeyboardDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -231,9 +232,9 @@ USBKeyboardDriverBindingSupported (
EFI_STATUS
EFIAPI
USBKeyboardDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -254,15 +255,16 @@ USBKeyboardDriverBindingStart (
EFI_STATUS
EFIAPI
USBKeyboardDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -366,16 +368,17 @@ UsbKeyboardComponentNameGetDriverName (
EFI_STATUS
EFIAPI
UsbKeyboardComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// Functions of Simple Text Input Protocol
//
/**
Reset the input device and optionally run diagnostics
@@ -394,8 +397,8 @@ UsbKeyboardComponentNameGetControllerName (
EFI_STATUS
EFIAPI
USBKeyboardReset (
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
@@ -414,13 +417,14 @@ USBKeyboardReset (
EFI_STATUS
EFIAPI
USBKeyboardReadKeyStroke (
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
OUT EFI_INPUT_KEY *Key
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
OUT EFI_INPUT_KEY *Key
);
//
// Simple Text Input Ex protocol functions
//
/**
Resets the input device hardware.
@@ -467,8 +471,8 @@ USBKeyboardResetEx (
EFI_STATUS
EFIAPI
USBKeyboardReadKeyStrokeEx (
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
);
/**
@@ -549,8 +553,8 @@ USBKeyboardUnregisterKeyNotify (
VOID
EFIAPI
USBKeyboardWaitForKey (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -564,7 +568,7 @@ USBKeyboardWaitForKey (
**/
EFI_STATUS
KbdFreeNotifyList (
IN OUT LIST_ENTRY *NotifyList
IN OUT LIST_ENTRY *NotifyList
);
/**
@@ -592,8 +596,8 @@ IsKeyRegistered (
VOID
EFIAPI
USBKeyboardTimerHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -605,9 +609,8 @@ USBKeyboardTimerHandler (
VOID
EFIAPI
KeyNotifyProcessHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -9,10 +9,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _EFI_KEYBOARD_H_
#define _EFI_KEYBOARD_H_
#include "EfiKey.h"
#define USB_KEYBOARD_KEY_COUNT 105
#define USB_KEYBOARD_KEY_COUNT 105
#define USB_KEYBOARD_LANGUAGE_STR_LEN 5 // RFC4646 Language Code: "en-US"
#define USB_KEYBOARD_DESCRIPTION_STR_LEN (16 + 1) // Description: "English Keyboard"
@@ -22,28 +21,29 @@ typedef struct {
//
// This 4-bytes total array length is required by PreparePackageList()
//
UINT32 Length;
UINT32 Length;
//
// Keyboard Layout package definition
//
EFI_HII_PACKAGE_HEADER PackageHeader;
UINT16 LayoutCount;
EFI_HII_PACKAGE_HEADER PackageHeader;
UINT16 LayoutCount;
//
// EFI_HII_KEYBOARD_LAYOUT
//
UINT16 LayoutLength;
EFI_GUID Guid;
UINT32 LayoutDescriptorStringOffset;
UINT8 DescriptorCount;
EFI_KEY_DESCRIPTOR KeyDescriptor[USB_KEYBOARD_KEY_COUNT];
UINT16 DescriptionCount;
CHAR16 Language[USB_KEYBOARD_LANGUAGE_STR_LEN];
CHAR16 Space;
CHAR16 DescriptionString[USB_KEYBOARD_DESCRIPTION_STR_LEN];
UINT16 LayoutLength;
EFI_GUID Guid;
UINT32 LayoutDescriptorStringOffset;
UINT8 DescriptorCount;
EFI_KEY_DESCRIPTOR KeyDescriptor[USB_KEYBOARD_KEY_COUNT];
UINT16 DescriptionCount;
CHAR16 Language[USB_KEYBOARD_LANGUAGE_STR_LEN];
CHAR16 Space;
CHAR16 DescriptionString[USB_KEYBOARD_DESCRIPTION_STR_LEN];
} USB_KEYBOARD_LAYOUT_PACK_BIN;
#pragma pack()
/**
Uses USB I/O to check whether the device is a USB keyboard device.
@@ -55,7 +55,7 @@ typedef struct {
**/
BOOLEAN
IsUSBKeyboard (
IN EFI_USB_IO_PROTOCOL *UsbIo
IN EFI_USB_IO_PROTOCOL *UsbIo
);
/**
@@ -69,7 +69,7 @@ IsUSBKeyboard (
**/
EFI_STATUS
InitUSBKeyboard (
IN OUT USB_KB_DEV *UsbKeyboardDevice
IN OUT USB_KB_DEV *UsbKeyboardDevice
);
/**
@@ -89,7 +89,7 @@ InitUSBKeyboard (
**/
EFI_STATUS
InitKeyboardLayout (
OUT USB_KB_DEV *UsbKeyboardDevice
OUT USB_KB_DEV *UsbKeyboardDevice
);
/**
@@ -100,7 +100,7 @@ InitKeyboardLayout (
**/
VOID
ReleaseKeyboardLayoutResources (
IN OUT USB_KB_DEV *UsbKeyboardDevice
IN OUT USB_KB_DEV *UsbKeyboardDevice
);
/**
@@ -124,10 +124,10 @@ ReleaseKeyboardLayoutResources (
EFI_STATUS
EFIAPI
KeyboardHandler (
IN VOID *Data,
IN UINTN DataLength,
IN VOID *Context,
IN UINT32 Result
IN VOID *Data,
IN UINTN DataLength,
IN VOID *Context,
IN UINT32 Result
);
/**
@@ -146,8 +146,8 @@ KeyboardHandler (
VOID
EFIAPI
USBKeyboardRecoveryHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -187,12 +187,11 @@ USBParseKey (
**/
EFI_STATUS
UsbKeyCodeToEfiInputKey (
IN USB_KB_DEV *UsbKeyboardDevice,
IN UINT8 KeyCode,
OUT EFI_KEY_DATA *KeyData
IN USB_KB_DEV *UsbKeyboardDevice,
IN UINT8 KeyCode,
OUT EFI_KEY_DATA *KeyData
);
/**
Create the queue.
@@ -202,8 +201,8 @@ UsbKeyCodeToEfiInputKey (
**/
VOID
InitQueue (
IN OUT USB_SIMPLE_QUEUE *Queue,
IN UINTN ItemSize
IN OUT USB_SIMPLE_QUEUE *Queue,
IN UINTN ItemSize
);
/**
@@ -213,10 +212,9 @@ InitQueue (
**/
VOID
DestroyQueue (
IN OUT USB_SIMPLE_QUEUE *Queue
IN OUT USB_SIMPLE_QUEUE *Queue
);
/**
Check whether the queue is empty.
@@ -228,10 +226,9 @@ DestroyQueue (
**/
BOOLEAN
IsQueueEmpty (
IN USB_SIMPLE_QUEUE *Queue
IN USB_SIMPLE_QUEUE *Queue
);
/**
Check whether the queue is full.
@@ -243,10 +240,9 @@ IsQueueEmpty (
**/
BOOLEAN
IsQueueFull (
IN USB_SIMPLE_QUEUE *Queue
IN USB_SIMPLE_QUEUE *Queue
);
/**
Enqueue the item to the queue.
@@ -256,12 +252,11 @@ IsQueueFull (
**/
VOID
Enqueue (
IN OUT USB_SIMPLE_QUEUE *Queue,
IN VOID *Item,
IN UINTN ItemSize
IN OUT USB_SIMPLE_QUEUE *Queue,
IN VOID *Item,
IN UINTN ItemSize
);
/**
Dequeue a item from the queue.
@@ -275,9 +270,9 @@ Enqueue (
**/
EFI_STATUS
Dequeue (
IN OUT USB_SIMPLE_QUEUE *Queue,
OUT VOID *Item,
IN UINTN ItemSize
IN OUT USB_SIMPLE_QUEUE *Queue,
OUT VOID *Item,
IN UINTN ItemSize
);
/**
@@ -296,8 +291,8 @@ Dequeue (
VOID
EFIAPI
USBKeyboardRepeatHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -308,7 +303,7 @@ USBKeyboardRepeatHandler (
**/
VOID
SetKeyLED (
IN USB_KB_DEV *UsbKeyboardDevice
IN USB_KB_DEV *UsbKeyboardDevice
);
/**
@@ -319,8 +314,8 @@ SetKeyLED (
**/
VOID
InitializeKeyState (
IN USB_KB_DEV *UsbKeyboardDevice,
OUT EFI_KEY_STATE *KeyState
IN USB_KB_DEV *UsbKeyboardDevice,
OUT EFI_KEY_STATE *KeyState
);
#endif