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