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.
23 // EFI Component Name Protocol
25 EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName
= {
26 Ps2MouseComponentNameGetDriverName
,
27 Ps2MouseComponentNameGetControllerName
,
31 static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable
[] = {
44 Ps2MouseComponentNameGetDriverName (
45 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
47 OUT CHAR16
**DriverName
53 Retrieves a Unicode string that is the user readable name of the EFI Driver.
57 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
58 Language - A pointer to a three character ISO 639-2 language identifier.
59 This is the language of the driver name that that the caller
60 is requesting, and it must match one of the languages specified
61 in SupportedLanguages. The number of languages supported by a
62 driver is up to the driver writer.
63 DriverName - A pointer to the Unicode string to return. This Unicode string
64 is the name of the driver specified by This in the language
65 specified by Language.
69 EFI_SUCCESS - The Unicode string for the Driver specified by This
70 and the language specified by Language was returned
72 EFI_INVALID_PARAMETER - Language is NULL.
73 EFI_INVALID_PARAMETER - DriverName is NULL.
74 EFI_UNSUPPORTED - The driver specified by This does not support the
75 language specified by Language.
79 return LookupUnicodeString (
81 gPs2MouseComponentName
.SupportedLanguages
,
82 mPs2MouseDriverNameTable
,
89 Ps2MouseComponentNameGetControllerName (
90 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
91 IN EFI_HANDLE ControllerHandle
,
92 IN EFI_HANDLE ChildHandle OPTIONAL
,
94 OUT CHAR16
**ControllerName
100 Retrieves a Unicode string that is the user readable name of the controller
101 that is being managed by an EFI Driver.
105 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
106 ControllerHandle - The handle of a controller that the driver specified by
107 This is managing. This handle specifies the controller
108 whose name is to be returned.
109 ChildHandle - The handle of the child controller to retrieve the name
110 of. This is an optional parameter that may be NULL. It
111 will be NULL for device drivers. It will also be NULL
112 for a bus drivers that wish to retrieve the name of the
113 bus controller. It will not be NULL for a bus driver
114 that wishes to retrieve the name of a child controller.
115 Language - A pointer to a three character ISO 639-2 language
116 identifier. This is the language of the controller name
117 that that the caller is requesting, and it must match one
118 of the languages specified in SupportedLanguages. The
119 number of languages supported by a driver is up to the
121 ControllerName - A pointer to the Unicode string to return. This Unicode
122 string is the name of the controller specified by
123 ControllerHandle and ChildHandle in the language specified
124 by Language from the point of view of the driver specified
129 EFI_SUCCESS - The Unicode string for the user readable name in the
130 language specified by Language for the driver
131 specified by This was returned in DriverName.
132 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
133 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
134 EFI_INVALID_PARAMETER - Language is NULL.
135 EFI_INVALID_PARAMETER - ControllerName is NULL.
136 EFI_UNSUPPORTED - The driver specified by This is not currently managing
137 the controller specified by ControllerHandle and
139 EFI_UNSUPPORTED - The driver specified by This does not support the
140 language specified by Language.
145 EFI_SIMPLE_POINTER_PROTOCOL
*SimplePointerProtocol
;
146 PS2_MOUSE_DEV
*MouseDev
;
147 EFI_ISA_IO_PROTOCOL
*IsaIoProtocol
;
150 // This is a device driver, so ChildHandle must be NULL.
152 if (ChildHandle
!= NULL
) {
153 return EFI_UNSUPPORTED
;
156 // Check Controller's handle
158 Status
= gBS
->OpenProtocol (
160 &gEfiIsaIoProtocolGuid
,
161 (VOID
**) &IsaIoProtocol
,
162 gPS2MouseDriver
.DriverBindingHandle
,
164 EFI_OPEN_PROTOCOL_BY_DRIVER
166 if (!EFI_ERROR (Status
)) {
169 &gEfiIsaIoProtocolGuid
,
170 gPS2MouseDriver
.DriverBindingHandle
,
174 return EFI_UNSUPPORTED
;
177 if (Status
!= EFI_ALREADY_STARTED
) {
178 return EFI_UNSUPPORTED
;
181 // Get the device context
183 Status
= gBS
->OpenProtocol (
185 &gEfiSimplePointerProtocolGuid
,
186 (VOID
**) &SimplePointerProtocol
,
187 gPS2MouseDriver
.DriverBindingHandle
,
189 EFI_OPEN_PROTOCOL_GET_PROTOCOL
191 if (EFI_ERROR (Status
)) {
195 MouseDev
= PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol
);
197 return LookupUnicodeString (
199 gPs2MouseComponentName
.SupportedLanguages
,
200 MouseDev
->ControllerNameTable
,