Initial import.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bbahnsen
2006-04-21 22:54:32 +00:00
commit 878ddf1fc3
2651 changed files with 624620 additions and 0 deletions

View File

@@ -0,0 +1,346 @@
/*++
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
CirrusLogic5430.c
Abstract:
Cirrus Logic 5430 Controller Driver.
This driver is a sample implementation of the UGA Draw Protocol for the
Cirrus Logic 5430 family of PCI video controllers. This driver is only
usable in the EFI pre-boot environment. This sample is intended to show
how the UGA Draw Protocol is able to function. The UGA I/O Protocol is not
implemented in this sample. A fully compliant EFI UGA driver requires both
the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's
documentation on UGA for details on how to write a UGA driver that is able
to function both in the EFI pre-boot environment and from the OS runtime.
Revision History:
--*/
//
// Cirrus Logic 5430 Controller Driver
//
#include "CirrusLogic5430.h"
EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding = {
CirrusLogic5430ControllerDriverSupported,
CirrusLogic5430ControllerDriverStart,
CirrusLogic5430ControllerDriverStop,
0x10,
NULL,
NULL
};
EFI_STATUS
EFIAPI
CirrusLogic5430ControllerDriverSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/*++
Routine Description:
Arguments:
Returns:
None
--*/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: RemainingDevicePath - add argument and description to function comment
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
PCI_TYPE00 Pci;
//
// Open the PCI I/O Protocol
//
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **) &PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Read the PCI Configuration Header from the PCI Device
//
Status = PciIo->Pci.Read (
PciIo,
EfiPciIoWidthUint32,
0,
sizeof (Pci) / sizeof (UINT32),
&Pci
);
if (EFI_ERROR (Status)) {
goto Done;
}
Status = EFI_UNSUPPORTED;
//
// See if the I/O enable is on. Most systems only allow one VGA device to be turned on
// at a time, so see if this is one that is turned on.
//
// if (((Pci.Hdr.Command & 0x01) == 0x01)) {
//
// See if this is a Cirrus Logic PCI controller
//
if (Pci.Hdr.VendorId == CIRRUS_LOGIC_VENDOR_ID) {
//
// See if this is a 5430 or a 5446 PCI controller
//
if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID) {
Status = EFI_SUCCESS;
}
if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID) {
Status = EFI_SUCCESS;
}
if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {
Status = EFI_SUCCESS;
}
}
Done:
//
// Close the PCI I/O Protocol
//
gBS->CloseProtocol (
Controller,
&gEfiPciIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
return Status;
}
EFI_STATUS
EFIAPI
CirrusLogic5430ControllerDriverStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/*++
Routine Description:
Arguments:
Returns:
None
--*/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: RemainingDevicePath - add argument and description to function comment
{
EFI_STATUS Status;
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
//
// Allocate Private context data for UGA Draw inteface.
//
Private = NULL;
Private = AllocateZeroPool (sizeof (CIRRUS_LOGIC_5430_PRIVATE_DATA));
if (Private == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error;
}
//
// Set up context record
//
Private->Signature = CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE;
Private->Handle = Controller;
//
// Open PCI I/O Protocol
//
Status = gBS->OpenProtocol (
Private->Handle,
&gEfiPciIoProtocolGuid,
(VOID **) &Private->PciIo,
This->DriverBindingHandle,
Private->Handle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
goto Error;
}
Status = Private->PciIo->Attributes (
Private->PciIo,
EfiPciIoAttributeOperationEnable,
EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
NULL
);
if (EFI_ERROR (Status)) {
goto Error;
}
//
// Start the UGA Draw software stack.
//
Status = CirrusLogic5430UgaDrawConstructor (Private);
if (EFI_ERROR (Status)) {
goto Error;
}
//
// Publish the UGA Draw interface to the world
//
Status = gBS->InstallMultipleProtocolInterfaces (
&Private->Handle,
&gEfiUgaDrawProtocolGuid,
&Private->UgaDraw,
NULL
);
Error:
if (EFI_ERROR (Status)) {
if (Private) {
if (Private->PciIo) {
Private->PciIo->Attributes (
Private->PciIo,
EfiPciIoAttributeOperationDisable,
EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
NULL
);
}
}
//
// Close the PCI I/O Protocol
//
gBS->CloseProtocol (
Private->Handle,
&gEfiPciIoProtocolGuid,
This->DriverBindingHandle,
Private->Handle
);
if (Private) {
gBS->FreePool (Private);
}
}
return Status;
}
EFI_STATUS
EFIAPI
CirrusLogic5430ControllerDriverStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
/*++
Routine Description:
Arguments:
Returns:
None
--*/
// TODO: This - add argument and description to function comment
// TODO: Controller - add argument and description to function comment
// TODO: NumberOfChildren - add argument and description to function comment
// TODO: ChildHandleBuffer - add argument and description to function comment
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_STATUS Status;
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
Status = gBS->OpenProtocol (
Controller,
&gEfiUgaDrawProtocolGuid,
(VOID **) &UgaDraw,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
//
// If the UGA Draw interface does not exist the driver is not started
//
return Status;
}
//
// Get our private context information
//
Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw);
//
// Remove the UGA Draw interface from the system
//
Status = gBS->UninstallMultipleProtocolInterfaces (
Private->Handle,
&gEfiUgaDrawProtocolGuid,
&Private->UgaDraw,
NULL
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Shutdown the hardware
//
CirrusLogic5430UgaDrawDestructor (Private);
Private->PciIo->Attributes (
Private->PciIo,
EfiPciIoAttributeOperationDisable,
EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
NULL
);
//
// Close the PCI I/O Protocol
//
gBS->CloseProtocol (
Controller,
&gEfiPciIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
//
// Free our instance data
//
gBS->FreePool (Private);
return EFI_SUCCESS;
}

View File

@@ -0,0 +1,254 @@
/*++
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
CirrusLogic5430.h
Abstract:
Cirrus Logic 5430 Controller Driver
Revision History
--*/
//
// Cirrus Logic 5430 Controller Driver
//
#ifndef _CIRRUS_LOGIC_5430_H_
#define _CIRRUS_LOGIC_5430_H_
#include <IndustryStandard/Pci22.h>
//
// Cirrus Logic 5430 PCI Configuration Header values
//
#define CIRRUS_LOGIC_VENDOR_ID 0x1013
#define CIRRUS_LOGIC_5430_DEVICE_ID 0x00a8
#define CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID 0x00a0
#define CIRRUS_LOGIC_5446_DEVICE_ID 0x00b8
//
// Cirrus Logic Graphical Mode Data
//
#define CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT 3
typedef struct {
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
UINT32 ColorDepth;
UINT32 RefreshRate;
} CIRRUS_LOGIC_5430_UGA_DRAW_MODE_DATA;
//
// Cirrus Logic 5440 Private Data Structure
//
#define CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('C', 'L', '5', '4')
typedef struct {
UINT64 Signature;
EFI_HANDLE Handle;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_UGA_DRAW_PROTOCOL UgaDraw;
//
// UGA Draw Private Data
//
BOOLEAN HardwareNeedsStarting;
UINTN CurrentMode;
UINTN MaxMode;
CIRRUS_LOGIC_5430_UGA_DRAW_MODE_DATA ModeData[CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT];
UINT8 *LineBuffer;
} CIRRUS_LOGIC_5430_PRIVATE_DATA;
#define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS(a) \
CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, UgaDraw, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE)
//
// Global Variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName;
//
// Io Registers defined by VGA
//
#define CRTC_ADDRESS_REGISTER 0x3d4
#define CRTC_DATA_REGISTER 0x3d5
#define SEQ_ADDRESS_REGISTER 0x3c4
#define SEQ_DATA_REGISTER 0x3c5
#define GRAPH_ADDRESS_REGISTER 0x3ce
#define GRAPH_DATA_REGISTER 0x3cf
#define ATT_ADDRESS_REGISTER 0x3c0
#define MISC_OUTPUT_REGISTER 0x3c2
#define INPUT_STATUS_1_REGISTER 0x3da
#define DAC_PIXEL_MASK_REGISTER 0x3c6
#define PALETTE_INDEX_REGISTER 0x3c8
#define PALETTE_DATA_REGISTER 0x3c9
//
// UGA Draw Hardware abstraction internal worker functions
//
EFI_STATUS
CirrusLogic5430UgaDrawConstructor (
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
)
/*++
Routine Description:
TODO: Add function description
Arguments:
Private - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
CirrusLogic5430UgaDrawDestructor (
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
)
/*++
Routine Description:
TODO: Add function description
Arguments:
Private - TODO: add argument description
Returns:
TODO: add return values
--*/
;
//
// EFI 1.1 driver model prototypes for Cirrus Logic 5430 UGA Draw
//
EFI_STATUS
EFIAPI
CirrusLogic5430DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
TODO: Add function description
Arguments:
ImageHandle - TODO: add argument description
SystemTable - TODO: add argument description
Returns:
TODO: add return values
--*/
;
//
// EFI_DRIVER_BINDING_PROTOCOL Protocol Interface
//
EFI_STATUS
EFIAPI
CirrusLogic5430ControllerDriverSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
Controller - TODO: add argument description
RemainingDevicePath - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
EFIAPI
CirrusLogic5430ControllerDriverStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
Controller - TODO: add argument description
RemainingDevicePath - TODO: add argument description
Returns:
TODO: add return values
--*/
;
EFI_STATUS
EFIAPI
CirrusLogic5430ControllerDriverStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - TODO: add argument description
Controller - TODO: add argument description
NumberOfChildren - TODO: add argument description
ChildHandleBuffer - TODO: add argument description
Returns:
TODO: add return values
--*/
;
#endif

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-->
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
<MbdHeader>
<BaseName>CirrusLogic5430UgaDraw</BaseName>
<Guid>555F76EA-785F-40d7-9174-153C43636C68</Guid>
<Version>0</Version>
<Description>FIX ME!</Description>
<Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
<License>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</License>
<Created>2006-03-12 17:09</Created>
<Modified>2006-03-19 15:18</Modified>
</MbdHeader>
<Libraries>
<Library>UefiBootServicesTableLib</Library>
<Library>UefiMemoryLib</Library>
<Library>UefiLib</Library>
<Library>UefiDriverEntryPoint</Library>
<Library>UefiDriverModelLib</Library>
<Library>DxeReportStatusCodeLib</Library>
<Library>BaseDebugLibReportStatusCode</Library>
<Library>EdkDxePrintLib</Library>
<Library>BaseLib</Library>
<Library>DxeMemoryAllocationLib</Library>
</Libraries>
</ModuleBuildDescription>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-->
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
<MsaHeader>
<BaseName>CirrusLogic5430UgaDraw</BaseName>
<ModuleType>UEFI_DRIVER</ModuleType>
<ComponentType>BS_DRIVER</ComponentType>
<Guid>555F76EA-785F-40d7-9174-153C43636C68</Guid>
<Version>0</Version>
<Abstract>Component description file for CirrusLogic5430 module</Abstract>
<Description>FIX ME!</Description>
<Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
<License>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</License>
<Specification>0</Specification>
<Created>2006-03-12 17:09</Created>
<Updated>2006-03-19 15:18</Updated>
</MsaHeader>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>CirrusLogic5430.h</Filename>
<Filename>CirrusLogic5430.c</Filename>
<Filename>CirrusLogic5430UgaDraw.c</Filename>
<Filename>ComponentName.c</Filename>
</SourceFiles>
<Includes>
<PackageName>MdePkg</PackageName>
</Includes>
<Protocols>
<Protocol Usage="TO_START">PciIo</Protocol>
<Protocol Usage="ALWAYS_PRODUCED">UgaDraw</Protocol>
</Protocols>
<Externs>
<Extern>
<ModuleEntryPoint></ModuleEntryPoint>
</Extern>
<Extern>
<DriverBinding>gCirrusLogic5430DriverBinding</DriverBinding>
<ComponentName>gCirrusLogic5430ComponentName</ComponentName>
</Extern>
</Externs>
</ModuleSurfaceArea>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,222 @@
/*++
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ComponentName.c
Abstract:
--*/
#include "CirrusLogic5430.h"
//
// EFI Component Name Functions
//
EFI_STATUS
EFIAPI
CirrusLogic5430ComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
);
EFI_STATUS
EFIAPI
CirrusLogic5430ComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName = {
CirrusLogic5430ComponentNameGetDriverName,
CirrusLogic5430ComponentNameGetControllerName,
"eng"
};
static EFI_UNICODE_STRING_TABLE mCirrusLogic5430DriverNameTable[] = {
{ "eng", (CHAR16 *) L"Cirrus Logic 5430 UGA Driver" },
{ NULL , NULL }
};
static EFI_UNICODE_STRING_TABLE mCirrusLogic5430ControllerNameTable[] = {
{ "eng", (CHAR16 *) L"Cirrus Logic 5430 PCI Adapter" },
{ NULL , NULL }
};
EFI_STATUS
EFIAPI
CirrusLogic5430ComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that that the caller
is requesting, and it must match one of the languages specified
in SupportedLanguages. The number of languages supported by a
driver is up to the driver writer.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCESS - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gCirrusLogic5430ComponentName.SupportedLanguages,
mCirrusLogic5430DriverNameTable,
DriverName
);
}
EFI_STATUS
EFIAPI
CirrusLogic5430ComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It
will be NULL for device drivers. It will also be NULL
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one
of the languages specified in SupportedLanguages. The
number of languages supported by a driver is up to the
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode
string is the name of the controller specified by
ControllerHandle and ChildHandle in the language specified
by Language from the point of view of the driver specified
by This.
Returns:
EFI_SUCCESS - The Unicode string for the user readable name in the
language specified by Language for the driver
specified by This was returned in DriverName.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently managing
the controller specified by ControllerHandle and
ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_STATUS Status;
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
EFI_PCI_IO_PROTOCOL *PciIoProtocol;
//
// This is a device driver, so ChildHandle must be NULL.
//
if (ChildHandle != NULL) {
return EFI_UNSUPPORTED;
}
//
// Check Controller's handle
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiPciIoProtocolGuid,
(VOID **) &PciIoProtocol,
gCirrusLogic5430DriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEfiPciIoProtocolGuid,
gCirrusLogic5430DriverBinding.DriverBindingHandle,
ControllerHandle
);
return EFI_UNSUPPORTED;
}
if (Status != EFI_ALREADY_STARTED) {
return EFI_UNSUPPORTED;
}
//
// Get the UGA Draw Protocol on Controller
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiUgaDrawProtocolGuid,
(VOID **) &UgaDraw,
gCirrusLogic5430DriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get the Cirrus Logic 5430's Device structure
//
Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw);
return LookupUnicodeString (
Language,
gCirrusLogic5430ComponentName.SupportedLanguages,
mCirrusLogic5430ControllerNameTable,
ControllerName
);
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<project basedir="." default="CirrusLogic5430UgaDraw"><!--Apply external ANT tasks-->
<taskdef resource="GenBuild.tasks"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property environment="env"/>
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
<property name="MODULE_RELATIVE_PATH" value="Bus\Pci\CirrusLogic\Dxe"/>
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
<target name="CirrusLogic5430UgaDraw">
<GenBuild baseName="CirrusLogic5430UgaDraw" mbdFilename="${MODULE_DIR}\CirrusLogic5430.mbd" msaFilename="${MODULE_DIR}\CirrusLogic5430.msa"/>
</target>
<target depends="CirrusLogic5430UgaDraw_clean" name="clean"/>
<target depends="CirrusLogic5430UgaDraw_cleanall" name="cleanall"/>
<target name="CirrusLogic5430UgaDraw_clean">
<OutputDirSetup baseName="CirrusLogic5430UgaDraw" mbdFilename="${MODULE_DIR}\CirrusLogic5430.mbd" msaFilename="${MODULE_DIR}\CirrusLogic5430.msa"/>
<if>
<available file="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml"/>
<then>
<ant antfile="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml" target="clean"/>
</then>
</if>
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
</target>
<target name="CirrusLogic5430UgaDraw_cleanall">
<OutputDirSetup baseName="CirrusLogic5430UgaDraw" mbdFilename="${MODULE_DIR}\CirrusLogic5430.mbd" msaFilename="${MODULE_DIR}\CirrusLogic5430.msa"/>
<if>
<available file="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml"/>
<then>
<ant antfile="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml" target="cleanall"/>
</then>
</if>
<delete dir="${DEST_DIR_OUTPUT}"/>
<delete dir="${DEST_DIR_DEBUG}"/>
<delete>
<fileset dir="${BIN_DIR}" includes="**CirrusLogic5430UgaDraw*"/>
</delete>
</target>
</project>