]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c
mass cleanup inf name
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2MouseDxe / ComponentName.c
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 ComponentName.c
15
16 Abstract:
17
18 --*/
19
20 #include "Ps2Mouse.h"
21
22 //
23 // EFI Component Name Protocol
24 //
25 EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName = {
26 Ps2MouseComponentNameGetDriverName,
27 Ps2MouseComponentNameGetControllerName,
28 "eng"
29 };
30
31 static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {
32 {
33 "eng",
34 L"PS/2 Mouse Driver"
35 },
36 {
37 NULL,
38 NULL
39 }
40 };
41
42 EFI_STATUS
43 EFIAPI
44 Ps2MouseComponentNameGetDriverName (
45 IN EFI_COMPONENT_NAME_PROTOCOL *This,
46 IN CHAR8 *Language,
47 OUT CHAR16 **DriverName
48 )
49 /*++
50
51 Routine Description:
52
53 Retrieves a Unicode string that is the user readable name of the EFI Driver.
54
55 Arguments:
56
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.
66
67 Returns:
68
69 EFI_SUCCESS - The Unicode string for the Driver specified by This
70 and the language specified by Language was returned
71 in DriverName.
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.
76
77 --*/
78 {
79 return LookupUnicodeString (
80 Language,
81 gPs2MouseComponentName.SupportedLanguages,
82 mPs2MouseDriverNameTable,
83 DriverName
84 );
85 }
86
87 EFI_STATUS
88 EFIAPI
89 Ps2MouseComponentNameGetControllerName (
90 IN EFI_COMPONENT_NAME_PROTOCOL *This,
91 IN EFI_HANDLE ControllerHandle,
92 IN EFI_HANDLE ChildHandle OPTIONAL,
93 IN CHAR8 *Language,
94 OUT CHAR16 **ControllerName
95 )
96 /*++
97
98 Routine Description:
99
100 Retrieves a Unicode string that is the user readable name of the controller
101 that is being managed by an EFI Driver.
102
103 Arguments:
104
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
120 driver writer.
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
125 by This.
126
127 Returns:
128
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
138 ChildHandle.
139 EFI_UNSUPPORTED - The driver specified by This does not support the
140 language specified by Language.
141
142 --*/
143 {
144 EFI_STATUS Status;
145 EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
146 PS2_MOUSE_DEV *MouseDev;
147 EFI_ISA_IO_PROTOCOL *IsaIoProtocol;
148
149 //
150 // This is a device driver, so ChildHandle must be NULL.
151 //
152 if (ChildHandle != NULL) {
153 return EFI_UNSUPPORTED;
154 }
155 //
156 // Check Controller's handle
157 //
158 Status = gBS->OpenProtocol (
159 ControllerHandle,
160 &gEfiIsaIoProtocolGuid,
161 (VOID **) &IsaIoProtocol,
162 gPS2MouseDriver.DriverBindingHandle,
163 ControllerHandle,
164 EFI_OPEN_PROTOCOL_BY_DRIVER
165 );
166 if (!EFI_ERROR (Status)) {
167 gBS->CloseProtocol (
168 ControllerHandle,
169 &gEfiIsaIoProtocolGuid,
170 gPS2MouseDriver.DriverBindingHandle,
171 ControllerHandle
172 );
173
174 return EFI_UNSUPPORTED;
175 }
176
177 if (Status != EFI_ALREADY_STARTED) {
178 return EFI_UNSUPPORTED;
179 }
180 //
181 // Get the device context
182 //
183 Status = gBS->OpenProtocol (
184 ControllerHandle,
185 &gEfiSimplePointerProtocolGuid,
186 (VOID **) &SimplePointerProtocol,
187 gPS2MouseDriver.DriverBindingHandle,
188 ControllerHandle,
189 EFI_OPEN_PROTOCOL_GET_PROTOCOL
190 );
191 if (EFI_ERROR (Status)) {
192 return Status;
193 }
194
195 MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol);
196
197 return LookupUnicodeString (
198 Language,
199 gPs2MouseComponentName.SupportedLanguages,
200 MouseDev->ControllerNameTable,
201 ControllerName
202 );
203 }