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"
29 // EFI Component Name Protocol
31 EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName
= {
32 Ps2MouseComponentNameGetDriverName
,
33 Ps2MouseComponentNameGetControllerName
,
37 static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable
[] = {
50 Ps2MouseComponentNameGetDriverName (
51 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
53 OUT CHAR16
**DriverName
59 Retrieves a Unicode string that is the user readable name of the EFI Driver.
63 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
64 Language - A pointer to a three character ISO 639-2 language identifier.
65 This is the language of the driver name that that the caller
66 is requesting, and it must match one of the languages specified
67 in SupportedLanguages. The number of languages supported by a
68 driver is up to the driver writer.
69 DriverName - A pointer to the Unicode string to return. This Unicode string
70 is the name of the driver specified by This in the language
71 specified by Language.
75 EFI_SUCCESS - The Unicode string for the Driver specified by This
76 and the language specified by Language was returned
78 EFI_INVALID_PARAMETER - Language is NULL.
79 EFI_INVALID_PARAMETER - DriverName is NULL.
80 EFI_UNSUPPORTED - The driver specified by This does not support the
81 language specified by Language.
85 return LookupUnicodeString (
87 gPs2MouseComponentName
.SupportedLanguages
,
88 mPs2MouseDriverNameTable
,
95 Ps2MouseComponentNameGetControllerName (
96 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
97 IN EFI_HANDLE ControllerHandle
,
98 IN EFI_HANDLE ChildHandle OPTIONAL
,
100 OUT CHAR16
**ControllerName
106 Retrieves a Unicode string that is the user readable name of the controller
107 that is being managed by an EFI Driver.
111 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
112 ControllerHandle - The handle of a controller that the driver specified by
113 This is managing. This handle specifies the controller
114 whose name is to be returned.
115 ChildHandle - The handle of the child controller to retrieve the name
116 of. This is an optional parameter that may be NULL. It
117 will be NULL for device drivers. It will also be NULL
118 for a bus drivers that wish to retrieve the name of the
119 bus controller. It will not be NULL for a bus driver
120 that wishes to retrieve the name of a child controller.
121 Language - A pointer to a three character ISO 639-2 language
122 identifier. This is the language of the controller name
123 that that the caller is requesting, and it must match one
124 of the languages specified in SupportedLanguages. The
125 number of languages supported by a driver is up to the
127 ControllerName - A pointer to the Unicode string to return. This Unicode
128 string is the name of the controller specified by
129 ControllerHandle and ChildHandle in the language specified
130 by Language from the point of view of the driver specified
135 EFI_SUCCESS - The Unicode string for the user readable name in the
136 language specified by Language for the driver
137 specified by This was returned in DriverName.
138 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
139 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
140 EFI_INVALID_PARAMETER - Language is NULL.
141 EFI_INVALID_PARAMETER - ControllerName is NULL.
142 EFI_UNSUPPORTED - The driver specified by This is not currently managing
143 the controller specified by ControllerHandle and
145 EFI_UNSUPPORTED - The driver specified by This does not support the
146 language specified by Language.
151 EFI_SIMPLE_POINTER_PROTOCOL
*SimplePointerProtocol
;
152 PS2_MOUSE_DEV
*MouseDev
;
153 EFI_ISA_IO_PROTOCOL
*IsaIoProtocol
;
156 // This is a device driver, so ChildHandle must be NULL.
158 if (ChildHandle
!= NULL
) {
159 return EFI_UNSUPPORTED
;
162 // Check Controller's handle
164 Status
= gBS
->OpenProtocol (
166 &gEfiIsaIoProtocolGuid
,
167 (VOID
**) &IsaIoProtocol
,
168 gPS2MouseDriver
.DriverBindingHandle
,
170 EFI_OPEN_PROTOCOL_BY_DRIVER
172 if (!EFI_ERROR (Status
)) {
175 &gEfiIsaIoProtocolGuid
,
176 gPS2MouseDriver
.DriverBindingHandle
,
180 return EFI_UNSUPPORTED
;
183 if (Status
!= EFI_ALREADY_STARTED
) {
184 return EFI_UNSUPPORTED
;
187 // Get the device context
189 Status
= gBS
->OpenProtocol (
191 &gEfiSimplePointerProtocolGuid
,
192 (VOID
**) &SimplePointerProtocol
,
193 gPS2MouseDriver
.DriverBindingHandle
,
195 EFI_OPEN_PROTOCOL_GET_PROTOCOL
197 if (EFI_ERROR (Status
)) {
201 MouseDev
= PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol
);
203 return LookupUnicodeString (
205 gPs2MouseComponentName
.SupportedLanguages
,
206 MouseDev
->ControllerNameTable
,