]> git.proxmox.com Git - mirror_edk2.git/blob - RedfishPkg/RedfishDiscoverDxe/ComponentName.c
SecurityPkg: UefiSecureBoot: Definitions of cert and payload structures
[mirror_edk2.git] / RedfishPkg / RedfishDiscoverDxe / ComponentName.c
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 /**
18 Retrieves a Unicode string that is the user-readable name of the EFI Driver.
19
20 @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
21 @param[in] Language A pointer to a three-character ISO 639-2 language identifier.
22 This is the language of the driver name that that the caller
23 is requesting, and it must match one of the languages specified
24 in SupportedLanguages. The number of languages supported by a
25 driver is up to the driver writer.
26 @param[out] DriverName A pointer to the Unicode string to return. This Unicode string
27 is the name of the driver specified by This in the language
28 specified by Language.
29
30 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
31 and the language specified by Language was returned
32 in DriverName.
33 @retval EFI_INVALID_PARAMETER Language is NULL.
34 @retval EFI_INVALID_PARAMETER DriverName is NULL.
35 @retval EFI_UNSUPPORTED The driver specified by This does not support the
36 language specified by Language.
37
38 **/
39 EFI_STATUS
40 EFIAPI
41 RedfishDiscoverComponentNameGetDriverName (
42 IN EFI_COMPONENT_NAME_PROTOCOL *This,
43 IN CHAR8 *Language,
44 OUT CHAR16 **DriverName
45 );
46
47 /**
48 Retrieves a Unicode string that is the user readable name of the controller
49 that is being managed by an EFI Driver.
50
51 @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
52 @param[in] ControllerHandle The handle of a controller that the driver specified by
53 This is managing. This handle specifies the controller
54 whose name is to be returned.
55 @param[in] ChildHandle The handle of the child controller to retrieve the name
56 of. This is an optional parameter that may be NULL. It
57 will be NULL for device drivers. It will also be NULL
58 for a bus drivers that wish to retrieve the name of the
59 bus controller. It will not be NULL for a bus driver
60 that wishes to retrieve the name of a child controller.
61 @param[in] Language A pointer to a three character ISO 639-2 language
62 identifier. This is the language of the controller name
63 that the caller is requesting, and it must match one
64 of the languages specified in SupportedLanguages. The
65 number of languages supported by a driver is up to the
66 driver writer.
67 @param[out] ControllerName A pointer to the Unicode string to return. This Unicode
68 string is the name of the controller specified by
69 ControllerHandle and ChildHandle in the language specified
70 by Language, from the point of view of the driver specified
71 by This.
72
73 @retval EFI_SUCCESS The Unicode string for the user-readable name in the
74 language specified by Language for the driver
75 specified by This was returned in DriverName.
76 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
77 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
78 @retval EFI_INVALID_PARAMETER Language is NULL.
79 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
80 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
81 the controller specified by ControllerHandle and
82 ChildHandle.
83 @retval EFI_UNSUPPORTED The driver specified by This does not support the
84 language specified by Language.
85
86 **/
87 EFI_STATUS
88 EFIAPI
89 RedfishDiscoverComponentNameGetControllerName (
90 IN EFI_COMPONENT_NAME_PROTOCOL *This,
91 IN EFI_HANDLE ControllerHandle,
92 IN EFI_HANDLE ChildHandle OPTIONAL,
93 IN CHAR8 *Language,
94 OUT CHAR16 **ControllerName
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 }