]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/ComponentName.c
Update to BSD license header.
[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
20//\r
21// Include common header file for this module.\r
22//\r
23#include "CommonHeader.h"\r
24\r
25#include "Ps2Mouse.h"\r
26\r
27//\r
28// EFI Component Name Protocol\r
29//\r
30EFI_COMPONENT_NAME_PROTOCOL gPs2MouseComponentName = {\r
31 Ps2MouseComponentNameGetDriverName,\r
32 Ps2MouseComponentNameGetControllerName,\r
33 "eng"\r
34};\r
35\r
36static EFI_UNICODE_STRING_TABLE mPs2MouseDriverNameTable[] = {\r
37 {\r
38 "eng",\r
39 L"PS/2 Mouse Driver"\r
40 },\r
41 {\r
42 NULL,\r
43 NULL\r
44 }\r
45};\r
46\r
47EFI_STATUS\r
48EFIAPI\r
49Ps2MouseComponentNameGetDriverName (\r
50 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
51 IN CHAR8 *Language,\r
52 OUT CHAR16 **DriverName\r
53 )\r
54/*++\r
55\r
56 Routine Description:\r
57 \r
58 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
59\r
60 Arguments:\r
61 \r
62 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
63 Language - A pointer to a three character ISO 639-2 language identifier.\r
64 This is the language of the driver name that that the caller \r
65 is requesting, and it must match one of the languages specified\r
66 in SupportedLanguages. The number of languages supported by a \r
67 driver is up to the driver writer.\r
68 DriverName - A pointer to the Unicode string to return. This Unicode string\r
69 is the name of the driver specified by This in the language \r
70 specified by Language.\r
71\r
72 Returns:\r
73 \r
74 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
75 and the language specified by Language was returned \r
76 in DriverName.\r
77 EFI_INVALID_PARAMETER - Language is NULL.\r
78 EFI_INVALID_PARAMETER - DriverName is NULL.\r
79 EFI_UNSUPPORTED - The driver specified by This does not support the \r
80 language specified by Language.\r
81\r
82--*/\r
83{\r
84 return LookupUnicodeString (\r
85 Language,\r
86 gPs2MouseComponentName.SupportedLanguages,\r
87 mPs2MouseDriverNameTable,\r
88 DriverName\r
89 );\r
90}\r
91\r
92EFI_STATUS\r
93EFIAPI\r
94Ps2MouseComponentNameGetControllerName (\r
95 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
96 IN EFI_HANDLE ControllerHandle,\r
97 IN EFI_HANDLE ChildHandle OPTIONAL,\r
98 IN CHAR8 *Language,\r
99 OUT CHAR16 **ControllerName\r
100 )\r
101/*++\r
102\r
103 Routine Description:\r
104 \r
105 Retrieves a Unicode string that is the user readable name of the controller\r
106 that is being managed by an EFI Driver.\r
107\r
108 Arguments:\r
109 \r
110 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
111 ControllerHandle - The handle of a controller that the driver specified by \r
112 This is managing. This handle specifies the controller \r
113 whose name is to be returned.\r
114 ChildHandle - The handle of the child controller to retrieve the name \r
115 of. This is an optional parameter that may be NULL. It \r
116 will be NULL for device drivers. It will also be NULL \r
117 for a bus drivers that wish to retrieve the name of the \r
118 bus controller. It will not be NULL for a bus driver \r
119 that wishes to retrieve the name of a child controller.\r
120 Language - A pointer to a three character ISO 639-2 language \r
121 identifier. This is the language of the controller name \r
122 that that the caller is requesting, and it must match one\r
123 of the languages specified in SupportedLanguages. The \r
124 number of languages supported by a driver is up to the \r
125 driver writer.\r
126 ControllerName - A pointer to the Unicode string to return. This Unicode\r
127 string is the name of the controller specified by \r
128 ControllerHandle and ChildHandle in the language specified\r
129 by Language from the point of view of the driver specified\r
130 by This. \r
131\r
132 Returns:\r
133 \r
134 EFI_SUCCESS - The Unicode string for the user readable name in the \r
135 language specified by Language for the driver \r
136 specified by This was returned in DriverName.\r
137 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
138 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
139 EFI_INVALID_PARAMETER - Language is NULL.\r
140 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
141 EFI_UNSUPPORTED - The driver specified by This is not currently managing \r
142 the controller specified by ControllerHandle and \r
143 ChildHandle.\r
144 EFI_UNSUPPORTED - The driver specified by This does not support the \r
145 language specified by Language.\r
146\r
147--*/\r
148{\r
149 EFI_STATUS Status;\r
150 EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;\r
151 PS2_MOUSE_DEV *MouseDev;\r
152 EFI_ISA_IO_PROTOCOL *IsaIoProtocol;\r
153\r
154 //\r
155 // This is a device driver, so ChildHandle must be NULL.\r
156 //\r
157 if (ChildHandle != NULL) {\r
158 return EFI_UNSUPPORTED;\r
159 }\r
160 //\r
161 // Check Controller's handle\r
162 //\r
163 Status = gBS->OpenProtocol (\r
164 ControllerHandle,\r
165 &gEfiIsaIoProtocolGuid,\r
166 (VOID **) &IsaIoProtocol,\r
167 gPS2MouseDriver.DriverBindingHandle,\r
168 ControllerHandle,\r
169 EFI_OPEN_PROTOCOL_BY_DRIVER\r
170 );\r
171 if (!EFI_ERROR (Status)) {\r
172 gBS->CloseProtocol (\r
173 ControllerHandle,\r
174 &gEfiIsaIoProtocolGuid,\r
175 gPS2MouseDriver.DriverBindingHandle,\r
176 ControllerHandle\r
177 );\r
178\r
179 return EFI_UNSUPPORTED;\r
180 }\r
181\r
182 if (Status != EFI_ALREADY_STARTED) {\r
183 return EFI_UNSUPPORTED;\r
184 }\r
185 //\r
186 // Get the device context\r
187 //\r
188 Status = gBS->OpenProtocol (\r
189 ControllerHandle,\r
190 &gEfiSimplePointerProtocolGuid,\r
191 (VOID **) &SimplePointerProtocol,\r
192 gPS2MouseDriver.DriverBindingHandle,\r
193 ControllerHandle,\r
194 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
195 );\r
196 if (EFI_ERROR (Status)) {\r
197 return Status;\r
198 }\r
199\r
200 MouseDev = PS2_MOUSE_DEV_FROM_THIS (SimplePointerProtocol);\r
201\r
202 return LookupUnicodeString (\r
203 Language,\r
204 gPs2MouseComponentName.SupportedLanguages,\r
205 MouseDev->ControllerNameTable,\r
206 ControllerName\r
207 );\r
208}\r