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