1 | #ifndef __NOUVEAU_MC_H__ |
2 | #define __NOUVEAU_MC_H__ |
3 | |
4 | #include <core/subdev.h> |
5 | #include <core/device.h> |
6 | |
7 | struct nouveau_mc_intr { |
8 | u32 stat; |
9 | u32 unit; |
10 | }; |
11 | |
12 | struct nouveau_mc { |
13 | struct nouveau_subdev base; |
14 | bool use_msi; |
15 | unsigned int irq; |
16 | #ifdef __NetBSD__ |
17 | void *irq_cookie; |
18 | #endif |
19 | }; |
20 | |
21 | static inline struct nouveau_mc * |
22 | nouveau_mc(void *obj) |
23 | { |
24 | return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_MC]; |
25 | } |
26 | |
27 | #define nouveau_mc_create(p,e,o,d) \ |
28 | nouveau_mc_create_((p), (e), (o), sizeof(**d), (void **)d) |
29 | #define nouveau_mc_destroy(p) ({ \ |
30 | struct nouveau_mc *pmc = (p); _nouveau_mc_dtor(nv_object(pmc)); \ |
31 | }) |
32 | #define nouveau_mc_init(p) ({ \ |
33 | struct nouveau_mc *pmc = (p); _nouveau_mc_init(nv_object(pmc)); \ |
34 | }) |
35 | #define nouveau_mc_fini(p,s) ({ \ |
36 | struct nouveau_mc *pmc = (p); _nouveau_mc_fini(nv_object(pmc), (s)); \ |
37 | }) |
38 | |
39 | int nouveau_mc_create_(struct nouveau_object *, struct nouveau_object *, |
40 | struct nouveau_oclass *, int, void **); |
41 | void _nouveau_mc_dtor(struct nouveau_object *); |
42 | int _nouveau_mc_init(struct nouveau_object *); |
43 | int _nouveau_mc_fini(struct nouveau_object *, bool); |
44 | |
45 | struct nouveau_mc_oclass { |
46 | struct nouveau_oclass base; |
47 | const struct nouveau_mc_intr *intr; |
48 | void (*msi_rearm)(struct nouveau_mc *); |
49 | }; |
50 | |
51 | extern struct nouveau_oclass *nv04_mc_oclass; |
52 | extern struct nouveau_oclass *nv40_mc_oclass; |
53 | extern struct nouveau_oclass *nv44_mc_oclass; |
54 | extern struct nouveau_oclass *nv4c_mc_oclass; |
55 | extern struct nouveau_oclass *nv50_mc_oclass; |
56 | extern struct nouveau_oclass *nv94_mc_oclass; |
57 | extern struct nouveau_oclass *nv98_mc_oclass; |
58 | extern struct nouveau_oclass *nvc0_mc_oclass; |
59 | extern struct nouveau_oclass *nvc3_mc_oclass; |
60 | |
61 | #endif |
62 | |