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