2 UEFI Component Name(2) protocol implementation for IPsec driver.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "IpSecImpl.h"
13 // EFI Component Name Functions
16 Retrieves a Unicode string that is the user-readable name of the driver.
18 This function retrieves the user-readable name of a driver in the form of a
19 Unicode string. If the driver specified by This has a user-readable name in
20 the language specified by Language, then a pointer to the driver name is
21 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
22 by This does not support the language specified by Language,
23 then EFI_UNSUPPORTED is returned.
25 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
26 EFI_COMPONENT_NAME_PROTOCOL instance.
28 @param[in] Language A pointer to a Null-terminated ASCII string
29 array indicating the language. This is the
30 language of the driver name that the caller is
31 requesting, and it must match one of the
32 languages specified in SupportedLanguages. The
33 number of languages supported by a driver is up
34 to the driver writer. Language is specified
35 in RFC 4646 or ISO 639-2 language code format.
37 @param[out] DriverName A pointer to the Unicode string to return.
38 This Unicode string is the name of the
39 driver specified by This in the language
40 specified by Language.
42 @retval EFI_SUCCESS The Unicode string for the Driver specified by
43 This and the language specified by Language was
44 returned in DriverName.
46 @retval EFI_INVALID_PARAMETER Language is NULL.
48 @retval EFI_INVALID_PARAMETER DriverName is NULL.
50 @retval EFI_UNSUPPORTED The driver specified by This does not support
51 the language specified by Language.
56 IpSecComponentNameGetDriverName (
57 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
59 OUT CHAR16
**DriverName
63 Retrieves a Unicode string that is the user-readable name of the controller
64 that is being managed by a driver.
66 This function retrieves the user-readable name of the controller specified by
67 ControllerHandle and ChildHandle in the form of a Unicode string. If the
68 driver specified by This has a user-readable name in the language specified by
69 Language, then a pointer to the controller name is returned in ControllerName,
70 and EFI_SUCCESS is returned. If the driver specified by This is not currently
71 managing the controller specified by ControllerHandle and ChildHandle,
72 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
73 support the language specified by Language, then EFI_UNSUPPORTED is returned.
75 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
76 EFI_COMPONENT_NAME_PROTOCOL instance.
78 @param[in] ControllerHandle The handle of a controller that the driver
79 specified by This is managing. This handle
80 specifies the controller whose name is to be
83 @param[in] ChildHandle The handle of the child controller to retrieve
84 the name of. This is an optional parameter that
85 may be NULL. It will be NULL for device
86 drivers. It will also be NULL for a bus drivers
87 that wish to retrieve the name of the bus
88 controller. It will not be NULL for a bus
89 driver that wishes to retrieve the name of a
92 @param[in] Language A pointer to a Null-terminated ASCII string
93 array indicating the language. This is the
94 language of the driver name that the caller is
95 requesting, and it must match one of the
96 languages specified in SupportedLanguages. The
97 number of languages supported by a driver is up
98 to the driver writer. Language is specified in
99 RFC 4646 or ISO 639-2 language code format.
101 @param[out] ControllerName A pointer to the Unicode string to return.
102 This Unicode string is the name of the
103 controller specified by ControllerHandle and
104 ChildHandle in the language specified by
105 Language from the point of view of the driver
108 @retval EFI_SUCCESS The Unicode string for the user-readable name in
109 the language specified by Language for the
110 driver specified by This was returned in
113 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
115 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
118 @retval EFI_INVALID_PARAMETER Language is NULL.
120 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
122 @retval EFI_UNSUPPORTED The driver specified by This is not currently
123 managing the controller specified by
124 ControllerHandle and ChildHandle.
126 @retval EFI_UNSUPPORTED The driver specified by This does not support
127 the language specified by Language.
132 IpSecComponentNameGetControllerName (
133 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
134 IN EFI_HANDLE ControllerHandle
,
135 IN EFI_HANDLE ChildHandle
, OPTIONAL
137 OUT CHAR16
**ControllerName
141 // EFI Component Name Protocol
143 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIpSecComponentName
= {
144 IpSecComponentNameGetDriverName
,
145 IpSecComponentNameGetControllerName
,
150 // EFI Component Name 2 Protocol
152 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIpSecComponentName2
= {
153 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) IpSecComponentNameGetDriverName
,
154 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) IpSecComponentNameGetControllerName
,
158 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIpSecDriverNameTable
[] = {
169 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIpSecControllerNameTable
[] = {
181 Retrieves a Unicode string that is the user-readable name of the driver.
183 This function retrieves the user-readable name of a driver in the form of a
184 Unicode string. If the driver specified by This has a user-readable name in
185 the language specified by Language, then a pointer to the driver name is
186 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
187 by This does not support the language specified by Language,
188 then EFI_UNSUPPORTED is returned.
190 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
191 EFI_COMPONENT_NAME_PROTOCOL instance.
193 @param[in] Language A pointer to a Null-terminated ASCII string
194 array indicating the language. This is the
195 language of the driver name that the caller is
196 requesting, and it must match one of the
197 languages specified in SupportedLanguages. The
198 number of languages supported by a driver is up
199 to the driver writer. Language is specified
200 in RFC 4646 or ISO 639-2 language code format.
202 @param[out] DriverName A pointer to the Unicode string to return.
203 This Unicode string is the name of the
204 driver specified by This in the language
205 specified by Language.
207 @retval EFI_SUCCESS The Unicode string for the Driver specified by
208 This, and the language specified by Language was
209 returned in DriverName.
211 @retval EFI_INVALID_PARAMETER Language is NULL.
213 @retval EFI_INVALID_PARAMETER DriverName is NULL.
215 @retval EFI_UNSUPPORTED The driver specified by This does not support
216 the language specified by Language.
221 IpSecComponentNameGetDriverName (
222 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
224 OUT CHAR16
**DriverName
227 return LookupUnicodeString2 (
229 This
->SupportedLanguages
,
230 mIpSecDriverNameTable
,
232 (BOOLEAN
) (This
== &gIpSecComponentName
)
237 Retrieves a Unicode string that is the user-readable name of the controller
238 that is being managed by a driver.
240 This function retrieves the user-readable name of the controller specified by
241 ControllerHandle and ChildHandle in the form of a Unicode string. If the
242 driver specified by This has a user-readable name in the language specified by
243 Language, then a pointer to the controller name is returned in ControllerName,
244 and EFI_SUCCESS is returned. If the driver specified by This is not currently
245 managing the controller specified by ControllerHandle and ChildHandle,
246 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
247 support the language specified by Language, then EFI_UNSUPPORTED is returned.
249 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
250 EFI_COMPONENT_NAME_PROTOCOL instance.
252 @param[in] ControllerHandle The handle of a controller that the driver
253 specified by This is managing. This handle
254 specifies the controller whose name is to be
257 @param[in] ChildHandle The handle of the child controller to retrieve
258 the name of. This is an optional parameter that
259 may be NULL. It will be NULL for device
260 drivers. It will also be NULL for a bus drivers
261 that wish to retrieve the name of the bus
262 controller. It will not be NULL for a bus
263 driver that wishes to retrieve the name of a
266 @param[in] Language A pointer to a Null-terminated ASCII string
267 array indicating the language. This is the
268 language of the driver name that the caller is
269 requesting, and it must match one of the
270 languages specified in SupportedLanguages. The
271 number of languages supported by a driver is up
272 to the driver writer. Language is specified in
273 RFC 4646 or ISO 639-2 language code format.
275 @param[out] ControllerName A pointer to the Unicode string to return.
276 This Unicode string is the name of the
277 controller specified by ControllerHandle and
278 ChildHandle in the language specified by
279 Language from the point of view of the driver
282 @retval EFI_SUCCESS The Unicode string for the user-readable name in
283 the language specified by Language for the
284 driver specified by This was returned in
287 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
289 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it is not a valid
292 @retval EFI_INVALID_PARAMETER Language is NULL.
294 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
296 @retval EFI_UNSUPPORTED The driver specified by This is not currently
297 managing the controller specified by
298 ControllerHandle and ChildHandle.
300 @retval EFI_UNSUPPORTED The driver specified by This does not support
301 the language specified by Language.
306 IpSecComponentNameGetControllerName (
307 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
308 IN EFI_HANDLE ControllerHandle
,
309 IN EFI_HANDLE ChildHandle
, OPTIONAL
311 OUT CHAR16
**ControllerName
317 // ChildHandle must be NULL for a Device Driver
319 if (ChildHandle
!= NULL
) {
320 return EFI_UNSUPPORTED
;
324 // Make sure this driver is currently managing ControllerHandle
326 Status
= gBS
->OpenProtocol (
328 &gEfiIpSec2ProtocolGuid
,
332 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
334 if (EFI_ERROR (Status
)) {
338 return LookupUnicodeString2 (
340 This
->SupportedLanguages
,
341 mIpSecControllerNameTable
,
343 (BOOLEAN
) (This
== &gIpSecComponentName
)