Set memory attributes on page
[pscnv.git] / pscnv / pscnv_chan.h
blob8eec36e7f3977f5c299b6c7862552995ca89a84b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2010 PathScale Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef __PSCNV_CHAN_H__
28 #define __PSCNV_CHAN_H__
30 #include "pscnv_vm.h"
31 #include "pscnv_ramht.h"
32 #include "pscnv_engine.h"
34 /* XXX */
35 extern uint64_t nvc0_fifo_ctrl_offs(struct drm_device *dev, int cid);
37 struct pscnv_chan {
38 struct drm_device *dev;
39 int cid;
40 /* protected by ch_lock below, used for lookup */
41 uint32_t handle;
42 struct pscnv_vspace *vspace;
43 struct list_head vspace_list;
44 struct pscnv_bo *bo;
45 spinlock_t instlock;
46 int instpos;
47 struct pscnv_ramht ramht;
48 uint32_t ramfc;
49 struct pscnv_bo *cache;
50 struct drm_file *filp;
51 struct kref ref;
52 void *engdata[PSCNV_ENGINES_NUM];
55 struct pscnv_chan_engine {
56 void (*takedown) (struct drm_device *dev);
57 int (*do_chan_new) (struct pscnv_chan *ch);
58 void (*do_chan_free) (struct pscnv_chan *ch);
59 struct pscnv_chan *fake_chans[4];
60 struct pscnv_chan *chans[128];
61 spinlock_t ch_lock;
62 int ch_min, ch_max;
65 extern struct pscnv_chan *pscnv_chan_new(struct drm_device *dev, struct pscnv_vspace *, int fake);
67 extern void pscnv_chan_ref_free(struct kref *ref);
69 static inline void pscnv_chan_ref(struct pscnv_chan *ch) {
70 kref_get(&ch->ref);
73 static inline void pscnv_chan_unref(struct pscnv_chan *ch) {
74 kref_put(&ch->ref, pscnv_chan_ref_free);
77 extern int pscnv_chan_mmap(struct file *filp, struct vm_area_struct *vma);
78 extern int pscnv_chan_handle_lookup(struct drm_device *dev, uint32_t handle);
80 int nv50_chan_init(struct drm_device *dev);
81 int nvc0_chan_init(struct drm_device *dev);
83 #endif