Created
May 8, 2016 18:14
-
-
Save coypoop/482fec62c5c6640beab29cf795c06ca8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
you've forgotten to apply this. | |
I suspected it is because you only have the ones that got all broken up. | |
this appears to apply well. | |
Index: sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c | |
===================================================================== | |
RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c,v | |
retrieving revision 1.10 | |
diff -p -u -r1.10 nouveau_engine_device_base.c | |
--- sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c 13 Apr 2016 08:50:51 -0000 1.10 | |
+++ sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c 17 Apr 2016 01:11:16 -0000 | |
@@ -297,12 +297,6 @@ nouveau_devobj_ctor(struct nouveau_objec | |
#ifdef __NetBSD__ | |
if (!(args->disable & NV_DEVICE_DISABLE_MMIO) && | |
!nv_subdev(device)->mmiosz) { | |
- /* | |
- * Map only through PRAMIN -- don't map the command | |
- * FIFO MMIO regions, which start at NV_FIFO_OFFSET = | |
- * 0x800000 and are mapped separately. | |
- */ | |
- mmio_size = MIN(mmio_size, 0x800000); | |
/* XXX errno NetBSD->Linux */ | |
ret = -bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh); | |
if (ret) { | |
Index: sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c | |
===================================================================== | |
RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c,v | |
retrieving revision 1.4 | |
diff -p -u -r1.4 nouveau_engine_fifo_base.c | |
--- sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c 10 Feb 2016 17:10:47 -0000 1.4 | |
+++ sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c 17 Apr 2016 01:11:16 -0000 | |
@@ -92,13 +97,68 @@ nouveau_fifo_channel_create_(struct nouv | |
/* map fifo control registers */ | |
#ifdef __NetBSD__ | |
- chan->bst = nv_device_resource_tag(device, bar); | |
- /* XXX errno NetBSD->Linux */ | |
- ret = -bus_space_map(chan->bst, nv_device_resource_start(device, bar) + | |
- addr + (chan->chid * size), size, 0, &chan->bsh); | |
- if (ret) | |
- return ret; | |
- chan->mapped = true; | |
+ if (bar == 0) { | |
+ /* | |
+ * We already map BAR 0 in the engine device base, so | |
+ * grab a subregion of that. | |
+ */ | |
+ bus_space_tag_t mmiot = nv_subdev(device)->mmiot; | |
+ bus_space_handle_t mmioh = nv_subdev(device)->mmioh; | |
+ bus_size_t mmiosz = nv_subdev(device)->mmiosz; | |
+ | |
+ /* Check whether it lies inside the region. */ | |
+ if (mmiosz < addr || | |
+ mmiosz - addr < chan->chid*size || | |
+ mmiosz - addr - chan->chid*size < size) { | |
+ ret = EIO; | |
+ nv_error(priv, "fifo channel out of range:" | |
+ " addr 0x%"PRIxMAX | |
+ " chid 0x%"PRIxMAX" size 0x%"PRIxMAX | |
+ " mmiosz 0x%"PRIxMAX"\n", | |
+ (uintmax_t)addr, | |
+ (uintmax_t)chan->chid, (uintmax_t)size, | |
+ (uintmax_t)mmiosz); | |
+ return ret; | |
+ } | |
+ | |
+ /* Grab a subregion. */ | |
+ /* XXX errno NetBSD->Linux */ | |
+ ret = -bus_space_subregion(mmiot, mmioh, | |
+ (addr + chan->chid*size), size, &chan->bsh); | |
+ if (ret) { | |
+ nv_error(priv, "bus_space_subregion failed: %d\n", | |
+ ret); | |
+ return ret; | |
+ } | |
+ | |
+ /* Success! No need to unmap a subregion. */ | |
+ chan->mapped = false; | |
+ chan->bst = mmiot; | |
+ } else { | |
+ chan->bst = nv_device_resource_tag(device, bar); | |
+ /* XXX errno NetBSD->Linux */ | |
+ ret = -bus_space_map(chan->bst, | |
+ (nv_device_resource_start(device, bar) + | |
+ addr + (chan->chid * size)), | |
+ size, 0, &chan->bsh); | |
+ if (ret) { | |
+ printf("%s: bus_space_map" | |
+ " bar %d addr %"PRIxMAX" + %"PRIxMAX | |
+ " + (%"PRIxMAX" * %"PRIxMAX") = %"PRIxMAX | |
+ " size %"PRIxMAX" failed: %d\n", | |
+ __func__, bar, | |
+ (uintmax_t)nv_device_resource_start(device, bar), | |
+ (uintmax_t)addr, | |
+ (uintmax_t)chan->chid, | |
+ (uintmax_t)size, | |
+ (uintmax_t)(nv_device_resource_start(device, bar) + | |
+ addr + (chan->chid * size)), | |
+ (uintmax_t)size, | |
+ ret); | |
+ return ret; | |
+ } | |
+ chan->mapped = true; | |
+ } | |
#else | |
chan->user = ioremap(nv_device_resource_start(device, bar) + addr + | |
(chan->chid * size), size); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment