Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 #ifndef __NVKM_CLIENT_H__
0003 #define __NVKM_CLIENT_H__
0004 #define nvkm_client(p) container_of((p), struct nvkm_client, object)
0005 #include <core/object.h>
0006 
0007 struct nvkm_client {
0008     struct nvkm_object object;
0009     char name[32];
0010     u64 device;
0011     u32 debug;
0012 
0013     struct nvkm_client_notify *notify[32];
0014     struct rb_root objroot;
0015 
0016     void *data;
0017     int (*ntfy)(const void *, u32, const void *, u32);
0018 
0019     struct list_head umem;
0020     spinlock_t lock;
0021 };
0022 
0023 int  nvkm_client_new(const char *name, u64 device, const char *cfg,
0024              const char *dbg,
0025              int (*)(const void *, u32, const void *, u32),
0026              struct nvkm_client **);
0027 struct nvkm_client *nvkm_client_search(struct nvkm_client *, u64 handle);
0028 
0029 int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
0030                void *data, u32 size);
0031 int nvkm_client_notify_del(struct nvkm_client *, int index);
0032 int nvkm_client_notify_get(struct nvkm_client *, int index);
0033 int nvkm_client_notify_put(struct nvkm_client *, int index);
0034 
0035 /* logging for client-facing objects */
0036 #define nvif_printk(o,l,p,f,a...) do {                                         \
0037     const struct nvkm_object *_object = (o);                               \
0038     const struct nvkm_client *_client = _object->client;                   \
0039     if (_client->debug >= NV_DBG_##l)                                      \
0040         printk(KERN_##p "nouveau: %s:%08x:%08x: "f, _client->name,     \
0041                _object->handle, _object->oclass, ##a);                 \
0042 } while(0)
0043 #define nvif_fatal(o,f,a...) nvif_printk((o), FATAL, CRIT, f, ##a)
0044 #define nvif_error(o,f,a...) nvif_printk((o), ERROR,  ERR, f, ##a)
0045 #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
0046 #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
0047 #define nvif_info(o,f,a...)  nvif_printk((o),  INFO, INFO, f, ##a)
0048 #define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)
0049 #endif