diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:10:21 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:43:28 +1000 |
commit | e70e14e424062a7dda7e8b87833652c3b5b33f68 (patch) | |
tree | 8e864790f8df75821edd829c7bd719eda8fb4428 /nvkm/core | |
parent | cc6062fe78164e347e6a37e4115666f329221808 (diff) | |
download | nouveau-e70e14e424062a7dda7e8b87833652c3b5b33f68.tar.gz |
client: add method to retrieve device list
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nvkm/core')
-rw-r--r-- | nvkm/core/client.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/nvkm/core/client.c b/nvkm/core/client.c index 42016cde5..10598dede 100644 --- a/nvkm/core/client.c +++ b/nvkm/core/client.c @@ -26,6 +26,7 @@ #include <core/client.h> #include <core/handle.h> #include <core/option.h> +#include <nvif/unpack.h> #include <nvif/class.h> #include <nvif/unpack.h> @@ -139,6 +140,46 @@ nvkm_client_notify_new(struct nouveau_client *client, return 0; } +static int +nouveau_client_devlist(struct nouveau_object *object, void *data, u32 size) +{ + union { + struct nv_client_devlist_v0 v0; + } *args = data; + int ret; + + nv_ioctl(object, "client devlist size %d\n", size); + if (nvif_unpack(args->v0, 0, 0, true)) { + nv_ioctl(object, "client devlist vers %d count %d\n", + args->v0.version, args->v0.count); + if (size == sizeof(args->v0.device[0]) * args->v0.count) { + ret = nouveau_device_list(args->v0.device, + args->v0.count); + if (ret >= 0) { + args->v0.count = ret; + ret = 0; + } + } else { + ret = -EINVAL; + } + } + + return ret; +} + +static int +nouveau_client_mthd(struct nouveau_object *object, u32 mthd, + void *data, u32 size) +{ + switch (mthd) { + case NV_CLIENT_DEVLIST: + return nouveau_client_devlist(object, data, size); + default: + break; + } + return -EINVAL; +} + static void nouveau_client_dtor(struct nouveau_object *object) { @@ -155,6 +196,7 @@ static struct nouveau_oclass nouveau_client_oclass = { .ofuncs = &(struct nouveau_ofuncs) { .dtor = nouveau_client_dtor, + .mthd = nouveau_client_mthd, }, }; |