2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 #include "CirrusLogic5430.h"
16 // EFI Component Name Functions
20 CirrusLogic5430ComponentNameGetDriverName (
21 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
23 OUT CHAR16
**DriverName
28 CirrusLogic5430ComponentNameGetControllerName (
29 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
30 IN EFI_HANDLE ControllerHandle
,
31 IN EFI_HANDLE ChildHandle OPTIONAL
,
33 OUT CHAR16
**ControllerName
37 // EFI Component Name Protocol
39 EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName
= {
40 CirrusLogic5430ComponentNameGetDriverName
,
41 CirrusLogic5430ComponentNameGetControllerName
,
45 static EFI_UNICODE_STRING_TABLE mCirrusLogic5430DriverNameTable
[] = {
46 { "eng", (CHAR16
*) L
"Cirrus Logic 5430 UGA Driver" },
50 static EFI_UNICODE_STRING_TABLE mCirrusLogic5430ControllerNameTable
[] = {
51 { "eng", (CHAR16
*) L
"Cirrus Logic 5430 PCI Adapter" },
56 Retrieves a Unicode string that is the user readable name of the EFI Driver.
58 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
59 @param Language A pointer to a three character ISO 639-2 language identifier.
60 This is the language of the driver name that that the caller
61 is requesting, and it must match one of the languages specified
62 in SupportedLanguages. The number of languages supported by a
63 driver is up to the driver writer.
64 @param DriverName A pointer to the Unicode string to return. This Unicode string
65 is the name of the driver specified by This in the language
66 specified by Language.
68 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
69 and the language specified by Language was returned
71 @retval EFI_INVALID_PARAMETER Language is NULL.
72 @retval EFI_INVALID_PARAMETER DriverName is NULL.
73 @retval EFI_UNSUPPORTED The driver specified by This does not support the
74 language specified by Language.
79 CirrusLogic5430ComponentNameGetDriverName (
80 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
82 OUT CHAR16
**DriverName
85 return LookupUnicodeString (
87 gCirrusLogic5430ComponentName
.SupportedLanguages
,
88 mCirrusLogic5430DriverNameTable
,
94 Retrieves a Unicode string that is the user readable name of the controller
95 that is being managed by an EFI Driver.
97 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
98 @param ControllerHandle The handle of a controller that the driver specified by
99 This is managing. This handle specifies the controller
100 whose name is to be returned.
101 @param ChildHandle The handle of the child controller to retrieve the name
102 of. This is an optional parameter that may be NULL. It
103 will be NULL for device drivers. It will also be NULL
104 for a bus drivers that wish to retrieve the name of the
105 bus controller. It will not be NULL for a bus driver
106 that wishes to retrieve the name of a child controller.
107 @param Language A pointer to a three character ISO 639-2 language
108 identifier. This is the language of the controller name
109 that that the caller is requesting, and it must match one
110 of the languages specified in SupportedLanguages. The
111 number of languages supported by a driver is up to the
113 @param ControllerName A pointer to the Unicode string to return. This Unicode
114 string is the name of the controller specified by
115 ControllerHandle and ChildHandle in the language specified
116 by Language from the point of view of the driver specified
119 @retval EFI_SUCCESS The Unicode string for the user readable name in the
120 language specified by Language for the driver
121 specified by This was returned in DriverName.
122 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
123 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
124 @retval EFI_INVALID_PARAMETER Language is NULL.
125 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
126 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
127 the controller specified by ControllerHandle and
129 @retval EFI_UNSUPPORTED The driver specified by This does not support the
130 language specified by Language.
135 CirrusLogic5430ComponentNameGetControllerName (
136 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
137 IN EFI_HANDLE ControllerHandle
,
138 IN EFI_HANDLE ChildHandle OPTIONAL
,
140 OUT CHAR16
**ControllerName
143 EFI_UGA_DRAW_PROTOCOL
*UgaDraw
;
145 CIRRUS_LOGIC_5430_PRIVATE_DATA
*Private
;
146 EFI_PCI_IO_PROTOCOL
*PciIoProtocol
;
149 // This is a device driver, so ChildHandle must be NULL.
151 if (ChildHandle
!= NULL
) {
152 return EFI_UNSUPPORTED
;
156 // Check Controller's handle
158 Status
= gBS
->OpenProtocol (
160 &gEfiPciIoProtocolGuid
,
161 (VOID
**) &PciIoProtocol
,
162 gCirrusLogic5430DriverBinding
.DriverBindingHandle
,
164 EFI_OPEN_PROTOCOL_BY_DRIVER
166 if (!EFI_ERROR (Status
)) {
169 &gEfiPciIoProtocolGuid
,
170 gCirrusLogic5430DriverBinding
.DriverBindingHandle
,
174 return EFI_UNSUPPORTED
;
177 if (Status
!= EFI_ALREADY_STARTED
) {
178 return EFI_UNSUPPORTED
;
182 // Get the UGA Draw Protocol on Controller
184 Status
= gBS
->OpenProtocol (
186 &gEfiUgaDrawProtocolGuid
,
188 gCirrusLogic5430DriverBinding
.DriverBindingHandle
,
190 EFI_OPEN_PROTOCOL_GET_PROTOCOL
192 if (EFI_ERROR (Status
)) {
197 // Get the Cirrus Logic 5430's Device structure
199 Private
= CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw
);
201 return LookupUnicodeString (
203 gCirrusLogic5430ComponentName
.SupportedLanguages
,
204 mCirrusLogic5430ControllerNameTable
,