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