void nouveau_memx_nsec(struct nouveau_memx *memx, u32 nsec) { nv_debug(memx->ppwr, " DELAY = %d ns\n", nsec); memx_cmd(memx, MEMX_DELAY, 1, (u32[]){ nsec }); memx_out(memx); /* fuc can't handle multiple */ }
int nvkm_memx_fini(struct nvkm_memx **pmemx, bool exec) { struct nvkm_memx *memx = *pmemx; struct nvkm_pmu *pmu = memx->pmu; struct nvkm_subdev *subdev = &pmu->subdev; struct nvkm_device *device = subdev->device; u32 finish, reply[2]; /* flush the cache... */ memx_out(memx); /* release data segment access */ finish = nvkm_rd32(device, 0x10a1c0) & 0x00ffffff; nvkm_wr32(device, 0x10a580, 0x00000000); /* call MEMX process to execute the script, and wait for reply */ if (exec) { nvkm_pmu_send(pmu, reply, PROC_MEMX, MEMX_MSG_EXEC, memx->base, finish); } nvkm_debug(subdev, "Exec took %uns, PMU_IN %08x\n", reply[0], reply[1]); kfree(memx); return 0; }
void nvkm_memx_nsec(struct nvkm_memx *memx, u32 nsec) { nvkm_debug(&memx->pmu->subdev, " DELAY = %d ns\n", nsec); memx_cmd(memx, MEMX_DELAY, 1, (u32[]){ nsec }); memx_out(memx); /* fuc can't handle multiple */ }
void nouveau_memx_wait(struct nouveau_memx *memx, u32 addr, u32 mask, u32 data, u32 nsec) { nv_debug(memx->ppwr, "R[%06x] & 0x%08x == 0x%08x, %d us\n", addr, mask, data, nsec); memx_cmd(memx, MEMX_WAIT, 4, (u32[]){ addr, ~mask, data, nsec }); memx_out(memx); /* fuc can't handle multiple */ }
void nvkm_memx_wait(struct nvkm_memx *memx, u32 addr, u32 mask, u32 data, u32 nsec) { nvkm_debug(&memx->pmu->subdev, "R[%06x] & %08x == %08x, %d us\n", addr, mask, data, nsec); memx_cmd(memx, MEMX_WAIT, 4, (u32[]){ addr, mask, data, nsec }); memx_out(memx); /* fuc can't handle multiple */ }
static void memx_cmd(struct nouveau_memx *memx, u32 mthd, u32 size, u32 data[]) { if ((memx->c.size + size >= ARRAY_SIZE(memx->c.data)) || (memx->c.size && memx->c.mthd != mthd)) memx_out(memx); memcpy(&memx->c.data[memx->c.size], data, size * sizeof(data[0])); memx->c.size += size; memx->c.mthd = mthd; }
int nouveau_memx_fini(struct nouveau_memx **pmemx, bool exec) { struct nouveau_memx *memx = *pmemx; struct nouveau_pwr *ppwr = memx->ppwr; u32 finish, reply[2]; /* flush the cache... */ memx_out(memx); /* release data segment access */ nv_wr32(ppwr, 0x10a1c4, 0x00000000 | MEMX_LEAVE); finish = nv_rd32(ppwr, 0x10a1c0) & 0x00ffffff; nv_wr32(ppwr, 0x10a580, 0x00000000); /* call MEMX process to execute the script, and wait for reply */ if (exec) { ppwr->message(ppwr, reply, PROC_MEMX, MEMX_MSG_EXEC, memx->base, finish); } kfree(memx); return 0; }