TianoCore EDK2 master
Loading...
Searching...
No Matches
Ps2Keyboard.h File Reference

Go to the source code of this file.

Data Structures

struct  _KEYBOARD_CONSOLE_IN_EX_NOTIFY
 
struct  SCAN_CODE_QUEUE
 
struct  EFI_KEY_QUEUE
 
struct  KEYBOARD_CONSOLE_IN_DEV
 

Macros

#define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE   SIGNATURE_32 ('k', 'k', 'e', 'y')
 
#define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE   SIGNATURE_32 ('k', 'c', 'e', 'n')
 
#define KEYBOARD_SCAN_CODE_MAX_COUNT   32
 
#define KEYBOARD_EFI_KEY_MAX_COUNT   256
 
#define KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a)   CR (a, KEYBOARD_CONSOLE_IN_DEV, ConIn, KEYBOARD_CONSOLE_IN_DEV_SIGNATURE)
 
#define TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a)
 
#define TABLE_END   0x0
 
#define KEYBOARD_8042_DATA_REGISTER   0x60
 
#define KEYBOARD_8042_STATUS_REGISTER   0x64
 
#define KEYBOARD_8042_COMMAND_REGISTER   0x64
 
#define KEYBOARD_KBEN   0xF4
 
#define KEYBOARD_CMDECHO_ACK   0xFA
 
#define KEYBOARD_MAX_TRY   256
 
#define KEYBOARD_TIMEOUT   65536
 
#define KEYBOARD_WAITFORVALUE_TIMEOUT   1000000
 
#define KEYBOARD_BAT_TIMEOUT   4000000
 
#define KEYBOARD_TIMER_INTERVAL   200000
 
#define SCANCODE_EXTENDED0   0xE0
 
#define SCANCODE_EXTENDED1   0xE1
 
#define SCANCODE_CTRL_MAKE   0x1D
 
#define SCANCODE_CTRL_BREAK   0x9D
 
#define SCANCODE_ALT_MAKE   0x38
 
#define SCANCODE_ALT_BREAK   0xB8
 
#define SCANCODE_LEFT_SHIFT_MAKE   0x2A
 
#define SCANCODE_LEFT_SHIFT_BREAK   0xAA
 
#define SCANCODE_RIGHT_SHIFT_MAKE   0x36
 
#define SCANCODE_RIGHT_SHIFT_BREAK   0xB6
 
#define SCANCODE_CAPS_LOCK_MAKE   0x3A
 
#define SCANCODE_NUM_LOCK_MAKE   0x45
 
#define SCANCODE_SCROLL_LOCK_MAKE   0x46
 
#define SCANCODE_DELETE_MAKE   0x53
 
#define SCANCODE_LEFT_LOGO_MAKE   0x5B
 
#define SCANCODE_LEFT_LOGO_BREAK   0xDB
 
#define SCANCODE_RIGHT_LOGO_MAKE   0x5C
 
#define SCANCODE_RIGHT_LOGO_BREAK   0xDC
 
#define SCANCODE_MENU_MAKE   0x5D
 
#define SCANCODE_MENU_BREAK   0xDD
 
#define SCANCODE_SYS_REQ_MAKE   0x37
 
#define SCANCODE_SYS_REQ_BREAK   0xB7
 
#define SCANCODE_SYS_REQ_MAKE_WITH_ALT   0x54
 
#define SCANCODE_SYS_REQ_BREAK_WITH_ALT   0xD4
 
#define SCANCODE_MAX_MAKE   0x60
 
#define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA   BIT0
 0 - Output register has no data; 1 - Output register has data
 
#define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA   BIT1
 0 - Input register has no data; 1 - Input register has data
 
#define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG   BIT2
 Set to 0 after power on reset.
 
#define KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE   BIT3
 0 - Data in input register is data; 1 - Data in input register is command
 
#define KEYBOARD_STATUS_REGISTER_ENABLE_FLAG   BIT4
 0 - Keyboard is disable; 1 - Keyboard is enable
 
#define KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT   BIT5
 0 - Transmit is complete without timeout; 1 - Transmit is timeout without complete
 
#define KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT   BIT6
 0 - Receive is complete without timeout; 1 - Receive is timeout without complete
 
#define KEYBOARD_STATUS_REGISTER_PARITY   BIT7
 0 - Odd parity; 1 - Even parity
 
#define KEYBOARD_8042_COMMAND_READ   0x20
 
#define KEYBOARD_8042_COMMAND_WRITE   0x60
 
#define KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE   0xA7
 
#define KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE   0xA8
 
#define KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST   0xAA
 
#define KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST   0xAB
 
#define KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE   0xAD
 
#define KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA   0xF4
 
#define KEYBOARD_8048_COMMAND_RESET   0xFF
 
#define KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET   0xF0
 
#define KEYBOARD_8048_RETURN_8042_BAT_SUCCESS   0xAA
 
#define KEYBOARD_8048_RETURN_8042_BAT_ERROR   0xFC
 
#define KEYBOARD_8048_RETURN_8042_ACK   0xFA
 
#define KBC_PARE   0x80
 
#define KBC_TIM   0x40
 

Typedefs

typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY KEYBOARD_CONSOLE_IN_EX_NOTIFY
 

Functions

EFI_STATUS EFIAPI InstallPs2KeyboardDriver (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS UpdateStatusLights (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
 
EFI_STATUS KeyboardRead (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, OUT UINT8 *Data)
 
VOID KeyGetchar (IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
 
VOID EFIAPI KeyNotifyProcessHandler (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS InitKeyboard (IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN BOOLEAN ExtendedVerification)
 
VOID EFIAPI KeyboardTimerHandler (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI KeyboardEfiReset (IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS EFIAPI KeyboardReadKeyStroke (IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, OUT EFI_INPUT_KEY *Key)
 
VOID EFIAPI KeyboardWaitForKey (IN EFI_EVENT Event, IN VOID *Context)
 
UINT8 KeyReadStatusRegister (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
 
BOOLEAN EFIAPI CheckKeyboardConnect (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
 
VOID EFIAPI KeyboardWaitForKeyEx (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI KeyboardEfiResetEx (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS EFIAPI KeyboardReadKeyStrokeEx (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData)
 
EFI_STATUS EFIAPI KeyboardSetState (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_TOGGLE_STATE *KeyToggleState)
 
EFI_STATUS EFIAPI KeyboardRegisterKeyNotify (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, OUT VOID **NotifyHandle)
 
EFI_STATUS EFIAPI KeyboardUnregisterKeyNotify (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle)
 
VOID PushEfikeyBufTail (IN EFI_KEY_QUEUE *Queue, IN EFI_KEY_DATA *KeyData)
 
BOOLEAN IsKeyRegistered (IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData)
 
VOID InitializeKeyState (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, OUT EFI_KEY_STATE *KeyState)
 

Variables

EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver
 
EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName
 
EFI_COMPONENT_NAME2_PROTOCOL gPs2KeyboardComponentName2
 

Detailed Description

PS/2 keyboard driver header file

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ps2Keyboard.h.

Macro Definition Documentation

◆ KBC_PARE

#define KBC_PARE   0x80

Definition at line 217 of file Ps2Keyboard.h.

◆ KBC_TIM

#define KBC_TIM   0x40

Definition at line 218 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST

#define KEYBOARD_8042_COMMAND_CONTROLLER_SELF_TEST   0xAA

Definition at line 202 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE

#define KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE   0xAD

Definition at line 204 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE

#define KEYBOARD_8042_COMMAND_DISABLE_MOUSE_INTERFACE   0xA7

Definition at line 200 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE

#define KEYBOARD_8042_COMMAND_ENABLE_MOUSE_INTERFACE   0xA8

Definition at line 201 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST

#define KEYBOARD_8042_COMMAND_KEYBOARD_INTERFACE_SELF_TEST   0xAB

Definition at line 203 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_READ

#define KEYBOARD_8042_COMMAND_READ   0x20

Definition at line 198 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_REGISTER

#define KEYBOARD_8042_COMMAND_REGISTER   0x64

Definition at line 152 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_COMMAND_WRITE

#define KEYBOARD_8042_COMMAND_WRITE   0x60

Definition at line 199 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_DATA_REGISTER

#define KEYBOARD_8042_DATA_REGISTER   0x60

Definition at line 150 of file Ps2Keyboard.h.

◆ KEYBOARD_8042_STATUS_REGISTER

#define KEYBOARD_8042_STATUS_REGISTER   0x64

Definition at line 151 of file Ps2Keyboard.h.

◆ KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA

#define KEYBOARD_8048_COMMAND_CLEAR_OUTPUT_DATA   0xF4

Definition at line 206 of file Ps2Keyboard.h.

◆ KEYBOARD_8048_COMMAND_RESET

#define KEYBOARD_8048_COMMAND_RESET   0xFF

Definition at line 207 of file Ps2Keyboard.h.

◆ KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET

#define KEYBOARD_8048_COMMAND_SELECT_SCAN_CODE_SET   0xF0

Definition at line 208 of file Ps2Keyboard.h.

◆ KEYBOARD_8048_RETURN_8042_ACK

#define KEYBOARD_8048_RETURN_8042_ACK   0xFA

Definition at line 212 of file Ps2Keyboard.h.

◆ KEYBOARD_8048_RETURN_8042_BAT_ERROR

#define KEYBOARD_8048_RETURN_8042_BAT_ERROR   0xFC

Definition at line 211 of file Ps2Keyboard.h.

◆ KEYBOARD_8048_RETURN_8042_BAT_SUCCESS

#define KEYBOARD_8048_RETURN_8042_BAT_SUCCESS   0xAA

Definition at line 210 of file Ps2Keyboard.h.

◆ KEYBOARD_BAT_TIMEOUT

#define KEYBOARD_BAT_TIMEOUT   4000000

Definition at line 160 of file Ps2Keyboard.h.

◆ KEYBOARD_CMDECHO_ACK

#define KEYBOARD_CMDECHO_ACK   0xFA

Definition at line 155 of file Ps2Keyboard.h.

◆ KEYBOARD_CONSOLE_IN_DEV_FROM_THIS

#define KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (   a)    CR (a, KEYBOARD_CONSOLE_IN_DEV, ConIn, KEYBOARD_CONSOLE_IN_DEV_SIGNATURE)

Definition at line 119 of file Ps2Keyboard.h.

◆ KEYBOARD_CONSOLE_IN_DEV_SIGNATURE

#define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE   SIGNATURE_32 ('k', 'k', 'e', 'y')

Definition at line 44 of file Ps2Keyboard.h.

◆ KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE

#define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE   SIGNATURE_32 ('k', 'c', 'e', 'n')

Definition at line 45 of file Ps2Keyboard.h.

◆ KEYBOARD_EFI_KEY_MAX_COUNT

#define KEYBOARD_EFI_KEY_MAX_COUNT   256

Definition at line 61 of file Ps2Keyboard.h.

◆ KEYBOARD_KBEN

#define KEYBOARD_KBEN   0xF4

Definition at line 154 of file Ps2Keyboard.h.

◆ KEYBOARD_MAX_TRY

#define KEYBOARD_MAX_TRY   256

Definition at line 157 of file Ps2Keyboard.h.

◆ KEYBOARD_SCAN_CODE_MAX_COUNT

#define KEYBOARD_SCAN_CODE_MAX_COUNT   32

Definition at line 54 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_ENABLE_FLAG

#define KEYBOARD_STATUS_REGISTER_ENABLE_FLAG   BIT4

0 - Keyboard is disable; 1 - Keyboard is enable

Definition at line 193 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA

#define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA   BIT1

0 - Input register has no data; 1 - Input register has data

Definition at line 190 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA

#define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA   BIT0

0 - Output register has no data; 1 - Output register has data

Definition at line 189 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE

#define KEYBOARD_STATUS_REGISTER_INPUT_DATA_TYPE   BIT3

0 - Data in input register is data; 1 - Data in input register is command

Definition at line 192 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_PARITY

#define KEYBOARD_STATUS_REGISTER_PARITY   BIT7

0 - Odd parity; 1 - Even parity

Definition at line 196 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT

#define KEYBOARD_STATUS_REGISTER_RECEIVE_TIMEOUT   BIT6

0 - Receive is complete without timeout; 1 - Receive is timeout without complete

Definition at line 195 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG

#define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG   BIT2

Set to 0 after power on reset.

Definition at line 191 of file Ps2Keyboard.h.

◆ KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT

#define KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT   BIT5

0 - Transmit is complete without timeout; 1 - Transmit is timeout without complete

Definition at line 194 of file Ps2Keyboard.h.

◆ KEYBOARD_TIMEOUT

#define KEYBOARD_TIMEOUT   65536

Definition at line 158 of file Ps2Keyboard.h.

◆ KEYBOARD_TIMER_INTERVAL

#define KEYBOARD_TIMER_INTERVAL   200000

Definition at line 161 of file Ps2Keyboard.h.

◆ KEYBOARD_WAITFORVALUE_TIMEOUT

#define KEYBOARD_WAITFORVALUE_TIMEOUT   1000000

Definition at line 159 of file Ps2Keyboard.h.

◆ SCANCODE_ALT_BREAK

#define SCANCODE_ALT_BREAK   0xB8

Definition at line 167 of file Ps2Keyboard.h.

◆ SCANCODE_ALT_MAKE

#define SCANCODE_ALT_MAKE   0x38

Definition at line 166 of file Ps2Keyboard.h.

◆ SCANCODE_CAPS_LOCK_MAKE

#define SCANCODE_CAPS_LOCK_MAKE   0x3A

Definition at line 172 of file Ps2Keyboard.h.

◆ SCANCODE_CTRL_BREAK

#define SCANCODE_CTRL_BREAK   0x9D

Definition at line 165 of file Ps2Keyboard.h.

◆ SCANCODE_CTRL_MAKE

#define SCANCODE_CTRL_MAKE   0x1D

Definition at line 164 of file Ps2Keyboard.h.

◆ SCANCODE_DELETE_MAKE

#define SCANCODE_DELETE_MAKE   0x53

Definition at line 175 of file Ps2Keyboard.h.

◆ SCANCODE_EXTENDED0

#define SCANCODE_EXTENDED0   0xE0

Definition at line 162 of file Ps2Keyboard.h.

◆ SCANCODE_EXTENDED1

#define SCANCODE_EXTENDED1   0xE1

Definition at line 163 of file Ps2Keyboard.h.

◆ SCANCODE_LEFT_LOGO_BREAK

#define SCANCODE_LEFT_LOGO_BREAK   0xDB

Definition at line 177 of file Ps2Keyboard.h.

◆ SCANCODE_LEFT_LOGO_MAKE

#define SCANCODE_LEFT_LOGO_MAKE   0x5B

Definition at line 176 of file Ps2Keyboard.h.

◆ SCANCODE_LEFT_SHIFT_BREAK

#define SCANCODE_LEFT_SHIFT_BREAK   0xAA

Definition at line 169 of file Ps2Keyboard.h.

◆ SCANCODE_LEFT_SHIFT_MAKE

#define SCANCODE_LEFT_SHIFT_MAKE   0x2A

Definition at line 168 of file Ps2Keyboard.h.

◆ SCANCODE_MAX_MAKE

#define SCANCODE_MAX_MAKE   0x60

Definition at line 187 of file Ps2Keyboard.h.

◆ SCANCODE_MENU_BREAK

#define SCANCODE_MENU_BREAK   0xDD

Definition at line 181 of file Ps2Keyboard.h.

◆ SCANCODE_MENU_MAKE

#define SCANCODE_MENU_MAKE   0x5D

Definition at line 180 of file Ps2Keyboard.h.

◆ SCANCODE_NUM_LOCK_MAKE

#define SCANCODE_NUM_LOCK_MAKE   0x45

Definition at line 173 of file Ps2Keyboard.h.

◆ SCANCODE_RIGHT_LOGO_BREAK

#define SCANCODE_RIGHT_LOGO_BREAK   0xDC

Definition at line 179 of file Ps2Keyboard.h.

◆ SCANCODE_RIGHT_LOGO_MAKE

#define SCANCODE_RIGHT_LOGO_MAKE   0x5C

Definition at line 178 of file Ps2Keyboard.h.

◆ SCANCODE_RIGHT_SHIFT_BREAK

#define SCANCODE_RIGHT_SHIFT_BREAK   0xB6

Definition at line 171 of file Ps2Keyboard.h.

◆ SCANCODE_RIGHT_SHIFT_MAKE

#define SCANCODE_RIGHT_SHIFT_MAKE   0x36

Definition at line 170 of file Ps2Keyboard.h.

◆ SCANCODE_SCROLL_LOCK_MAKE

#define SCANCODE_SCROLL_LOCK_MAKE   0x46

Definition at line 174 of file Ps2Keyboard.h.

◆ SCANCODE_SYS_REQ_BREAK

#define SCANCODE_SYS_REQ_BREAK   0xB7

Definition at line 183 of file Ps2Keyboard.h.

◆ SCANCODE_SYS_REQ_BREAK_WITH_ALT

#define SCANCODE_SYS_REQ_BREAK_WITH_ALT   0xD4

Definition at line 185 of file Ps2Keyboard.h.

◆ SCANCODE_SYS_REQ_MAKE

#define SCANCODE_SYS_REQ_MAKE   0x37

Definition at line 182 of file Ps2Keyboard.h.

◆ SCANCODE_SYS_REQ_MAKE_WITH_ALT

#define SCANCODE_SYS_REQ_MAKE_WITH_ALT   0x54

Definition at line 184 of file Ps2Keyboard.h.

◆ TABLE_END

#define TABLE_END   0x0

Definition at line 127 of file Ps2Keyboard.h.

◆ TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS

#define TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (   a)
Value:
CR (a, \
ConInEx, \
KEYBOARD_CONSOLE_IN_DEV_SIGNATURE \
)
#define CR(Record, TYPE, Field, TestSignature)
Definition: DebugLib.h:659

Definition at line 120 of file Ps2Keyboard.h.

Function Documentation

◆ CheckKeyboardConnect()

BOOLEAN EFIAPI CheckKeyboardConnect ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device should not be in system.

Parameters
[in]ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Return values
TRUEKeyboard in System.
FALSEKeyboard not in System.

Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device should not be in system.

Parameters
[in]ConsoleInKeyboard Private Data Structure
Return values
TRUEKeyboard in System.
FALSEKeyboard not in System.

Definition at line 1840 of file Ps2KbdCtrller.c.

◆ InitializeKeyState()

VOID InitializeKeyState ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
OUT EFI_KEY_STATE KeyState 
)

Initialize the key state.

Parameters
ConsoleInThe KEYBOARD_CONSOLE_IN_DEV instance.
KeyStateA pointer to receive the key state information.

Definition at line 1111 of file Ps2KbdCtrller.c.

◆ InitKeyboard()

EFI_STATUS InitKeyboard ( IN OUT KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN BOOLEAN  ExtendedVerification 
)

Perform 8042 controller and keyboard Initialization. If ExtendedVerification is TRUE, do additional test for the keyboard interface

Parameters
ConsoleIn- KEYBOARD_CONSOLE_IN_DEV instance pointer
ExtendedVerification- indicates a thorough initialization
Return values
EFI_DEVICE_ERRORFail to init keyboard
EFI_SUCCESSSuccess to init keyboard

Definition at line 1483 of file Ps2KbdCtrller.c.

◆ InstallPs2KeyboardDriver()

EFI_STATUS EFIAPI InstallPs2KeyboardDriver ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The user Entry Point for module Ps2Keyboard. The user code starts with this function.

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.
otherSome error occurs when executing this entry point.

◆ IsKeyRegistered()

BOOLEAN IsKeyRegistered ( IN EFI_KEY_DATA RegsiteredData,
IN EFI_KEY_DATA InputData 
)

Judge whether is a registered key

Parameters
RegsiteredDataA pointer to a buffer that is filled in with the keystroke state data for the key that was registered.
InputDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
TRUEKey be pressed matches a registered key.
FALSEMatch failed.

Judge whether is a registed key

Parameters
RegsiteredDataA pointer to a buffer that is filled in with the keystroke state data for the key that was registered.
InputDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
TRUEKey be pressed matches a registered key.
FALSEMatch failed.

Check whether the pressed key matches a registered key or not.

Parameters
RegsiteredDataA pointer to keystroke data for the key that was registered.
InputDataA pointer to keystroke data for the key that was pressed.
Return values
TRUEKey pressed matches a registered key.
FALSEKey pressed does not matches a registered key.

Test if the key has been registered on input device.

Parameters
RegsiteredDataA pointer to a buffer that is filled in with the keystroke state data for the key that was registered.
InputDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
TRUEKey be pressed matches a registered key.
FALSEMatch failed.

Check if the key already has been registered.

If both RegsiteredData and InputData is NULL, then ASSERT().

Parameters
RegsiteredDataA pointer to a buffer that is filled in with the keystroke state data for the key that was registered.
InputDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
TRUEKey be pressed matches a registered key.
FALSEMatch failed.

Definition at line 448 of file VirtualKeyboard.c.

◆ KeyboardEfiReset()

EFI_STATUS EFIAPI KeyboardEfiReset ( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

logic reset keyboard Implement SIMPLE_TEXT_IN.Reset() Perform 8042 controller and keyboard initialization

Parameters
ThisPointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL
ExtendedVerificationIndicate that the driver may perform a more exhaustive verification operation of the device during reset, now this par is ignored in this driver

Perform 8042 controller and keyboard initialization which implement SIMPLE_TEXT_IN.Reset()

Parameters
ThisPointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL
ExtendedVerificationIndicate that the driver may perform a more exhaustive verification operation of the device during reset, now this par is ignored in this driver

Definition at line 188 of file Ps2KbdTextIn.c.

◆ KeyboardEfiResetEx()

EFI_STATUS EFIAPI KeyboardEfiResetEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

Reset the input device and optionally run diagnostics

Parameters
This- Protocol instance pointer.
ExtendedVerification- Driver may perform diagnostics on reset.
Return values
EFI_SUCCESS- The device was reset.
EFI_DEVICE_ERROR- The device is not functioning properly and could not be reset.

Reset the input device and optionally run diagnostics

Parameters
ThisProtocol instance pointer.
ExtendedVerificationDriver may perform diagnostics on reset.
Return values
EFI_SUCCESSThe device was reset.
EFI_DEVICE_ERRORThe device is not functioning properly and could not be reset.

Definition at line 407 of file Ps2KbdTextIn.c.

◆ KeyboardRead()

EFI_STATUS KeyboardRead ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
OUT UINT8 *  Data 
)

write key to keyboard.

Parameters
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Datavalue wanted to be written
Return values
EFI_TIMEOUT- GC_TODO: Add description for return value
EFI_SUCCESS- GC_TODO: Add description for return value

Read key value .

Parameters
ConsoleIn- Pointer to instance of KEYBOARD_CONSOLE_IN_DEV
Data- Pointer to outof buffer for keeping key value
Return values
EFI_TIMEOUTStatus register time out
EFI_SUCCESSSuccess to read keyboard

Definition at line 835 of file Ps2KbdCtrller.c.

◆ KeyboardReadKeyStroke()

EFI_STATUS EFIAPI KeyboardReadKeyStroke ( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL This,
OUT EFI_INPUT_KEY Key 
)

Implement SIMPLE_TEXT_IN.ReadKeyStroke(). Retrieve key values for driver user.

Parameters
ThisPointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL
KeyThe output buffer for key value
Return values
EFI_SUCCESSsuccess to read key stroke
EFI_UNSUPPORTEDThe device does not support the ability to read keystroke data.

Retrieve key values for driver user which implement SIMPLE_TEXT_IN.ReadKeyStroke().

Parameters
ThisPointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL
KeyThe output buffer for key value
Return values
EFI_SUCCESSsuccess to read key stroke
EFI_UNSUPPORTEDThe device does not support the ability to read keystroke data.

Definition at line 266 of file Ps2KbdTextIn.c.

◆ KeyboardReadKeyStrokeEx()

EFI_STATUS EFIAPI KeyboardReadKeyStrokeEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
OUT EFI_KEY_DATA KeyData 
)

Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existence of a keystroke via WaitForEvent () call.

Parameters
This- Protocol instance pointer.
KeyData- A pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
EFI_SUCCESS- The keystroke information was returned.
EFI_NOT_READY- There was no keystroke data available.
EFI_DEVICE_ERROR- The keystroke information was not returned due to hardware errors.
EFI_INVALID_PARAMETER- KeyData is NULL.
EFI_UNSUPPORTED- The device does not support the ability to read keystroke data.

Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existence of a keystroke via WaitForEvent () call.

Parameters
ThisProtocol instance pointer.
KeyDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
EFI_SUCCESSThe keystroke information was returned.
EFI_NOT_READYThere was no keystroke data available.
EFI_DEVICE_ERRORThe keystroke information was not returned due to hardware errors.
EFI_INVALID_PARAMETERKeyData is NULL.
EFI_UNSUPPORTEDThe device does not support the ability to read keystroke data.

Definition at line 442 of file Ps2KbdTextIn.c.

◆ KeyboardRegisterKeyNotify()

EFI_STATUS EFIAPI KeyboardRegisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN EFI_KEY_DATA KeyData,
IN EFI_KEY_NOTIFY_FUNCTION  KeyNotificationFunction,
OUT VOID **  NotifyHandle 
)

Register a notification function for a particular keystroke for the input device.

Parameters
This- Protocol instance pointer.
KeyData- A pointer to a buffer that is filled in with the keystroke information data for the key that was pressed. If KeyData.Key, KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState are 0, then any incomplete keystroke will trigger a notification of the KeyNotificationFunction.
KeyNotificationFunction- Points to the function to be called when the key sequence is typed specified by KeyData. This notification function should be called at <=TPL_CALLBACK.
NotifyHandle- Points to the unique handle assigned to the registered notification.
Return values
EFI_SUCCESS- The notification function was registered successfully.
EFI_OUT_OF_RESOURCES- Unable to allocate resources for necessary data structures.
EFI_INVALID_PARAMETER- KeyData or NotifyHandle is NULL.

Register a notification function for a particular keystroke for the input device.

Parameters
ThisProtocol instance pointer.
KeyDataA pointer to a buffer that is filled in with the keystroke information data for the key that was pressed. If KeyData.Key, KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState are 0, then any incomplete keystroke will trigger a notification of the KeyNotificationFunction.
KeyNotificationFunctionPoints to the function to be called when the key sequence is typed specified by KeyData. This notification function should be called at <=TPL_CALLBACK.
NotifyHandlePoints to the unique handle assigned to the registered notification.
Return values
EFI_SUCCESSThe notification function was registered successfully.
EFI_OUT_OF_RESOURCESUnable to allocate resources for necessary data structures.
EFI_INVALID_PARAMETERKeyData or NotifyHandle or KeyNotificationFunction is NULL.

Definition at line 563 of file Ps2KbdTextIn.c.

◆ KeyboardSetState()

EFI_STATUS EFIAPI KeyboardSetState ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN EFI_KEY_TOGGLE_STATE KeyToggleState 
)

Set certain state for the input device.

Parameters
This- Protocol instance pointer.
KeyToggleState- A pointer to the EFI_KEY_TOGGLE_STATE to set the state for the input device.
Return values
EFI_SUCCESS- The device state was set successfully.
EFI_DEVICE_ERROR- The device is not functioning correctly and could not have the setting adjusted.
EFI_UNSUPPORTED- The device does not have the ability to set its state.
EFI_INVALID_PARAMETER- KeyToggleState is NULL.

Set certain state for the input device.

Parameters
ThisProtocol instance pointer.
KeyToggleStateA pointer to the EFI_KEY_TOGGLE_STATE to set the state for the input device.
Return values
EFI_SUCCESSThe device state was set successfully.
EFI_DEVICE_ERRORThe device is not functioning correctly and could not have the setting adjusted.
EFI_UNSUPPORTEDThe device does not have the ability to set its state.
EFI_INVALID_PARAMETERKeyToggleState is NULL.

Definition at line 474 of file Ps2KbdTextIn.c.

◆ KeyboardTimerHandler()

VOID EFIAPI KeyboardTimerHandler ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Timer event handler: read a series of scancodes from 8042 and put them into memory scancode buffer. it read as much scancodes to either fill the memory buffer or empty the keyboard buffer. It is registered as running under TPL_NOTIFY

Parameters
Event- The timer event
Context- A KEYBOARD_CONSOLE_IN_DEV pointer

Timer event handler: read a series of scancodes from 8042 and put them into memory scancode buffer. it read as much scancodes to either fill the memory buffer or empty the keyboard buffer. It is registered as running under TPL_NOTIFY

Parameters
EventThe timer event
ContextA KEYBOARD_CONSOLE_IN_DEV pointer

Definition at line 772 of file Ps2KbdCtrller.c.

◆ KeyboardUnregisterKeyNotify()

EFI_STATUS EFIAPI KeyboardUnregisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN VOID *  NotificationHandle 
)

Remove a registered notification function from a particular keystroke.

Parameters
This- Protocol instance pointer.
NotificationHandle- The handle of the notification function being unregistered.
Return values
EFI_SUCCESS- The notification function was unregistered successfully.
EFI_INVALID_PARAMETER- The NotificationHandle is invalid.
EFI_NOT_FOUND- Can not find the matching entry in database.

Remove a registered notification function from a particular keystroke.

Parameters
ThisProtocol instance pointer.
NotificationHandleThe handle of the notification function being unregistered.
Return values
EFI_SUCCESSThe notification function was unregistered successfully.
EFI_INVALID_PARAMETERThe NotificationHandle is invalid.

Definition at line 645 of file Ps2KbdTextIn.c.

◆ KeyboardWaitForKey()

VOID EFIAPI KeyboardWaitForKey ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Event notification function for SIMPLE_TEXT_IN.WaitForKey event Signal the event if there is key available

Parameters
Eventthe event object
Contextwaiting context

Definition at line 325 of file Ps2KbdTextIn.c.

◆ KeyboardWaitForKeyEx()

VOID EFIAPI KeyboardWaitForKeyEx ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event Signal the event if there is key available

Parameters
Eventevent object
Contextwaiting context

Definition at line 385 of file Ps2KbdTextIn.c.

◆ KeyGetchar()

VOID KeyGetchar ( IN OUT KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Get scancode from scancode buffer and translate into EFI-scancode and unicode defined by EFI spec.

The function is always called in TPL_NOTIFY.

Parameters
ConsoleInKEYBOARD_CONSOLE_IN_DEV instance pointer

Definition at line 1145 of file Ps2KbdCtrller.c.

◆ KeyNotifyProcessHandler()

VOID EFIAPI KeyNotifyProcessHandler ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Process key notify.

Parameters
EventIndicates the event that invoke this function.
ContextIndicates the calling context.

Definition at line 1080 of file VirtualKeyboard.c.

◆ KeyReadStatusRegister()

UINT8 KeyReadStatusRegister ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Read status register.

Parameters
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Returns
value in status register

Definition at line 720 of file Ps2KbdCtrller.c.

◆ PushEfikeyBufTail()

VOID PushEfikeyBufTail ( IN EFI_KEY_QUEUE Queue,
IN EFI_KEY_DATA KeyData 
)

Push one key data to the EFI key buffer.

Parameters
QueuePointer to instance of EFI_KEY_QUEUE.
KeyDataThe key data to push.

Definition at line 65 of file Ps2KbdTextIn.c.

◆ UpdateStatusLights()

EFI_STATUS UpdateStatusLights ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Show keyboard status lights according to indicators in ConsoleIn.

Parameters
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Returns
status

Show keyboard status lights according to indicators in ConsoleIn.

Parameters
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Returns
status of updating keyboard register

Definition at line 1061 of file Ps2KbdCtrller.c.

Variable Documentation

◆ gKeyboardControllerDriver

EFI_DRIVER_BINDING_PROTOCOL gKeyboardControllerDriver
extern

Definition at line 91 of file Ps2Keyboard.c.

◆ gPs2KeyboardComponentName

EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName
extern

Definition at line 143 of file ComponentName.c.

◆ gPs2KeyboardComponentName2

EFI_COMPONENT_NAME2_PROTOCOL gPs2KeyboardComponentName2
extern

Definition at line 152 of file ComponentName.c.