]> git.proxmox.com Git - mirror_edk2.git/blame - EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
[Source] Useless assigning statement in ata and atapi
[mirror_edk2.git] / EdkNt32Pkg / Dxe / WinNtThunk / Bus / Gop / ComponentName.c
CommitLineData
72b695f3 1/** @file
2
3Copyright (c) 2006, Intel Corporation
4All rights reserved. This program and the accompanying materials
5are licensed and made available under the terms and conditions of the BSD License
6which accompanies this distribution. The full text of the license may be found at
7http://opensource.org/licenses/bsd-license.php
8
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12Module Name:
13
14 ComponentName.c
15
16Abstract:
17
18
19**/
20
21#include "WinNtGop.h"
22
23//
24// EFI Component Name Functions
25//
26EFI_STATUS
27EFIAPI
28WinNtGopComponentNameGetDriverName (
29 IN EFI_COMPONENT_NAME_PROTOCOL *This,
30 IN CHAR8 *Language,
31 OUT CHAR16 **DriverName
32 );
33
34EFI_STATUS
35EFIAPI
36WinNtGopComponentNameGetControllerName (
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//
47EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName = {
48 WinNtGopComponentNameGetDriverName,
49 WinNtGopComponentNameGetControllerName,
50 "eng"
51};
52
53static 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**/
83EFI_STATUS
84EFIAPI
85WinNtGopComponentNameGetDriverName (
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**/
145EFI_STATUS
146EFIAPI
147WinNtGopComponentNameGetControllerName (
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 }
8b018de6 165 //\r
166 // Make sure this driver is currently managing ControllerHandle\r
167 //\r
168 Status = EfiTestManagedDevice (\r
169 ControllerHandle,\r
170 gWinNtGopDriverBinding.DriverBindingHandle,\r
171 &gEfiWinNtIoProtocolGuid\r
172 );\r
173 if (EFI_ERROR (Status)) {\r
174 return EFI_UNSUPPORTED;\r
175 }\r
176 //\r
72b695f3 177 // Get our context back
178 //
179 Status = gBS->OpenProtocol (
180 ControllerHandle,
181 &gEfiGraphicsOutputProtocolGuid,
182 &GraphicsOutput,
183 gWinNtGopDriverBinding.DriverBindingHandle,
184 ControllerHandle,
185 EFI_OPEN_PROTOCOL_GET_PROTOCOL
186 );
187 if (EFI_ERROR (Status)) {
188 return EFI_UNSUPPORTED;
189 }
190
191 Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
192
193 return LookupUnicodeString (
194 Language,
195 gWinNtGopComponentName.SupportedLanguages,
196 Private->ControllerNameTable,
197 ControllerName
198 );
199}