From 630ec6c0d31e0d3b2d8aa641f252e83dfa4a9345 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 14 Jan 2015 14:53:51 +1000 Subject: [PATCH] drm/nouveau/fuse: namespace + nvidia gpu names (no binary change) The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs --- .../gpu/drm/nouveau/include/nvkm/core/os.h | 1 + .../drm/nouveau/include/nvkm/subdev/fuse.h | 36 ++++++++-------- .../gpu/drm/nouveau/nvkm/engine/device/nv50.c | 28 ++++++------- .../gpu/drm/nouveau/nvkm/subdev/fuse/Kbuild | 2 +- .../gpu/drm/nouveau/nvkm/subdev/fuse/base.c | 25 +++++------ .../gpu/drm/nouveau/nvkm/subdev/fuse/gf100.c | 29 ++++++------- .../gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c | 24 +++++------ .../nvkm/subdev/fuse/{g80.c => nv50.c} | 41 ++++++++----------- .../gpu/drm/nouveau/nvkm/subdev/fuse/priv.h | 6 +-- 9 files changed, 87 insertions(+), 105 deletions(-) rename drivers/gpu/drm/nouveau/nvkm/subdev/fuse/{g80.c => nv50.c} (70%) diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h index 9571710e637c..4c16deb1ab7d 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h @@ -237,5 +237,6 @@ #define nouveau_fb nvkm_fb #define nouveau_fb_tile nvkm_fb_tile #define nvc0_pte_storage_type_map gf100_pte_storage_type_map +#define nouveau_fuse nvkm_fuse #endif diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fuse.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fuse.h index cc6b02fec682..a1384786adc9 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fuse.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fuse.h @@ -1,30 +1,28 @@ -#ifndef __NOUVEAU_FUSE_H__ -#define __NOUVEAU_FUSE_H__ - +#ifndef __NVKM_FUSE_H__ +#define __NVKM_FUSE_H__ #include #include -struct nouveau_fuse { - struct nouveau_subdev base; +struct nvkm_fuse { + struct nvkm_subdev base; }; -static inline struct nouveau_fuse * -nouveau_fuse(void *obj) +static inline struct nvkm_fuse * +nvkm_fuse(void *obj) { - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_FUSE); + return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_FUSE); } -#define nouveau_fuse_create(p, e, o, d) \ - nouveau_fuse_create_((p), (e), (o), sizeof(**d), (void **)d) - -int nouveau_fuse_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int, void **); -void _nouveau_fuse_dtor(struct nouveau_object *); -int _nouveau_fuse_init(struct nouveau_object *); -#define _nouveau_fuse_fini _nouveau_subdev_fini +#define nvkm_fuse_create(p, e, o, d) \ + nvkm_fuse_create_((p), (e), (o), sizeof(**d), (void **)d) -extern struct nouveau_oclass g80_fuse_oclass; -extern struct nouveau_oclass gf100_fuse_oclass; -extern struct nouveau_oclass gm107_fuse_oclass; +int nvkm_fuse_create_(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, int, void **); +void _nvkm_fuse_dtor(struct nvkm_object *); +int _nvkm_fuse_init(struct nvkm_object *); +#define _nvkm_fuse_fini _nvkm_subdev_fini +extern struct nvkm_oclass nv50_fuse_oclass; +extern struct nvkm_oclass gf100_fuse_oclass; +extern struct nvkm_oclass gm107_fuse_oclass; #endif diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c index 393b14cfddfa..aaa2e5bf38c2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c @@ -66,7 +66,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = nv50_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -92,7 +92,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -121,7 +121,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -150,7 +150,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv50_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -179,7 +179,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -208,7 +208,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -237,7 +237,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -266,7 +266,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -295,7 +295,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -324,7 +324,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -353,7 +353,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -384,7 +384,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -414,7 +414,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; @@ -444,7 +444,7 @@ nv50_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nv94_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; - device->oclass[NVDEV_SUBDEV_FUSE ] = &g80_fuse_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/Kbuild index 0458bce2ceeb..f3d4e6e131b6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/Kbuild @@ -1,4 +1,4 @@ nvkm-y += nvkm/subdev/fuse/base.o -nvkm-y += nvkm/subdev/fuse/g80.o +nvkm-y += nvkm/subdev/fuse/nv50.o nvkm-y += nvkm/subdev/fuse/gf100.o nvkm-y += nvkm/subdev/fuse/gm107.o diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c index 9e8e92127715..b7b7193bbce7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c @@ -21,34 +21,31 @@ * * Authors: Martin Peres */ - #include int -_nouveau_fuse_init(struct nouveau_object *object) +_nvkm_fuse_init(struct nvkm_object *object) { - struct nouveau_fuse *fuse = (void *)object; - return nouveau_subdev_init(&fuse->base); + struct nvkm_fuse *fuse = (void *)object; + return nvkm_subdev_init(&fuse->base); } void -_nouveau_fuse_dtor(struct nouveau_object *object) +_nvkm_fuse_dtor(struct nvkm_object *object) { - struct nouveau_fuse *fuse = (void *)object; - nouveau_subdev_destroy(&fuse->base); + struct nvkm_fuse *fuse = (void *)object; + nvkm_subdev_destroy(&fuse->base); } int -nouveau_fuse_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, int length, void **pobject) +nvkm_fuse_create_(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, int length, void **pobject) { - struct nouveau_fuse *fuse; + struct nvkm_fuse *fuse; int ret; - ret = nouveau_subdev_create_(parent, engine, oclass, 0, "FUSE", - "fuse", length, pobject); + ret = nvkm_subdev_create_(parent, engine, oclass, 0, "FUSE", + "fuse", length, pobject); fuse = *pobject; - return ret; } diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gf100.c index 5ed03f54b3d4..393ef3a0faaf 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gf100.c @@ -21,63 +21,58 @@ * * Authors: Martin Peres */ - #include "priv.h" struct gf100_fuse_priv { - struct nouveau_fuse base; + struct nvkm_fuse base; spinlock_t fuse_enable_lock; }; static u32 -gf100_fuse_rd32(struct nouveau_object *object, u64 addr) +gf100_fuse_rd32(struct nvkm_object *object, u64 addr) { struct gf100_fuse_priv *priv = (void *)object; unsigned long flags; u32 fuse_enable, unk, val; + /* racy if another part of nvkm start writing to these regs */ spin_lock_irqsave(&priv->fuse_enable_lock, flags); - - /* racy if another part of nouveau start writing to these regs */ fuse_enable = nv_mask(priv, 0x22400, 0x800, 0x800); unk = nv_mask(priv, 0x21000, 0x1, 0x1); val = nv_rd32(priv, 0x21100 + addr); nv_wr32(priv, 0x21000, unk); nv_wr32(priv, 0x22400, fuse_enable); - spin_unlock_irqrestore(&priv->fuse_enable_lock, flags); - return val; } static int -gf100_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +gf100_fuse_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { struct gf100_fuse_priv *priv; int ret; - ret = nouveau_fuse_create(parent, engine, oclass, &priv); + ret = nvkm_fuse_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; spin_lock_init(&priv->fuse_enable_lock); - return 0; } -struct nouveau_oclass +struct nvkm_oclass gf100_fuse_oclass = { .handle = NV_SUBDEV(FUSE, 0xC0), - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = gf100_fuse_ctor, - .dtor = _nouveau_fuse_dtor, - .init = _nouveau_fuse_init, - .fini = _nouveau_fuse_fini, + .dtor = _nvkm_fuse_dtor, + .init = _nvkm_fuse_init, + .fini = _nvkm_fuse_fini, .rd32 = gf100_fuse_rd32, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c index 4f1a636c6538..ba19158a5912 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c @@ -21,31 +21,29 @@ * * Authors: Martin Peres */ - #include "priv.h" struct gm107_fuse_priv { - struct nouveau_fuse base; + struct nvkm_fuse base; }; static u32 -gm107_fuse_rd32(struct nouveau_object *object, u64 addr) +gm107_fuse_rd32(struct nvkm_object *object, u64 addr) { struct gf100_fuse_priv *priv = (void *)object; - return nv_rd32(priv, 0x21100 + addr); } static int -gm107_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +gm107_fuse_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { struct gm107_fuse_priv *priv; int ret; - ret = nouveau_fuse_create(parent, engine, oclass, &priv); + ret = nvkm_fuse_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -53,14 +51,14 @@ gm107_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -struct nouveau_oclass +struct nvkm_oclass gm107_fuse_oclass = { .handle = NV_SUBDEV(FUSE, 0x117), - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = gm107_fuse_ctor, - .dtor = _nouveau_fuse_dtor, - .init = _nouveau_fuse_init, - .fini = _nouveau_fuse_fini, + .dtor = _nvkm_fuse_dtor, + .init = _nvkm_fuse_init, + .fini = _nvkm_fuse_fini, .rd32 = gm107_fuse_rd32, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/g80.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c similarity index 70% rename from drivers/gpu/drm/nouveau/nvkm/subdev/fuse/g80.c rename to drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c index a374ade485be..0d2afc426100 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/g80.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c @@ -21,61 +21,56 @@ * * Authors: Martin Peres */ - #include "priv.h" -struct g80_fuse_priv { - struct nouveau_fuse base; +struct nv50_fuse_priv { + struct nvkm_fuse base; spinlock_t fuse_enable_lock; }; static u32 -g80_fuse_rd32(struct nouveau_object *object, u64 addr) +nv50_fuse_rd32(struct nvkm_object *object, u64 addr) { - struct g80_fuse_priv *priv = (void *)object; + struct nv50_fuse_priv *priv = (void *)object; unsigned long flags; u32 fuse_enable, val; + /* racy if another part of nvkm start writing to this reg */ spin_lock_irqsave(&priv->fuse_enable_lock, flags); - - /* racy if another part of nouveau start writing to this reg */ fuse_enable = nv_mask(priv, 0x1084, 0x800, 0x800); val = nv_rd32(priv, 0x21000 + addr); nv_wr32(priv, 0x1084, fuse_enable); - spin_unlock_irqrestore(&priv->fuse_enable_lock, flags); - return val; } static int -g80_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +nv50_fuse_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { - struct g80_fuse_priv *priv; + struct nv50_fuse_priv *priv; int ret; - ret = nouveau_fuse_create(parent, engine, oclass, &priv); + ret = nvkm_fuse_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; spin_lock_init(&priv->fuse_enable_lock); - return 0; } -struct nouveau_oclass -g80_fuse_oclass = { +struct nvkm_oclass +nv50_fuse_oclass = { .handle = NV_SUBDEV(FUSE, 0x50), - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = g80_fuse_ctor, - .dtor = _nouveau_fuse_dtor, - .init = _nouveau_fuse_init, - .fini = _nouveau_fuse_fini, - .rd32 = g80_fuse_rd32, + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = nv50_fuse_ctor, + .dtor = _nvkm_fuse_dtor, + .init = _nvkm_fuse_init, + .fini = _nvkm_fuse_fini, + .rd32 = nv50_fuse_rd32, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/priv.h index d2085411a5cb..7e050f789384 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/priv.h @@ -1,9 +1,7 @@ #ifndef __NVKM_FUSE_PRIV_H__ #define __NVKM_FUSE_PRIV_H__ - #include -int _nouveau_fuse_init(struct nouveau_object *object); -void _nouveau_fuse_dtor(struct nouveau_object *object); - +int _nvkm_fuse_init(struct nvkm_object *object); +void _nvkm_fuse_dtor(struct nvkm_object *object); #endif -- 2.20.1