]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/SocketDxe/ComponentName.c
StdLib: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / StdLib / SocketDxe / ComponentName.c
CommitLineData
d7ce7006 1/** @file\r
2 UEFI Component Name(2) protocol implementation.\r
3\r
0a2530ea
MK
4 Copyright (c) 2011, Intel Corporation. All rights reserved.\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
d7ce7006 6\r
7**/\r
8\r
9#include "Socket.h"\r
10\r
11/**\r
12 EFI Component Name Protocol declaration\r
13**/\r
a88c3163 14GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL mComponentName = {\r
d7ce7006 15 GetDriverName,\r
16 GetControllerName,\r
17 "eng"\r
18};\r
19\r
20/**\r
21 EFI Component Name 2 Protocol declaration\r
22**/\r
a88c3163 23GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {\r
d7ce7006 24 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GetDriverName,\r
25 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GetControllerName,\r
26 "en"\r
27};\r
28\r
29\r
30/**\r
31 Driver name table declaration\r
32**/\r
33GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE\r
34mDriverNameTable[] = {\r
35 {"eng;en", L"Socket Layer Driver"},\r
36 {NULL, NULL}\r
37};\r
38\r
39/**\r
40 Retrieves a Unicode string that is the user readable name of the driver.\r
41\r
42 This function retrieves the user readable name of a driver in the form of a\r
43 Unicode string. If the driver specified by This has a user readable name in\r
44 the language specified by Language, then a pointer to the driver name is\r
45 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
46 by This does not support the language specified by Language,\r
47 then EFI_UNSUPPORTED is returned.\r
48\r
49 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
50 EFI_COMPONENT_NAME_PROTOCOL instance.\r
51 @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
52 array indicating the language. This is the\r
53 language of the driver name that the caller is\r
54 requesting, and it must match one of the\r
55 languages specified in SupportedLanguages. The\r
56 number of languages supported by a driver is up\r
57 to the driver writer. Language is specified\r
58 in RFC 3066 or ISO 639-2 language code format.\r
59 @param [out] ppDriverName A pointer to the Unicode string to return.\r
60 This Unicode string is the name of the\r
61 driver specified by This in the language\r
62 specified by Language.\r
63\r
64 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
65 This and the language specified by Language was\r
66 returned in DriverName.\r
67 @retval EFI_INVALID_PARAMETER Language is NULL.\r
68 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
69 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
70 the language specified by Language.\r
71\r
72**/\r
73EFI_STATUS\r
74EFIAPI\r
75GetDriverName (\r
76 IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
77 IN CHAR8 * pLanguage,\r
78 OUT CHAR16 ** ppDriverName\r
79 )\r
80{\r
81 EFI_STATUS Status;\r
82\r
83 Status = LookupUnicodeString2 (\r
84 pLanguage,\r
85 pThis->SupportedLanguages,\r
86 mDriverNameTable,\r
87 ppDriverName,\r
a88c3163 88 (BOOLEAN)(pThis == &mComponentName)\r
d7ce7006 89 );\r
90 return Status;\r
91}\r
92\r
93/**\r
94 Retrieves a Unicode string that is the user readable name of the controller\r
95 that is being managed by a driver.\r
96\r
97 This function retrieves the user readable name of the controller specified by\r
98 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
99 driver specified by This has a user readable name in the language specified by\r
100 Language, then a pointer to the controller name is returned in ControllerName,\r
101 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
102 managing the controller specified by ControllerHandle and ChildHandle,\r
103 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
104 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
105\r
106 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
107 EFI_COMPONENT_NAME_PROTOCOL instance.\r
108 @param [in] ControllerHandle The handle of a controller that the driver\r
109 specified by This is managing. This handle\r
110 specifies the controller whose name is to be\r
111 returned.\r
112 @param [in] ChildHandle The handle of the child controller to retrieve\r
113 the name of. This is an optional parameter that\r
114 may be NULL. It will be NULL for device\r
115 drivers. It will also be NULL for a bus drivers\r
116 that wish to retrieve the name of the bus\r
117 controller. It will not be NULL for a bus\r
118 driver that wishes to retrieve the name of a\r
119 child controller.\r
120 @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
121 array indicating the language. This is the\r
122 language of the driver name that the caller is\r
123 requesting, and it must match one of the\r
124 languages specified in SupportedLanguages. The\r
125 number of languages supported by a driver is up\r
126 to the driver writer. Language is specified in\r
127 RFC 3066 or ISO 639-2 language code format.\r
128 @param [out] ppControllerName A pointer to the Unicode string to return.\r
129 This Unicode string is the name of the\r
130 controller specified by ControllerHandle and\r
131 ChildHandle in the language specified by\r
132 Language from the point of view of the driver\r
133 specified by This.\r
134\r
135 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
136 the language specified by Language for the\r
137 driver specified by This was returned in\r
138 DriverName.\r
139 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
140 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
141 EFI_HANDLE.\r
142 @retval EFI_INVALID_PARAMETER Language is NULL.\r
143 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
144 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
145 managing the controller specified by\r
146 ControllerHandle and ChildHandle.\r
147 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
148 the language specified by Language.\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153GetControllerName (\r
154 IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
155 IN EFI_HANDLE ControllerHandle,\r
156 IN OPTIONAL EFI_HANDLE ChildHandle,\r
157 IN CHAR8 * pLanguage,\r
158 OUT CHAR16 ** ppControllerName\r
159 )\r
160{\r
161 EFI_STATUS Status;\r
162\r
163 DBG_ENTER ( );\r
164\r
165 //\r
166 // Set the controller name\r
167 //\r
168 *ppControllerName = L"Socket Layer";\r
169 Status = EFI_SUCCESS;\r
170\r
171 //\r
172 // Return the operation status\r
173 //\r
174 DBG_EXIT_HEX ( Status );\r
175 return Status;\r
176}\r