]>
Commit | Line | Data |
---|---|---|
90b24889 WF |
1 | /** @file\r |
2 | UEFI Component Name(2) protocol implementation for WiFi Connection Manager.\r | |
3 | \r | |
4 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
5 | \r | |
ecf98fbc | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
90b24889 WF |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #include "WifiConnectionMgrDxe.h"\r | |
11 | \r | |
12 | extern EFI_GUID mEfiWifiMgrPrivateGuid;\r | |
13 | \r | |
14 | ///\r | |
15 | /// Component Name Protocol instance\r | |
16 | ///\r | |
17 | GLOBAL_REMOVE_IF_UNREFERENCED\r | |
18 | EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName = {\r | |
19 | (EFI_COMPONENT_NAME_GET_DRIVER_NAME) WifiMgrDxeComponentNameGetDriverName,\r | |
20 | (EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) WifiMgrDxeComponentNameGetControllerName,\r | |
21 | "eng"\r | |
22 | };\r | |
23 | \r | |
24 | ///\r | |
25 | /// Component Name 2 Protocol instance\r | |
26 | ///\r | |
27 | GLOBAL_REMOVE_IF_UNREFERENCED\r | |
28 | EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2 = {\r | |
29 | WifiMgrDxeComponentNameGetDriverName,\r | |
30 | WifiMgrDxeComponentNameGetControllerName,\r | |
31 | "en"\r | |
32 | };\r | |
33 | \r | |
34 | ///\r | |
35 | /// Table of driver names\r | |
36 | ///\r | |
37 | GLOBAL_REMOVE_IF_UNREFERENCED\r | |
38 | EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable[] = {\r | |
39 | {\r | |
40 | "eng;en",\r | |
41 | L"UEFI WiFi Connection Manager"\r | |
42 | },\r | |
43 | {\r | |
44 | NULL,\r | |
45 | NULL\r | |
46 | }\r | |
47 | };\r | |
48 | \r | |
49 | ///\r | |
50 | /// Table of controller names\r | |
51 | ///\r | |
52 | GLOBAL_REMOVE_IF_UNREFERENCED\r | |
53 | EFI_UNICODE_STRING_TABLE mWifiMgrDxeControllerNameTable[] = {\r | |
54 | {\r | |
55 | "eng;en",\r | |
56 | L"UEFI WiFi Connection Manager Controller"\r | |
57 | },\r | |
58 | {\r | |
59 | NULL,\r | |
60 | NULL\r | |
61 | }\r | |
62 | };\r | |
63 | \r | |
64 | /**\r | |
65 | Retrieves a Unicode string that is the user-readable name of the EFI Driver.\r | |
66 | \r | |
67 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
68 | @param Language A pointer to a three-character ISO 639-2 language identifier.\r | |
69 | This is the language of the driver name that that the caller\r | |
70 | is requesting, and it must match one of the languages specified\r | |
71 | in SupportedLanguages. The number of languages supported by a\r | |
72 | driver is up to the driver writer.\r | |
73 | @param DriverName A pointer to the Unicode string to return. This Unicode string\r | |
74 | is the name of the driver specified by This in the language\r | |
75 | specified by Language.\r | |
76 | \r | |
77 | @retval EFI_SUCCESS The Unicode string for the Driver specified by This\r | |
78 | and the language specified by Language was returned\r | |
79 | in DriverName.\r | |
80 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
81 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
82 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
83 | language specified by Language.\r | |
84 | \r | |
85 | **/\r | |
86 | EFI_STATUS\r | |
87 | EFIAPI\r | |
88 | WifiMgrDxeComponentNameGetDriverName (\r | |
89 | IN EFI_COMPONENT_NAME2_PROTOCOL *This,\r | |
90 | IN CHAR8 *Language,\r | |
91 | OUT CHAR16 **DriverName\r | |
92 | )\r | |
93 | {\r | |
94 | return LookupUnicodeString2 (\r | |
95 | Language,\r | |
96 | This->SupportedLanguages,\r | |
97 | mWifiMgrDxeDriverNameTable,\r | |
98 | DriverName,\r | |
99 | (BOOLEAN)(This != &gWifiMgrDxeComponentName2)\r | |
100 | );\r | |
101 | }\r | |
102 | \r | |
103 | /**\r | |
104 | Retrieves a Unicode string that is the user readable name of the controller\r | |
105 | that is being managed by an EFI Driver.\r | |
106 | \r | |
107 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
108 | @param ControllerHandle The handle of a controller that the driver specified by\r | |
109 | This is managing. This handle specifies the controller\r | |
110 | whose name is to be returned.\r | |
111 | @param ChildHandle The handle of the child controller to retrieve the name\r | |
112 | of. This is an optional parameter that may be NULL. It\r | |
113 | will be NULL for device drivers. It will also be NULL\r | |
114 | for a bus drivers that wish to retrieve the name of the\r | |
115 | bus controller. It will not be NULL for a bus driver\r | |
116 | that wishes to retrieve the name of a child controller.\r | |
117 | @param Language A pointer to a three character ISO 639-2 language\r | |
118 | identifier. This is the language of the controller name\r | |
119 | that the caller is requesting, and it must match one\r | |
120 | of the languages specified in SupportedLanguages. The\r | |
121 | number of languages supported by a driver is up to the\r | |
122 | driver writer.\r | |
123 | @param ControllerName A pointer to the Unicode string to return. This Unicode\r | |
124 | string is the name of the controller specified by\r | |
125 | ControllerHandle and ChildHandle in the language specified\r | |
126 | by Language, from the point of view of the driver specified\r | |
127 | by This.\r | |
128 | \r | |
129 | @retval EFI_SUCCESS The Unicode string for the user-readable name in the\r | |
130 | language specified by Language for the driver\r | |
131 | specified by This was returned in DriverName.\r | |
132 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
133 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r | |
134 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
135 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
136 | @retval EFI_UNSUPPORTED The driver specified by This is not currently managing\r | |
137 | the controller specified by ControllerHandle and\r | |
138 | ChildHandle.\r | |
139 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
140 | language specified by Language.\r | |
141 | \r | |
142 | **/\r | |
143 | EFI_STATUS\r | |
144 | EFIAPI\r | |
145 | WifiMgrDxeComponentNameGetControllerName (\r | |
146 | IN EFI_COMPONENT_NAME2_PROTOCOL *This,\r | |
147 | IN EFI_HANDLE ControllerHandle,\r | |
148 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
149 | IN CHAR8 *Language,\r | |
150 | OUT CHAR16 **ControllerName\r | |
151 | )\r | |
152 | {\r | |
153 | EFI_STATUS Status;\r | |
154 | WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrPrivate;\r | |
155 | \r | |
156 | //\r | |
157 | // ChildHandle must be NULL for a Device Driver\r | |
158 | //\r | |
159 | if (ControllerHandle == NULL || ChildHandle != NULL) {\r | |
160 | return EFI_UNSUPPORTED;\r | |
161 | }\r | |
162 | \r | |
163 | //\r | |
164 | // Check Controller's handle\r | |
165 | //\r | |
166 | Status = gBS->OpenProtocol (\r | |
167 | ControllerHandle,\r | |
168 | &mEfiWifiMgrPrivateGuid,\r | |
169 | (VOID **) &WifiMgrPrivate,\r | |
170 | NULL,\r | |
171 | NULL,\r | |
172 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
173 | );\r | |
174 | if (EFI_ERROR (Status)) {\r | |
175 | return EFI_UNSUPPORTED;\r | |
176 | }\r | |
177 | \r | |
178 | return LookupUnicodeString2 (\r | |
179 | Language,\r | |
180 | This->SupportedLanguages,\r | |
181 | mWifiMgrDxeControllerNameTable,\r | |
182 | ControllerName,\r | |
183 | (BOOLEAN)(This != &gWifiMgrDxeComponentName2)\r | |
184 | );\r | |
185 | }\r |