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 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #include "WifiConnectionMgrDxe.h"
|
---|
11 |
|
---|
12 | extern EFI_GUID mEfiWifiMgrPrivateGuid;
|
---|
13 |
|
---|
14 | ///
|
---|
15 | /// Component Name Protocol instance
|
---|
16 | ///
|
---|
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,
|
---|
21 | "eng"
|
---|
22 | };
|
---|
23 |
|
---|
24 | ///
|
---|
25 | /// Component Name 2 Protocol instance
|
---|
26 | ///
|
---|
27 | GLOBAL_REMOVE_IF_UNREFERENCED
|
---|
28 | EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2 = {
|
---|
29 | WifiMgrDxeComponentNameGetDriverName,
|
---|
30 | WifiMgrDxeComponentNameGetControllerName,
|
---|
31 | "en"
|
---|
32 | };
|
---|
33 |
|
---|
34 | ///
|
---|
35 | /// Table of driver names
|
---|
36 | ///
|
---|
37 | GLOBAL_REMOVE_IF_UNREFERENCED
|
---|
38 | EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable[] = {
|
---|
39 | {
|
---|
40 | "eng;en",
|
---|
41 | L"UEFI WiFi Connection Manager"
|
---|
42 | },
|
---|
43 | {
|
---|
44 | NULL,
|
---|
45 | NULL
|
---|
46 | }
|
---|
47 | };
|
---|
48 |
|
---|
49 | ///
|
---|
50 | /// Table of controller names
|
---|
51 | ///
|
---|
52 | GLOBAL_REMOVE_IF_UNREFERENCED
|
---|
53 | EFI_UNICODE_STRING_TABLE mWifiMgrDxeControllerNameTable[] = {
|
---|
54 | {
|
---|
55 | "eng;en",
|
---|
56 | L"UEFI WiFi Connection Manager Controller"
|
---|
57 | },
|
---|
58 | {
|
---|
59 | NULL,
|
---|
60 | NULL
|
---|
61 | }
|
---|
62 | };
|
---|
63 |
|
---|
64 | /**
|
---|
65 | Retrieves a Unicode string that is the user-readable name of the EFI Driver.
|
---|
66 |
|
---|
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.
|
---|
76 |
|
---|
77 | @retval EFI_SUCCESS The Unicode string for the Driver specified by This
|
---|
78 | and the language specified by Language was returned
|
---|
79 | in DriverName.
|
---|
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.
|
---|
84 |
|
---|
85 | **/
|
---|
86 | EFI_STATUS
|
---|
87 | EFIAPI
|
---|
88 | WifiMgrDxeComponentNameGetDriverName (
|
---|
89 | IN EFI_COMPONENT_NAME2_PROTOCOL *This,
|
---|
90 | IN CHAR8 *Language,
|
---|
91 | OUT CHAR16 **DriverName
|
---|
92 | )
|
---|
93 | {
|
---|
94 | return LookupUnicodeString2 (
|
---|
95 | Language,
|
---|
96 | This->SupportedLanguages,
|
---|
97 | mWifiMgrDxeDriverNameTable,
|
---|
98 | DriverName,
|
---|
99 | (BOOLEAN)(This != &gWifiMgrDxeComponentName2)
|
---|
100 | );
|
---|
101 | }
|
---|
102 |
|
---|
103 | /**
|
---|
104 | Retrieves a Unicode string that is the user readable name of the controller
|
---|
105 | that is being managed by an EFI Driver.
|
---|
106 |
|
---|
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
|
---|
122 | driver writer.
|
---|
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
|
---|
127 | by This.
|
---|
128 |
|
---|
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
|
---|
138 | ChildHandle.
|
---|
139 | @retval EFI_UNSUPPORTED The driver specified by This does not support the
|
---|
140 | language specified by Language.
|
---|
141 |
|
---|
142 | **/
|
---|
143 | EFI_STATUS
|
---|
144 | EFIAPI
|
---|
145 | WifiMgrDxeComponentNameGetControllerName (
|
---|
146 | IN EFI_COMPONENT_NAME2_PROTOCOL *This,
|
---|
147 | IN EFI_HANDLE ControllerHandle,
|
---|
148 | IN EFI_HANDLE ChildHandle OPTIONAL,
|
---|
149 | IN CHAR8 *Language,
|
---|
150 | OUT CHAR16 **ControllerName
|
---|
151 | )
|
---|
152 | {
|
---|
153 | EFI_STATUS Status;
|
---|
154 | WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrPrivate;
|
---|
155 |
|
---|
156 | //
|
---|
157 | // ChildHandle must be NULL for a Device Driver
|
---|
158 | //
|
---|
159 | if (ControllerHandle == NULL || ChildHandle != NULL) {
|
---|
160 | return EFI_UNSUPPORTED;
|
---|
161 | }
|
---|
162 |
|
---|
163 | //
|
---|
164 | // Check Controller's handle
|
---|
165 | //
|
---|
166 | Status = gBS->OpenProtocol (
|
---|
167 | ControllerHandle,
|
---|
168 | &mEfiWifiMgrPrivateGuid,
|
---|
169 | (VOID **) &WifiMgrPrivate,
|
---|
170 | NULL,
|
---|
171 | NULL,
|
---|
172 | EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
---|
173 | );
|
---|
174 | if (EFI_ERROR (Status)) {
|
---|
175 | return EFI_UNSUPPORTED;
|
---|
176 | }
|
---|
177 |
|
---|
178 | return LookupUnicodeString2 (
|
---|
179 | Language,
|
---|
180 | This->SupportedLanguages,
|
---|
181 | mWifiMgrDxeControllerNameTable,
|
---|
182 | ControllerName,
|
---|
183 | (BOOLEAN)(This != &gWifiMgrDxeComponentName2)
|
---|
184 | );
|
---|
185 | }
|
---|