2 Component name for the QEMU video controller.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
13 // EFI Component Name Protocol
15 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gQemuVideoComponentName
= {
16 QemuVideoComponentNameGetDriverName
,
17 QemuVideoComponentNameGetControllerName
,
22 // EFI Component Name 2 Protocol
24 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gQemuVideoComponentName2
= {
25 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME
) QemuVideoComponentNameGetDriverName
,
26 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME
) QemuVideoComponentNameGetControllerName
,
31 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mQemuVideoDriverNameTable
[] = {
32 { "eng;en", L
"QEMU Video Driver" },
36 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mQemuVideoControllerNameTable
[] = {
37 { "eng;en", L
"QEMU Video PCI Adapter" },
42 Retrieves a Unicode string that is the user readable name of the driver.
44 This function retrieves the user readable name of a driver in the form of a
45 Unicode string. If the driver specified by This has a user readable name in
46 the language specified by Language, then a pointer to the driver name is
47 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
48 by This does not support the language specified by Language,
49 then EFI_UNSUPPORTED is returned.
51 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
52 EFI_COMPONENT_NAME_PROTOCOL instance.
54 @param Language[in] A pointer to a Null-terminated ASCII string
55 array indicating the language. This is the
56 language of the driver name that the caller is
57 requesting, and it must match one of the
58 languages specified in SupportedLanguages. The
59 number of languages supported by a driver is up
60 to the driver writer. Language is specified
61 in RFC 4646 or ISO 639-2 language code format.
63 @param DriverName[out] A pointer to the Unicode string to return.
64 This Unicode string is the name of the
65 driver specified by This in the language
66 specified by Language.
68 @retval EFI_SUCCESS The Unicode string for the Driver specified by
69 This and the language specified by Language was
70 returned in DriverName.
72 @retval EFI_INVALID_PARAMETER Language is NULL.
74 @retval EFI_INVALID_PARAMETER DriverName is NULL.
76 @retval EFI_UNSUPPORTED The driver specified by This does not support
77 the language specified by Language.
82 QemuVideoComponentNameGetDriverName (
83 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
85 OUT CHAR16
**DriverName
88 return LookupUnicodeString2 (
90 This
->SupportedLanguages
,
91 mQemuVideoDriverNameTable
,
93 (BOOLEAN
)(This
== &gQemuVideoComponentName
)
98 Retrieves a Unicode string that is the user readable name of the controller
99 that is being managed by a driver.
101 This function retrieves the user readable name of the controller specified by
102 ControllerHandle and ChildHandle in the form of a Unicode string. If the
103 driver specified by This has a user readable name in the language specified by
104 Language, then a pointer to the controller name is returned in ControllerName,
105 and EFI_SUCCESS is returned. If the driver specified by This is not currently
106 managing the controller specified by ControllerHandle and ChildHandle,
107 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
108 support the language specified by Language, then EFI_UNSUPPORTED is returned.
110 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
111 EFI_COMPONENT_NAME_PROTOCOL instance.
113 @param ControllerHandle[in] The handle of a controller that the driver
114 specified by This is managing. This handle
115 specifies the controller whose name is to be
118 @param ChildHandle[in] The handle of the child controller to retrieve
119 the name of. This is an optional parameter that
120 may be NULL. It will be NULL for device
121 drivers. It will also be NULL for a bus drivers
122 that wish to retrieve the name of the bus
123 controller. It will not be NULL for a bus
124 driver that wishes to retrieve the name of a
127 @param Language[in] A pointer to a Null-terminated ASCII string
128 array indicating the language. This is the
129 language of the driver name that the caller is
130 requesting, and it must match one of the
131 languages specified in SupportedLanguages. The
132 number of languages supported by a driver is up
133 to the driver writer. Language is specified in
134 RFC 4646 or ISO 639-2 language code format.
136 @param ControllerName[out] A pointer to the Unicode string to return.
137 This Unicode string is the name of the
138 controller specified by ControllerHandle and
139 ChildHandle in the language specified by
140 Language from the point of view of the driver
143 @retval EFI_SUCCESS The Unicode string for the user readable name in
144 the language specified by Language for the
145 driver specified by This was returned in
148 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
150 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
153 @retval EFI_INVALID_PARAMETER Language is NULL.
155 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
157 @retval EFI_UNSUPPORTED The driver specified by This is not currently
158 managing the controller specified by
159 ControllerHandle and ChildHandle.
161 @retval EFI_UNSUPPORTED The driver specified by This does not support
162 the language specified by Language.
167 QemuVideoComponentNameGetControllerName (
168 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
169 IN EFI_HANDLE ControllerHandle
,
170 IN EFI_HANDLE ChildHandle OPTIONAL
,
172 OUT CHAR16
**ControllerName
178 // This is a device driver, so ChildHandle must be NULL.
180 if (ChildHandle
!= NULL
) {
181 return EFI_UNSUPPORTED
;
185 // Make sure this driver is currently managing ControllHandle
187 Status
= EfiTestManagedDevice (
189 gQemuVideoDriverBinding
.DriverBindingHandle
,
190 &gEfiPciIoProtocolGuid
192 if (EFI_ERROR (Status
)) {
197 // Get the QEMU Video's Device structure
199 return LookupUnicodeString2 (
201 This
->SupportedLanguages
,
202 mQemuVideoControllerNameTable
,
204 (BOOLEAN
)(This
== &gQemuVideoComponentName
)