summaryrefslogtreecommitdiff
path: root/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
diff options
context:
space:
mode:
Diffstat (limited to 'OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c')
-rw-r--r--OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c116
1 files changed, 77 insertions, 39 deletions
diff --git a/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c b/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
index 21bb4afee0..789b23358d 100644
--- a/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
+++ b/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c
@@ -11,7 +11,7 @@
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.
- Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2009, 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
@@ -125,6 +125,7 @@ CirrusLogic5430ControllerDriverSupported (
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
PCI_TYPE00 Pci;
+ EFI_DEV_PATH *Node;
//
// Open the PCI I/O Protocol
@@ -168,16 +169,33 @@ CirrusLogic5430ControllerDriverSupported (
//
// 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) {
+ if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID ||
+ Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID ||
+ Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {
+
Status = EFI_SUCCESS;
+ //
+ // If this is an Intel 945 graphics controller,
+ // go further check RemainingDevicePath validation
+ //
+ if (RemainingDevicePath != NULL) {
+ Node = (EFI_DEV_PATH *) RemainingDevicePath;
+ //
+ // Check if RemainingDevicePath is the End of Device Path Node,
+ // if yes, return EFI_SUCCESS
+ //
+ if (!IsDevicePathEnd (Node)) {
+ //
+ // If RemainingDevicePath isn't the End of Device Path Node,
+ // check its validation
+ //
+ if (Node->DevPath.Type != ACPI_DEVICE_PATH ||
+ Node->DevPath.SubType != ACPI_ADR_DP ||
+ DevicePathNodeLength(&Node->DevPath) != sizeof(ACPI_ADR_DEVICE_PATH)) {
+ Status = EFI_UNSUPPORTED;
+ }
+ }
+ }
}
}
@@ -299,20 +317,32 @@ CirrusLogic5430ControllerDriverStart (
ParentDevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode
);
- } else {
+ } else if (!IsDevicePathEnd (RemainingDevicePath)) {
+ //
+ // If RemainingDevicePath isn't the End of Device Path Node,
+ // only scan the specified device by RemainingDevicePath
+ //
Private->GopDevicePath = AppendDevicePathNode (ParentDevicePath, RemainingDevicePath);
+ } else {
+ //
+ // If RemainingDevicePath is the End of Device Path Node,
+ // don't create child device and return EFI_SUCCESS
+ //
+ Private->GopDevicePath = NULL;
+ }
+
+ if (Private->GopDevicePath != NULL) {
+ //
+ // Creat child handle and device path protocol firstly
+ //
+ Private->Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Private->Handle,
+ &gEfiDevicePathProtocolGuid,
+ Private->GopDevicePath,
+ NULL
+ );
}
-
- //
- // Creat child handle and device path protocol firstly
- //
- Private->Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiDevicePathProtocolGuid,
- Private->GopDevicePath,
- NULL
- );
}
//
@@ -341,23 +371,31 @@ CirrusLogic5430ControllerDriverStart (
);
} else if (FeaturePcdGet (PcdSupportGop)) {
- //
- // Start the GOP software stack.
- //
- Status = CirrusLogic5430GraphicsOutputConstructor (Private);
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiGraphicsOutputProtocolGuid,
- &Private->GraphicsOutput,
- &gEfiEdidDiscoveredProtocolGuid,
- &Private->EdidDiscovered,
- &gEfiEdidActiveProtocolGuid,
- &Private->EdidActive,
- NULL
- );
-
+ if (Private->GopDevicePath == NULL) {
+ //
+ // If RemainingDevicePath is the End of Device Path Node,
+ // don't create child device and return EFI_SUCCESS
+ //
+ Status = EFI_SUCCESS;
+ } else {
+
+ //
+ // Start the GOP software stack.
+ //
+ Status = CirrusLogic5430GraphicsOutputConstructor (Private);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Private->Handle,
+ &gEfiGraphicsOutputProtocolGuid,
+ &Private->GraphicsOutput,
+ &gEfiEdidDiscoveredProtocolGuid,
+ &Private->EdidDiscovered,
+ &gEfiEdidActiveProtocolGuid,
+ &Private->EdidActive,
+ NULL
+ );
+ }
} else {
//
// This driver must support eithor GOP or UGA or both.