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