static int
nvkm_perfsrc_enable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
{
+ struct nvkm_device *device = pm->engine.subdev.device;
struct nvkm_perfdom *dom = NULL;
struct nvkm_perfsig *sig;
struct nvkm_perfsrc *src;
value |= ((ctr->source[i][j] >> 32) << src->shift);
/* enable the source */
- nv_mask(pm, src->addr, mask, value);
+ nvkm_mask(device, src->addr, mask, value);
nv_debug(pm, "enabled source 0x%08x 0x%08x 0x%08x\n",
src->addr, mask, value);
}
static int
nvkm_perfsrc_disable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
{
+ struct nvkm_device *device = pm->engine.subdev.device;
struct nvkm_perfdom *dom = NULL;
struct nvkm_perfsig *sig;
struct nvkm_perfsrc *src;
mask |= (src->mask << src->shift);
/* disable the source */
- nv_mask(pm, src->addr, mask, 0);
+ nvkm_mask(device, src->addr, mask, 0);
nv_debug(pm, "disabled source 0x%08x 0x%08x\n",
src->addr, mask);
}
gf100_perfctr_init(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
struct nvkm_perfctr *ctr)
{
+ struct nvkm_device *device = pm->engine.subdev.device;
struct gf100_pm_cntr *cntr = (void *)ctr;
u32 log = ctr->logic_op;
u32 src = 0x00000000;
for (i = 0; i < 4; i++)
src |= ctr->signal[i] << (i * 8);
- nv_wr32(pm, dom->addr + 0x09c, 0x00040002 | (dom->mode << 3));
- nv_wr32(pm, dom->addr + 0x100, 0x00000000);
- nv_wr32(pm, dom->addr + 0x040 + (cntr->base.slot * 0x08), src);
- nv_wr32(pm, dom->addr + 0x044 + (cntr->base.slot * 0x08), log);
+ nvkm_wr32(device, dom->addr + 0x09c, 0x00040002 | (dom->mode << 3));
+ nvkm_wr32(device, dom->addr + 0x100, 0x00000000);
+ nvkm_wr32(device, dom->addr + 0x040 + (cntr->base.slot * 0x08), src);
+ nvkm_wr32(device, dom->addr + 0x044 + (cntr->base.slot * 0x08), log);
}
static void
gf100_perfctr_read(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
struct nvkm_perfctr *ctr)
{
+ struct nvkm_device *device = pm->engine.subdev.device;
struct gf100_pm_cntr *cntr = (void *)ctr;
switch (cntr->base.slot) {
- case 0: cntr->base.ctr = nv_rd32(pm, dom->addr + 0x08c); break;
- case 1: cntr->base.ctr = nv_rd32(pm, dom->addr + 0x088); break;
- case 2: cntr->base.ctr = nv_rd32(pm, dom->addr + 0x080); break;
- case 3: cntr->base.ctr = nv_rd32(pm, dom->addr + 0x090); break;
+ case 0: cntr->base.ctr = nvkm_rd32(device, dom->addr + 0x08c); break;
+ case 1: cntr->base.ctr = nvkm_rd32(device, dom->addr + 0x088); break;
+ case 2: cntr->base.ctr = nvkm_rd32(device, dom->addr + 0x080); break;
+ case 3: cntr->base.ctr = nvkm_rd32(device, dom->addr + 0x090); break;
}
- dom->clk = nv_rd32(pm, dom->addr + 0x070);
+ dom->clk = nvkm_rd32(device, dom->addr + 0x070);
}
static void
gf100_perfctr_next(struct nvkm_pm *pm, struct nvkm_perfdom *dom)
{
- nv_wr32(pm, dom->addr + 0x06c, dom->signal_nr - 0x40 + 0x27);
- nv_wr32(pm, dom->addr + 0x0ec, 0x00000011);
+ struct nvkm_device *device = pm->engine.subdev.device;
+ nvkm_wr32(device, dom->addr + 0x06c, dom->signal_nr - 0x40 + 0x27);
+ nvkm_wr32(device, dom->addr + 0x0ec, 0x00000011);
}
const struct nvkm_funcdom
gf100_pm_fini(struct nvkm_object *object, bool suspend)
{
struct nvkm_pm *pm = (void *)object;
- nv_mask(pm, 0x000200, 0x10000000, 0x00000000);
- nv_mask(pm, 0x000200, 0x10000000, 0x10000000);
+ struct nvkm_device *device = pm->engine.subdev.device;
+ nvkm_mask(device, 0x000200, 0x10000000, 0x00000000);
+ nvkm_mask(device, 0x000200, 0x10000000, 0x10000000);
return nvkm_pm_fini(pm, suspend);
}
struct nvkm_object **pobject)
{
struct gf100_pm_oclass *mclass = (void *)oclass;
+ struct nvkm_device *device = (void *)parent;
struct nvkm_pm *pm;
u32 mask;
int ret;
return ret;
/* GPC */
- mask = (1 << nv_rd32(pm, 0x022430)) - 1;
- mask &= ~nv_rd32(pm, 0x022504);
- mask &= ~nv_rd32(pm, 0x022584);
+ mask = (1 << nvkm_rd32(device, 0x022430)) - 1;
+ mask &= ~nvkm_rd32(device, 0x022504);
+ mask &= ~nvkm_rd32(device, 0x022584);
ret = nvkm_perfdom_new(pm, "gpc", mask, 0x180000,
0x1000, 0x200, mclass->doms_gpc);
return ret;
/* PART */
- mask = (1 << nv_rd32(pm, 0x022438)) - 1;
- mask &= ~nv_rd32(pm, 0x022548);
- mask &= ~nv_rd32(pm, 0x0225c8);
+ mask = (1 << nvkm_rd32(device, 0x022438)) - 1;
+ mask &= ~nvkm_rd32(device, 0x022548);
+ mask &= ~nvkm_rd32(device, 0x0225c8);
ret = nvkm_perfdom_new(pm, "part", mask, 0x1a0000,
0x1000, 0x200, mclass->doms_part);
nv40_perfctr_init(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
struct nvkm_perfctr *ctr)
{
+ struct nvkm_device *device = pm->engine.subdev.device;
struct nv40_pm_cntr *cntr = (void *)ctr;
u32 log = ctr->logic_op;
u32 src = 0x00000000;
for (i = 0; i < 4; i++)
src |= ctr->signal[i] << (i * 8);
- nv_wr32(pm, 0x00a7c0 + dom->addr, 0x00000001 | (dom->mode << 4));
- nv_wr32(pm, 0x00a400 + dom->addr + (cntr->base.slot * 0x40), src);
- nv_wr32(pm, 0x00a420 + dom->addr + (cntr->base.slot * 0x40), log);
+ nvkm_wr32(device, 0x00a7c0 + dom->addr, 0x00000001 | (dom->mode << 4));
+ nvkm_wr32(device, 0x00a400 + dom->addr + (cntr->base.slot * 0x40), src);
+ nvkm_wr32(device, 0x00a420 + dom->addr + (cntr->base.slot * 0x40), log);
}
static void
nv40_perfctr_read(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
struct nvkm_perfctr *ctr)
{
+ struct nvkm_device *device = pm->engine.subdev.device;
struct nv40_pm_cntr *cntr = (void *)ctr;
switch (cntr->base.slot) {
- case 0: cntr->base.ctr = nv_rd32(pm, 0x00a700 + dom->addr); break;
- case 1: cntr->base.ctr = nv_rd32(pm, 0x00a6c0 + dom->addr); break;
- case 2: cntr->base.ctr = nv_rd32(pm, 0x00a680 + dom->addr); break;
- case 3: cntr->base.ctr = nv_rd32(pm, 0x00a740 + dom->addr); break;
+ case 0: cntr->base.ctr = nvkm_rd32(device, 0x00a700 + dom->addr); break;
+ case 1: cntr->base.ctr = nvkm_rd32(device, 0x00a6c0 + dom->addr); break;
+ case 2: cntr->base.ctr = nvkm_rd32(device, 0x00a680 + dom->addr); break;
+ case 3: cntr->base.ctr = nvkm_rd32(device, 0x00a740 + dom->addr); break;
}
- dom->clk = nv_rd32(pm, 0x00a600 + dom->addr);
+ dom->clk = nvkm_rd32(device, 0x00a600 + dom->addr);
}
static void
nv40_perfctr_next(struct nvkm_pm *pm, struct nvkm_perfdom *dom)
{
+ struct nvkm_device *device = pm->engine.subdev.device;
if (pm->sequence != pm->sequence) {
- nv_wr32(pm, 0x400084, 0x00000020);
+ nvkm_wr32(device, 0x400084, 0x00000020);
pm->sequence = pm->sequence;
}
}