From 0d59b365576847ea6d89b8dbc7dd9c51aca9a593 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sun, 10 Aug 2014 04:10:24 +1000 Subject: device: audit and version NV_DEVICE class The full object interfaces are about to be exposed to userspace, so we need to check for any security-related issues and version the structs to make it easier to handle any changes we may need in the future. Signed-off-by: Ben Skeggs --- bin/nv_aux.c | 14 +++++++------- bin/nv_disp.c | 2 +- bin/nv_i2c.c | 14 +++++++------- bin/nv_init.c | 6 +++--- bin/nv_perfmon.c | 12 ++++++------ bin/nv_rdfuc.c | 8 ++++---- bin/nv_rdfunc.h | 6 +++--- bin/nv_rffunc.h | 2 +- bin/nv_rifunc.h | 2 +- bin/nv_rsfunc.h | 2 +- bin/nv_rvfunc.h | 2 +- bin/nv_wffunc.h | 2 +- bin/nv_wifunc.h | 2 +- bin/nv_wrfunc.h | 6 +++--- bin/nv_wsfunc.h | 2 +- bin/nv_wvfunc.h | 2 +- 16 files changed, 42 insertions(+), 42 deletions(-) (limited to 'bin') diff --git a/bin/nv_aux.c b/bin/nv_aux.c index 00da6b305..4abc45cb5 100644 --- a/bin/nv_aux.c +++ b/bin/nv_aux.c @@ -68,16 +68,16 @@ main(int argc, char **argv) if (ret) return ret; - ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE_CLASS, - &(struct nv_device_class) { + ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE, + &(struct nv_device_v0) { .device = ~0ULL, - .disable = ~(NV_DEVICE_DISABLE_MMIO | - NV_DEVICE_DISABLE_IDENTIFY| - NV_DEVICE_DISABLE_VBIOS | - NV_DEVICE_DISABLE_CORE), + .disable = ~(NV_DEVICE_V0_DISABLE_MMIO | + NV_DEVICE_V0_DISABLE_IDENTIFY| + NV_DEVICE_V0_DISABLE_VBIOS | + NV_DEVICE_V0_DISABLE_CORE), .debug0 = ~((1 << NVDEV_SUBDEV_VBIOS) | (1 << NVDEV_SUBDEV_I2C)), - }, sizeof(struct nv_device_class), &device); + }, sizeof(struct nv_device_v0), &device); nvif_client_ref(NULL, &client); if (ret) return ret; diff --git a/bin/nv_disp.c b/bin/nv_disp.c index 7cf5a2c51..9a6c481f8 100644 --- a/bin/nv_disp.c +++ b/bin/nv_disp.c @@ -34,7 +34,7 @@ nv_disp(struct nvif_device *device, u16 mthd, u32 data) #define CAST u32 #define WRITE(o,v) nv_disp(device, (o), (v)) #define MAIN main_ -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_wrfunc.h" int diff --git a/bin/nv_i2c.c b/bin/nv_i2c.c index 7b1c87952..b098fb113 100644 --- a/bin/nv_i2c.c +++ b/bin/nv_i2c.c @@ -74,16 +74,16 @@ main(int argc, char **argv) if (ret) return ret; - ret = nvif_device_new(nvif_object(client), 0, NV_DEVICE_CLASS, - &(struct nv_device_class) { + ret = nvif_device_new(nvif_object(client), 0, NV_DEVICE, + &(struct nv_device_v0) { .device = ~0ULL, - .disable = ~(NV_DEVICE_DISABLE_MMIO | - NV_DEVICE_DISABLE_IDENTIFY| - NV_DEVICE_DISABLE_VBIOS | - NV_DEVICE_DISABLE_CORE), + .disable = ~(NV_DEVICE_V0_DISABLE_MMIO | + NV_DEVICE_V0_DISABLE_IDENTIFY| + NV_DEVICE_V0_DISABLE_VBIOS | + NV_DEVICE_V0_DISABLE_CORE), .debug0 = ~((1 << NVDEV_SUBDEV_VBIOS) | (1 << NVDEV_SUBDEV_I2C)), - }, sizeof(struct nv_device_class), &device); + }, sizeof(struct nv_device_v0), &device); nvif_client_ref(NULL, &client); if (ret) return ret; diff --git a/bin/nv_init.c b/bin/nv_init.c index d012aa79e..8354f970c 100644 --- a/bin/nv_init.c +++ b/bin/nv_init.c @@ -41,12 +41,12 @@ main(int argc, char **argv) if (ret) return ret; - ret = nvif_device_new(nvif_object(client), 0, NV_DEVICE_CLASS, - &(struct nv_device_class) { + ret = nvif_device_new(nvif_object(client), 0, NV_DEVICE, + &(struct nv_device_v0) { .device = ~0ULL, .disable = 0ULL, .debug0 = 0ULL, - }, sizeof(struct nv_device_class), &device); + }, sizeof(struct nv_device_v0), &device); nvif_client_ref(NULL, &client); if (ret) return ret; diff --git a/bin/nv_perfmon.c b/bin/nv_perfmon.c index 611a327a0..2cb594879 100644 --- a/bin/nv_perfmon.c +++ b/bin/nv_perfmon.c @@ -627,15 +627,15 @@ main(int argc, char **argv) return ret; ret = nvif_device_new(nvif_object(client), 0x00000000, - NV_DEVICE_CLASS, &(struct nv_device_class) { + NV_DEVICE, &(struct nv_device_v0) { .device = ~0ULL, - .disable = ~(NV_DEVICE_DISABLE_MMIO | - NV_DEVICE_DISABLE_VBIOS | - NV_DEVICE_DISABLE_CORE | - NV_DEVICE_DISABLE_IDENTIFY), + .disable = ~(NV_DEVICE_V0_DISABLE_MMIO | + NV_DEVICE_V0_DISABLE_VBIOS | + NV_DEVICE_V0_DISABLE_CORE | + NV_DEVICE_V0_DISABLE_IDENTIFY), .debug0 = ~((1ULL << NVDEV_SUBDEV_TIMER) | (1ULL << NVDEV_ENGINE_PERFMON)), - }, sizeof(struct nv_device_class), &device); + }, sizeof(struct nv_device_v0), &device); nvif_client_ref(NULL, &client); if (ret) return ret; diff --git a/bin/nv_rdfuc.c b/bin/nv_rdfuc.c index 1478eb13d..27d4cb2ed 100644 --- a/bin/nv_rdfuc.c +++ b/bin/nv_rdfuc.c @@ -43,12 +43,12 @@ main(int argc, char **argv) if (ret) return ret; - ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE_CLASS, - &(struct nv_device_class) { + ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE, + &(struct nv_device_v0) { .device = ~0ULL, - .disable = ~NV_DEVICE_DISABLE_MMIO, + .disable = ~NV_DEVICE_V0_DISABLE_MMIO, .debug0 = 0, - }, sizeof(struct nv_device_class), &device); + }, sizeof(struct nv_device_v0), &device); nvif_client_ref(NULL, &client); if (ret) return ret; diff --git a/bin/nv_rdfunc.h b/bin/nv_rdfunc.h index fef29de7a..4dc77243e 100644 --- a/bin/nv_rdfunc.h +++ b/bin/nv_rdfunc.h @@ -8,7 +8,7 @@ #include #ifndef ENABLE -#define ENABLE NV_DEVICE_DISABLE_MMIO +#define ENABLE NV_DEVICE_V0_DISABLE_MMIO #endif #ifndef DEBUG0 #define DEBUG0 0ULL @@ -23,7 +23,7 @@ main(int argc, char **argv) u64 dev = ~0ULL; struct nvif_client *client; struct nvif_device *device; - struct nv_device_class args; + struct nv_device_v0 args = {}; char *rstr = NULL; enum { NORMAL, @@ -64,7 +64,7 @@ main(int argc, char **argv) args.disable = ~ENABLE; args.debug0 = ~DEBUG0; - ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE_CLASS, + ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE, &args, sizeof(args), &device); nvif_client_ref(NULL, &client); if (ret) diff --git a/bin/nv_rffunc.h b/bin/nv_rffunc.h index 31dc5c88e..caf973dc3 100644 --- a/bin/nv_rffunc.h +++ b/bin/nv_rffunc.h @@ -35,5 +35,5 @@ nv_rfb(struct nvif_device *device, u64 offset) } #define READ(o) nv_rfb(device, (o)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_rdfunc.h" diff --git a/bin/nv_rifunc.h b/bin/nv_rifunc.h index 8041ea1b4..be9578ca8 100644 --- a/bin/nv_rifunc.h +++ b/bin/nv_rifunc.h @@ -42,5 +42,5 @@ nv_rfb(struct nvif_device *device, u64 offset) } #define READ(o) nv_rfb(device, (o)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_rdfunc.h" diff --git a/bin/nv_rsfunc.h b/bin/nv_rsfunc.h index 47b53fee8..e5cff49e1 100644 --- a/bin/nv_rsfunc.h +++ b/bin/nv_rsfunc.h @@ -20,5 +20,5 @@ nv_rsys(struct nvif_device *device, u64 addr) } #define READ(o) nv_rsys(device, (o)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_rdfunc.h" diff --git a/bin/nv_rvfunc.h b/bin/nv_rvfunc.h index 590e959b2..7ab2db9a7 100644 --- a/bin/nv_rvfunc.h +++ b/bin/nv_rvfunc.h @@ -20,5 +20,5 @@ nv_rvram(struct nvif_device *device, u64 addr) } #define READ(o) nv_rvram(device, (o)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_rdfunc.h" diff --git a/bin/nv_wffunc.h b/bin/nv_wffunc.h index 6aaf13176..fde5bc027 100644 --- a/bin/nv_wffunc.h +++ b/bin/nv_wffunc.h @@ -35,5 +35,5 @@ nv_wfb(struct nvif_device *device, u64 offset, CAST data) } #define WRITE(o,v) nv_wfb(device, (o), (v)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_wrfunc.h" diff --git a/bin/nv_wifunc.h b/bin/nv_wifunc.h index 2ae519228..19df090d8 100644 --- a/bin/nv_wifunc.h +++ b/bin/nv_wifunc.h @@ -42,5 +42,5 @@ nv_wfb(struct nvif_device *device, u64 offset, CAST data) } #define WRITE(o,v) nv_wfb(device, (o), (v)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_wrfunc.h" diff --git a/bin/nv_wrfunc.h b/bin/nv_wrfunc.h index c0e24efd1..88d2b629e 100644 --- a/bin/nv_wrfunc.h +++ b/bin/nv_wrfunc.h @@ -8,7 +8,7 @@ #include #ifndef ENABLE -#define ENABLE NV_DEVICE_DISABLE_MMIO +#define ENABLE NV_DEVICE_V0_DISABLE_MMIO #endif #ifndef DEBUG0 #define DEBUG0 0ULL @@ -23,7 +23,7 @@ MAIN(int argc, char **argv) u64 dev = ~0ULL; struct nvif_client *client; struct nvif_device *device; - struct nv_device_class args; + struct nv_device_v0 args = {}; char *rstr = NULL; char *vstr = NULL; int quiet = 0; @@ -58,7 +58,7 @@ MAIN(int argc, char **argv) args.disable = ~ENABLE; args.debug0 = ~DEBUG0; - ret = nvif_device_new(nvif_object(client), 0, NV_DEVICE_CLASS, + ret = nvif_device_new(nvif_object(client), 0, NV_DEVICE, &args, sizeof(args), &device); nvif_client_ref(NULL, &client); if (ret) diff --git a/bin/nv_wsfunc.h b/bin/nv_wsfunc.h index 70feefb10..9472fc9b1 100644 --- a/bin/nv_wsfunc.h +++ b/bin/nv_wsfunc.h @@ -18,5 +18,5 @@ nv_wsys(struct nvif_device *device, u64 addr, CAST data) } #define WRITE(o,v) nv_wsys(device, (o), (v)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_wrfunc.h" diff --git a/bin/nv_wvfunc.h b/bin/nv_wvfunc.h index 2832f168d..668278ace 100644 --- a/bin/nv_wvfunc.h +++ b/bin/nv_wvfunc.h @@ -18,5 +18,5 @@ nv_wvram(struct nvif_device *device, u64 addr, CAST data) } #define WRITE(o,v) nv_wvram(device, (o), (v)) -#define ENABLE (NV_DEVICE_DISABLE_MMIO | NV_DEVICE_DISABLE_IDENTIFY) +#define ENABLE (NV_DEVICE_V0_DISABLE_MMIO | NV_DEVICE_V0_DISABLE_IDENTIFY) #include "nv_wrfunc.h" -- cgit v1.2.1