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