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