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