]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c
mass cleanup inf name
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2MouseDxe / ComponentName.c
CommitLineData
05fbd06d 1/*++\r
2\r
92a428e1 3Copyright (c) 2006 - 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
05fbd06d 11\r
12Module Name:\r
13\r
14 ComponentName.c\r
15\r
16Abstract:\r
17\r
18--*/\r
19\r
05fbd06d 20#include "Ps2Mouse.h"\r
21\r
22//\r
23// EFI Component Name Protocol\r
24//\r
25EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName = {\r
26 Ps2MouseComponentNameGetDriverName,\r
27 Ps2MouseComponentNameGetControllerName,\r
28 "eng"\r
29};\r
30\r
31static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {\r
32 {\r
33 "eng",\r
34 L"PS/2 Mouse Driver"\r
35 },\r
36 {\r
37 NULL,\r
38 NULL\r
39 }\r
40};\r
41\r
42EFI_STATUS\r
43EFIAPI\r
44Ps2MouseComponentNameGetDriverName (\r
45 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
46 IN CHAR8 *Language,\r
47 OUT CHAR16 **DriverName\r
48 )\r
49/*++\r
50\r
51 Routine Description:\r
52 \r
53 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
54\r
55 Arguments:\r
56 \r
57 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
58 Language - A pointer to a three character ISO 639-2 language identifier.\r
59 This is the language of the driver name that that the caller \r
60 is requesting, and it must match one of the languages specified\r
61 in SupportedLanguages. The number of languages supported by a \r
62 driver is up to the driver writer.\r
63 DriverName - A pointer to the Unicode string to return. This Unicode string\r
64 is the name of the driver specified by This in the language \r
65 specified by Language.\r
66\r
67 Returns:\r
68 \r
69 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
70 and the language specified by Language was returned \r
71 in DriverName.\r
72 EFI_INVALID_PARAMETER - Language is NULL.\r
73 EFI_INVALID_PARAMETER - DriverName is NULL.\r
74 EFI_UNSUPPORTED - The driver specified by This does not support the \r
75 language specified by Language.\r
76\r
77--*/\r
78{\r
79 return LookupUnicodeString (\r
80 Language,\r
81 gPs2MouseComponentName.SupportedLanguages,\r
82 mPs2MouseDriverNameTable,\r
83 DriverName\r
84 );\r
85}\r
86\r
87EFI_STATUS\r
88EFIAPI\r
89Ps2MouseComponentNameGetControllerName (\r
90 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
91 IN EFI_HANDLE ControllerHandle,\r
92 IN EFI_HANDLE ChildHandle OPTIONAL,\r
93 IN CHAR8 *Language,\r
94 OUT CHAR16 **ControllerName\r
95 )\r
96/*++\r
97\r
98 Routine Description:\r
99 \r
100 Retrieves a Unicode string that is the user readable name of the controller\r
101 that is being managed by an EFI Driver.\r
102\r
103 Arguments:\r
104 \r
105 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
106 ControllerHandle - The handle of a controller that the driver specified by \r
107 This is managing. This handle specifies the controller \r
108 whose name is to be returned.\r
109 ChildHandle - The handle of the child controller to retrieve the name \r
110 of. This is an optional parameter that may be NULL. It \r
111 will be NULL for device drivers. It will also be NULL \r
112 for a bus drivers that wish to retrieve the name of the \r
113 bus controller. It will not be NULL for a bus driver \r
114 that wishes to retrieve the name of a child controller.\r
115 Language - A pointer to a three character ISO 639-2 language \r
116 identifier. This is the language of the controller name \r
117 that that the caller is requesting, and it must match one\r
118 of the languages specified in SupportedLanguages. The \r
119 number of languages supported by a driver is up to the \r
120 driver writer.\r
121 ControllerName - A pointer to the Unicode string to return. This Unicode\r
122 string is the name of the controller specified by \r
123 ControllerHandle and ChildHandle in the language specified\r
124 by Language from the point of view of the driver specified\r
125 by This. \r
126\r
127 Returns:\r
128 \r
129 EFI_SUCCESS - The Unicode string for the user readable name in the \r
130 language specified by Language for the driver \r
131 specified by This was returned in DriverName.\r
132 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
133 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
134 EFI_INVALID_PARAMETER - Language is NULL.\r
135 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
136 EFI_UNSUPPORTED - The driver specified by This is not currently managing \r
137 the controller specified by ControllerHandle and \r
138 ChildHandle.\r
139 EFI_UNSUPPORTED - The driver specified by This does not support the \r
140 language specified by Language.\r
141\r
142--*/\r
143{\r
144 EFI_STATUS Status;\r
145 EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;\r
146 PS2_MOUSE_DEV *MouseDev;\r
147 EFI_ISA_IO_PROTOCOL *IsaIoProtocol;\r
148\r
149 //\r
150 // This is a device driver, so ChildHandle must be NULL.\r
151 //\r
152 if (ChildHandle != NULL) {\r
153 return EFI_UNSUPPORTED;\r
154 }\r
155 //\r
156 // Check Controller's handle\r
157 //\r
158 Status = gBS->OpenProtocol (\r
159 ControllerHandle,\r
160 &gEfiIsaIoProtocolGuid,\r
161 (VOID **) &IsaIoProtocol,\r
162 gPS2MouseDriver.DriverBindingHandle,\r
163 ControllerHandle,\r
164 EFI_OPEN_PROTOCOL_BY_DRIVER\r
165 );\r
166 if (!EFI_ERROR (Status)) {\r
167 gBS->CloseProtocol (\r
168 ControllerHandle,\r
169 &gEfiIsaIoProtocolGuid,\r
170 gPS2MouseDriver.DriverBindingHandle,\r
171 ControllerHandle\r
172 );\r
173\r
174 return EFI_UNSUPPORTED;\r
175 }\r
176\r
177 if (Status != EFI_ALREADY_STARTED) {\r
178 return EFI_UNSUPPORTED;\r
179 }\r
180 //\r
181 // Get the device context\r
182 //\r
183 Status = gBS->OpenProtocol (\r
184 ControllerHandle,\r
185 &gEfiSimplePointerProtocolGuid,\r
186 (VOID **) &SimplePointerProtocol,\r
187 gPS2MouseDriver.DriverBindingHandle,\r
188 ControllerHandle,\r
189 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
190 );\r
191 if (EFI_ERROR (Status)) {\r
192 return Status;\r
193 }\r
194\r
195 MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol);\r
196\r
197 return LookupUnicodeString (\r
198 Language,\r
199 gPs2MouseComponentName.SupportedLanguages,\r
200 MouseDev->ControllerNameTable,\r
201 ControllerName\r
202 );\r
203}\r