On Fri, Jan 28, 2011 at 09:44:17PM -0500, Ted Unangst wrote:
> 
> I'm a little scared of counting to 1000 here.  Does i = 100 work?  And
> is there a reason to write the loop backwards?
> 

If you're sharing tedu's concerns, try the version of the patch
below, and report the higher number of loops you see in your console
log.

Index: i915_drv.c
===================================================================
RCS file: /cvs/OpenBSD/src/sys/dev/pci/drm/i915_drv.c,v
retrieving revision 1.101
diff -u -r1.101 i915_drv.c
--- i915_drv.c  21 Sep 2010 23:05:41 -0000      1.101
+++ i915_drv.c  31 Jan 2011 21:09:43 -0000
@@ -995,16 +995,19 @@
                bus_space_write_4(dev_priv->ifp.i9xx.bst,
                    dev_priv->ifp.i9xx.bsh, 0, 1);
        } else {
-               /*
-                * I8XX don't have a flush page mechanism, but do have the
-                * cache. Do it the bruteforce way. we write 1024 byes into
-                * the cache, then clflush them out so they'll kick the stuff
-                * we care about out of the chipset cache.
-                */
-               if (dev_priv->ifp.i8xx.kva != NULL) {
-                       memset(dev_priv->ifp.i8xx.kva, 0, 1024);
-                       agp_flush_cache_range((vaddr_t)dev_priv->ifp.i8xx.kva,
-                           1024);
+               int i;
+
+               wbinvd();
+
+#define I830_HIC       0x70
+
+               I915_WRITE(I830_HIC, (I915_READ(I830_HIC) | (1<<31)));
+               for (i = 0; i < 1000; i++) {
+                       if (!(I915_READ(I830_HIC) & (1<<31))) {
+                               if (i) printf("i830_HIC waited %d loops\n", i);
+                               break;
+                       }
+                       delay(100);
                }
        }
 }

-- 
Matthieu Herrb

Reply via email to