drm/nouveau/timer: 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 <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2015-01-14 15:12:11 +10:00
parent e1404611d5
commit 9e79a85343
26 changed files with 103 additions and 89 deletions

View File

@ -1,64 +1,61 @@
#ifndef __NOUVEAU_TIMER_H__
#define __NOUVEAU_TIMER_H__
#ifndef __NVKM_TIMER_H__
#define __NVKM_TIMER_H__
#include <core/subdev.h>
#include <core/device.h>
struct nouveau_alarm {
struct nvkm_alarm {
struct list_head head;
u64 timestamp;
void (*func)(struct nouveau_alarm *);
void (*func)(struct nvkm_alarm *);
};
static inline void
nouveau_alarm_init(struct nouveau_alarm *alarm,
void (*func)(struct nouveau_alarm *))
nvkm_alarm_init(struct nvkm_alarm *alarm,
void (*func)(struct nvkm_alarm *))
{
INIT_LIST_HEAD(&alarm->head);
alarm->func = func;
}
bool nouveau_timer_wait_eq(void *, u64 nsec, u32 addr, u32 mask, u32 data);
bool nouveau_timer_wait_ne(void *, u64 nsec, u32 addr, u32 mask, u32 data);
bool nouveau_timer_wait_cb(void *, u64 nsec, bool (*func)(void *), void *data);
void nouveau_timer_alarm(void *, u32 nsec, struct nouveau_alarm *);
void nouveau_timer_alarm_cancel(void *, struct nouveau_alarm *);
bool nvkm_timer_wait_eq(void *, u64 nsec, u32 addr, u32 mask, u32 data);
bool nvkm_timer_wait_ne(void *, u64 nsec, u32 addr, u32 mask, u32 data);
bool nvkm_timer_wait_cb(void *, u64 nsec, bool (*func)(void *), void *data);
void nvkm_timer_alarm(void *, u32 nsec, struct nvkm_alarm *);
void nvkm_timer_alarm_cancel(void *, struct nvkm_alarm *);
#define NV_WAIT_DEFAULT 2000000000ULL
#define nv_wait(o,a,m,v) \
nouveau_timer_wait_eq((o), NV_WAIT_DEFAULT, (a), (m), (v))
nvkm_timer_wait_eq((o), NV_WAIT_DEFAULT, (a), (m), (v))
#define nv_wait_ne(o,a,m,v) \
nouveau_timer_wait_ne((o), NV_WAIT_DEFAULT, (a), (m), (v))
nvkm_timer_wait_ne((o), NV_WAIT_DEFAULT, (a), (m), (v))
#define nv_wait_cb(o,c,d) \
nouveau_timer_wait_cb((o), NV_WAIT_DEFAULT, (c), (d))
nvkm_timer_wait_cb((o), NV_WAIT_DEFAULT, (c), (d))
struct nouveau_timer {
struct nouveau_subdev base;
u64 (*read)(struct nouveau_timer *);
void (*alarm)(struct nouveau_timer *, u64 time, struct nouveau_alarm *);
void (*alarm_cancel)(struct nouveau_timer *, struct nouveau_alarm *);
struct nvkm_timer {
struct nvkm_subdev base;
u64 (*read)(struct nvkm_timer *);
void (*alarm)(struct nvkm_timer *, u64 time, struct nvkm_alarm *);
void (*alarm_cancel)(struct nvkm_timer *, struct nvkm_alarm *);
};
static inline struct nouveau_timer *
nouveau_timer(void *obj)
static inline struct nvkm_timer *
nvkm_timer(void *obj)
{
return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_TIMER);
return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_TIMER);
}
#define nouveau_timer_create(p,e,o,d) \
nouveau_subdev_create_((p), (e), (o), 0, "PTIMER", "timer", \
#define nvkm_timer_create(p,e,o,d) \
nvkm_subdev_create_((p), (e), (o), 0, "PTIMER", "timer", \
sizeof(**d), (void **)d)
#define nouveau_timer_destroy(p) \
nouveau_subdev_destroy(&(p)->base)
#define nouveau_timer_init(p) \
nouveau_subdev_init(&(p)->base)
#define nouveau_timer_fini(p,s) \
nouveau_subdev_fini(&(p)->base, (s))
#define nvkm_timer_destroy(p) \
nvkm_subdev_destroy(&(p)->base)
#define nvkm_timer_init(p) \
nvkm_subdev_init(&(p)->base)
#define nvkm_timer_fini(p,s) \
nvkm_subdev_fini(&(p)->base, (s))
int nouveau_timer_create_(struct nouveau_object *, struct nouveau_engine *,
struct nouveau_oclass *, int size, void **);
extern struct nouveau_oclass nv04_timer_oclass;
extern struct nouveau_oclass gk20a_timer_oclass;
int nvkm_timer_create_(struct nvkm_object *, struct nvkm_engine *,
struct nvkm_oclass *, int size, void **);
extern struct nvkm_oclass nv04_timer_oclass;
extern struct nvkm_oclass gk20a_timer_oclass;
#endif

View File

@ -21,6 +21,7 @@
*/
#include <engine/falcon.h>
#include <core/device.h>
#include <subdev/timer.h>
void

View File

@ -23,6 +23,7 @@
*/
#include <core/client.h>
#include <core/device.h>
#include <nvif/unpack.h>
#include <nvif/class.h>
#include <core/engctx.h>

View File

@ -23,6 +23,7 @@
*/
#include <core/client.h>
#include <core/device.h>
#include <core/os.h>
#include <core/handle.h>
#include <core/namedb.h>

View File

@ -1,4 +1,5 @@
#include <core/client.h>
#include <core/device.h>
#include <core/os.h>
#include <core/engctx.h>
#include <core/handle.h>

View File

@ -1,4 +1,5 @@
#include <core/os.h>
#include <core/device.h>
#include <core/engctx.h>
#include <core/enum.h>

View File

@ -24,6 +24,7 @@
#include <core/os.h>
#include <core/client.h>
#include <core/device.h>
#include <core/handle.h>
#include <core/engctx.h>
#include <core/enum.h>

View File

@ -26,6 +26,7 @@
#define __NVC0_GR_H__
#include <core/client.h>
#include <core/device.h>
#include <core/handle.h>
#include <core/gpuobj.h>
#include <core/option.h>

View File

@ -23,6 +23,7 @@
*/
#include "priv.h"
#include <core/device.h>
#include <core/gpuobj.h>
#include <subdev/fb.h>
#include <subdev/mmu.h>

View File

@ -24,6 +24,7 @@
#include <subdev/clk.h>
#include "pll.h"
#include <core/device.h>
#include <subdev/bios.h>
#include <subdev/bios/pll.h>
#include <subdev/timer.h>

View File

@ -24,6 +24,7 @@
#include <subdev/clk.h>
#include "pll.h"
#include <core/device.h>
#include <subdev/timer.h>
#include <subdev/bios.h>
#include <subdev/bios/pll.h>

View File

@ -25,6 +25,8 @@
#include <subdev/clk.h>
#include <subdev/timer.h>
#include <core/device.h>
#ifdef __KERNEL__
#include <nouveau_platform.h>
#endif

View File

@ -25,6 +25,7 @@
#include "gt215.h"
#include "pll.h"
#include <core/device.h>
#include <engine/fifo.h>
#include <subdev/bios.h>
#include <subdev/bios/pll.h>

View File

@ -24,6 +24,7 @@
#include "gt215.h"
#include "pll.h"
#include <core/device.h>
#include <subdev/bios.h>
#include <subdev/bios/pll.h>
#include <subdev/timer.h>

View File

@ -23,6 +23,7 @@
*/
#include "nv40.h"
#include <core/device.h>
#include <subdev/bios.h>
#include <subdev/bios/bit.h>
#include <subdev/bios/init.h>

View File

@ -24,6 +24,7 @@
*/
#include "priv.h"
#include <core/device.h>
#include <core/option.h>
#include <subdev/bios.h>
#include <subdev/bios/fan.h>

View File

@ -23,6 +23,8 @@
*/
#include "priv.h"
#include <core/device.h>
struct gf110_therm_priv {
struct nvkm_therm_priv base;
};

View File

@ -23,6 +23,8 @@
*/
#include "priv.h"
#include <core/device.h>
struct gm107_therm_priv {
struct nvkm_therm_priv base;
};

View File

@ -23,6 +23,7 @@
*/
#include "priv.h"
#include <core/device.h>
#include <subdev/gpio.h>
struct gt215_therm_priv {

View File

@ -24,6 +24,8 @@
*/
#include "priv.h"
#include <core/device.h>
struct nv40_therm_priv {
struct nvkm_therm_priv base;
};

View File

@ -24,6 +24,8 @@
*/
#include "priv.h"
#include <core/device.h>
struct nv50_therm_priv {
struct nvkm_therm_priv base;
};

View File

@ -21,13 +21,12 @@
*
* Authors: Ben Skeggs
*/
#include "subdev/timer.h"
#include <subdev/timer.h>
bool
nouveau_timer_wait_eq(void *obj, u64 nsec, u32 addr, u32 mask, u32 data)
nvkm_timer_wait_eq(void *obj, u64 nsec, u32 addr, u32 mask, u32 data)
{
struct nouveau_timer *ptimer = nouveau_timer(obj);
struct nvkm_timer *ptimer = nvkm_timer(obj);
u64 time0;
time0 = ptimer->read(ptimer);
@ -45,9 +44,9 @@ nouveau_timer_wait_eq(void *obj, u64 nsec, u32 addr, u32 mask, u32 data)
}
bool
nouveau_timer_wait_ne(void *obj, u64 nsec, u32 addr, u32 mask, u32 data)
nvkm_timer_wait_ne(void *obj, u64 nsec, u32 addr, u32 mask, u32 data)
{
struct nouveau_timer *ptimer = nouveau_timer(obj);
struct nvkm_timer *ptimer = nvkm_timer(obj);
u64 time0;
time0 = ptimer->read(ptimer);
@ -65,9 +64,9 @@ nouveau_timer_wait_ne(void *obj, u64 nsec, u32 addr, u32 mask, u32 data)
}
bool
nouveau_timer_wait_cb(void *obj, u64 nsec, bool (*func)(void *), void *data)
nvkm_timer_wait_cb(void *obj, u64 nsec, bool (*func)(void *), void *data)
{
struct nouveau_timer *ptimer = nouveau_timer(obj);
struct nvkm_timer *ptimer = nvkm_timer(obj);
u64 time0;
time0 = ptimer->read(ptimer);
@ -80,15 +79,15 @@ nouveau_timer_wait_cb(void *obj, u64 nsec, bool (*func)(void *), void *data)
}
void
nouveau_timer_alarm(void *obj, u32 nsec, struct nouveau_alarm *alarm)
nvkm_timer_alarm(void *obj, u32 nsec, struct nvkm_alarm *alarm)
{
struct nouveau_timer *ptimer = nouveau_timer(obj);
struct nvkm_timer *ptimer = nvkm_timer(obj);
ptimer->alarm(ptimer, nsec, alarm);
}
void
nouveau_timer_alarm_cancel(void *obj, struct nouveau_alarm *alarm)
nvkm_timer_alarm_cancel(void *obj, struct nvkm_alarm *alarm)
{
struct nouveau_timer *ptimer = nouveau_timer(obj);
struct nvkm_timer *ptimer = nvkm_timer(obj);
ptimer->alarm_cancel(ptimer, alarm);
}

View File

@ -21,18 +21,17 @@
*
* Authors: Ben Skeggs
*/
#include "nv04.h"
static int
gk20a_timer_init(struct nouveau_object *object)
gk20a_timer_init(struct nvkm_object *object)
{
struct nv04_timer_priv *priv = (void *)object;
u32 hi = upper_32_bits(priv->suspend_time);
u32 lo = lower_32_bits(priv->suspend_time);
int ret;
ret = nouveau_timer_init(&priv->base);
ret = nvkm_timer_init(&priv->base);
if (ret)
return ret;
@ -45,10 +44,10 @@ gk20a_timer_init(struct nouveau_object *object)
return 0;
}
struct nouveau_oclass
struct nvkm_oclass
gk20a_timer_oclass = {
.handle = NV_SUBDEV(TIMER, 0xff),
.ofuncs = &(struct nouveau_ofuncs) {
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv04_timer_ctor,
.dtor = nv04_timer_dtor,
.init = gk20a_timer_init,

View File

@ -21,11 +21,12 @@
*
* Authors: Ben Skeggs
*/
#include "nv04.h"
#include <core/device.h>
static u64
nv04_timer_read(struct nouveau_timer *ptimer)
nv04_timer_read(struct nvkm_timer *ptimer)
{
struct nv04_timer_priv *priv = (void *)ptimer;
u32 hi, lo;
@ -39,10 +40,10 @@ nv04_timer_read(struct nouveau_timer *ptimer)
}
static void
nv04_timer_alarm_trigger(struct nouveau_timer *ptimer)
nv04_timer_alarm_trigger(struct nvkm_timer *ptimer)
{
struct nv04_timer_priv *priv = (void *)ptimer;
struct nouveau_alarm *alarm, *atemp;
struct nvkm_alarm *alarm, *atemp;
unsigned long flags;
LIST_HEAD(exec);
@ -71,11 +72,10 @@ nv04_timer_alarm_trigger(struct nouveau_timer *ptimer)
}
static void
nv04_timer_alarm(struct nouveau_timer *ptimer, u64 time,
struct nouveau_alarm *alarm)
nv04_timer_alarm(struct nvkm_timer *ptimer, u64 time, struct nvkm_alarm *alarm)
{
struct nv04_timer_priv *priv = (void *)ptimer;
struct nouveau_alarm *list;
struct nvkm_alarm *list;
unsigned long flags;
alarm->timestamp = ptimer->read(ptimer) + time;
@ -99,8 +99,7 @@ nv04_timer_alarm(struct nouveau_timer *ptimer, u64 time,
}
static void
nv04_timer_alarm_cancel(struct nouveau_timer *ptimer,
struct nouveau_alarm *alarm)
nv04_timer_alarm_cancel(struct nvkm_timer *ptimer, struct nvkm_alarm *alarm)
{
struct nv04_timer_priv *priv = (void *)ptimer;
unsigned long flags;
@ -110,7 +109,7 @@ nv04_timer_alarm_cancel(struct nouveau_timer *ptimer,
}
static void
nv04_timer_intr(struct nouveau_subdev *subdev)
nv04_timer_intr(struct nvkm_subdev *subdev)
{
struct nv04_timer_priv *priv = (void *)subdev;
u32 stat = nv_rd32(priv, NV04_PTIMER_INTR_0);
@ -128,24 +127,24 @@ nv04_timer_intr(struct nouveau_subdev *subdev)
}
int
nv04_timer_fini(struct nouveau_object *object, bool suspend)
nv04_timer_fini(struct nvkm_object *object, bool suspend)
{
struct nv04_timer_priv *priv = (void *)object;
if (suspend)
priv->suspend_time = nv04_timer_read(&priv->base);
nv_wr32(priv, NV04_PTIMER_INTR_EN_0, 0x00000000);
return nouveau_timer_fini(&priv->base, suspend);
return nvkm_timer_fini(&priv->base, suspend);
}
static int
nv04_timer_init(struct nouveau_object *object)
nv04_timer_init(struct nvkm_object *object)
{
struct nouveau_device *device = nv_device(object);
struct nvkm_device *device = nv_device(object);
struct nv04_timer_priv *priv = (void *)object;
u32 m = 1, f, n, d, lo, hi;
int ret;
ret = nouveau_timer_init(&priv->base);
ret = nvkm_timer_init(&priv->base);
if (ret)
return ret;
@ -155,7 +154,7 @@ nv04_timer_init(struct nouveau_object *object)
/* determine base clock for timer source */
#if 0 /*XXX*/
if (device->chipset < 0x40) {
n = nouveau_hw_get_clock(device, PLL_CORE);
n = nvkm_hw_get_clock(device, PLL_CORE);
} else
#endif
if (device->chipset <= 0x40) {
@ -217,26 +216,25 @@ nv04_timer_init(struct nouveau_object *object)
nv_wr32(priv, NV04_PTIMER_INTR_EN_0, 0x00000000);
nv_wr32(priv, NV04_PTIMER_TIME_1, hi);
nv_wr32(priv, NV04_PTIMER_TIME_0, lo);
return 0;
}
void
nv04_timer_dtor(struct nouveau_object *object)
nv04_timer_dtor(struct nvkm_object *object)
{
struct nv04_timer_priv *priv = (void *)object;
return nouveau_timer_destroy(&priv->base);
return nvkm_timer_destroy(&priv->base);
}
int
nv04_timer_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
struct nouveau_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject)
nv04_timer_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct nv04_timer_priv *priv;
int ret;
ret = nouveau_timer_create(parent, engine, oclass, &priv);
ret = nvkm_timer_create(parent, engine, oclass, &priv);
*pobject = nv_object(priv);
if (ret)
return ret;
@ -252,10 +250,10 @@ nv04_timer_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0;
}
struct nouveau_oclass
struct nvkm_oclass
nv04_timer_oclass = {
.handle = NV_SUBDEV(TIMER, 0x04),
.ofuncs = &(struct nouveau_ofuncs) {
.ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv04_timer_ctor,
.dtor = nv04_timer_dtor,
.init = nv04_timer_init,

View File

@ -1,6 +1,5 @@
#ifndef __NVKM_TIMER_NV04_H__
#define __NVKM_TIMER_NV04_H__
#include "priv.h"
#define NV04_PTIMER_INTR_0 0x009100
@ -12,16 +11,15 @@
#define NV04_PTIMER_ALARM_0 0x009420
struct nv04_timer_priv {
struct nouveau_timer base;
struct nvkm_timer base;
struct list_head alarms;
spinlock_t lock;
u64 suspend_time;
};
int nv04_timer_ctor(struct nouveau_object *, struct nouveau_object *,
struct nouveau_oclass *, void *, u32,
struct nouveau_object **);
void nv04_timer_dtor(struct nouveau_object *);
int nv04_timer_fini(struct nouveau_object *, bool);
int nv04_timer_ctor(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, void *, u32,
struct nvkm_object **);
void nv04_timer_dtor(struct nvkm_object *);
int nv04_timer_fini(struct nvkm_object *, bool);
#endif

View File

@ -1,6 +1,4 @@
#ifndef __NVKM_TIMER_PRIV_H__
#define __NVKM_TIMER_PRIV_H__
#include <subdev/timer.h>
#endif