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