]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrComponentName.c
NetworkPkg: Add WiFi Connection Manager to NetworkPkg
[mirror_edk2.git] / NetworkPkg / WifiConnectionManagerDxe / WifiConnectionMgrComponentName.c
1 /** @file
2 UEFI Component Name(2) protocol implementation for WiFi Connection Manager.
3
4 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5
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.
10
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.
13
14 **/
15
16 #include "WifiConnectionMgrDxe.h"
17
18 extern EFI_GUID mEfiWifiMgrPrivateGuid;
19
20 ///
21 /// Component Name Protocol instance
22 ///
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,
27 "eng"
28 };
29
30 ///
31 /// Component Name 2 Protocol instance
32 ///
33 GLOBAL_REMOVE_IF_UNREFERENCED
34 EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2 = {
35 WifiMgrDxeComponentNameGetDriverName,
36 WifiMgrDxeComponentNameGetControllerName,
37 "en"
38 };
39
40 ///
41 /// Table of driver names
42 ///
43 GLOBAL_REMOVE_IF_UNREFERENCED
44 EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable[] = {
45 {
46 "eng;en",
47 L"UEFI WiFi Connection Manager"
48 },
49 {
50 NULL,
51 NULL
52 }
53 };
54
55 ///
56 /// Table of controller names
57 ///
58 GLOBAL_REMOVE_IF_UNREFERENCED
59 EFI_UNICODE_STRING_TABLE mWifiMgrDxeControllerNameTable[] = {
60 {
61 "eng;en",
62 L"UEFI WiFi Connection Manager Controller"
63 },
64 {
65 NULL,
66 NULL
67 }
68 };
69
70 /**
71 Retrieves a Unicode string that is the user-readable name of the EFI Driver.
72
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.
82
83 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
84 and the language specified by Language was returned
85 in DriverName.
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.
90
91 **/
92 EFI_STATUS
93 EFIAPI
94 WifiMgrDxeComponentNameGetDriverName (
95 IN EFI_COMPONENT_NAME2_PROTOCOL *This,
96 IN CHAR8 *Language,
97 OUT CHAR16 **DriverName
98 )
99 {
100 return LookupUnicodeString2 (
101 Language,
102 This->SupportedLanguages,
103 mWifiMgrDxeDriverNameTable,
104 DriverName,
105 (BOOLEAN)(This != &gWifiMgrDxeComponentName2)
106 );
107 }
108
109 /**
110 Retrieves a Unicode string that is the user readable name of the controller
111 that is being managed by an EFI Driver.
112
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
128 driver writer.
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
133 by This.
134
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
144 ChildHandle.
145 @retval EFI_UNSUPPORTED The driver specified by This does not support the
146 language specified by Language.
147
148 **/
149 EFI_STATUS
150 EFIAPI
151 WifiMgrDxeComponentNameGetControllerName (
152 IN EFI_COMPONENT_NAME2_PROTOCOL *This,
153 IN EFI_HANDLE ControllerHandle,
154 IN EFI_HANDLE ChildHandle OPTIONAL,
155 IN CHAR8 *Language,
156 OUT CHAR16 **ControllerName
157 )
158 {
159 EFI_STATUS Status;
160 WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrPrivate;
161
162 //
163 // ChildHandle must be NULL for a Device Driver
164 //
165 if (ControllerHandle == NULL || ChildHandle != NULL) {
166 return EFI_UNSUPPORTED;
167 }
168
169 //
170 // Check Controller's handle
171 //
172 Status = gBS->OpenProtocol (
173 ControllerHandle,
174 &mEfiWifiMgrPrivateGuid,
175 (VOID **) &WifiMgrPrivate,
176 NULL,
177 NULL,
178 EFI_OPEN_PROTOCOL_GET_PROTOCOL
179 );
180 if (EFI_ERROR (Status)) {
181 return EFI_UNSUPPORTED;
182 }
183
184 return LookupUnicodeString2 (
185 Language,
186 This->SupportedLanguages,
187 mWifiMgrDxeControllerNameTable,
188 ControllerName,
189 (BOOLEAN)(This != &gWifiMgrDxeComponentName2)
190 );
191 }