121b13791SBen Skeggs /*
221b13791SBen Skeggs * Copyright 2013 Red Hat Inc.
321b13791SBen Skeggs *
421b13791SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
521b13791SBen Skeggs * copy of this software and associated documentation files (the "Software"),
621b13791SBen Skeggs * to deal in the Software without restriction, including without limitation
721b13791SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
821b13791SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
921b13791SBen Skeggs * Software is furnished to do so, subject to the following conditions:
1021b13791SBen Skeggs *
1121b13791SBen Skeggs * The above copyright notice and this permission notice shall be included in
1221b13791SBen Skeggs * all copies or substantial portions of the Software.
1321b13791SBen Skeggs *
1421b13791SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1521b13791SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1621b13791SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1721b13791SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1821b13791SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1921b13791SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2021b13791SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
2121b13791SBen Skeggs *
2221b13791SBen Skeggs * Authors: Ben Skeggs
2321b13791SBen Skeggs */
2421b13791SBen Skeggs #include "priv.h"
2521b13791SBen Skeggs #include "fuc/gf100.fuc3.h"
2621b13791SBen Skeggs
27715e7d26SBen Skeggs #include <subdev/mc.h>
28715e7d26SBen Skeggs
29715e7d26SBen Skeggs void
gf100_pmu_reset(struct nvkm_pmu * pmu)30715e7d26SBen Skeggs gf100_pmu_reset(struct nvkm_pmu *pmu)
31715e7d26SBen Skeggs {
32715e7d26SBen Skeggs struct nvkm_device *device = pmu->subdev.device;
336997ea13SBen Skeggs nvkm_mc_disable(device, NVKM_SUBDEV_PMU, 0);
346997ea13SBen Skeggs nvkm_mc_enable(device, NVKM_SUBDEV_PMU, 0);
35715e7d26SBen Skeggs }
36715e7d26SBen Skeggs
376b1277c8SBen Skeggs bool
gf100_pmu_enabled(struct nvkm_pmu * pmu)386b1277c8SBen Skeggs gf100_pmu_enabled(struct nvkm_pmu *pmu)
396b1277c8SBen Skeggs {
406997ea13SBen Skeggs return nvkm_mc_enabled(pmu->subdev.device, NVKM_SUBDEV_PMU, 0);
416b1277c8SBen Skeggs }
426b1277c8SBen Skeggs
43e2ca4e7dSBen Skeggs static const struct nvkm_pmu_func
44e2ca4e7dSBen Skeggs gf100_pmu = {
452952a2b4SBen Skeggs .flcn = >215_pmu_flcn,
4621b13791SBen Skeggs .code.data = gf100_pmu_code,
4721b13791SBen Skeggs .code.size = sizeof(gf100_pmu_code),
4821b13791SBen Skeggs .data.data = gf100_pmu_data,
4921b13791SBen Skeggs .data.size = sizeof(gf100_pmu_data),
506b1277c8SBen Skeggs .enabled = gf100_pmu_enabled,
51715e7d26SBen Skeggs .reset = gf100_pmu_reset,
52da7d2062SBen Skeggs .init = gt215_pmu_init,
53da7d2062SBen Skeggs .fini = gt215_pmu_fini,
54da7d2062SBen Skeggs .intr = gt215_pmu_intr,
55da7d2062SBen Skeggs .send = gt215_pmu_send,
56da7d2062SBen Skeggs .recv = gt215_pmu_recv,
57e2ca4e7dSBen Skeggs };
58e2ca4e7dSBen Skeggs
59e2ca4e7dSBen Skeggs int
gf100_pmu_nofw(struct nvkm_pmu * pmu,int ver,const struct nvkm_pmu_fwif * fwif)60989863d7SBen Skeggs gf100_pmu_nofw(struct nvkm_pmu *pmu, int ver, const struct nvkm_pmu_fwif *fwif)
61989863d7SBen Skeggs {
62989863d7SBen Skeggs return 0;
63989863d7SBen Skeggs }
64989863d7SBen Skeggs
65989863d7SBen Skeggs static const struct nvkm_pmu_fwif
66989863d7SBen Skeggs gf100_pmu_fwif[] = {
67989863d7SBen Skeggs { -1, gf100_pmu_nofw, &gf100_pmu },
68989863d7SBen Skeggs {}
69989863d7SBen Skeggs };
70989863d7SBen Skeggs
71989863d7SBen Skeggs int
gf100_pmu_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_pmu ** ppmu)72*e4b15b4cSBen Skeggs gf100_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
73*e4b15b4cSBen Skeggs struct nvkm_pmu **ppmu)
74e2ca4e7dSBen Skeggs {
75*e4b15b4cSBen Skeggs return nvkm_pmu_new_(gf100_pmu_fwif, device, type, inst, ppmu);
76e2ca4e7dSBen Skeggs }
77