On 11/08/12 22:23, Jordan Justen wrote:
> Seems like you're going to need to:
> * Pull IoRead/Write16 from MdePkg/Library/BaseIoLibIntrinsic into the driver.
> * Rename to UnalignedIoRead/Write16 and remove the alignment assert
> * Read the BAR to get the address
> * Use UnalignedIoRead/Write16

Whoa, straight to the lowest level.  But works fine.  Adds gcc
dependency though.  Incremental patch attached FYI.

thanks,
  Gerd
From 3d38e9b451486b4df2e4e5ea6a223db240ffed86 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <[email protected]>
Date: Thu, 8 Nov 2012 23:07:57 +0100
Subject: [PATCH 2/2] unaligned access

---
 OvmfPkg/QemuVideoDxe/Driver.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index ef7e521..0037997 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -550,6 +550,19 @@ outw (
                       );
 }
 
+/*
+ * copy IoWrite16 from MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
+ * and drop alignment check
+ */
+VOID
+outw_unaligned (
+  IN      UINTN                     Port,
+  IN      UINT16                    Value
+  )
+{
+  __asm__ __volatile__ ("outw %w0,%w1" : : "a" (Value), "d" ((UINT16)Port));
+}
+
 /**
   TODO: Add function description
 
@@ -795,12 +808,8 @@ bochsw (
     Private->Variant = QEMU_VIDEO_BOCHS;
   }
 
-  /*
-   * FIXME: VBE_DISPI_IOPORT_DATA is unaligned and writes catched
-   *        somewhere in the stack, so this doesn't actually work.
-   */
   outw (Private, VBE_DISPI_IOPORT_INDEX, Reg);
-  outw (Private, VBE_DISPI_IOPORT_DATA,  Data);
+  outw_unaligned (VBE_DISPI_IOPORT_DATA,  Data);
 }
 
 VOID
-- 
1.7.1

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to