From e0ee9d9314c7c2816b89908a1fac871c911f1cb0 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Tue, 28 Dec 2010 10:10:10 +0000 Subject: =?UTF-8?q?Clean=20ISA=5FIO/ISA=5FIO=5F16=20and=20VGA=5FIO/VGA=5FI?= =?UTF-8?q?O=5F16=20attribute=20usage=20in=20PCI=20bus=20driver/PCI=20host?= =?UTF-8?q?=20bridge=20drivers/LPC/VGA=20device=20drivers.=201.=20Fix=20th?= =?UTF-8?q?e=20incorrect=20definition=20of=20EFI=5FPCI=5FIO=5FATTRIBUTE=5F?= =?UTF-8?q?VGA=5FIO=5F16=20(does=20not=20conform=20to=20the=20UEFI=20spec)?= =?UTF-8?q?=20in=20PciIo.h.=202.=20Add=20missing=20definitions=20of=20ISA?= =?UTF-8?q?=20and=20VGA=20IO=20attributes=20in=20PCI=20Root=20Bridge=20IO?= =?UTF-8?q?=20protocol.=203.=20Improve=20the=20algorithm=20in=20the=20PCI?= =?UTF-8?q?=20bus=20driver=20to=20get=20PCI=20platform=20policy=20from=20P?= =?UTF-8?q?CI=20Platform=20Protocol=20and=20PCI=20Override=20Protocol.=204?= =?UTF-8?q?.=20Update=20the=20PCI=20bus=20driver=20to=20use=20the=20PCI=20?= =?UTF-8?q?platform=20policy=20to=20determine=20the=20supported=20attribut?= =?UTF-8?q?es=20that=20are=20returned=20by=20the=20EFI=5FPCI=5FIO=5FPROTOC?= =?UTF-8?q?OL.Attributes()=20function.=20This=20is=20required=20by=20the?= =?UTF-8?q?=20PI=20spec.=205.=20Add=20a=20backward=20compatibility=20worka?= =?UTF-8?q?round=20for=20PCI=20VGA=20drivers=20in=20Option=20ROM,=20which?= =?UTF-8?q?=20typically=20sets=20VGA=5FIO=20without=20checking=20supported?= =?UTF-8?q?=20attributes.=206.=20Update=20the=20PCI=20host=20bridge=20driv?= =?UTF-8?q?er=20in=20PcAtChipsetPkg=20to=20report=20VGA=5FIO=5F16=20and=20?= =?UTF-8?q?ISA=5FIO=5F16=20instead=20of=20VGA=5FIO/ISA=5FIO=20attributes.?= =?UTF-8?q?=20Modern=20chipsets=20don=E2=80=99t=20have=20hardware=20capabi?= =?UTF-8?q?lity=20to=20control=2010-bit=20or=2016-bit=20decoding=20for=20I?= =?UTF-8?q?SA/VGA=20aliases.=207.=20Update=20LPC/VGA=20device=20drivers=20?= =?UTF-8?q?to=20check=20supported=20attributes=20of=20VGA=5FIO/VGA=5FIO=5F?= =?UTF-8?q?16=20or=20ISA=5FIO/ISA=5FIO=5F16.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11204 6f19259b-4bc3-4df7-8a09-765794883524 --- OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c | 32 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'OptionRomPkg/CirrusLogic5430Dxe') diff --git a/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c b/OptionRomPkg/CirrusLogic5430Dxe/CirrusLogic5430.c index d5ea4e294d..8b6dfac1fe 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 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2010, 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 @@ -233,6 +233,7 @@ CirrusLogic5430ControllerDriverStart ( BOOLEAN PciAttributesSaved; EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; ACPI_ADR_DEVICE_PATH AcpiDeviceNode; + UINT64 Supports; PciAttributesSaved = FALSE; // @@ -265,6 +266,25 @@ CirrusLogic5430ControllerDriverStart ( goto Error; } + // + // Get supported PCI attributes + // + Status = Private->PciIo->Attributes ( + Private->PciIo, + EfiPciIoAttributeOperationSupported, + 0, + &Supports + ); + if (EFI_ERROR (Status)) { + goto Error; + } + + Supports &= (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16); + if (Supports == 0 || Supports == (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) { + Status = EFI_UNSUPPORTED; + goto Error; + } + // // Save original PCI attributes // @@ -281,11 +301,11 @@ CirrusLogic5430ControllerDriverStart ( PciAttributesSaved = TRUE; Status = Private->PciIo->Attributes ( - Private->PciIo, - EfiPciIoAttributeOperationEnable, - EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO, - NULL - ); + Private->PciIo, + EfiPciIoAttributeOperationEnable, + EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | Supports, + NULL + ); if (EFI_ERROR (Status)) { goto Error; } -- cgit v1.2.3