]> git.proxmox.com Git - mirror_edk2.git/blame - OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/ComponentName.c
OptionRomPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / OptionRomPkg / Bus / Usb / UsbNetworking / Ax88772b / ComponentName.c
CommitLineData
7f556e4d 1/** @file\r
2 UEFI Component Name(2) protocol implementation.\r
3\r
96ae5934
MK
4 Copyright (c) 2011, Intel Corporation. All rights reserved.\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7f556e4d 6\r
7**/\r
8\r
9#include "Ax88772.h"\r
10\r
11/**\r
12 EFI Component Name Protocol declaration\r
13**/\r
14GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gComponentName = {\r
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
23GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {\r
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"ASIX AX88772B Ethernet Driver 1.0"},\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
88 (BOOLEAN)(pThis == &gComponentName)\r
89 );\r
90\r
91 return Status;\r
92}\r
93\r
94/**\r
95 Retrieves a Unicode string that is the user readable name of the controller\r
96 that is being managed by a driver.\r
97\r
98 This function retrieves the user readable name of the controller specified by\r
99 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
100 driver specified by This has a user readable name in the language specified by\r
101 Language, then a pointer to the controller name is returned in ControllerName,\r
102 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
103 managing the controller specified by ControllerHandle and ChildHandle,\r
104 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
105 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
106\r
107 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
108 EFI_COMPONENT_NAME_PROTOCOL instance.\r
109 @param [in] ControllerHandle The handle of a controller that the driver\r
110 specified by This is managing. This handle\r
111 specifies the controller whose name is to be\r
112 returned.\r
113 @param [in] ChildHandle The handle of the child controller to retrieve\r
114 the name of. This is an optional parameter that\r
115 may be NULL. It will be NULL for device\r
116 drivers. It will also be NULL for a bus drivers\r
117 that wish to retrieve the name of the bus\r
118 controller. It will not be NULL for a bus\r
119 driver that wishes to retrieve the name of a\r
120 child controller.\r
121 @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
122 array indicating the language. This is the\r
123 language of the driver name that the caller is\r
124 requesting, and it must match one of the\r
125 languages specified in SupportedLanguages. The\r
126 number of languages supported by a driver is up\r
127 to the driver writer. Language is specified in\r
128 RFC 3066 or ISO 639-2 language code format.\r
129 @param [out] ppControllerName A pointer to the Unicode string to return.\r
130 This Unicode string is the name of the\r
131 controller specified by ControllerHandle and\r
132 ChildHandle in the language specified by\r
133 Language from the point of view of the driver\r
134 specified by This.\r
135\r
136 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
137 the language specified by Language for the\r
138 driver specified by This was returned in\r
139 DriverName.\r
140 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
141 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
142 EFI_HANDLE.\r
143 @retval EFI_INVALID_PARAMETER Language is NULL.\r
144 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
145 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
146 managing the controller specified by\r
147 ControllerHandle and ChildHandle.\r
148 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
149 the language specified by Language.\r
150\r
151**/\r
152EFI_STATUS\r
153EFIAPI\r
154GetControllerName (\r
155 IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
156 IN EFI_HANDLE ControllerHandle,\r
157 IN OPTIONAL EFI_HANDLE ChildHandle,\r
158 IN CHAR8 * pLanguage,\r
159 OUT CHAR16 ** ppControllerName\r
160 )\r
161{\r
162 EFI_STATUS Status;\r
163\r
164 //\r
165 // Set the controller name\r
166 //\r
167 *ppControllerName = L"ASIX AX88772B USB Fast Ethernet Controller";\r
168 Status = EFI_SUCCESS;\r
169\r
170 //\r
171 // Return the operation status\r
172 //\r
173\r
174 return Status;\r
175}\r