ARM: pmu: add support for interrupt-affinity property
[linux/fpc-iii.git] / drivers / gpu / drm / nouveau / include / nvif / object.h
blob04c874707b96aecf9c6a5180513f3a69a68f6c64
1 #ifndef __NVIF_OBJECT_H__
2 #define __NVIF_OBJECT_H__
4 #include <nvif/os.h>
6 struct nvif_object {
7 struct nvif_object *parent;
8 struct nvif_object *object; /*XXX: hack for nvif_object() */
9 struct kref refcount;
10 u32 handle;
11 u32 oclass;
12 void *data;
13 u32 size;
14 void *priv; /*XXX: hack */
15 void (*dtor)(struct nvif_object *);
16 struct {
17 void __iomem *ptr;
18 u32 size;
19 } map;
22 int nvif_object_init(struct nvif_object *, void (*dtor)(struct nvif_object *),
23 u32 handle, u32 oclass, void *, u32,
24 struct nvif_object *);
25 void nvif_object_fini(struct nvif_object *);
26 int nvif_object_new(struct nvif_object *, u32 handle, u32 oclass,
27 void *, u32, struct nvif_object **);
28 void nvif_object_ref(struct nvif_object *, struct nvif_object **);
29 int nvif_object_ioctl(struct nvif_object *, void *, u32, void **);
30 int nvif_object_sclass(struct nvif_object *, u32 *, int);
31 u32 nvif_object_rd(struct nvif_object *, int, u64);
32 void nvif_object_wr(struct nvif_object *, int, u64, u32);
33 int nvif_object_mthd(struct nvif_object *, u32, void *, u32);
34 int nvif_object_map(struct nvif_object *);
35 void nvif_object_unmap(struct nvif_object *);
37 #define nvif_object(a) (a)->object
39 #define ioread8_native ioread8
40 #define iowrite8_native iowrite8
41 #define nvif_rd(a,b,c) ({ \
42 struct nvif_object *_object = nvif_object(a); \
43 u32 _data; \
44 if (likely(_object->map.ptr)) \
45 _data = ioread##b##_native((u8 __iomem *)_object->map.ptr + (c)); \
46 else \
47 _data = nvif_object_rd(_object, (b) / 8, (c)); \
48 _data; \
50 #define nvif_wr(a,b,c,d) ({ \
51 struct nvif_object *_object = nvif_object(a); \
52 if (likely(_object->map.ptr)) \
53 iowrite##b##_native((d), (u8 __iomem *)_object->map.ptr + (c)); \
54 else \
55 nvif_object_wr(_object, (b) / 8, (c), (d)); \
57 #define nvif_rd08(a,b) ({ u8 _v = nvif_rd((a), 8, (b)); _v; })
58 #define nvif_rd16(a,b) ({ u16 _v = nvif_rd((a), 16, (b)); _v; })
59 #define nvif_rd32(a,b) ({ u32 _v = nvif_rd((a), 32, (b)); _v; })
60 #define nvif_wr08(a,b,c) nvif_wr((a), 8, (b), (u8)(c))
61 #define nvif_wr16(a,b,c) nvif_wr((a), 16, (b), (u16)(c))
62 #define nvif_wr32(a,b,c) nvif_wr((a), 32, (b), (u32)(c))
63 #define nvif_mask(a,b,c,d) ({ \
64 u32 _v = nvif_rd32(nvif_object(a), (b)); \
65 nvif_wr32(nvif_object(a), (b), (_v & ~(c)) | (d)); \
66 _v; \
69 #define nvif_mthd(a,b,c,d) nvif_object_mthd(nvif_object(a), (b), (c), (d))
71 /*XXX*/
72 #include <core/object.h>
73 #define nvxx_object(a) ((struct nvkm_object *)nvif_object(a)->priv)
75 #endif