File: instmem.h

package info (click to toggle)
linux 3.14.12-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 666,320 kB
  • sloc: ansic: 11,822,312; asm: 273,382; xml: 46,774; perl: 44,603; makefile: 29,283; sh: 7,245; python: 6,582; cpp: 5,100; yacc: 4,233; lex: 2,167; awk: 737; pascal: 231; lisp: 218; sed: 30
file content (52 lines) | stat: -rw-r--r-- 1,219 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __NOUVEAU_INSTMEM_H__
#define __NOUVEAU_INSTMEM_H__

#include <core/subdev.h>
#include <core/device.h>
#include <core/mm.h>

struct nouveau_instobj {
	struct nouveau_object base;
	struct list_head head;
	u32 *suspend;
	u64 addr;
	u32 size;
};

static inline struct nouveau_instobj *
nv_memobj(void *obj)
{
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
	if (unlikely(!nv_iclass(obj, NV_MEMOBJ_CLASS)))
		nv_assert("BAD CAST -> NvMemObj, %08x", nv_hclass(obj));
#endif
	return obj;
}

struct nouveau_instmem {
	struct nouveau_subdev base;
	struct list_head list;

	u32 reserved;
	int (*alloc)(struct nouveau_instmem *, struct nouveau_object *,
		     u32 size, u32 align, struct nouveau_object **);
};

static inline struct nouveau_instmem *
nouveau_instmem(void *obj)
{
	/* nv04/nv40 impls need to create objects in their constructor,
	 * which is before the subdev pointer is valid
	 */
	if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
	    nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
		return obj;

	return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_INSTMEM];
}

extern struct nouveau_oclass *nv04_instmem_oclass;
extern struct nouveau_oclass *nv40_instmem_oclass;
extern struct nouveau_oclass *nv50_instmem_oclass;

#endif