2 Component name for the QEMU video controller.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 // EFI Component Name Protocol
21 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gQemuVideoComponentName
= {
22 QemuVideoComponentNameGetDriverName
,
23 QemuVideoComponentNameGetControllerName
,
28 // EFI Component Name 2 Protocol
30 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gQemuVideoComponentName2
= {
31 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) QemuVideoComponentNameGetDriverName
,
32 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) QemuVideoComponentNameGetControllerName
,
37 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mQemuVideoDriverNameTable
[] = {
38 { "eng;en", L
"QEMU Video Driver" },
42 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mQemuVideoControllerNameTable
[] = {
43 { "eng;en", L
"QEMU Video PCI Adapter" },
48 Retrieves a Unicode string that is the user readable name of the driver.
50 This function retrieves the user readable name of a driver in the form of a
51 Unicode string. If the driver specified by This has a user readable name in
52 the language specified by Language, then a pointer to the driver name is
53 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
54 by This does not support the language specified by Language,
55 then EFI_UNSUPPORTED is returned.
57 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
58 EFI_COMPONENT_NAME_PROTOCOL instance.
60 @param Language[in] A pointer to a Null-terminated ASCII string
61 array indicating the language. This is the
62 language of the driver name that the caller is
63 requesting, and it must match one of the
64 languages specified in SupportedLanguages. The
65 number of languages supported by a driver is up
66 to the driver writer. Language is specified
67 in RFC 4646 or ISO 639-2 language code format.
69 @param DriverName[out] A pointer to the Unicode string to return.
70 This Unicode string is the name of the
71 driver specified by This in the language
72 specified by Language.
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.
78 @retval EFI_INVALID_PARAMETER Language is NULL.
80 @retval EFI_INVALID_PARAMETER DriverName is NULL.
82 @retval EFI_UNSUPPORTED The driver specified by This does not support
83 the language specified by Language.
88 QemuVideoComponentNameGetDriverName (
89 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
91 OUT CHAR16
**DriverName
94 return LookupUnicodeString2 (
96 This
->SupportedLanguages
,
97 mQemuVideoDriverNameTable
,
99 (BOOLEAN
)(This
== &gQemuVideoComponentName
)
104 Retrieves a Unicode string that is the user readable name of the controller
105 that is being managed by a driver.
107 This function retrieves the user readable name of the controller specified by
108 ControllerHandle and ChildHandle in the form of a Unicode string. If the
109 driver specified by This has a user readable name in the language specified by
110 Language, then a pointer to the controller name is returned in ControllerName,
111 and EFI_SUCCESS is returned. If the driver specified by This is not currently
112 managing the controller specified by ControllerHandle and ChildHandle,
113 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
114 support the language specified by Language, then EFI_UNSUPPORTED is returned.
116 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
117 EFI_COMPONENT_NAME_PROTOCOL instance.
119 @param ControllerHandle[in] The handle of a controller that the driver
120 specified by This is managing. This handle
121 specifies the controller whose name is to be
124 @param ChildHandle[in] The handle of the child controller to retrieve
125 the name of. This is an optional parameter that
126 may be NULL. It will be NULL for device
127 drivers. It will also be NULL for a bus drivers
128 that wish to retrieve the name of the bus
129 controller. It will not be NULL for a bus
130 driver that wishes to retrieve the name of a
133 @param Language[in] A pointer to a Null-terminated ASCII string
134 array indicating the language. This is the
135 language of the driver name that the caller is
136 requesting, and it must match one of the
137 languages specified in SupportedLanguages. The
138 number of languages supported by a driver is up
139 to the driver writer. Language is specified in
140 RFC 4646 or ISO 639-2 language code format.
142 @param ControllerName[out] A pointer to the Unicode string to return.
143 This Unicode string is the name of the
144 controller specified by ControllerHandle and
145 ChildHandle in the language specified by
146 Language from the point of view of the driver
149 @retval EFI_SUCCESS The Unicode string for the user readable name in
150 the language specified by Language for the
151 driver specified by This was returned in
154 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
156 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
159 @retval EFI_INVALID_PARAMETER Language is NULL.
161 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
163 @retval EFI_UNSUPPORTED The driver specified by This is not currently
164 managing the controller specified by
165 ControllerHandle and ChildHandle.
167 @retval EFI_UNSUPPORTED The driver specified by This does not support
168 the language specified by Language.
173 QemuVideoComponentNameGetControllerName (
174 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
175 IN EFI_HANDLE ControllerHandle
,
176 IN EFI_HANDLE ChildHandle OPTIONAL
,
178 OUT CHAR16
**ControllerName
184 // This is a device driver, so ChildHandle must be NULL.
186 if (ChildHandle
!= NULL
) {
187 return EFI_UNSUPPORTED
;
191 // Make sure this driver is currently managing ControllHandle
193 Status
= EfiTestManagedDevice (
195 gQemuVideoDriverBinding
.DriverBindingHandle
,
196 &gEfiPciIoProtocolGuid
198 if (EFI_ERROR (Status
)) {
203 // Get the QEMU Video's Device structure
205 return LookupUnicodeString2 (
207 This
->SupportedLanguages
,
208 mQemuVideoControllerNameTable
,
210 (BOOLEAN
)(This
== &gQemuVideoComponentName
)