3 Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. <BR>
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
22 // Include common header file for this module.
24 #include "CommonHeader.h"
26 #include "Ps2Keyboard.h"
29 // EFI Component Name Functions
33 Ps2KeyboardComponentNameGetDriverName (
34 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
36 OUT CHAR16
**DriverName
41 Ps2KeyboardComponentNameGetControllerName (
42 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
43 IN EFI_HANDLE ControllerHandle
,
44 IN EFI_HANDLE ChildHandle OPTIONAL
,
46 OUT CHAR16
**ControllerName
50 // EFI Component Name Protocol
52 EFI_COMPONENT_NAME_PROTOCOL gPs2KeyboardComponentName
= {
53 Ps2KeyboardComponentNameGetDriverName
,
54 Ps2KeyboardComponentNameGetControllerName
,
58 static EFI_UNICODE_STRING_TABLE mPs2KeyboardDriverNameTable
[] = {
61 L
"PS/2 Keyboard Driver"
71 Ps2KeyboardComponentNameGetDriverName (
72 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
74 OUT CHAR16
**DriverName
80 Retrieves a Unicode string that is the user readable name of the EFI Driver.
84 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
85 Language - A pointer to a three character ISO 639-2 language identifier.
86 This is the language of the driver name that that the caller
87 is requesting, and it must match one of the languages specified
88 in SupportedLanguages. The number of languages supported by a
89 driver is up to the driver writer.
90 DriverName - A pointer to the Unicode string to return. This Unicode string
91 is the name of the driver specified by This in the language
92 specified by Language.
96 EFI_SUCCESS - The Unicode string for the Driver specified by This
97 and the language specified by Language was returned
99 EFI_INVALID_PARAMETER - Language is NULL.
100 EFI_INVALID_PARAMETER - DriverName is NULL.
101 EFI_UNSUPPORTED - The driver specified by This does not support the
102 language specified by Language.
106 return LookupUnicodeString (
108 gPs2KeyboardComponentName
.SupportedLanguages
,
109 mPs2KeyboardDriverNameTable
,
116 Ps2KeyboardComponentNameGetControllerName (
117 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
118 IN EFI_HANDLE ControllerHandle
,
119 IN EFI_HANDLE ChildHandle OPTIONAL
,
121 OUT CHAR16
**ControllerName
127 Retrieves a Unicode string that is the user readable name of the controller
128 that is being managed by an EFI Driver.
132 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
133 ControllerHandle - The handle of a controller that the driver specified by
134 This is managing. This handle specifies the controller
135 whose name is to be returned.
136 ChildHandle - The handle of the child controller to retrieve the name
137 of. This is an optional parameter that may be NULL. It
138 will be NULL for device drivers. It will also be NULL
139 for a bus drivers that wish to retrieve the name of the
140 bus controller. It will not be NULL for a bus driver
141 that wishes to retrieve the name of a child controller.
142 Language - A pointer to a three character ISO 639-2 language
143 identifier. This is the language of the controller name
144 that that the caller is requesting, and it must match one
145 of the languages specified in SupportedLanguages. The
146 number of languages supported by a driver is up to the
148 ControllerName - A pointer to the Unicode string to return. This Unicode
149 string is the name of the controller specified by
150 ControllerHandle and ChildHandle in the language specified
151 by Language from the point of view of the driver specified
156 EFI_SUCCESS - The Unicode string for the user readable name in the
157 language specified by Language for the driver
158 specified by This was returned in DriverName.
159 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
160 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
161 EFI_INVALID_PARAMETER - Language is NULL.
162 EFI_INVALID_PARAMETER - ControllerName is NULL.
163 EFI_UNSUPPORTED - The driver specified by This is not currently managing
164 the controller specified by ControllerHandle and
166 EFI_UNSUPPORTED - The driver specified by This does not support the
167 language specified by Language.
172 EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*ConIn
;
173 KEYBOARD_CONSOLE_IN_DEV
*ConsoleIn
;
174 EFI_ISA_IO_PROTOCOL
*IsaIoProtocol
;
177 // This is a device driver, so ChildHandle must be NULL.
179 if (ChildHandle
!= NULL
) {
180 return EFI_UNSUPPORTED
;
183 // Check Controller's handle
185 Status
= gBS
->OpenProtocol (
187 &gEfiIsaIoProtocolGuid
,
188 (VOID
**) &IsaIoProtocol
,
189 gKeyboardControllerDriver
.DriverBindingHandle
,
191 EFI_OPEN_PROTOCOL_BY_DRIVER
193 if (!EFI_ERROR (Status
)) {
196 &gEfiIsaIoProtocolGuid
,
197 gKeyboardControllerDriver
.DriverBindingHandle
,
201 return EFI_UNSUPPORTED
;
204 if (Status
!= EFI_ALREADY_STARTED
) {
205 return EFI_UNSUPPORTED
;
208 // Get the device context
210 Status
= gBS
->OpenProtocol (
212 &gEfiSimpleTextInProtocolGuid
,
214 gKeyboardControllerDriver
.DriverBindingHandle
,
216 EFI_OPEN_PROTOCOL_GET_PROTOCOL
218 if (EFI_ERROR (Status
)) {
222 ConsoleIn
= KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (ConIn
);
224 return LookupUnicodeString (
226 gPs2KeyboardComponentName
.SupportedLanguages
,
227 ConsoleIn
->ControllerNameTable
,