3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 // Include common header file for this module.
23 #include "CommonHeader.h"
28 // EFI Component Name Protocol
30 EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName
= {
31 Ps2MouseComponentNameGetDriverName
,
32 Ps2MouseComponentNameGetControllerName
,
36 static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable
[] = {
49 Ps2MouseComponentNameGetDriverName (
50 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
52 OUT CHAR16
**DriverName
58 Retrieves a Unicode string that is the user readable name of the EFI Driver.
62 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
63 Language - A pointer to a three character ISO 639-2 language identifier.
64 This is the language of the driver name that that the caller
65 is requesting, and it must match one of the languages specified
66 in SupportedLanguages. The number of languages supported by a
67 driver is up to the driver writer.
68 DriverName - A pointer to the Unicode string to return. This Unicode string
69 is the name of the driver specified by This in the language
70 specified by Language.
74 EFI_SUCCESS - The Unicode string for the Driver specified by This
75 and the language specified by Language was returned
77 EFI_INVALID_PARAMETER - Language is NULL.
78 EFI_INVALID_PARAMETER - DriverName is NULL.
79 EFI_UNSUPPORTED - The driver specified by This does not support the
80 language specified by Language.
84 return LookupUnicodeString (
86 gPs2MouseComponentName
.SupportedLanguages
,
87 mPs2MouseDriverNameTable
,
94 Ps2MouseComponentNameGetControllerName (
95 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
96 IN EFI_HANDLE ControllerHandle
,
97 IN EFI_HANDLE ChildHandle OPTIONAL
,
99 OUT CHAR16
**ControllerName
105 Retrieves a Unicode string that is the user readable name of the controller
106 that is being managed by an EFI Driver.
110 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
111 ControllerHandle - The handle of a controller that the driver specified by
112 This is managing. This handle specifies the controller
113 whose name is to be returned.
114 ChildHandle - The handle of the child controller to retrieve the name
115 of. This is an optional parameter that may be NULL. It
116 will be NULL for device drivers. It will also be NULL
117 for a bus drivers that wish to retrieve the name of the
118 bus controller. It will not be NULL for a bus driver
119 that wishes to retrieve the name of a child controller.
120 Language - A pointer to a three character ISO 639-2 language
121 identifier. This is the language of the controller name
122 that that the caller is requesting, and it must match one
123 of the languages specified in SupportedLanguages. The
124 number of languages supported by a driver is up to the
126 ControllerName - A pointer to the Unicode string to return. This Unicode
127 string is the name of the controller specified by
128 ControllerHandle and ChildHandle in the language specified
129 by Language from the point of view of the driver specified
134 EFI_SUCCESS - The Unicode string for the user readable name in the
135 language specified by Language for the driver
136 specified by This was returned in DriverName.
137 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
138 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
139 EFI_INVALID_PARAMETER - Language is NULL.
140 EFI_INVALID_PARAMETER - ControllerName is NULL.
141 EFI_UNSUPPORTED - The driver specified by This is not currently managing
142 the controller specified by ControllerHandle and
144 EFI_UNSUPPORTED - The driver specified by This does not support the
145 language specified by Language.
150 EFI_SIMPLE_POINTER_PROTOCOL
*SimplePointerProtocol
;
151 PS2_MOUSE_DEV
*MouseDev
;
152 EFI_ISA_IO_PROTOCOL
*IsaIoProtocol
;
155 // This is a device driver, so ChildHandle must be NULL.
157 if (ChildHandle
!= NULL
) {
158 return EFI_UNSUPPORTED
;
161 // Check Controller's handle
163 Status
= gBS
->OpenProtocol (
165 &gEfiIsaIoProtocolGuid
,
166 (VOID
**) &IsaIoProtocol
,
167 gPS2MouseDriver
.DriverBindingHandle
,
169 EFI_OPEN_PROTOCOL_BY_DRIVER
171 if (!EFI_ERROR (Status
)) {
174 &gEfiIsaIoProtocolGuid
,
175 gPS2MouseDriver
.DriverBindingHandle
,
179 return EFI_UNSUPPORTED
;
182 if (Status
!= EFI_ALREADY_STARTED
) {
183 return EFI_UNSUPPORTED
;
186 // Get the device context
188 Status
= gBS
->OpenProtocol (
190 &gEfiSimplePointerProtocolGuid
,
191 (VOID
**) &SimplePointerProtocol
,
192 gPS2MouseDriver
.DriverBindingHandle
,
194 EFI_OPEN_PROTOCOL_GET_PROTOCOL
196 if (EFI_ERROR (Status
)) {
200 MouseDev
= PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol
);
202 return LookupUnicodeString (
204 gPs2MouseComponentName
.SupportedLanguages
,
205 MouseDev
->ControllerNameTable
,