]>
Commit | Line | Data |
---|---|---|
72b695f3 | 1 | /** @file |
2 | ||
3 | Copyright (c) 2006, Intel Corporation | |
4 | All rights reserved. This program and the accompanying materials | |
5 | are licensed and made available under the terms and conditions of the BSD License | |
6 | which accompanies this distribution. The full text of the license may be found at | |
7 | http://opensource.org/licenses/bsd-license.php | |
8 | ||
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
11 | ||
12 | Module Name: | |
13 | ||
14 | ComponentName.c | |
15 | ||
16 | Abstract: | |
17 | ||
18 | ||
19 | **/ | |
20 | ||
21 | #include "WinNtGop.h" | |
22 | ||
23 | // | |
24 | // EFI Component Name Functions | |
25 | // | |
26 | EFI_STATUS | |
27 | EFIAPI | |
28 | WinNtGopComponentNameGetDriverName ( | |
29 | IN EFI_COMPONENT_NAME_PROTOCOL *This, | |
30 | IN CHAR8 *Language, | |
31 | OUT CHAR16 **DriverName | |
32 | ); | |
33 | ||
34 | EFI_STATUS | |
35 | EFIAPI | |
36 | WinNtGopComponentNameGetControllerName ( | |
37 | IN EFI_COMPONENT_NAME_PROTOCOL *This, | |
38 | IN EFI_HANDLE ControllerHandle, | |
39 | IN EFI_HANDLE ChildHandle OPTIONAL, | |
40 | IN CHAR8 *Language, | |
41 | OUT CHAR16 **ControllerName | |
42 | ); | |
43 | ||
44 | // | |
45 | // EFI Component Name Protocol | |
46 | // | |
47 | EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName = { | |
48 | WinNtGopComponentNameGetDriverName, | |
49 | WinNtGopComponentNameGetControllerName, | |
50 | "eng" | |
51 | }; | |
52 | ||
53 | static EFI_UNICODE_STRING_TABLE mWinNtGopDriverNameTable[] = { | |
54 | { "eng", L"Windows GOP Driver" }, | |
55 | { NULL , NULL } | |
56 | }; | |
57 | ||
58 | ||
59 | /** | |
60 | Retrieves a Unicode string that is the user readable name of the EFI Driver. | |
61 | ||
62 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL | |
63 | instance. | |
64 | @param Language A pointer to a three character ISO 639-2 language | |
65 | identifier. This is the language of the driver | |
66 | name that that the caller is requesting, and it | |
67 | must match one of the languages specified in | |
68 | SupportedLanguages. The number of languages | |
69 | supported by a driver is up to the driver writer. | |
70 | @param DriverName A pointer to the Unicode string to return. This | |
71 | Unicode string is the name of the driver specified | |
72 | by This in the language specified by Language. | |
73 | ||
74 | @retval EFI_SUCCESS The Unicode string for the Driver specified by | |
75 | This and the language specified by Language was | |
76 | returned in DriverName. | |
77 | @retval EFI_INVALID_PARAMETER Language is NULL. | |
78 | @retval EFI_INVALID_PARAMETER DriverName is NULL. | |
79 | @retval EFI_UNSUPPORTED The driver specified by This does not support the | |
80 | language specified by Language. | |
81 | ||
82 | **/ | |
83 | EFI_STATUS | |
84 | EFIAPI | |
85 | WinNtGopComponentNameGetDriverName ( | |
86 | IN EFI_COMPONENT_NAME_PROTOCOL *This, | |
87 | IN CHAR8 *Language, | |
88 | OUT CHAR16 **DriverName | |
89 | ) | |
90 | { | |
91 | return LookupUnicodeString ( | |
92 | Language, | |
93 | gWinNtGopComponentName.SupportedLanguages, | |
94 | mWinNtGopDriverNameTable, | |
95 | DriverName | |
96 | ); | |
97 | } | |
98 | ||
99 | ||
100 | /** | |
101 | Retrieves a Unicode string that is the user readable name of the controller | |
102 | that is being managed by an EFI Driver. | |
103 | ||
104 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL | |
105 | instance. | |
106 | @param ControllerHandle The handle of a controller that the driver | |
107 | specified by This is managing. This handle | |
108 | specifies the controller whose name is to be | |
109 | returned. | |
110 | @param ChildHandle The handle of the child controller to retrieve the | |
111 | name of. This is an optional parameter that may | |
112 | be NULL. It will be NULL for device drivers. It | |
113 | will also be NULL for a bus drivers that wish to | |
114 | retrieve the name of the bus controller. It will | |
115 | not be NULL for a bus driver that wishes to | |
116 | retrieve the name of a child controller. | |
117 | @param Language A pointer to a three character ISO 639-2 language | |
118 | identifier. This is the language of the | |
119 | controller name that that the caller is | |
120 | requesting, and it must match one of the languages | |
121 | specified in SupportedLanguages. The number of | |
122 | languages supported by a driver is up to the | |
123 | driver writer. | |
124 | @param ControllerName A pointer to the Unicode string to return. This | |
125 | Unicode string is the name of the controller | |
126 | specified by ControllerHandle and ChildHandle in | |
127 | the language specified by Language from the point | |
128 | of view of the driver specified by This. | |
129 | ||
130 | @retval EFI_SUCCESS The Unicode string for the user readable name in | |
131 | the language specified by Language for the driver | |
132 | specified by This was returned in DriverName. | |
133 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. | |
134 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid | |
135 | EFI_HANDLE. | |
136 | @retval EFI_INVALID_PARAMETER Language is NULL. | |
137 | @retval EFI_INVALID_PARAMETER ControllerName is NULL. | |
138 | @retval EFI_UNSUPPORTED The driver specified by This is not currently | |
139 | managing the controller specified by | |
140 | ControllerHandle and ChildHandle. | |
141 | @retval EFI_UNSUPPORTED The driver specified by This does not support the | |
142 | language specified by Language. | |
143 | ||
144 | **/ | |
145 | EFI_STATUS | |
146 | EFIAPI | |
147 | WinNtGopComponentNameGetControllerName ( | |
148 | IN EFI_COMPONENT_NAME_PROTOCOL *This, | |
149 | IN EFI_HANDLE ControllerHandle, | |
150 | IN EFI_HANDLE ChildHandle OPTIONAL, | |
151 | IN CHAR8 *Language, | |
152 | OUT CHAR16 **ControllerName | |
153 | ) | |
154 | { | |
155 | EFI_STATUS Status; | |
156 | EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; | |
157 | GOP_PRIVATE_DATA *Private; | |
158 | ||
159 | // | |
160 | // This is a device driver, so ChildHandle must be NULL. | |
161 | // | |
162 | if (ChildHandle != NULL) { | |
163 | return EFI_UNSUPPORTED; | |
164 | } | |
165 | ||
166 | // | |
167 | // Get our context back | |
168 | // | |
169 | Status = gBS->OpenProtocol ( | |
170 | ControllerHandle, | |
171 | &gEfiGraphicsOutputProtocolGuid, | |
172 | &GraphicsOutput, | |
173 | gWinNtGopDriverBinding.DriverBindingHandle, | |
174 | ControllerHandle, | |
175 | EFI_OPEN_PROTOCOL_GET_PROTOCOL | |
176 | ); | |
177 | if (EFI_ERROR (Status)) { | |
178 | return EFI_UNSUPPORTED; | |
179 | } | |
180 | ||
181 | Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput); | |
182 | ||
183 | return LookupUnicodeString ( | |
184 | Language, | |
185 | gWinNtGopComponentName.SupportedLanguages, | |
186 | Private->ControllerNameTable, | |
187 | ControllerName | |
188 | ); | |
189 | } |