Ben Skeggs | 7d9115d | 2012-07-11 15:58:56 +1000 | [diff] [blame] | 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; |
Lucas Stach | a27e569 | 2013-08-28 02:00:50 +0200 | [diff] [blame] | 14 | bool use_msi; |
Ben Skeggs | 7d9115d | 2012-07-11 15:58:56 +1000 | [diff] [blame] | 15 | }; |
| 16 | |
| 17 | static inline struct nouveau_mc * |
| 18 | nouveau_mc(void *obj) |
| 19 | { |
| 20 | return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_MC]; |
| 21 | } |
| 22 | |
Ben Skeggs | 08f6fbd | 2013-10-11 15:34:08 +1000 | [diff] [blame] | 23 | #define nouveau_mc_create(p,e,o,d) \ |
| 24 | nouveau_mc_create_((p), (e), (o), sizeof(**d), (void **)d) |
Ben Skeggs | 0fa9061 | 2013-03-22 10:05:03 +1000 | [diff] [blame] | 25 | #define nouveau_mc_destroy(p) ({ \ |
| 26 | struct nouveau_mc *pmc = (p); _nouveau_mc_dtor(nv_object(pmc)); \ |
| 27 | }) |
| 28 | #define nouveau_mc_init(p) ({ \ |
| 29 | struct nouveau_mc *pmc = (p); _nouveau_mc_init(nv_object(pmc)); \ |
| 30 | }) |
| 31 | #define nouveau_mc_fini(p,s) ({ \ |
| 32 | struct nouveau_mc *pmc = (p); _nouveau_mc_fini(nv_object(pmc), (s)); \ |
| 33 | }) |
Ben Skeggs | 7d9115d | 2012-07-11 15:58:56 +1000 | [diff] [blame] | 34 | |
Ben Skeggs | 0fa9061 | 2013-03-22 10:05:03 +1000 | [diff] [blame] | 35 | int nouveau_mc_create_(struct nouveau_object *, struct nouveau_object *, |
Ben Skeggs | 08f6fbd | 2013-10-11 15:34:08 +1000 | [diff] [blame] | 36 | struct nouveau_oclass *, int, void **); |
Ben Skeggs | 0fa9061 | 2013-03-22 10:05:03 +1000 | [diff] [blame] | 37 | void _nouveau_mc_dtor(struct nouveau_object *); |
| 38 | int _nouveau_mc_init(struct nouveau_object *); |
| 39 | int _nouveau_mc_fini(struct nouveau_object *, bool); |
Ben Skeggs | 7d9115d | 2012-07-11 15:58:56 +1000 | [diff] [blame] | 40 | |
Ben Skeggs | 1b4fea0 | 2013-10-11 15:38:15 +1000 | [diff] [blame] | 41 | struct nouveau_mc_oclass { |
| 42 | struct nouveau_oclass base; |
| 43 | const struct nouveau_mc_intr *intr; |
| 44 | void (*msi_rearm)(struct nouveau_mc *); |
| 45 | }; |
| 46 | |
Ben Skeggs | 08f6fbd | 2013-10-11 15:34:08 +1000 | [diff] [blame] | 47 | extern struct nouveau_oclass *nv04_mc_oclass; |
Ben Skeggs | 1b4fea0 | 2013-10-11 15:38:15 +1000 | [diff] [blame] | 48 | extern struct nouveau_oclass *nv40_mc_oclass; |
Ben Skeggs | 08f6fbd | 2013-10-11 15:34:08 +1000 | [diff] [blame] | 49 | extern struct nouveau_oclass *nv44_mc_oclass; |
Ilia Mirkin | fa8c9ac | 2014-02-05 14:33:02 -0500 | [diff] [blame] | 50 | extern struct nouveau_oclass *nv4c_mc_oclass; |
Ben Skeggs | 08f6fbd | 2013-10-11 15:34:08 +1000 | [diff] [blame] | 51 | extern struct nouveau_oclass *nv50_mc_oclass; |
Ben Skeggs | 9a9d5c6 | 2013-10-14 14:58:16 +1000 | [diff] [blame] | 52 | extern struct nouveau_oclass *nv94_mc_oclass; |
Ben Skeggs | 08f6fbd | 2013-10-11 15:34:08 +1000 | [diff] [blame] | 53 | extern struct nouveau_oclass *nv98_mc_oclass; |
| 54 | extern struct nouveau_oclass *nvc0_mc_oclass; |
Ben Skeggs | 1b4fea0 | 2013-10-11 15:38:15 +1000 | [diff] [blame] | 55 | extern struct nouveau_oclass *nvc3_mc_oclass; |
Ben Skeggs | 7d9115d | 2012-07-11 15:58:56 +1000 | [diff] [blame] | 56 | |
| 57 | #endif |