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