Home | History | Annotate | Line # | Download | only in nvif
      1 /*	$NetBSD: driver.h,v 1.6 2021/12/18 23:45:33 riastradh Exp $	*/
      2 
      3 /* SPDX-License-Identifier: MIT */
      4 #ifndef __NVIF_DRIVER_H__
      5 #define __NVIF_DRIVER_H__
      6 #include <nvif/os.h>
      7 struct nvif_client;
      8 
      9 #ifdef __NetBSD__
     10 #  define	__nvif_iomem	volatile
     11 #  define	__iomem		__nvif_iomem
     12 #endif
     13 
     14 struct nvif_driver {
     15 	const char *name;
     16 	int (*init)(const char *name, u64 device, const char *cfg,
     17 		    const char *dbg, void **priv);
     18 	void (*fini)(void *priv);
     19 	int (*suspend)(void *priv);
     20 	int (*resume)(void *priv);
     21 	int (*ioctl)(void *priv, bool super, void *data, u32 size, void **hack);
     22 #ifdef __NetBSD__
     23 	int (*map)(void *priv, bus_space_tag_t tag, u64 handle, u32 size,
     24 	    bus_space_handle_t *handlep, void __iomem **ptrp);
     25 	void (*unmap)(void *priv, bus_space_tag_t tag,
     26 	    bus_space_handle_t handle, bus_addr_t addr, void __iomem *ptr,
     27 	    u32 size);
     28 #else
     29 	void __iomem *(*map)(void *priv, u64 handle, u32 size);
     30 	void (*unmap)(void *priv, void __iomem *ptr, u32 size);
     31 #endif
     32 	bool keep;
     33 };
     34 
     35 #ifdef __NetBSD__
     36 #  undef	__iomem
     37 #endif
     38 int nvif_driver_init(const char *drv, const char *cfg, const char *dbg,
     39 		     const char *name, u64 device, struct nvif_client *);
     40 
     41 extern const struct nvif_driver nvif_driver_nvkm;
     42 extern const struct nvif_driver nvif_driver_drm;
     43 extern const struct nvif_driver nvif_driver_lib;
     44 extern const struct nvif_driver nvif_driver_null;
     45 #endif
     46