Could this cause unaligned memory accesses?  This is fine for x86/x86_64,
could cause a fault on Itanium, and will always cause a fault on EBC.  It
would be a pretty remote use case but still could happen.

On Sun, Jan 20, 2013 at 1:41 PM, David Woodhouse <dw...@infradead.org>wrote:

> The current vgabios images shipped with qemu violate the PCI Firmware
> Specification by having a PCIR data structure at offset 0x10f, which is
> not DWORD-aligned.
>
> If I relax the check in OVMF, it works fine with SeaBIOS-as-CSM and I
> can initialise the VGA ROM then use INT 10h services for display in EFI.
>
> I've submitted a patch to *fix* the vgabios images, of course, but
> perhaps it's worth being lenient in OVMF?
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: David Woodhouse <david.woodho...@intel.com>
>
> diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
> b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
> index 910ed41..f5e647d 100644
> --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
> +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyPci.c
> @@ -305,7 +305,6 @@ GetPciLegacyRom (
>    RomHeader.Raw = *Rom;
>    while (RomHeader.Generic->Signature ==
> PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
>      if (RomHeader.Generic->PcirOffset == 0 ||
> -        (RomHeader.Generic->PcirOffset & 3) !=0 ||
>          *ImageSize < RomHeader.Raw - (UINT8 *) *Rom +
> RomHeader.Generic->PcirOffset + sizeof (PCI_DATA_STRUCTURE)) {
>        break;
>      }
> @@ -2919,8 +2918,7 @@ LegacyBiosInstallPciRom (
>
>      LocalRomImage = *RomImage;
>      if (((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->Signature !=
> PCI_EXPANSION_ROM_HEADER_SIGNATURE ||
> -        ((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->PcirOffset == 0 ||
> -        (((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->PcirOffset & 3 )
> != 0) {
> +        ((PCI_EXPANSION_ROM_HEADER *) LocalRomImage)->PcirOffset == 0) {
>        mVgaInstallationInProgress = FALSE;
>        return EFI_UNSUPPORTED;
>      }
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
> index 33dbfa4..21a522c 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
> @@ -420,7 +420,6 @@ LoadOpRomImage (
>      // The PCI Data Structure must be DWORD aligned.
>      //
>      if (OffsetPcir == 0 ||
> -        (OffsetPcir & 3) != 0 ||
>          RomImageSize + OffsetPcir + sizeof (PCI_DATA_STRUCTURE) >
> RomSize) {
>        break;
>      }
>
> --
> David Woodhouse                            Open Source Technology Centre
> david.woodho...@intel.com                              Intel Corporation
>
>
>
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_123012
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to