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
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.
20 #include "CirrusLogic5430.h"
23 // EFI Component Name Functions
27 CirrusLogic5430ComponentNameGetDriverName (
28 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
30 OUT CHAR16
**DriverName
35 CirrusLogic5430ComponentNameGetControllerName (
36 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
37 IN EFI_HANDLE ControllerHandle
,
38 IN EFI_HANDLE ChildHandle OPTIONAL
,
40 OUT CHAR16
**ControllerName
44 // EFI Component Name Protocol
46 EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName
= {
47 CirrusLogic5430ComponentNameGetDriverName
,
48 CirrusLogic5430ComponentNameGetControllerName
,
52 static EFI_UNICODE_STRING_TABLE mCirrusLogic5430DriverNameTable
[] = {
53 { "eng", (CHAR16
*) L
"Cirrus Logic 5430 UGA Driver" },
57 static EFI_UNICODE_STRING_TABLE mCirrusLogic5430ControllerNameTable
[] = {
58 { "eng", (CHAR16
*) L
"Cirrus Logic 5430 PCI Adapter" },
64 CirrusLogic5430ComponentNameGetDriverName (
65 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
67 OUT CHAR16
**DriverName
72 Retrieves a Unicode string that is the user readable name of the EFI Driver.
75 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
76 Language - A pointer to a three character ISO 639-2 language identifier.
77 This is the language of the driver name that that the caller
78 is requesting, and it must match one of the languages specified
79 in SupportedLanguages. The number of languages supported by a
80 driver is up to the driver writer.
81 DriverName - A pointer to the Unicode string to return. This Unicode string
82 is the name of the driver specified by This in the language
83 specified by Language.
86 EFI_SUCCESS - The Unicode string for the Driver specified by This
87 and the language specified by Language was returned
89 EFI_INVALID_PARAMETER - Language is NULL.
90 EFI_INVALID_PARAMETER - DriverName is NULL.
91 EFI_UNSUPPORTED - The driver specified by This does not support the
92 language specified by Language.
96 return LookupUnicodeString (
98 gCirrusLogic5430ComponentName
.SupportedLanguages
,
99 mCirrusLogic5430DriverNameTable
,
106 CirrusLogic5430ComponentNameGetControllerName (
107 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
108 IN EFI_HANDLE ControllerHandle
,
109 IN EFI_HANDLE ChildHandle OPTIONAL
,
111 OUT CHAR16
**ControllerName
116 Retrieves a Unicode string that is the user readable name of the controller
117 that is being managed by an EFI Driver.
120 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
121 ControllerHandle - The handle of a controller that the driver specified by
122 This is managing. This handle specifies the controller
123 whose name is to be returned.
124 ChildHandle - The handle of the child controller to retrieve the name
125 of. This is an optional parameter that may be NULL. It
126 will be NULL for device drivers. It will also be NULL
127 for a bus drivers that wish to retrieve the name of the
128 bus controller. It will not be NULL for a bus driver
129 that wishes to retrieve the name of a child controller.
130 Language - A pointer to a three character ISO 639-2 language
131 identifier. This is the language of the controller name
132 that that the caller is requesting, and it must match one
133 of the languages specified in SupportedLanguages. The
134 number of languages supported by a driver is up to the
136 ControllerName - A pointer to the Unicode string to return. This Unicode
137 string is the name of the controller specified by
138 ControllerHandle and ChildHandle in the language specified
139 by Language from the point of view of the driver specified
143 EFI_SUCCESS - The Unicode string for the user readable name in the
144 language specified by Language for the driver
145 specified by This was returned in DriverName.
146 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
147 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
148 EFI_INVALID_PARAMETER - Language is NULL.
149 EFI_INVALID_PARAMETER - ControllerName is NULL.
150 EFI_UNSUPPORTED - The driver specified by This is not currently managing
151 the controller specified by ControllerHandle and
153 EFI_UNSUPPORTED - The driver specified by This does not support the
154 language specified by Language.
158 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
160 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
;
161 EFI_PCI_IO_PROTOCOL
*PciIoProtocol
;
164 // This is a device driver, so ChildHandle must be NULL.
166 if (ChildHandle
!= NULL
) {
167 return EFI_UNSUPPORTED
;
171 // Check Controller's handle
173 Status
= gBS
->OpenProtocol (
175 &gEfiPciIoProtocolGuid
,
176 (VOID
**) &PciIoProtocol
,
177 gCirrusLogic5430DriverBinding
.DriverBindingHandle
,
179 EFI_OPEN_PROTOCOL_BY_DRIVER
181 if (!EFI_ERROR (Status
)) {
184 &gEfiPciIoProtocolGuid
,
185 gCirrusLogic5430DriverBinding
.DriverBindingHandle
,
189 return EFI_UNSUPPORTED
;
192 if (Status
!= EFI_ALREADY_STARTED
) {
193 return EFI_UNSUPPORTED
;
197 // Get the UGA Draw Protocol on Controller
199 Status
= gBS
->OpenProtocol (
201 &gEfiUgaDrawProtocolGuid
,
203 gCirrusLogic5430DriverBinding
.DriverBindingHandle
,
205 EFI_OPEN_PROTOCOL_GET_PROTOCOL
207 if (EFI_ERROR (Status
)) {
212 // Get the Cirrus Logic 5430's Device structure
214 Private
= CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw
);
216 return LookupUnicodeString (
218 gCirrusLogic5430ComponentName
.SupportedLanguages
,
219 mCirrusLogic5430ControllerNameTable
,