1/* $NetBSD: notify.h,v 1.3 2021/12/18 23:45:33 riastradh Exp $ */ 2 3/* SPDX-License-Identifier: MIT */ 4#ifndef __NVKM_NOTIFY_H__ 5#define __NVKM_NOTIFY_H__ 6#include <core/os.h> 7struct nvkm_object; 8 9struct nvkm_notify { 10 struct nvkm_event *event; 11 struct list_head head; 12#define NVKM_NOTIFY_USER 0 13#define NVKM_NOTIFY_WORK 1 14 unsigned long flags; 15 int block; 16#define NVKM_NOTIFY_DROP 0 17#define NVKM_NOTIFY_KEEP 1 18 int (*func)(struct nvkm_notify *); 19 20 /* set by nvkm_event ctor */ 21 u32 types; 22 int index; 23 u32 size; 24 25 struct work_struct work; 26 /* this is const for a *very* good reason - the data might be on the 27 * stack from an irq handler. if you're not core/notify.c then you 28 * should probably think twice before casting it away... 29 */ 30 const void *data; 31}; 32 33int nvkm_notify_init(struct nvkm_object *, struct nvkm_event *, 34 int (*func)(struct nvkm_notify *), bool work, 35 void *data, u32 size, u32 reply, 36 struct nvkm_notify *); 37void nvkm_notify_fini(struct nvkm_notify *); 38void nvkm_notify_get(struct nvkm_notify *); 39void nvkm_notify_put(struct nvkm_notify *); 40void nvkm_notify_send(struct nvkm_notify *, void *data, u32 size); 41#endif 42