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