2 UEFI Component Name(2) protocol implementation for WiFi Connection Manager.
4 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "WifiConnectionMgrDxe.h"
18 extern EFI_GUID mEfiWifiMgrPrivateGuid
;
21 /// Component Name Protocol instance
23 GLOBAL_REMOVE_IF_UNREFERENCED
24 EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName
= {
25 (EFI_COMPONENT_NAME_GET_DRIVER_NAME
) WifiMgrDxeComponentNameGetDriverName
,
26 (EFI_COMPONENT_NAME_GET_CONTROLLER_NAME
) WifiMgrDxeComponentNameGetControllerName
,
31 /// Component Name 2 Protocol instance
33 GLOBAL_REMOVE_IF_UNREFERENCED
34 EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2
= {
35 WifiMgrDxeComponentNameGetDriverName
,
36 WifiMgrDxeComponentNameGetControllerName
,
41 /// Table of driver names
43 GLOBAL_REMOVE_IF_UNREFERENCED
44 EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable
[] = {
47 L
"UEFI WiFi Connection Manager"
56 /// Table of controller names
58 GLOBAL_REMOVE_IF_UNREFERENCED
59 EFI_UNICODE_STRING_TABLE mWifiMgrDxeControllerNameTable
[] = {
62 L
"UEFI WiFi Connection Manager Controller"
71 Retrieves a Unicode string that is the user-readable name of the EFI Driver.
73 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
74 @param Language A pointer to a three-character ISO 639-2 language identifier.
75 This is the language of the driver name that that the caller
76 is requesting, and it must match one of the languages specified
77 in SupportedLanguages. The number of languages supported by a
78 driver is up to the driver writer.
79 @param DriverName A pointer to the Unicode string to return. This Unicode string
80 is the name of the driver specified by This in the language
81 specified by Language.
83 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
84 and the language specified by Language was returned
86 @retval EFI_INVALID_PARAMETER Language is NULL.
87 @retval EFI_INVALID_PARAMETER DriverName is NULL.
88 @retval EFI_UNSUPPORTED The driver specified by This does not support the
89 language specified by Language.
94 WifiMgrDxeComponentNameGetDriverName (
95 IN EFI_COMPONENT_NAME2_PROTOCOL
*This
,
97 OUT CHAR16
**DriverName
100 return LookupUnicodeString2 (
102 This
->SupportedLanguages
,
103 mWifiMgrDxeDriverNameTable
,
105 (BOOLEAN
)(This
!= &gWifiMgrDxeComponentName2
)
110 Retrieves a Unicode string that is the user readable name of the controller
111 that is being managed by an EFI Driver.
113 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
114 @param ControllerHandle The handle of a controller that the driver specified by
115 This is managing. This handle specifies the controller
116 whose name is to be returned.
117 @param ChildHandle The handle of the child controller to retrieve the name
118 of. This is an optional parameter that may be NULL. It
119 will be NULL for device drivers. It will also be NULL
120 for a bus drivers that wish to retrieve the name of the
121 bus controller. It will not be NULL for a bus driver
122 that wishes to retrieve the name of a child controller.
123 @param Language A pointer to a three character ISO 639-2 language
124 identifier. This is the language of the controller name
125 that the caller is requesting, and it must match one
126 of the languages specified in SupportedLanguages. The
127 number of languages supported by a driver is up to the
129 @param ControllerName A pointer to the Unicode string to return. This Unicode
130 string is the name of the controller specified by
131 ControllerHandle and ChildHandle in the language specified
132 by Language, from the point of view of the driver specified
135 @retval EFI_SUCCESS The Unicode string for the user-readable name in the
136 language specified by Language for the driver
137 specified by This was returned in DriverName.
138 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
139 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
140 @retval EFI_INVALID_PARAMETER Language is NULL.
141 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
142 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
143 the controller specified by ControllerHandle and
145 @retval EFI_UNSUPPORTED The driver specified by This does not support the
146 language specified by Language.
151 WifiMgrDxeComponentNameGetControllerName (
152 IN EFI_COMPONENT_NAME2_PROTOCOL
*This
,
153 IN EFI_HANDLE ControllerHandle
,
154 IN EFI_HANDLE ChildHandle OPTIONAL
,
156 OUT CHAR16
**ControllerName
160 WIFI_MGR_PRIVATE_PROTOCOL
*WifiMgrPrivate
;
163 // ChildHandle must be NULL for a Device Driver
165 if (ControllerHandle
== NULL
|| ChildHandle
!= NULL
) {
166 return EFI_UNSUPPORTED
;
170 // Check Controller's handle
172 Status
= gBS
->OpenProtocol (
174 &mEfiWifiMgrPrivateGuid
,
175 (VOID
**) &WifiMgrPrivate
,
178 EFI_OPEN_PROTOCOL_GET_PROTOCOL
180 if (EFI_ERROR (Status
)) {
181 return EFI_UNSUPPORTED
;
184 return LookupUnicodeString2 (
186 This
->SupportedLanguages
,
187 mWifiMgrDxeControllerNameTable
,
189 (BOOLEAN
)(This
!= &gWifiMgrDxeComponentName2
)