Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device...



details:   https://anonhg.NetBSD.org/src/rev/e9e1aba0fd51
branches:  netbsd-7
changeset: 799787:e9e1aba0fd51
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Feb 11 23:00:30 2016 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1082):
        sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c: revisions 1.6-1.8
Fix bogus output parameter for bus_space_map.
We stored the bus space handle in nv_subdev(device)->mmioh, which we
then overwrote with whatever was in the mmioh local variable -- maybe
garbage, maybe an old mapping, almost certainly wrong either way.
Instead store it in mmioh so that the subsequent assignment
nv_subdev(device)->mmioh = mmioh actually works as intended.
--
Return error from bus_space_map.
--
Paranoia about mmio register mapping size.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c |  17 ++++++---
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r d7043be7f5f9 -r e9e1aba0fd51 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Thu Feb 11 22:55:50 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c    Thu Feb 11 23:00:30 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_engine_device_base.c,v 1.2.4.2 2015/03/06 21:39:08 snj Exp $   */
+/*     $NetBSD: nouveau_engine_device_base.c,v 1.2.4.3 2016/02/11 23:00:30 snj Exp $   */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2.4.2 2015/03/06 21:39:08 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2.4.3 2016/02/11 23:00:30 snj Exp $");
 
 #include <core/object.h>
 #include <core/device.h>
@@ -177,8 +177,12 @@
        if (!(args->disable & NV_DEVICE_DISABLE_IDENTIFY) &&
            !device->card_type) {
 #ifdef __NetBSD__
-               if (bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh) != 0)
+               if (mmio_size < 0x102000)
                        return -ENOMEM;
+               /* XXX errno NetBSD->Linux */
+               ret = -bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh);
+               if (ret)
+                       return ret;
 
 #ifndef __BIG_ENDIAN
                if (bus_space_read_4(mmiot, mmioh, 4) != 0)
@@ -293,10 +297,11 @@
 #ifdef __NetBSD__
        if (!(args->disable & NV_DEVICE_DISABLE_MMIO) &&
            !nv_subdev(device)->mmiosz) {
-               if (bus_space_map(mmiot, mmio_base, mmio_size, 0,
-                       &nv_subdev(device)->mmioh) != 0) {
+               /* XXX errno NetBSD->Linux */
+               ret = -bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh);
+               if (ret) {
                        nv_error(device, "unable to map device registers\n");
-                       return -ENOMEM;
+                       return ret;
                }
                nv_subdev(device)->mmiot = mmiot;
                nv_subdev(device)->mmioh = mmioh;



Home | Main Index | Thread Index | Old Index