|
@@ -39,6 +39,40 @@ struct nvkm_udevice {
|
|
|
struct nvkm_device *device;
|
|
|
};
|
|
|
|
|
|
+static int
|
|
|
+nvkm_udevice_info_subdev(struct nvkm_device *device, u64 mthd, u64 *data)
|
|
|
+{
|
|
|
+ struct nvkm_subdev *subdev;
|
|
|
+ enum nvkm_devidx subidx;
|
|
|
+
|
|
|
+ switch (mthd & NV_DEVICE_INFO_UNIT) {
|
|
|
+ default:
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ subdev = nvkm_device_subdev(device, subidx);
|
|
|
+ if (subdev)
|
|
|
+ return nvkm_subdev_info(subdev, mthd, data);
|
|
|
+ return -ENODEV;
|
|
|
+}
|
|
|
+
|
|
|
+static void
|
|
|
+nvkm_udevice_info_v1(struct nvkm_device *device,
|
|
|
+ struct nv_device_info_v1_data *args)
|
|
|
+{
|
|
|
+ if (args->mthd & NV_DEVICE_INFO_UNIT) {
|
|
|
+ if (nvkm_udevice_info_subdev(device, args->mthd, &args->data))
|
|
|
+ args->mthd = NV_DEVICE_INFO_INVALID;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (args->mthd) {
|
|
|
+ default:
|
|
|
+ args->mthd = NV_DEVICE_INFO_INVALID;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static int
|
|
|
nvkm_udevice_info(struct nvkm_udevice *udev, void *data, u32 size)
|
|
|
{
|
|
@@ -48,10 +82,21 @@ nvkm_udevice_info(struct nvkm_udevice *udev, void *data, u32 size)
|
|
|
struct nvkm_instmem *imem = device->imem;
|
|
|
union {
|
|
|
struct nv_device_info_v0 v0;
|
|
|
+ struct nv_device_info_v1 v1;
|
|
|
} *args = data;
|
|
|
- int ret = -ENOSYS;
|
|
|
+ int ret = -ENOSYS, i;
|
|
|
|
|
|
nvif_ioctl(object, "device info size %d\n", size);
|
|
|
+ if (!(ret = nvif_unpack(ret, &data, &size, args->v1, 1, 1, true))) {
|
|
|
+ nvif_ioctl(object, "device info vers %d count %d\n",
|
|
|
+ args->v1.version, args->v1.count);
|
|
|
+ if (args->v1.count * sizeof(args->v1.data[0]) == size) {
|
|
|
+ for (i = 0; i < args->v1.count; i++)
|
|
|
+ nvkm_udevice_info_v1(device, &args->v1.data[i]);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return -EINVAL;
|
|
|
+ } else
|
|
|
if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
|
|
|
nvif_ioctl(object, "device info vers %d\n", args->v0.version);
|
|
|
} else
|