Mon Aug 27 14:51:55 2018 UTC ()
Missed some spots of I/O byte ordering.


(riastradh)
diff -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_chan.c
diff -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c

cvs diff -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_chan.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_chan.c 2018/08/27 14:51:33 1.6
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_chan.c 2018/08/27 14:51:55 1.7
@@ -1,40 +1,40 @@ @@ -1,40 +1,40 @@
1/* $NetBSD: nouveau_nvkm_engine_fifo_chan.c,v 1.6 2018/08/27 14:51:33 riastradh Exp $ */ 1/* $NetBSD: nouveau_nvkm_engine_fifo_chan.c,v 1.7 2018/08/27 14:51:55 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright 2012 Red Hat Inc. 4 * Copyright 2012 Red Hat Inc.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE. 22 * OTHER DEALINGS IN THE SOFTWARE.
23 * 23 *
24 * Authors: Ben Skeggs 24 * Authors: Ben Skeggs
25 */ 25 */
26#include <sys/cdefs.h> 26#include <sys/cdefs.h>
27__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_fifo_chan.c,v 1.6 2018/08/27 14:51:33 riastradh Exp $"); 27__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_fifo_chan.c,v 1.7 2018/08/27 14:51:55 riastradh Exp $");
28 28
29#include "chan.h" 29#include "chan.h"
30 30
31#include <core/client.h> 31#include <core/client.h>
32#include <core/gpuobj.h> 32#include <core/gpuobj.h>
33#include <core/oproxy.h> 33#include <core/oproxy.h>
34#include <subdev/mmu.h> 34#include <subdev/mmu.h>
35#include <engine/dma.h> 35#include <engine/dma.h>
36 36
37struct nvkm_fifo_chan_object { 37struct nvkm_fifo_chan_object {
38 struct nvkm_oproxy oproxy; 38 struct nvkm_oproxy oproxy;
39 struct nvkm_fifo_chan *chan; 39 struct nvkm_fifo_chan *chan;
40 int hash; 40 int hash;
@@ -323,27 +323,27 @@ nvkm_fifo_chan_wr32(struct nvkm_object * @@ -323,27 +323,27 @@ nvkm_fifo_chan_wr32(struct nvkm_object *
323 int ret = nvkm_fifo_chan_ensure_mapped(chan); 323 int ret = nvkm_fifo_chan_ensure_mapped(chan);
324 if (ret) 324 if (ret)
325 return ret; 325 return ret;
326#else 326#else
327 if (unlikely(!chan->user)) { 327 if (unlikely(!chan->user)) {
328 chan->user = ioremap(chan->addr, chan->size); 328 chan->user = ioremap(chan->addr, chan->size);
329 if (!chan->user) 329 if (!chan->user)
330 return -ENOMEM; 330 return -ENOMEM;
331 } 331 }
332#endif 332#endif
333 if (unlikely(addr + 4 > chan->size)) 333 if (unlikely(addr + 4 > chan->size))
334 return -EINVAL; 334 return -EINVAL;
335#ifdef __NetBSD__ 335#ifdef __NetBSD__
336 bus_space_write_4(chan->bst, chan->bsh, addr, data); 336 bus_space_write_stream_4(chan->bst, chan->bsh, addr, data);
337#else 337#else
338 iowrite32_native(data, chan->user + addr); 338 iowrite32_native(data, chan->user + addr);
339#endif 339#endif
340 return 0; 340 return 0;
341} 341}
342 342
343static int 343static int
344nvkm_fifo_chan_fini(struct nvkm_object *object, bool suspend) 344nvkm_fifo_chan_fini(struct nvkm_object *object, bool suspend)
345{ 345{
346 struct nvkm_fifo_chan *chan = nvkm_fifo_chan(object); 346 struct nvkm_fifo_chan *chan = nvkm_fifo_chan(object);
347 chan->func->fini(chan); 347 chan->func->fini(chan);
348 return 0; 348 return 0;
349} 349}

cvs diff -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c 2018/08/27 14:51:33 1.4
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c 2018/08/27 14:51:55 1.5
@@ -1,40 +1,40 @@ @@ -1,40 +1,40 @@
1/* $NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.4 2018/08/27 14:51:33 riastradh Exp $ */ 1/* $NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.5 2018/08/27 14:51:55 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright 2012 Red Hat Inc. 4 * Copyright 2012 Red Hat Inc.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE. 22 * OTHER DEALINGS IN THE SOFTWARE.
23 * 23 *
24 * Authors: Ben Skeggs 24 * Authors: Ben Skeggs
25 */ 25 */
26#include <sys/cdefs.h> 26#include <sys/cdefs.h>
27__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.4 2018/08/27 14:51:33 riastradh Exp $"); 27__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_instmem_nv40.c,v 1.5 2018/08/27 14:51:55 riastradh Exp $");
28 28
29#define nv40_instmem(p) container_of((p), struct nv40_instmem, base) 29#define nv40_instmem(p) container_of((p), struct nv40_instmem, base)
30#include "priv.h" 30#include "priv.h"
31 31
32#include <core/memory.h> 32#include <core/memory.h>
33#include <core/ramht.h> 33#include <core/ramht.h>
34#include <engine/gr/nv40.h> 34#include <engine/gr/nv40.h>
35 35
36#ifdef __NetBSD__ 36#ifdef __NetBSD__
37# define __iomem __nvkm_memory_iomem 37# define __iomem __nvkm_memory_iomem
38#endif 38#endif
39 39
40struct nv40_instmem { 40struct nv40_instmem {
@@ -158,38 +158,38 @@ nv40_instobj_new(struct nvkm_instmem *ba @@ -158,38 +158,38 @@ nv40_instobj_new(struct nvkm_instmem *ba
158 mutex_unlock(&imem->base.subdev.mutex); 158 mutex_unlock(&imem->base.subdev.mutex);
159 return ret; 159 return ret;
160} 160}
161 161
162/****************************************************************************** 162/******************************************************************************
163 * instmem subdev implementation 163 * instmem subdev implementation
164 *****************************************************************************/ 164 *****************************************************************************/
165 165
166static u32 166static u32
167nv40_instmem_rd32(struct nvkm_instmem *base, u32 addr) 167nv40_instmem_rd32(struct nvkm_instmem *base, u32 addr)
168{ 168{
169#ifdef __NetBSD__ 169#ifdef __NetBSD__
170 struct nv40_instmem *imem = nv40_instmem(base); 170 struct nv40_instmem *imem = nv40_instmem(base);
171 return bus_space_read_4(imem->iomemt, imem->iomemh, addr); 171 return bus_space_read_stream_4(imem->iomemt, imem->iomemh, addr);
172#else 172#else
173 return ioread32_native(nv40_instmem(base)->iomem + addr); 173 return ioread32_native(nv40_instmem(base)->iomem + addr);
174#endif 174#endif
175} 175}
176 176
177static void 177static void
178nv40_instmem_wr32(struct nvkm_instmem *base, u32 addr, u32 data) 178nv40_instmem_wr32(struct nvkm_instmem *base, u32 addr, u32 data)
179{ 179{
180#ifdef __NetBSD__ 180#ifdef __NetBSD__
181 struct nv40_instmem *imem = nv40_instmem(base); 181 struct nv40_instmem *imem = nv40_instmem(base);
182 bus_space_write_4(imem->iomemt, imem->iomemh, addr, data); 182 bus_space_write_stream_4(imem->iomemt, imem->iomemh, addr, data);
183#else 183#else
184 iowrite32_native(data, nv40_instmem(base)->iomem + addr); 184 iowrite32_native(data, nv40_instmem(base)->iomem + addr);
185#endif 185#endif
186} 186}
187 187
188static int 188static int
189nv40_instmem_oneinit(struct nvkm_instmem *base) 189nv40_instmem_oneinit(struct nvkm_instmem *base)
190{ 190{
191 struct nv40_instmem *imem = nv40_instmem(base); 191 struct nv40_instmem *imem = nv40_instmem(base);
192 struct nvkm_device *device = imem->base.subdev.device; 192 struct nvkm_device *device = imem->base.subdev.device;
193 int ret, vs; 193 int ret, vs;
194 194
195 /* PRAMIN aperture maps over the end of vram, reserve enough space 195 /* PRAMIN aperture maps over the end of vram, reserve enough space