]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Tcp4Dxe/ComponentName.c
Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is valid...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / ComponentName.c
CommitLineData
8a67d61d 1/** @file\r
dab714aa 2 UEFI Component Name(2) protocol implementation for Tcp4Dxe driver.\r
8a67d61d 3\r
284ee2e8 4Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5This program and the accompanying materials\r
8a67d61d 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
dfc1f033 8http://opensource.org/licenses/bsd-license.php<BR>\r
8a67d61d 9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
8a67d61d 13**/\r
14\r
15#include "Tcp4Main.h"\r
16\r
83cbd279 17/**\r
18 Retrieves a Unicode string that is the user readable name of the driver.\r
19\r
20 This function retrieves the user readable name of a driver in the form of a\r
21 Unicode string. If the driver specified by This has a user readable name in\r
22 the language specified by Language, then a pointer to the driver name is\r
23 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
24 by This does not support the language specified by Language,\r
25 then EFI_UNSUPPORTED is returned.\r
26\r
dfc1f033 27 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
83cbd279 28 EFI_COMPONENT_NAME_PROTOCOL instance.\r
29\r
dfc1f033 30 @param[in] Language A pointer to a Null-terminated ASCII string\r
83cbd279 31 array indicating the language. This is the\r
32 language of the driver name that the caller is\r
33 requesting, and it must match one of the\r
34 languages specified in SupportedLanguages. The\r
35 number of languages supported by a driver is up\r
36 to the driver writer. Language is specified\r
0254efc0 37 in RFC 4646 or ISO 639-2 language code format.\r
83cbd279 38\r
dfc1f033 39 @param[out] DriverName A pointer to the Unicode string to return.\r
83cbd279 40 This Unicode string is the name of the\r
41 driver specified by This in the language\r
42 specified by Language.\r
43\r
44 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
45 This and the language specified by Language was\r
46 returned in DriverName.\r
47\r
48 @retval EFI_INVALID_PARAMETER Language is NULL.\r
49\r
50 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
51\r
52 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
53 the language specified by Language.\r
54\r
55**/\r
8a67d61d 56EFI_STATUS\r
57EFIAPI\r
58TcpComponentNameGetDriverName (\r
dfc1f033 59 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
60 IN CHAR8 *Language,\r
61 OUT CHAR16 **DriverName\r
8a67d61d 62 );\r
63\r
83cbd279 64\r
65/**\r
66 Retrieves a Unicode string that is the user readable name of the controller\r
67 that is being managed by a driver.\r
68\r
69 This function retrieves the user readable name of the controller specified by\r
70 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
71 driver specified by This has a user readable name in the language specified by\r
72 Language, then a pointer to the controller name is returned in ControllerName,\r
73 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
74 managing the controller specified by ControllerHandle and ChildHandle,\r
75 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
76 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
77\r
dfc1f033 78 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
83cbd279 79 EFI_COMPONENT_NAME_PROTOCOL instance.\r
80\r
dfc1f033 81 @param[in] ControllerHandle The handle of a controller that the driver\r
83cbd279 82 specified by This is managing. This handle\r
83 specifies the controller whose name is to be\r
84 returned.\r
85\r
dfc1f033 86 @param[in] ChildHandle The handle of the child controller to retrieve\r
83cbd279 87 the name of. This is an optional parameter that\r
88 may be NULL. It will be NULL for device\r
89 drivers. It will also be NULL for a bus drivers\r
90 that wish to retrieve the name of the bus\r
91 controller. It will not be NULL for a bus\r
92 driver that wishes to retrieve the name of a\r
93 child controller.\r
94\r
dfc1f033 95 @param[in] Language A pointer to a Null-terminated ASCII string\r
83cbd279 96 array indicating the language. This is the\r
97 language of the driver name that the caller is\r
98 requesting, and it must match one of the\r
99 languages specified in SupportedLanguages. The\r
100 number of languages supported by a driver is up\r
101 to the driver writer. Language is specified in\r
0254efc0 102 RFC 4646 or ISO 639-2 language code format.\r
83cbd279 103\r
dfc1f033 104 @param[out] ControllerName A pointer to the Unicode string to return.\r
83cbd279 105 This Unicode string is the name of the\r
106 controller specified by ControllerHandle and\r
107 ChildHandle in the language specified by\r
108 Language from the point of view of the driver\r
109 specified by This.\r
110\r
111 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
112 the language specified by Language for the\r
113 driver specified by This was returned in\r
114 DriverName.\r
115\r
284ee2e8 116 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
83cbd279 117\r
118 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
119 EFI_HANDLE.\r
120\r
121 @retval EFI_INVALID_PARAMETER Language is NULL.\r
122\r
123 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
124\r
125 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
126 managing the controller specified by\r
127 ControllerHandle and ChildHandle.\r
128\r
129 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
130 the language specified by Language.\r
131\r
132**/\r
8a67d61d 133EFI_STATUS\r
134EFIAPI\r
135TcpComponentNameGetControllerName (\r
dfc1f033 136 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
137 IN EFI_HANDLE ControllerHandle,\r
138 IN EFI_HANDLE ChildHandle OPTIONAL,\r
139 IN CHAR8 *Language,\r
140 OUT CHAR16 **ControllerName\r
8a67d61d 141 );\r
142\r
83cbd279 143\r
dfc1f033 144///\r
145/// EFI Component Name Protocol\r
146///\r
1307dcd7 147GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gTcp4ComponentName = {\r
8a67d61d 148 TcpComponentNameGetDriverName,\r
149 TcpComponentNameGetControllerName,\r
150 "eng"\r
1307dcd7 151};\r
83cbd279 152\r
dfc1f033 153///\r
154/// EFI Component Name 2 Protocol\r
155///\r
1307dcd7 156GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gTcp4ComponentName2 = {\r
83cbd279 157 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) TcpComponentNameGetDriverName,\r
158 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) TcpComponentNameGetControllerName,\r
159 "en"\r
1307dcd7 160};\r
83cbd279 161\r
8a67d61d 162\r
d1aeb0bd 163GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mTcpDriverNameTable[] = {\r
8a67d61d 164 {\r
83cbd279 165 "eng;en",\r
8a67d61d 166 L"Tcp Network Service Driver"\r
167 },\r
168 {\r
169 NULL,\r
170 NULL\r
171 }\r
172};\r
173\r
83cbd279 174/**\r
175 Retrieves a Unicode string that is the user readable name of the driver.\r
176\r
177 This function retrieves the user readable name of a driver in the form of a\r
178 Unicode string. If the driver specified by This has a user readable name in\r
179 the language specified by Language, then a pointer to the driver name is\r
180 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
181 by This does not support the language specified by Language,\r
182 then EFI_UNSUPPORTED is returned.\r
183\r
dfc1f033 184 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
83cbd279 185 EFI_COMPONENT_NAME_PROTOCOL instance.\r
186\r
dfc1f033 187 @param[in] Language A pointer to a Null-terminated ASCII string\r
83cbd279 188 array indicating the language. This is the\r
189 language of the driver name that the caller is\r
190 requesting, and it must match one of the\r
191 languages specified in SupportedLanguages. The\r
192 number of languages supported by a driver is up\r
193 to the driver writer. Language is specified\r
0254efc0 194 in RFC 4646 or ISO 639-2 language code format.\r
83cbd279 195\r
dfc1f033 196 @param[out] DriverName A pointer to the Unicode string to return.\r
83cbd279 197 This Unicode string is the name of the\r
198 driver specified by This in the language\r
199 specified by Language.\r
200\r
201 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
202 This and the language specified by Language was\r
203 returned in DriverName.\r
204\r
205 @retval EFI_INVALID_PARAMETER Language is NULL.\r
206\r
207 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
208\r
209 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
210 the language specified by Language.\r
211\r
212**/\r
8a67d61d 213EFI_STATUS\r
214EFIAPI\r
215TcpComponentNameGetDriverName (\r
dfc1f033 216 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
217 IN CHAR8 *Language,\r
218 OUT CHAR16 **DriverName\r
8a67d61d 219 )\r
83cbd279 220{\r
221 return LookupUnicodeString2 (\r
222 Language,\r
223 This->SupportedLanguages,\r
224 mTcpDriverNameTable,\r
225 DriverName,\r
77f00155 226 (BOOLEAN) (This == &gTcp4ComponentName)\r
83cbd279 227 );\r
228}\r
8a67d61d 229\r
83cbd279 230/**\r
231 Retrieves a Unicode string that is the user readable name of the controller\r
232 that is being managed by a driver.\r
8a67d61d 233\r
83cbd279 234 This function retrieves the user readable name of the controller specified by\r
235 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
236 driver specified by This has a user readable name in the language specified by\r
237 Language, then a pointer to the controller name is returned in ControllerName,\r
238 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
239 managing the controller specified by ControllerHandle and ChildHandle,\r
240 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
241 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
8a67d61d 242\r
dfc1f033 243 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
83cbd279 244 EFI_COMPONENT_NAME_PROTOCOL instance.\r
8a67d61d 245\r
dfc1f033 246 @param[in] ControllerHandle The handle of a controller that the driver\r
83cbd279 247 specified by This is managing. This handle\r
248 specifies the controller whose name is to be\r
249 returned.\r
8a67d61d 250\r
dfc1f033 251 @param[in] ChildHandle The handle of the child controller to retrieve\r
83cbd279 252 the name of. This is an optional parameter that\r
253 may be NULL. It will be NULL for device\r
254 drivers. It will also be NULL for a bus drivers\r
255 that wish to retrieve the name of the bus\r
256 controller. It will not be NULL for a bus\r
257 driver that wishes to retrieve the name of a\r
258 child controller.\r
8a67d61d 259\r
dfc1f033 260 @param[in] Language A pointer to a Null-terminated ASCII string\r
83cbd279 261 array indicating the language. This is the\r
262 language of the driver name that the caller is\r
263 requesting, and it must match one of the\r
264 languages specified in SupportedLanguages. The\r
265 number of languages supported by a driver is up\r
266 to the driver writer. Language is specified in\r
0254efc0 267 RFC 4646 or ISO 639-2 language code format.\r
8a67d61d 268\r
dfc1f033 269 @param[out] ControllerName A pointer to the Unicode string to return.\r
83cbd279 270 This Unicode string is the name of the\r
271 controller specified by ControllerHandle and\r
272 ChildHandle in the language specified by\r
273 Language from the point of view of the driver\r
274 specified by This.\r
275\r
276 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
277 the language specified by Language for the\r
278 driver specified by This was returned in\r
279 DriverName.\r
280\r
284ee2e8 281 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
83cbd279 282\r
283 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
284 EFI_HANDLE.\r
285\r
286 @retval EFI_INVALID_PARAMETER Language is NULL.\r
287\r
288 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
289\r
290 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
291 managing the controller specified by\r
292 ControllerHandle and ChildHandle.\r
8a67d61d 293\r
83cbd279 294 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
295 the language specified by Language.\r
296\r
297**/\r
8a67d61d 298EFI_STATUS\r
299EFIAPI\r
300TcpComponentNameGetControllerName (\r
dfc1f033 301 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
302 IN EFI_HANDLE ControllerHandle,\r
303 IN EFI_HANDLE ChildHandle OPTIONAL,\r
304 IN CHAR8 *Language,\r
305 OUT CHAR16 **ControllerName\r
8a67d61d 306 )\r
8a67d61d 307{\r
308 return EFI_UNSUPPORTED;\r
309}\r