Wed Oct 14 00:12:56 2015 UTC ()
use pci_dma64_available() to choose a valid DMA tag.


(mrg)
diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c
diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nv50.c
diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_nvc0.c
diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv04.c
diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/nouveau_subdev_vm_nv44.c

cvs diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/Attic/nouveau_nv50_display.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/Attic/nouveau_nv50_display.c 2015/02/25 14:57:04 1.3
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/Attic/nouveau_nv50_display.c 2015/10/14 00:12:55 1.4
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: nouveau_nv50_display.c,v 1.3 2015/02/25 14:57:04 riastradh Exp $ */ 1/* $NetBSD: nouveau_nv50_display.c,v 1.4 2015/10/14 00:12:55 mrg Exp $ */
2 2
3 /* 3 /*
4 * Copyright 2011 Red Hat Inc. 4 * Copyright 2011 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 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.3 2015/02/25 14:57:04 riastradh Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.4 2015/10/14 00:12:55 mrg Exp $");
29 29
30#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
31#include <linux/err.h> 31#include <linux/err.h>
32 32
33#include <drm/drmP.h> 33#include <drm/drmP.h>
34#include <drm/drm_crtc_helper.h> 34#include <drm/drm_crtc_helper.h>
35 35
36#include "nouveau_drm.h" 36#include "nouveau_drm.h"
37#include "nouveau_dma.h" 37#include "nouveau_dma.h"
38#include "nouveau_gem.h" 38#include "nouveau_gem.h"
39#include "nouveau_connector.h" 39#include "nouveau_connector.h"
40#include "nouveau_encoder.h" 40#include "nouveau_encoder.h"
41#include "nouveau_crtc.h" 41#include "nouveau_crtc.h"
@@ -174,28 +174,28 @@ struct nv50_dmac { @@ -174,28 +174,28 @@ struct nv50_dmac {
174 174
175 /* Protects against concurrent pushbuf access to this channel, lock is 175 /* Protects against concurrent pushbuf access to this channel, lock is
176 * grabbed by evo_wait (if the pushbuf reservation is successful) and 176 * grabbed by evo_wait (if the pushbuf reservation is successful) and
177 * dropped again by evo_kick. */ 177 * dropped again by evo_kick. */
178 struct mutex lock; 178 struct mutex lock;
179}; 179};
180 180
181static void 181static void
182nv50_dmac_destroy(struct nouveau_object *core, struct nv50_dmac *dmac) 182nv50_dmac_destroy(struct nouveau_object *core, struct nv50_dmac *dmac)
183{ 183{
184 if (dmac->ptr) { 184 if (dmac->ptr) {
185 struct pci_dev *pdev = nv_device(core)->pdev; 185 struct pci_dev *pdev = nv_device(core)->pdev;
186#ifdef __NetBSD__ 186#ifdef __NetBSD__
187 /* XXX pa_dmat or pa_dmat64? */ 187 const bus_dma_tag_t dmat = pci_dma64_available(&pdev->pd_pa) ?
188 const bus_dma_tag_t dmat = pdev->pd_pa.pa_dmat64; 188 pdev->pd_pa.pa_dmat64 : pdev->pd_pa.pa_dmat;
189 189
190 bus_dmamap_unload(dmat, dmac->dmamap); 190 bus_dmamap_unload(dmat, dmac->dmamap);
191 bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE); 191 bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE);
192 bus_dmamap_destroy(dmat, dmac->dmamap); 192 bus_dmamap_destroy(dmat, dmac->dmamap);
193 bus_dmamem_free(dmat, &dmac->dmaseg, 1); 193 bus_dmamem_free(dmat, &dmac->dmaseg, 1);
194 dmac->handle = 0; 194 dmac->handle = 0;
195 dmac->ptr = NULL; 195 dmac->ptr = NULL;
196#else 196#else
197 pci_free_consistent(pdev, PAGE_SIZE, dmac->ptr, dmac->handle); 197 pci_free_consistent(pdev, PAGE_SIZE, dmac->ptr, dmac->handle);
198#endif 198#endif
199 } 199 }
200 200
201#ifdef __NetBSD__ 201#ifdef __NetBSD__
@@ -333,27 +333,30 @@ nv50_dmac_create(struct nouveau_object * @@ -333,27 +333,30 @@ nv50_dmac_create(struct nouveau_object *
333 struct nouveau_object *client = nv_pclass(core, NV_CLIENT_CLASS); 333 struct nouveau_object *client = nv_pclass(core, NV_CLIENT_CLASS);
334 struct nouveau_object *object; 334 struct nouveau_object *object;
335 u32 pushbuf = *(u32 *)data; 335 u32 pushbuf = *(u32 *)data;
336 int ret; 336 int ret;
337 337
338#ifdef __NetBSD__ 338#ifdef __NetBSD__
339 linux_mutex_init(&dmac->lock); 339 linux_mutex_init(&dmac->lock);
340#else 340#else
341 mutex_init(&dmac->lock); 341 mutex_init(&dmac->lock);
342#endif 342#endif
343 343
344#ifdef __NetBSD__ 344#ifdef __NetBSD__
345 { 345 {
346 const bus_dma_tag_t dmat = nv_device(core)->pdev->pd_pa.pa_dmat64; 346 struct nouveau_device *device = nv_device(core);
 347 const bus_dma_tag_t dmat = pci_dma64_available(&device->pdev->pd_pa) ?
 348 device->pdev->pd_pa.pa_dmat64 : device->pdev->pd_pa.pa_dmat;
 349
347 int rsegs; 350 int rsegs;
348 351
349 /* XXX errno NetBSD->Linux */ 352 /* XXX errno NetBSD->Linux */
350 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0, &dmac->dmaseg, 353 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0, &dmac->dmaseg,
351 1, &rsegs, BUS_DMA_WAITOK); 354 1, &rsegs, BUS_DMA_WAITOK);
352 if (ret) 355 if (ret)
353 return ret; 356 return ret;
354 KASSERT(rsegs == 1); 357 KASSERT(rsegs == 1);
355 /* XXX errno NetBSD->Linux */ 358 /* XXX errno NetBSD->Linux */
356 ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0, 359 ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
357 BUS_DMA_WAITOK, &dmac->dmamap); 360 BUS_DMA_WAITOK, &dmac->dmamap);
358 if (ret) { 361 if (ret) {
359 bus_dmamem_free(dmat, &dmac->dmaseg, 1); 362 bus_dmamem_free(dmat, &dmac->dmaseg, 1);

cvs diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/Attic/nouveau_subdev_fb_nv50.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/Attic/nouveau_subdev_fb_nv50.c 2015/02/25 17:29:43 1.2
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/Attic/nouveau_subdev_fb_nv50.c 2015/10/14 00:12:55 1.3
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: nouveau_subdev_fb_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */ 1/* $NetBSD: nouveau_subdev_fb_nv50.c,v 1.3 2015/10/14 00:12:55 mrg 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 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nv50.c,v 1.3 2015/10/14 00:12:55 mrg Exp $");
29 29
30#include <core/client.h> 30#include <core/client.h>
31#include <core/enum.h> 31#include <core/enum.h>
32#include <core/engctx.h> 32#include <core/engctx.h>
33#include <core/object.h> 33#include <core/object.h>
34 34
35#include <subdev/bios.h> 35#include <subdev/bios.h>
36 36
37#include "nv50.h" 37#include "nv50.h"
38 38
39int 39int
40nv50_fb_memtype[0x80] = { 40nv50_fb_memtype[0x80] = {
41 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -245,28 +245,28 @@ nv50_fb_ctor(struct nouveau_object *pare @@ -245,28 +245,28 @@ nv50_fb_ctor(struct nouveau_object *pare
245 struct nouveau_object **pobject) 245 struct nouveau_object **pobject)
246{ 246{
247 struct nouveau_device *device = nv_device(parent); 247 struct nouveau_device *device = nv_device(parent);
248 struct nv50_fb_priv *priv; 248 struct nv50_fb_priv *priv;
249 int ret; 249 int ret;
250 250
251 ret = nouveau_fb_create(parent, engine, oclass, &priv); 251 ret = nouveau_fb_create(parent, engine, oclass, &priv);
252 *pobject = nv_object(priv); 252 *pobject = nv_object(priv);
253 if (ret) 253 if (ret)
254 return ret; 254 return ret;
255 255
256#ifdef __NetBSD__ 256#ifdef __NetBSD__
257 { 257 {
258 /* XXX pa_dmat or pa_dmat64? */ 258 const bus_dma_tag_t dmat = pci_dma64_available(&device->pdev->pd_pa) ?
259 const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64; 259 device->pdev->pd_pa.pa_dmat64 : device->pdev->pd_pa.pa_dmat;
260 int nsegs; 260 int nsegs;
261 261
262 priv->r100c08_map = NULL; /* paranoia */ 262 priv->r100c08_map = NULL; /* paranoia */
263 priv->r100c08_kva = NULL; 263 priv->r100c08_kva = NULL;
264 264
265 /* XXX errno NetBSD->Linux */ 265 /* XXX errno NetBSD->Linux */
266 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0, 266 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0,
267 &priv->r100c08_seg, 1, &nsegs, BUS_DMA_WAITOK); 267 &priv->r100c08_seg, 1, &nsegs, BUS_DMA_WAITOK);
268 if (ret) { 268 if (ret) {
269fail0: nouveau_fb_destroy(&priv->base); 269fail0: nouveau_fb_destroy(&priv->base);
270 return ret; 270 return ret;
271 } 271 }
272 KASSERT(nsegs == 1); 272 KASSERT(nsegs == 1);
@@ -311,27 +311,28 @@ fail3: __unused bus_dmamem_unmap(dmat, p @@ -311,27 +311,28 @@ fail3: __unused bus_dmamem_unmap(dmat, p
311 311
312 nv_subdev(priv)->intr = nv50_fb_intr; 312 nv_subdev(priv)->intr = nv50_fb_intr;
313 return 0; 313 return 0;
314} 314}
315 315
316void 316void
317nv50_fb_dtor(struct nouveau_object *object) 317nv50_fb_dtor(struct nouveau_object *object)
318{ 318{
319 struct nouveau_device *device = nv_device(object); 319 struct nouveau_device *device = nv_device(object);
320 struct nv50_fb_priv *priv = (void *)object; 320 struct nv50_fb_priv *priv = (void *)object;
321 321
322#ifdef __NetBSD__ 322#ifdef __NetBSD__
323 if (priv->r100c08_map) { 323 if (priv->r100c08_map) {
324 const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64; 324 const bus_dma_tag_t dmat = pci_dma64_available(&device->pdev->pd_pa) ?
 325 device->pdev->pd_pa.pa_dmat64 : device->pdev->pd_pa.pa_dmat;
325 326
326 bus_dmamap_unload(dmat, priv->r100c08_map); 327 bus_dmamap_unload(dmat, priv->r100c08_map);
327 bus_dmamem_unmap(dmat, priv->r100c08_kva, PAGE_SIZE); 328 bus_dmamem_unmap(dmat, priv->r100c08_kva, PAGE_SIZE);
328 bus_dmamap_destroy(dmat, priv->r100c08_map); 329 bus_dmamap_destroy(dmat, priv->r100c08_map);
329 bus_dmamem_free(dmat, &priv->r100c08_seg, 1); 330 bus_dmamem_free(dmat, &priv->r100c08_seg, 1);
330 } 331 }
331#else 332#else
332 if (priv->r100c08_page) { 333 if (priv->r100c08_page) {
333 nv_device_unmap_page(device, priv->r100c08); 334 nv_device_unmap_page(device, priv->r100c08);
334 __free_page(priv->r100c08_page); 335 __free_page(priv->r100c08_page);
335 } 336 }
336#endif 337#endif
337 338

cvs diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/Attic/nouveau_subdev_fb_nvc0.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/Attic/nouveau_subdev_fb_nvc0.c 2015/02/25 17:29:43 1.2
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/Attic/nouveau_subdev_fb_nvc0.c 2015/10/14 00:12:55 1.3
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: nouveau_subdev_fb_nvc0.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */ 1/* $NetBSD: nouveau_subdev_fb_nvc0.c,v 1.3 2015/10/14 00:12:55 mrg 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 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nvc0.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nvc0.c,v 1.3 2015/10/14 00:12:55 mrg Exp $");
29 29
30#include "nvc0.h" 30#include "nvc0.h"
31 31
32extern const u8 nvc0_pte_storage_type_map[256]; 32extern const u8 nvc0_pte_storage_type_map[256];
33 33
34bool 34bool
35nvc0_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags) 35nvc0_fb_memtype_valid(struct nouveau_fb *pfb, u32 tile_flags)
36{ 36{
37 u8 memtype = (tile_flags & 0x0000ff00) >> 8; 37 u8 memtype = (tile_flags & 0x0000ff00) >> 8;
38 return likely((nvc0_pte_storage_type_map[memtype] != 0xff)); 38 return likely((nvc0_pte_storage_type_map[memtype] != 0xff));
39} 39}
40 40
41static void 41static void
@@ -71,27 +71,28 @@ nvc0_fb_init(struct nouveau_object *obje @@ -71,27 +71,28 @@ nvc0_fb_init(struct nouveau_object *obje
71 nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); 71 nv_wr32(priv, 0x100c10, priv->r100c10 >> 8);
72#endif 72#endif
73 return 0; 73 return 0;
74} 74}
75 75
76void 76void
77nvc0_fb_dtor(struct nouveau_object *object) 77nvc0_fb_dtor(struct nouveau_object *object)
78{ 78{
79 struct nouveau_device *device = nv_device(object); 79 struct nouveau_device *device = nv_device(object);
80 struct nvc0_fb_priv *priv = (void *)object; 80 struct nvc0_fb_priv *priv = (void *)object;
81 81
82#ifdef __NetBSD__ 82#ifdef __NetBSD__
83 if (priv->r100c10_map) { 83 if (priv->r100c10_map) {
84 const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64; 84 const bus_dma_tag_t dmat = pci_dma64_available(&device->pdev->pd_pa) ?
 85 device->pdev->pd_pa.pa_dmat64 : device->pdev->pd_pa.pa_dmat;
85 86
86 bus_dmamap_unload(dmat, priv->r100c10_map); 87 bus_dmamap_unload(dmat, priv->r100c10_map);
87 bus_dmamem_unmap(dmat, priv->r100c10_kva, PAGE_SIZE); 88 bus_dmamem_unmap(dmat, priv->r100c10_kva, PAGE_SIZE);
88 bus_dmamap_destroy(dmat, priv->r100c10_map); 89 bus_dmamap_destroy(dmat, priv->r100c10_map);
89 bus_dmamem_free(dmat, &priv->r100c10_seg, 1); 90 bus_dmamem_free(dmat, &priv->r100c10_seg, 1);
90 } 91 }
91#else 92#else
92 if (priv->r100c10_page) { 93 if (priv->r100c10_page) {
93 nv_device_unmap_page(device, priv->r100c10); 94 nv_device_unmap_page(device, priv->r100c10);
94 __free_page(priv->r100c10_page); 95 __free_page(priv->r100c10_page);
95 } 96 }
96#endif 97#endif
97 98
@@ -104,28 +105,28 @@ nvc0_fb_ctor(struct nouveau_object *pare @@ -104,28 +105,28 @@ nvc0_fb_ctor(struct nouveau_object *pare
104 struct nouveau_object **pobject) 105 struct nouveau_object **pobject)
105{ 106{
106 struct nouveau_device *device = nv_device(parent); 107 struct nouveau_device *device = nv_device(parent);
107 struct nvc0_fb_priv *priv; 108 struct nvc0_fb_priv *priv;
108 int ret; 109 int ret;
109 110
110 ret = nouveau_fb_create(parent, engine, oclass, &priv); 111 ret = nouveau_fb_create(parent, engine, oclass, &priv);
111 *pobject = nv_object(priv); 112 *pobject = nv_object(priv);
112 if (ret) 113 if (ret)
113 return ret; 114 return ret;
114 115
115#ifdef __NetBSD__ 116#ifdef __NetBSD__
116 { 117 {
117 /* XXX pa_dmat or pa_dmat64? */ 118 const bus_dma_tag_t dmat = pci_dma64_available(&device->pdev->pd_pa) ?
118 const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64; 119 device->pdev->pd_pa.pa_dmat64 : device->pdev->pd_pa.pa_dmat;
119 int nsegs; 120 int nsegs;
120 121
121 priv->r100c10_map = NULL; /* paranoia */ 122 priv->r100c10_map = NULL; /* paranoia */
122 priv->r100c10_kva = NULL; 123 priv->r100c10_kva = NULL;
123 124
124 /* XXX errno NetBSD->Linux */ 125 /* XXX errno NetBSD->Linux */
125 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0, 126 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0,
126 &priv->r100c10_seg, 1, &nsegs, BUS_DMA_WAITOK); 127 &priv->r100c10_seg, 1, &nsegs, BUS_DMA_WAITOK);
127 if (ret) { 128 if (ret) {
128fail0: nouveau_fb_destroy(&priv->base); 129fail0: nouveau_fb_destroy(&priv->base);
129 return ret; 130 return ret;
130 } 131 }
131 KASSERT(nsegs == 1); 132 KASSERT(nsegs == 1);

cvs diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/Attic/nouveau_subdev_vm_nv04.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/Attic/nouveau_subdev_vm_nv04.c 2015/02/25 22:12:00 1.2
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/Attic/nouveau_subdev_vm_nv04.c 2015/10/14 00:12:55 1.3
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: nouveau_subdev_vm_nv04.c,v 1.2 2015/02/25 22:12:00 riastradh Exp $ */ 1/* $NetBSD: nouveau_subdev_vm_nv04.c,v 1.3 2015/10/14 00:12:55 mrg 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 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_vm_nv04.c,v 1.2 2015/02/25 22:12:00 riastradh Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_vm_nv04.c,v 1.3 2015/10/14 00:12:55 mrg Exp $");
29 29
30#include <core/gpuobj.h> 30#include <core/gpuobj.h>
31 31
32#include "nv04.h" 32#include "nv04.h"
33 33
34#define NV04_PDMA_SIZE (128 * 1024 * 1024) 34#define NV04_PDMA_SIZE (128 * 1024 * 1024)
35#define NV04_PDMA_PAGE ( 4 * 1024) 35#define NV04_PDMA_PAGE ( 4 * 1024)
36 36
37/******************************************************************************* 37/*******************************************************************************
38 * VM map/unmap callbacks 38 * VM map/unmap callbacks
39 ******************************************************************************/ 39 ******************************************************************************/
40 40
41static void 41static void
@@ -129,29 +129,29 @@ nv04_vmmgr_ctor(struct nouveau_object *p @@ -129,29 +129,29 @@ nv04_vmmgr_ctor(struct nouveau_object *p
129 return 0; 129 return 0;
130} 130}
131 131
132void 132void
133nv04_vmmgr_dtor(struct nouveau_object *object) 133nv04_vmmgr_dtor(struct nouveau_object *object)
134{ 134{
135 struct nv04_vmmgr_priv *priv = (void *)object; 135 struct nv04_vmmgr_priv *priv = (void *)object;
136 if (priv->vm) { 136 if (priv->vm) {
137 nouveau_gpuobj_ref(NULL, &priv->vm->pgt[0].obj[0]); 137 nouveau_gpuobj_ref(NULL, &priv->vm->pgt[0].obj[0]);
138 nouveau_vm_ref(NULL, &priv->vm, NULL); 138 nouveau_vm_ref(NULL, &priv->vm, NULL);
139 } 139 }
140#ifdef __NetBSD__ 140#ifdef __NetBSD__
141 if (priv->nullp) { 141 if (priv->nullp) {
142 /* XXX pa_dmat or pa_dmat64? */ 
143 struct nouveau_device *device = nv_device(priv); 142 struct nouveau_device *device = nv_device(priv);
144 const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64; 143 const bus_dma_tag_t dmat = pci_dma64_available(&device->pdev->pd_pa) ?
 144 device->pdev->pd_pa.pa_dmat64 : device->pdev->pd_pa.pa_dmat;
145 145
146 bus_dmamap_unload(dmat, priv->nullmap); 146 bus_dmamap_unload(dmat, priv->nullmap);
147 bus_dmamem_unmap(dmat, priv->nullp, PAGE_SIZE); 147 bus_dmamem_unmap(dmat, priv->nullp, PAGE_SIZE);
148 bus_dmamap_destroy(dmat, priv->nullmap); 148 bus_dmamap_destroy(dmat, priv->nullmap);
149 bus_dmamem_free(dmat, &priv->nullseg, 1); 149 bus_dmamem_free(dmat, &priv->nullseg, 1);
150 } 150 }
151#else 151#else
152 if (priv->nullp) { 152 if (priv->nullp) {
153 pci_free_consistent(nv_device(priv)->pdev, 16 * 1024, 153 pci_free_consistent(nv_device(priv)->pdev, 16 * 1024,
154 priv->nullp, priv->null); 154 priv->nullp, priv->null);
155 } 155 }
156#endif 156#endif
157 nouveau_vmmgr_destroy(&priv->base); 157 nouveau_vmmgr_destroy(&priv->base);

cvs diff -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/Attic/nouveau_subdev_vm_nv44.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/Attic/nouveau_subdev_vm_nv44.c 2015/02/25 22:12:00 1.2
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/vm/Attic/nouveau_subdev_vm_nv44.c 2015/10/14 00:12:55 1.3
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: nouveau_subdev_vm_nv44.c,v 1.2 2015/02/25 22:12:00 riastradh Exp $ */ 1/* $NetBSD: nouveau_subdev_vm_nv44.c,v 1.3 2015/10/14 00:12:55 mrg 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 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_vm_nv44.c,v 1.2 2015/02/25 22:12:00 riastradh Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_vm_nv44.c,v 1.3 2015/10/14 00:12:55 mrg Exp $");
29 29
30#include <core/gpuobj.h> 30#include <core/gpuobj.h>
31#include <core/option.h> 31#include <core/option.h>
32 32
33#include <subdev/timer.h> 33#include <subdev/timer.h>
34#include <subdev/vm.h> 34#include <subdev/vm.h>
35 35
36#include "nv04.h" 36#include "nv04.h"
37 37
38#define NV44_GART_SIZE (512 * 1024 * 1024) 38#define NV44_GART_SIZE (512 * 1024 * 1024)
39#define NV44_GART_PAGE ( 4 * 1024) 39#define NV44_GART_PAGE ( 4 * 1024)
40 40
41/******************************************************************************* 41/*******************************************************************************
@@ -182,28 +182,28 @@ nv44_vmmgr_ctor(struct nouveau_object *p @@ -182,28 +182,28 @@ nv44_vmmgr_ctor(struct nouveau_object *p
182 182
183 priv->base.create = nv04_vm_create; 183 priv->base.create = nv04_vm_create;
184 priv->base.limit = NV44_GART_SIZE; 184 priv->base.limit = NV44_GART_SIZE;
185 priv->base.dma_bits = 39; 185 priv->base.dma_bits = 39;
186 priv->base.pgt_bits = 32 - 12; 186 priv->base.pgt_bits = 32 - 12;
187 priv->base.spg_shift = 12; 187 priv->base.spg_shift = 12;
188 priv->base.lpg_shift = 12; 188 priv->base.lpg_shift = 12;
189 priv->base.map_sg = nv44_vm_map_sg; 189 priv->base.map_sg = nv44_vm_map_sg;
190 priv->base.unmap = nv44_vm_unmap; 190 priv->base.unmap = nv44_vm_unmap;
191 priv->base.flush = nv44_vm_flush; 191 priv->base.flush = nv44_vm_flush;
192 192
193#ifdef __NetBSD__ 193#ifdef __NetBSD__
194 { 194 {
195 /* XXX pa_dmat or pa_dmat64? */ 195 const bus_dma_tag_t dmat = pci_dma64_available(&device->pdev->pd_pa) ?
196 const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64; 196 device->pdev->pd_pa.pa_dmat64 : device->pdev->pd_pa.pa_dmat;
197 int nsegs; 197 int nsegs;
198 198
199 /* XXX errno NetBSD->Linux */ 199 /* XXX errno NetBSD->Linux */
200 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0, 200 ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0,
201 &priv->nullseg, 1, &nsegs, BUS_DMA_WAITOK); 201 &priv->nullseg, 1, &nsegs, BUS_DMA_WAITOK);
202 if (ret) { 202 if (ret) {
203 /* XXX Need to destroy stuff... */ 203 /* XXX Need to destroy stuff... */
204fail0: nv_error(priv, "unable to allocate dummy pages\n"); 204fail0: nv_error(priv, "unable to allocate dummy pages\n");
205 return ret; 205 return ret;
206 } 206 }
207 KASSERT(nsegs == 1); 207 KASSERT(nsegs == 1);
208 208
209 /* XXX errno NetBSD->Linux */ 209 /* XXX errno NetBSD->Linux */