]>
Commit | Line | Data |
---|---|---|
10dc8c56 AC |
1 | /** @file\r |
2 | Implementation of EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PROTOCOL\r | |
3 | protocol.\r | |
4 | \r | |
5 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
6 | (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>\r | |
7 | \r | |
8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
9 | \r | |
10 | **/\r | |
11 | #include <Uefi.h>\r | |
12 | \r | |
13 | #include <Library/UefiLib.h>\r | |
14 | \r | |
15 | #include <Protocol/ComponentName.h>\r | |
16 | #include <Protocol/ComponentName2.h>\r | |
17 | \r | |
18 | //\r | |
19 | // EFI Component Name Functions\r | |
20 | //\r | |
39de741e | 21 | \r |
10dc8c56 AC |
22 | /**\r |
23 | Retrieves a Unicode string that is the user-readable name of the EFI Driver.\r | |
24 | \r | |
25 | @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
26 | @param[in] Language A pointer to a three-character ISO 639-2 language identifier.\r | |
27 | This is the language of the driver name that that the caller\r | |
28 | is requesting, and it must match one of the languages specified\r | |
29 | in SupportedLanguages. The number of languages supported by a\r | |
30 | driver is up to the driver writer.\r | |
31 | @param[out] DriverName A pointer to the Unicode string to return. This Unicode string\r | |
32 | is the name of the driver specified by This in the language\r | |
33 | specified by Language.\r | |
34 | \r | |
35 | @retval EFI_SUCCESS The Unicode string for the Driver specified by This\r | |
36 | and the language specified by Language was returned\r | |
37 | in DriverName.\r | |
38 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
39 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
40 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
41 | language specified by Language.\r | |
42 | \r | |
43 | **/\r | |
44 | EFI_STATUS\r | |
45 | EFIAPI\r | |
46 | RedfishRestExComponentNameGetDriverName (\r | |
47 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
48 | IN CHAR8 *Language,\r | |
49 | OUT CHAR16 **DriverName\r | |
50 | );\r | |
51 | \r | |
52 | /**\r | |
53 | Retrieves a Unicode string that is the user readable name of the controller\r | |
54 | that is being managed by an EFI Driver.\r | |
55 | \r | |
56 | @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
57 | @param[in] ControllerHandle The handle of a controller that the driver specified by\r | |
58 | This is managing. This handle specifies the controller\r | |
59 | whose name is to be returned.\r | |
60 | @param[in] ChildHandle The handle of the child controller to retrieve the name\r | |
61 | of. This is an optional parameter that may be NULL. It\r | |
62 | will be NULL for device drivers. It will also be NULL\r | |
63 | for a bus drivers that wish to retrieve the name of the\r | |
64 | bus controller. It will not be NULL for a bus driver\r | |
65 | that wishes to retrieve the name of a child controller.\r | |
66 | @param[in] Language A pointer to a three character ISO 639-2 language\r | |
67 | identifier. This is the language of the controller name\r | |
68 | that the caller is requesting, and it must match one\r | |
69 | of the languages specified in SupportedLanguages. The\r | |
70 | number of languages supported by a driver is up to the\r | |
71 | driver writer.\r | |
72 | @param[out] ControllerName A pointer to the Unicode string to return. This Unicode\r | |
73 | string is the name of the controller specified by\r | |
74 | ControllerHandle and ChildHandle in the language specified\r | |
75 | by Language, from the point of view of the driver specified\r | |
76 | by This.\r | |
77 | \r | |
78 | @retval EFI_SUCCESS The Unicode string for the user-readable name in the\r | |
79 | language specified by Language for the driver\r | |
80 | specified by This was returned in DriverName.\r | |
81 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
82 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r | |
83 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
84 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
85 | @retval EFI_UNSUPPORTED The driver specified by This is not currently managing\r | |
86 | the controller specified by ControllerHandle and\r | |
87 | ChildHandle.\r | |
88 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
89 | language specified by Language.\r | |
90 | \r | |
91 | **/\r | |
92 | EFI_STATUS\r | |
93 | EFIAPI\r | |
94 | RedfishRestExComponentNameGetControllerName (\r | |
95 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
39de741e MK |
96 | IN EFI_HANDLE ControllerHandle,\r |
97 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
98 | IN CHAR8 *Language,\r | |
99 | OUT CHAR16 **ControllerName\r | |
10dc8c56 AC |
100 | );\r |
101 | \r | |
102 | ///\r | |
103 | /// Component Name Protocol instance\r | |
104 | ///\r | |
105 | GLOBAL_REMOVE_IF_UNREFERENCED\r | |
106 | EFI_COMPONENT_NAME_PROTOCOL gRedfishRestExComponentName = {\r | |
107 | RedfishRestExComponentNameGetDriverName,\r | |
108 | RedfishRestExComponentNameGetControllerName,\r | |
109 | "eng"\r | |
110 | };\r | |
111 | \r | |
112 | ///\r | |
113 | /// Component Name 2 Protocol instance\r | |
114 | ///\r | |
115 | GLOBAL_REMOVE_IF_UNREFERENCED\r | |
116 | EFI_COMPONENT_NAME2_PROTOCOL gRedfishRestExComponentName2 = {\r | |
39de741e MK |
117 | (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)RedfishRestExComponentNameGetDriverName,\r |
118 | (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)RedfishRestExComponentNameGetControllerName,\r | |
10dc8c56 AC |
119 | "en"\r |
120 | };\r | |
121 | \r | |
122 | ///\r | |
123 | /// Table of driver names\r | |
124 | ///\r | |
125 | GLOBAL_REMOVE_IF_UNREFERENCED\r | |
39de741e | 126 | EFI_UNICODE_STRING_TABLE mRedfishRestExDriverNameTable[] = {\r |
10dc8c56 | 127 | { "eng;en", (CHAR16 *)L"Redfish RestEx Network Service Driver" },\r |
39de741e | 128 | { NULL, NULL }\r |
10dc8c56 AC |
129 | };\r |
130 | \r | |
39de741e | 131 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gRedfishRestExControllerNameTable = NULL;\r |
10dc8c56 AC |
132 | \r |
133 | /**\r | |
134 | Retrieves a Unicode string that is the user-readable name of the EFI Driver.\r | |
135 | \r | |
136 | @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
137 | @param[in] Language A pointer to a three-character ISO 639-2 language identifier.\r | |
138 | This is the language of the driver name that that the caller\r | |
139 | is requesting, and it must match one of the languages specified\r | |
140 | in SupportedLanguages. The number of languages supported by a\r | |
141 | driver is up to the driver writer.\r | |
142 | @param[out] DriverName A pointer to the Unicode string to return. This Unicode string\r | |
143 | is the name of the driver specified by This in the language\r | |
144 | specified by Language.\r | |
145 | \r | |
146 | @retval EFI_SUCCESS The Unicode string for the Driver specified by This\r | |
147 | and the language specified by Language was returned\r | |
148 | in DriverName.\r | |
149 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
150 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
151 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
152 | language specified by Language.\r | |
153 | \r | |
154 | **/\r | |
155 | EFI_STATUS\r | |
156 | EFIAPI\r | |
157 | RedfishRestExComponentNameGetDriverName (\r | |
158 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
159 | IN CHAR8 *Language,\r | |
160 | OUT CHAR16 **DriverName\r | |
161 | )\r | |
162 | {\r | |
163 | return LookupUnicodeString2 (\r | |
164 | Language,\r | |
165 | This->SupportedLanguages,\r | |
166 | mRedfishRestExDriverNameTable,\r | |
167 | DriverName,\r | |
168 | (BOOLEAN)(This == &gRedfishRestExComponentName)\r | |
169 | );\r | |
170 | }\r | |
171 | \r | |
172 | /**\r | |
173 | Retrieves a Unicode string that is the user readable name of the controller\r | |
174 | that is being managed by an EFI Driver.\r | |
175 | \r | |
176 | @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
177 | @param[in] ControllerHandle The handle of a controller that the driver specified by\r | |
178 | This is managing. This handle specifies the controller\r | |
179 | whose name is to be returned.\r | |
180 | @param[in] ChildHandle The handle of the child controller to retrieve the name\r | |
181 | of. This is an optional parameter that may be NULL. It\r | |
182 | will be NULL for device drivers. It will also be NULL\r | |
183 | for a bus drivers that wish to retrieve the name of the\r | |
184 | bus controller. It will not be NULL for a bus driver\r | |
185 | that wishes to retrieve the name of a child controller.\r | |
186 | @param[in] Language A pointer to a three character ISO 639-2 language\r | |
187 | identifier. This is the language of the controller name\r | |
188 | that the caller is requesting, and it must match one\r | |
189 | of the languages specified in SupportedLanguages. The\r | |
190 | number of languages supported by a driver is up to the\r | |
191 | driver writer.\r | |
192 | @param[out] ControllerName A pointer to the Unicode string to return. This Unicode\r | |
193 | string is the name of the controller specified by\r | |
194 | ControllerHandle and ChildHandle in the language specified\r | |
195 | by Language, from the point of view of the driver specified\r | |
196 | by This.\r | |
197 | \r | |
198 | @retval EFI_SUCCESS The Unicode string for the user-readable name in the\r | |
199 | language specified by Language for the driver\r | |
200 | specified by This was returned in DriverName.\r | |
201 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
202 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r | |
203 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
204 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
205 | @retval EFI_UNSUPPORTED The driver specified by This is not currently managing\r | |
206 | the controller specified by ControllerHandle and\r | |
207 | ChildHandle.\r | |
208 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
209 | language specified by Language.\r | |
210 | \r | |
211 | **/\r | |
212 | EFI_STATUS\r | |
213 | EFIAPI\r | |
214 | RedfishRestExComponentNameGetControllerName (\r | |
215 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
39de741e MK |
216 | IN EFI_HANDLE ControllerHandle,\r |
217 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
218 | IN CHAR8 *Language,\r | |
219 | OUT CHAR16 **ControllerName\r | |
10dc8c56 AC |
220 | )\r |
221 | {\r | |
222 | return EFI_UNSUPPORTED;\r | |
223 | }\r |