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]
23 * Copyright 2010 PathScale Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef __PSCNV_VRAM_H__
28 #define __PSCNV_VRAM_H__
29 #include "pscnv_drm.h"
32 #define PSCNV_MEM_PAGE_SIZE 0x1000
34 /* A VRAM object of any kind. */
36 struct drm_device
*dev
;
37 /* size. Always a multiple of page size. */
39 /* misc flags, see below. */
42 /* cookie: free-form 32-bit number displayed in debug info. */
44 /* only used for debug */
46 /* only for contig blocks. same info as start of first [and only]
47 * region, but more convenient to access */
49 /* the following used for GEM objects only */
51 struct drm_gem_object
*gem
;
52 struct pscnv_mm_node
*map1
;
53 struct pscnv_mm_node
*map3
;
54 /* VRAM only: the first mm node */
55 struct pscnv_mm_node
*mmnode
;
56 /* SYSRaM only: list of pages */
59 /* CHAN only, pointer to a channel (FreeBSD doesn't allow overriding mmap) */
60 struct pscnv_chan
*chan
;
62 #define PSCNV_GEM_NOUSER 0x10
64 struct pscnv_vram_engine
{
65 void (*takedown
) (struct drm_device
*);
66 int (*alloc
) (struct pscnv_bo
*);
67 int (*free
) (struct pscnv_bo
*);
68 int (*sysram_tiling_ok
) (struct pscnv_bo
*);
71 extern int pscnv_mem_init(struct drm_device
*);
72 extern void pscnv_mem_takedown(struct drm_device
*);
73 extern struct pscnv_bo
*pscnv_mem_alloc(struct drm_device
*,
74 uint64_t size
, int flags
, int tile_flags
, uint32_t cookie
);
75 extern int pscnv_mem_free(struct pscnv_bo
*);
77 extern int pscnv_vram_free(struct pscnv_bo
*bo
);
78 extern void pscnv_vram_takedown(struct drm_device
*dev
);
80 extern int nv50_vram_init(struct drm_device
*);
81 extern int nvc0_vram_init(struct drm_device
*);
83 extern int pscnv_sysram_alloc(struct pscnv_bo
*);
84 extern int pscnv_sysram_free(struct pscnv_bo
*);
85 extern int pscnv_sysram_vm_fault(struct vm_area_struct
*vma
, struct vm_fault
*vmf
);