1 #ifndef __NVKM_DEVICE_H__
2 #define __NVKM_DEVICE_H__
3 #include <core/engine.h>
4 #include <core/event.h>
7 struct nvkm_engine engine;
11 struct platform_device *platformdev;
14 struct nvkm_event event;
38 struct nvkm_oclass *oclass[NVDEV_SUBDEV_NR];
39 struct nvkm_object *subdev[NVDEV_SUBDEV_NR];
42 struct notifier_block nb;
46 struct nvkm_device *nvkm_device_find(u64 name);
47 int nvkm_device_list(u64 *name, int size);
49 struct nvkm_device *nv_device(void *obj);
52 nv_device_match(struct nvkm_object *object, u16 dev, u16 ven, u16 sub)
54 struct nvkm_device *device = nv_device(object);
55 return device->pdev->device == dev &&
56 device->pdev->subsystem_vendor == ven &&
57 device->pdev->subsystem_device == sub;
61 nv_device_is_pci(struct nvkm_device *device)
63 return device->pdev != NULL;
67 nv_device_is_cpu_coherent(struct nvkm_device *device)
69 return (!IS_ENABLED(CONFIG_ARM) && nv_device_is_pci(device));
72 static inline struct device *
73 nv_device_base(struct nvkm_device *device)
75 return nv_device_is_pci(device) ? &device->pdev->dev :
76 &device->platformdev->dev;
80 nv_device_resource_start(struct nvkm_device *device, unsigned int bar);
83 nv_device_resource_len(struct nvkm_device *device, unsigned int bar);
86 nv_device_get_irq(struct nvkm_device *device, bool stall);