Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/i915 Temporary diagnostic klu...



details:   https://anonhg.NetBSD.org/src/rev/792b25b7625e
branches:  trunk
changeset: 835257:792b25b7625e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 13:41:50 2018 +0000

description:
Temporary diagnostic kludge: confirm the ubc_uiomove worked as expected.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/intel_guc_loader.c |  33 ++++++++++++++++-
 1 files changed, 31 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r bc4feb80de52 -r 792b25b7625e sys/external/bsd/drm2/dist/drm/i915/intel_guc_loader.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_guc_loader.c    Mon Aug 27 13:41:37 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_guc_loader.c    Mon Aug 27 13:41:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_guc_loader.c,v 1.7 2018/08/27 13:40:28 riastradh Exp $   */
+/*     $NetBSD: intel_guc_loader.c,v 1.8 2018/08/27 13:41:50 riastradh Exp $   */
 
 /*
  * Copyright © 2014 Intel Corporation
@@ -29,7 +29,7 @@
  *    Alex Dai <yu.dai%intel.com@localhost>
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_guc_loader.c,v 1.7 2018/08/27 13:40:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_guc_loader.c,v 1.8 2018/08/27 13:41:50 riastradh Exp $");
 
 #include <linux/firmware.h>
 #include <linux/module.h>
@@ -539,6 +539,35 @@
                goto fail;
        }
 
+#ifdef __NetBSD__              /* XXX temporary diagnostic kludge */
+       {
+               void *buf = kmem_alloc(fw->size, KM_SLEEP);
+               struct iovec iov;
+               struct uio uio;
+               iov.iov_base = buf;
+               iov.iov_len = fw->size;
+               uio.uio_iov = &iov;
+               uio.uio_iovcnt = 1;
+               uio.uio_resid = fw->size;
+               uio.uio_rw = UIO_READ;
+               UIO_SETUP_SYSSPACE(&uio);
+               err = -ubc_uiomove(obj->base.filp, &uio, fw->size,
+                   UVM_ADV_NORMAL, UBC_READ);
+               if (err) {
+                       DRM_DEBUG_DRIVER("ubc_uiomove failed for test: %d\n",
+                           err);
+                       kmem_free(buf, fw->size);
+                       goto fail;
+               }
+               if (memcmp(fw->data, buf, fw->size) != 0) {
+                       DRM_DEBUG_DRIVER("firmware copy corrupted\n");
+                       kmem_free(buf, fw->size);
+                       goto fail;
+               }
+               kmem_free(buf, fw->size);
+       }
+#endif
+
        guc_fw->guc_fw_obj = obj;
        guc_fw->guc_fw_size = fw->size;
 



Home | Main Index | Thread Index | Old Index