1 #ifndef __NOUVEAU_DEVICE_H__
2 #define __NOUVEAU_DEVICE_H__
4 #include <core/object.h>
5 #include <core/subdev.h>
6 #include <core/engine.h>
7 #include <core/event.h>
13 /* All subdevs from DEVINIT to DEVINIT_LAST will be created before
14 * *any* of them are initialised. This subdev category is used
15 * for any subdevs that the VBIOS init table parsing may call out
22 NVDEV_SUBDEV_DEVINIT_LAST
= NVDEV_SUBDEV_I2C
,
24 /* This grouping of subdevs are initialised right after they've
25 * been created, and are allowed to assume any subdevs in the
26 * list above them exist and have been initialised.
44 NVDEV_ENGINE_DMAOBJ
= NVDEV_ENGINE_FIRST
,
69 struct nouveau_device
{
70 struct nouveau_engine engine
;
71 struct list_head head
;
74 struct platform_device
*platformdev
;
77 struct nvkm_event event
;
101 struct nouveau_oclass
*oclass
[NVDEV_SUBDEV_NR
];
102 struct nouveau_object
*subdev
[NVDEV_SUBDEV_NR
];
105 struct notifier_block nb
;
109 int nouveau_device_list(u64
*name
, int size
);
111 struct nouveau_device
*nv_device(void *obj
);
114 nv_device_match(struct nouveau_object
*object
, u16 dev
, u16 ven
, u16 sub
)
116 struct nouveau_device
*device
= nv_device(object
);
117 return device
->pdev
->device
== dev
&&
118 device
->pdev
->subsystem_vendor
== ven
&&
119 device
->pdev
->subsystem_device
== sub
;
123 nv_device_is_pci(struct nouveau_device
*device
)
125 return device
->pdev
!= NULL
;
129 nv_device_is_cpu_coherent(struct nouveau_device
*device
)
131 return (!IS_ENABLED(CONFIG_ARM
) && nv_device_is_pci(device
));
134 static inline struct device
*
135 nv_device_base(struct nouveau_device
*device
)
137 return nv_device_is_pci(device
) ? &device
->pdev
->dev
:
138 &device
->platformdev
->dev
;
142 nv_device_resource_start(struct nouveau_device
*device
, unsigned int bar
);
145 nv_device_resource_len(struct nouveau_device
*device
, unsigned int bar
);
148 nv_device_get_irq(struct nouveau_device
*device
, bool stall
);