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