Sat Oct 17 21:11:06 2015 UTC ()
use VM_FREELIST_DEFAULT on arm


(jmcneill)
diff -r1.7 -r1.8 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h

cvs diff -r1.7 -r1.8 src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h 2014/07/26 14:27:40 1.7
+++ src/sys/external/bsd/drm2/include/drm/bus_dma_hacks.h 2015/10/17 21:11:06 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bus_dma_hacks.h,v 1.7 2014/07/26 14:27:40 riastradh Exp $ */ 1/* $NetBSD: bus_dma_hacks.h,v 1.8 2015/10/17 21:11:06 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -30,33 +30,33 @@ @@ -30,33 +30,33 @@
30 */ 30 */
31 31
32#ifndef _DRM_BUS_DMA_HACKS_H_ 32#ifndef _DRM_BUS_DMA_HACKS_H_
33#define _DRM_BUS_DMA_HACKS_H_ 33#define _DRM_BUS_DMA_HACKS_H_
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36#include <sys/bus.h> 36#include <sys/bus.h>
37#include <sys/kmem.h> 37#include <sys/kmem.h>
38#include <sys/queue.h> 38#include <sys/queue.h>
39 39
40#include <uvm/uvm.h> 40#include <uvm/uvm.h>
41#include <uvm/uvm_extern.h> 41#include <uvm/uvm_extern.h>
42 42
43/* XXX This is x86-specific bollocks. */ 43#if defined(__i386__) || defined(__x86_64__)
44#if !defined(__i386__) && !defined(__x86_64__) 
45#error DRM GEM/TTM need new MI bus_dma APIs! Halp! 
46#endif 
47 
48#include <x86/bus_private.h> 44#include <x86/bus_private.h>
49#include <x86/machdep.h> 45#include <x86/machdep.h>
 46#elif defined(__arm__)
 47#else
 48#error DRM GEM/TTM need new MI bus_dma APIs! Halp!
 49#endif
50 50
51static inline int 51static inline int
52bus_dmamem_wire_uvm_object(bus_dma_tag_t tag, struct uvm_object *uobj, 52bus_dmamem_wire_uvm_object(bus_dma_tag_t tag, struct uvm_object *uobj,
53 off_t start, bus_size_t size, struct pglist *pages, bus_size_t alignment, 53 off_t start, bus_size_t size, struct pglist *pages, bus_size_t alignment,
54 bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, 54 bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
55 int flags) 55 int flags)
56{ 56{
57 struct pglist pageq; 57 struct pglist pageq;
58 struct vm_page *page; 58 struct vm_page *page;
59 unsigned i; 59 unsigned i;
60 int error; 60 int error;
61 61
62 /* 62 /*
@@ -106,27 +106,31 @@ fail0: return error; @@ -106,27 +106,31 @@ fail0: return error;
106} 106}
107 107
108static inline void 108static inline void
109bus_dmamem_unwire_uvm_object(bus_dma_tag_t tag __unused, 109bus_dmamem_unwire_uvm_object(bus_dma_tag_t tag __unused,
110 struct uvm_object *uobj, off_t start, bus_size_t size, 110 struct uvm_object *uobj, off_t start, bus_size_t size,
111 bus_dma_segment_t *segs __unused, int nsegs __unused) 111 bus_dma_segment_t *segs __unused, int nsegs __unused)
112{ 112{
113 uvm_obj_unwirepages(uobj, start, (start + size)); 113 uvm_obj_unwirepages(uobj, start, (start + size));
114} 114}
115 115
116static inline int 116static inline int
117bus_dmamem_pgfl(bus_dma_tag_t tag) 117bus_dmamem_pgfl(bus_dma_tag_t tag)
118{ 118{
 119#if defined(__i386__) || defined(__x86_64__)
119 return x86_select_freelist(tag->_bounce_alloc_hi - 1); 120 return x86_select_freelist(tag->_bounce_alloc_hi - 1);
 121#else
 122 return VM_FREELIST_DEFAULT;
 123#endif
120} 124}
121 125
122static inline int 126static inline int
123bus_dmamap_load_pglist(bus_dma_tag_t tag, bus_dmamap_t map, 127bus_dmamap_load_pglist(bus_dma_tag_t tag, bus_dmamap_t map,
124 struct pglist *pglist, bus_size_t size, int flags) 128 struct pglist *pglist, bus_size_t size, int flags)
125{ 129{
126 km_flag_t kmflags; 130 km_flag_t kmflags;
127 bus_dma_segment_t *segs; 131 bus_dma_segment_t *segs;
128 int nsegs, seg; 132 int nsegs, seg;
129 struct vm_page *page; 133 struct vm_page *page;
130 int error; 134 int error;
131 135
132 nsegs = 0; 136 nsegs = 0;