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