drm/nouveau/fuse: namespace + nvidia gpu names (no binary change)
authorBen Skeggs <bskeggs@redhat.com>
Wed, 14 Jan 2015 04:53:51 +0000 (14:53 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 22 Jan 2015 02:17:53 +0000 (12:17 +1000)
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 <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/os.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/fuse.h
drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/g80.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/priv.h

index 9571710e637c645206504f9ba154cfc3bd8a70d6..4c16deb1ab7d061caab744c6cc97e135572f2a05 100644 (file)
 #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
index cc6b02fec6829efceacd6ec130c832d8967a8470..a1384786adc9850c651f20ffad31c38066c9d05c 100644 (file)
@@ -1,30 +1,28 @@
-#ifndef __NOUVEAU_FUSE_H__
-#define __NOUVEAU_FUSE_H__
-
+#ifndef __NVKM_FUSE_H__
+#define __NVKM_FUSE_H__
 #include <core/subdev.h>
 #include <core/device.h>
 
-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
index 393b14cfddfa05a791ceb0a89bb2dd7b1009ad63..aaa2e5bf38c2b5c6598986d2e04f5ddca68d8163 100644 (file)
@@ -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    ] = &gt215_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    ] = &gt215_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    ] = &gt215_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    ] = &gt215_clk_oclass;
                device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
index 0458bce2ceeb44a0b0982dc2c47ff973147360a2..f3d4e6e131b6813bc41efc1a94bcad946f2a2975 100644 (file)
@@ -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
index 9e8e92127715016b7acefc4fbdb81a5f8a09b027..b7b7193bbce7a4566a1c7d4fdeb6235360e4fbbe 100644 (file)
  *
  * Authors: Martin Peres
  */
-
 #include <subdev/fuse.h>
 
 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/g80.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/g80.c
deleted file mode 100644 (file)
index a374ade..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2014 Martin Peres
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: Martin Peres
- */
-
-#include "priv.h"
-
-struct g80_fuse_priv {
-       struct nouveau_fuse base;
-
-       spinlock_t fuse_enable_lock;
-};
-
-static u32
-g80_fuse_rd32(struct nouveau_object *object, u64 addr)
-{
-       struct g80_fuse_priv *priv = (void *)object;
-       unsigned long flags;
-       u32 fuse_enable, val;
-
-       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)
-{
-       struct g80_fuse_priv *priv;
-       int ret;
-
-       ret = nouveau_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 = {
-       .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,
-       },
-};
index 5ed03f54b3d4eca4ad323f0edd9742d0258d3059..393ef3a0faaf94b6c624a2128e6faacec150d85f 100644 (file)
  *
  * 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,
        },
 };
index 4f1a636c6538dd27fadc6652bac81b0da9cde692..ba19158a5912e740a415480671d1ad375125fa46 100644 (file)
  *
  * 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/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c
new file mode 100644 (file)
index 0000000..0d2afc4
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 Martin Peres
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Martin Peres
+ */
+#include "priv.h"
+
+struct nv50_fuse_priv {
+       struct nvkm_fuse base;
+
+       spinlock_t fuse_enable_lock;
+};
+
+static u32
+nv50_fuse_rd32(struct nvkm_object *object, u64 addr)
+{
+       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);
+       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
+nv50_fuse_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+              struct nvkm_oclass *oclass, void *data, u32 size,
+              struct nvkm_object **pobject)
+{
+       struct nv50_fuse_priv *priv;
+       int ret;
+
+       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 nvkm_oclass
+nv50_fuse_oclass = {
+       .handle = NV_SUBDEV(FUSE, 0x50),
+       .ofuncs = &(struct nvkm_ofuncs) {
+               .ctor = nv50_fuse_ctor,
+               .dtor = _nvkm_fuse_dtor,
+               .init = _nvkm_fuse_init,
+               .fini = _nvkm_fuse_fini,
+               .rd32 = nv50_fuse_rd32,
+       },
+};
index d2085411a5cba55ee2f2828ee578ec77f88c51d0..7e050f78938429b7c6a1130770eb901b8394a331 100644 (file)
@@ -1,9 +1,7 @@
 #ifndef __NVKM_FUSE_PRIV_H__
 #define __NVKM_FUSE_PRIV_H__
-
 #include <subdev/fuse.h>
 
-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
This page took 0.035623 seconds and 5 git commands to generate.