2 UEFI Component Name(2) protocol implementation for WiFi Connection Manager.
4 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "WifiConnectionMgrDxe.h"
12 extern EFI_GUID mEfiWifiMgrPrivateGuid
;
15 /// Component Name Protocol instance
17 GLOBAL_REMOVE_IF_UNREFERENCED
18 EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName
= {
19 (EFI_COMPONENT_NAME_GET_DRIVER_NAME
) WifiMgrDxeComponentNameGetDriverName
,
20 (EFI_COMPONENT_NAME_GET_CONTROLLER_NAME
) WifiMgrDxeComponentNameGetControllerName
,
25 /// Component Name 2 Protocol instance
27 GLOBAL_REMOVE_IF_UNREFERENCED
28 EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2
= {
29 WifiMgrDxeComponentNameGetDriverName
,
30 WifiMgrDxeComponentNameGetControllerName
,
35 /// Table of driver names
37 GLOBAL_REMOVE_IF_UNREFERENCED
38 EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable
[] = {
41 L
"UEFI WiFi Connection Manager"
50 /// Table of controller names
52 GLOBAL_REMOVE_IF_UNREFERENCED
53 EFI_UNICODE_STRING_TABLE mWifiMgrDxeControllerNameTable
[] = {
56 L
"UEFI WiFi Connection Manager Controller"
65 Retrieves a Unicode string that is the user-readable name of the EFI Driver.
67 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
68 @param Language A pointer to a three-character ISO 639-2 language identifier.
69 This is the language of the driver name that that the caller
70 is requesting, and it must match one of the languages specified
71 in SupportedLanguages. The number of languages supported by a
72 driver is up to the driver writer.
73 @param DriverName A pointer to the Unicode string to return. This Unicode string
74 is the name of the driver specified by This in the language
75 specified by Language.
77 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
78 and the language specified by Language was returned
80 @retval EFI_INVALID_PARAMETER Language is NULL.
81 @retval EFI_INVALID_PARAMETER DriverName is NULL.
82 @retval EFI_UNSUPPORTED The driver specified by This does not support the
83 language specified by Language.
88 WifiMgrDxeComponentNameGetDriverName (
89 IN EFI_COMPONENT_NAME2_PROTOCOL
*This
,
91 OUT CHAR16
**DriverName
94 return LookupUnicodeString2 (
96 This
->SupportedLanguages
,
97 mWifiMgrDxeDriverNameTable
,
99 (BOOLEAN
)(This
!= &gWifiMgrDxeComponentName2
)
104 Retrieves a Unicode string that is the user readable name of the controller
105 that is being managed by an EFI Driver.
107 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
108 @param ControllerHandle The handle of a controller that the driver specified by
109 This is managing. This handle specifies the controller
110 whose name is to be returned.
111 @param ChildHandle The handle of the child controller to retrieve the name
112 of. This is an optional parameter that may be NULL. It
113 will be NULL for device drivers. It will also be NULL
114 for a bus drivers that wish to retrieve the name of the
115 bus controller. It will not be NULL for a bus driver
116 that wishes to retrieve the name of a child controller.
117 @param Language A pointer to a three character ISO 639-2 language
118 identifier. This is the language of the controller name
119 that the caller is requesting, and it must match one
120 of the languages specified in SupportedLanguages. The
121 number of languages supported by a driver is up to the
123 @param ControllerName A pointer to the Unicode string to return. This Unicode
124 string is the name of the controller specified by
125 ControllerHandle and ChildHandle in the language specified
126 by Language, from the point of view of the driver specified
129 @retval EFI_SUCCESS The Unicode string for the user-readable name in the
130 language specified by Language for the driver
131 specified by This was returned in DriverName.
132 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
133 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
134 @retval EFI_INVALID_PARAMETER Language is NULL.
135 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
136 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
137 the controller specified by ControllerHandle and
139 @retval EFI_UNSUPPORTED The driver specified by This does not support the
140 language specified by Language.
145 WifiMgrDxeComponentNameGetControllerName (
146 IN EFI_COMPONENT_NAME2_PROTOCOL
*This
,
147 IN EFI_HANDLE ControllerHandle
,
148 IN EFI_HANDLE ChildHandle OPTIONAL
,
150 OUT CHAR16
**ControllerName
154 WIFI_MGR_PRIVATE_PROTOCOL
*WifiMgrPrivate
;
157 // ChildHandle must be NULL for a Device Driver
159 if (ControllerHandle
== NULL
|| ChildHandle
!= NULL
) {
160 return EFI_UNSUPPORTED
;
164 // Check Controller's handle
166 Status
= gBS
->OpenProtocol (
168 &mEfiWifiMgrPrivateGuid
,
169 (VOID
**) &WifiMgrPrivate
,
172 EFI_OPEN_PROTOCOL_GET_PROTOCOL
174 if (EFI_ERROR (Status
)) {
175 return EFI_UNSUPPORTED
;
178 return LookupUnicodeString2 (
180 This
->SupportedLanguages
,
181 mWifiMgrDxeControllerNameTable
,
183 (BOOLEAN
)(This
!= &gWifiMgrDxeComponentName2
)