]> git.proxmox.com Git - mirror_edk2.git/blame - OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/ComponentName.c
Contributed-under: TianoCore Contribution Agreement 1.0
[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
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"ASIX AX88772B Ethernet Driver 1.0"},\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 Status = LookupUnicodeString2 (\r
90 pLanguage,\r
91 pThis->SupportedLanguages,\r
92 mDriverNameTable,\r
93 ppDriverName,\r
94 (BOOLEAN)(pThis == &gComponentName)\r
95 );\r
96\r
97 return Status;\r
98}\r
99\r
100/**\r
101 Retrieves a Unicode string that is the user readable name of the controller\r
102 that is being managed by a driver.\r
103\r
104 This function retrieves the user readable name of the controller specified by\r
105 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
106 driver specified by This has a user readable name in the language specified by\r
107 Language, then a pointer to the controller name is returned in ControllerName,\r
108 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
109 managing the controller specified by ControllerHandle and ChildHandle,\r
110 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
111 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
112\r
113 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
114 EFI_COMPONENT_NAME_PROTOCOL instance.\r
115 @param [in] ControllerHandle The handle of a controller that the driver\r
116 specified by This is managing. This handle\r
117 specifies the controller whose name is to be\r
118 returned.\r
119 @param [in] ChildHandle The handle of the child controller to retrieve\r
120 the name of. This is an optional parameter that\r
121 may be NULL. It will be NULL for device\r
122 drivers. It will also be NULL for a bus drivers\r
123 that wish to retrieve the name of the bus\r
124 controller. It will not be NULL for a bus\r
125 driver that wishes to retrieve the name of a\r
126 child controller.\r
127 @param [in] pLanguage A pointer to a Null-terminated ASCII string\r
128 array indicating the language. This is the\r
129 language of the driver name that the caller is\r
130 requesting, and it must match one of the\r
131 languages specified in SupportedLanguages. The\r
132 number of languages supported by a driver is up\r
133 to the driver writer. Language is specified in\r
134 RFC 3066 or ISO 639-2 language code format.\r
135 @param [out] ppControllerName A pointer to the Unicode string to return.\r
136 This Unicode string is the name of the\r
137 controller specified by ControllerHandle and\r
138 ChildHandle in the language specified by\r
139 Language from the point of view of the driver\r
140 specified by This.\r
141\r
142 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
143 the language specified by Language for the\r
144 driver specified by This was returned in\r
145 DriverName.\r
146 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
147 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
148 EFI_HANDLE.\r
149 @retval EFI_INVALID_PARAMETER Language is NULL.\r
150 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
151 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
152 managing the controller specified by\r
153 ControllerHandle and ChildHandle.\r
154 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
155 the language specified by Language.\r
156\r
157**/\r
158EFI_STATUS\r
159EFIAPI\r
160GetControllerName (\r
161 IN EFI_COMPONENT_NAME_PROTOCOL * pThis,\r
162 IN EFI_HANDLE ControllerHandle,\r
163 IN OPTIONAL EFI_HANDLE ChildHandle,\r
164 IN CHAR8 * pLanguage,\r
165 OUT CHAR16 ** ppControllerName\r
166 )\r
167{\r
168 EFI_STATUS Status;\r
169\r
170 //\r
171 // Set the controller name\r
172 //\r
173 *ppControllerName = L"ASIX AX88772B USB Fast Ethernet Controller";\r
174 Status = EFI_SUCCESS;\r
175\r
176 //\r
177 // Return the operation status\r
178 //\r
179\r
180 return Status;\r
181}\r