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