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