Commit a699a85a authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bus: switch to subdev printk macros

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 60b29d20
...@@ -27,20 +27,20 @@ ...@@ -27,20 +27,20 @@
static void static void
gf100_bus_intr(struct nvkm_subdev *subdev) gf100_bus_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_bus *bus = nvkm_bus(subdev); struct nvkm_device *device = subdev->device;
struct nvkm_device *device = bus->subdev.device;
u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140); u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140);
if (stat & 0x0000000e) { if (stat & 0x0000000e) {
u32 addr = nvkm_rd32(device, 0x009084); u32 addr = nvkm_rd32(device, 0x009084);
u32 data = nvkm_rd32(device, 0x009088); u32 data = nvkm_rd32(device, 0x009088);
nv_error(bus, "MMIO %s of 0x%08x FAULT at 0x%06x [ %s%s%s]\n", nvkm_error(subdev,
(addr & 0x00000002) ? "write" : "read", data, "MMIO %s of %08x FAULT at %06x [ %s%s%s]\n",
(addr & 0x00fffffc), (addr & 0x00000002) ? "write" : "read", data,
(stat & 0x00000002) ? "!ENGINE " : "", (addr & 0x00fffffc),
(stat & 0x00000004) ? "IBUS " : "", (stat & 0x00000002) ? "!ENGINE " : "",
(stat & 0x00000008) ? "TIMEOUT " : ""); (stat & 0x00000004) ? "IBUS " : "",
(stat & 0x00000008) ? "TIMEOUT " : "");
nvkm_wr32(device, 0x009084, 0x00000000); nvkm_wr32(device, 0x009084, 0x00000000);
nvkm_wr32(device, 0x001100, (stat & 0x0000000e)); nvkm_wr32(device, 0x001100, (stat & 0x0000000e));
...@@ -48,7 +48,7 @@ gf100_bus_intr(struct nvkm_subdev *subdev) ...@@ -48,7 +48,7 @@ gf100_bus_intr(struct nvkm_subdev *subdev)
} }
if (stat) { if (stat) {
nv_error(bus, "unknown intr 0x%08x\n", stat); nvkm_error(subdev, "intr %08x\n", stat);
nvkm_mask(device, 0x001140, stat, 0x00000000); nvkm_mask(device, 0x001140, stat, 0x00000000);
} }
} }
......
...@@ -64,20 +64,21 @@ nvkm_hwsq_fini(struct nvkm_hwsq **phwsq, bool exec) ...@@ -64,20 +64,21 @@ nvkm_hwsq_fini(struct nvkm_hwsq **phwsq, bool exec)
int ret = 0, i; int ret = 0, i;
if (hwsq) { if (hwsq) {
struct nvkm_bus *bus = hwsq->bus; struct nvkm_bus *bus = hwsq->bus;
struct nvkm_subdev *subdev = &bus->subdev;
hwsq->c.size = (hwsq->c.size + 4) / 4; hwsq->c.size = (hwsq->c.size + 4) / 4;
if (hwsq->c.size <= bus->hwsq_size) { if (hwsq->c.size <= bus->hwsq_size) {
if (exec) if (exec)
ret = bus->hwsq_exec(bus, (u32 *)hwsq->c.data, ret = bus->hwsq_exec(bus, (u32 *)hwsq->c.data,
hwsq->c.size); hwsq->c.size);
if (ret) if (ret)
nv_error(bus, "hwsq exec failed: %d\n", ret); nvkm_error(subdev, "hwsq exec failed: %d\n", ret);
} else { } else {
nv_error(bus, "hwsq ucode too large\n"); nvkm_error(subdev, "hwsq ucode too large\n");
ret = -ENOSPC; ret = -ENOSPC;
} }
for (i = 0; ret && i < hwsq->c.size; i++) for (i = 0; ret && i < hwsq->c.size; i++)
nv_error(bus, "\t0x%08x\n", ((u32 *)hwsq->c.data)[i]); nvkm_error(subdev, "\t%08x\n", ((u32 *)hwsq->c.data)[i]);
*phwsq = NULL; *phwsq = NULL;
kfree(hwsq); kfree(hwsq);
...@@ -88,7 +89,7 @@ nvkm_hwsq_fini(struct nvkm_hwsq **phwsq, bool exec) ...@@ -88,7 +89,7 @@ nvkm_hwsq_fini(struct nvkm_hwsq **phwsq, bool exec)
void void
nvkm_hwsq_wr32(struct nvkm_hwsq *hwsq, u32 addr, u32 data) nvkm_hwsq_wr32(struct nvkm_hwsq *hwsq, u32 addr, u32 data)
{ {
nv_debug(hwsq->bus, "R[%06x] = 0x%08x\n", addr, data); nvkm_debug(&hwsq->bus->subdev, "R[%06x] = %08x\n", addr, data);
if (hwsq->data != data) { if (hwsq->data != data) {
if ((data & 0xffff0000) != (hwsq->data & 0xffff0000)) { if ((data & 0xffff0000) != (hwsq->data & 0xffff0000)) {
...@@ -113,7 +114,7 @@ nvkm_hwsq_wr32(struct nvkm_hwsq *hwsq, u32 addr, u32 data) ...@@ -113,7 +114,7 @@ nvkm_hwsq_wr32(struct nvkm_hwsq *hwsq, u32 addr, u32 data)
void void
nvkm_hwsq_setf(struct nvkm_hwsq *hwsq, u8 flag, int data) nvkm_hwsq_setf(struct nvkm_hwsq *hwsq, u8 flag, int data)
{ {
nv_debug(hwsq->bus, " FLAG[%02x] = %d\n", flag, data); nvkm_debug(&hwsq->bus->subdev, " FLAG[%02x] = %d\n", flag, data);
flag += 0x80; flag += 0x80;
if (data >= 0) if (data >= 0)
flag += 0x20; flag += 0x20;
...@@ -125,7 +126,7 @@ nvkm_hwsq_setf(struct nvkm_hwsq *hwsq, u8 flag, int data) ...@@ -125,7 +126,7 @@ nvkm_hwsq_setf(struct nvkm_hwsq *hwsq, u8 flag, int data)
void void
nvkm_hwsq_wait(struct nvkm_hwsq *hwsq, u8 flag, u8 data) nvkm_hwsq_wait(struct nvkm_hwsq *hwsq, u8 flag, u8 data)
{ {
nv_debug(hwsq->bus, " WAIT[%02x] = %d\n", flag, data); nvkm_debug(&hwsq->bus->subdev, " WAIT[%02x] = %d\n", flag, data);
hwsq_cmd(hwsq, 3, (u8[]){ 0x5f, flag, data }); hwsq_cmd(hwsq, 3, (u8[]){ 0x5f, flag, data });
} }
...@@ -138,6 +139,6 @@ nvkm_hwsq_nsec(struct nvkm_hwsq *hwsq, u32 nsec) ...@@ -138,6 +139,6 @@ nvkm_hwsq_nsec(struct nvkm_hwsq *hwsq, u32 nsec)
shift++; shift++;
} }
nv_debug(hwsq->bus, " DELAY = %d ns\n", nsec); nvkm_debug(&hwsq->bus->subdev, " DELAY = %d ns\n", nsec);
hwsq_cmd(hwsq, 1, (u8[]){ 0x00 | (shift << 2) | usec }); hwsq_cmd(hwsq, 1, (u8[]){ 0x00 | (shift << 2) | usec });
} }
...@@ -24,29 +24,30 @@ ...@@ -24,29 +24,30 @@
*/ */
#include "nv04.h" #include "nv04.h"
#include <subdev/gpio.h>
static void static void
nv04_bus_intr(struct nvkm_subdev *subdev) nv04_bus_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_bus *bus = nvkm_bus(subdev); struct nvkm_device *device = subdev->device;
struct nvkm_device *device = bus->subdev.device;
u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140); u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140);
if (stat & 0x00000001) { if (stat & 0x00000001) {
nv_error(bus, "BUS ERROR\n"); nvkm_error(subdev, "BUS ERROR\n");
stat &= ~0x00000001; stat &= ~0x00000001;
nvkm_wr32(device, 0x001100, 0x00000001); nvkm_wr32(device, 0x001100, 0x00000001);
} }
if (stat & 0x00000110) { if (stat & 0x00000110) {
subdev = nvkm_subdev(subdev, NVDEV_SUBDEV_GPIO); struct nvkm_gpio *gpio = device->gpio;
if (subdev && subdev->intr) if (gpio && gpio->subdev.intr)
subdev->intr(subdev); gpio->subdev.intr(&gpio->subdev);
stat &= ~0x00000110; stat &= ~0x00000110;
nvkm_wr32(device, 0x001100, 0x00000110); nvkm_wr32(device, 0x001100, 0x00000110);
} }
if (stat) { if (stat) {
nv_error(bus, "unknown intr 0x%08x\n", stat); nvkm_error(subdev, "intr %08x\n", stat);
nvkm_mask(device, 0x001140, stat, 0x00000000); nvkm_mask(device, 0x001140, stat, 0x00000000);
} }
} }
......
...@@ -24,42 +24,44 @@ ...@@ -24,42 +24,44 @@
*/ */
#include "nv04.h" #include "nv04.h"
#include <subdev/gpio.h>
#include <subdev/therm.h>
static void static void
nv31_bus_intr(struct nvkm_subdev *subdev) nv31_bus_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_bus *bus = nvkm_bus(subdev); struct nvkm_device *device = subdev->device;
struct nvkm_device *device = bus->subdev.device;
u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140); u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140);
u32 gpio = nvkm_rd32(device, 0x001104) & nvkm_rd32(device, 0x001144); u32 gpio = nvkm_rd32(device, 0x001104) & nvkm_rd32(device, 0x001144);
if (gpio) { if (gpio) {
subdev = nvkm_subdev(bus, NVDEV_SUBDEV_GPIO); struct nvkm_gpio *gpio = device->gpio;
if (subdev && subdev->intr) if (gpio && gpio->subdev.intr)
subdev->intr(subdev); gpio->subdev.intr(&gpio->subdev);
} }
if (stat & 0x00000008) { /* NV41- */ if (stat & 0x00000008) { /* NV41- */
u32 addr = nvkm_rd32(device, 0x009084); u32 addr = nvkm_rd32(device, 0x009084);
u32 data = nvkm_rd32(device, 0x009088); u32 data = nvkm_rd32(device, 0x009088);
nv_error(bus, "MMIO %s of 0x%08x FAULT at 0x%06x\n", nvkm_error(subdev, "MMIO %s of %08x FAULT at %06x\n",
(addr & 0x00000002) ? "write" : "read", data, (addr & 0x00000002) ? "write" : "read", data,
(addr & 0x00fffffc)); (addr & 0x00fffffc));
stat &= ~0x00000008; stat &= ~0x00000008;
nvkm_wr32(device, 0x001100, 0x00000008); nvkm_wr32(device, 0x001100, 0x00000008);
} }
if (stat & 0x00070000) { if (stat & 0x00070000) {
subdev = nvkm_subdev(bus, NVDEV_SUBDEV_THERM); struct nvkm_therm *therm = device->therm;
if (subdev && subdev->intr) if (therm && therm->subdev.intr)
subdev->intr(subdev); therm->subdev.intr(&therm->subdev);
stat &= ~0x00070000; stat &= ~0x00070000;
nvkm_wr32(device, 0x001100, 0x00070000); nvkm_wr32(device, 0x001100, 0x00070000);
} }
if (stat) { if (stat) {
nv_error(bus, "unknown intr 0x%08x\n", stat); nvkm_error(subdev, "intr %08x\n", stat);
nvkm_mask(device, 0x001140, stat, 0x00000000); nvkm_mask(device, 0x001140, stat, 0x00000000);
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#include "nv04.h" #include "nv04.h"
#include <subdev/therm.h>
#include <subdev/timer.h> #include <subdev/timer.h>
static int static int
...@@ -51,32 +52,31 @@ nv50_bus_hwsq_exec(struct nvkm_bus *bus, u32 *data, u32 size) ...@@ -51,32 +52,31 @@ nv50_bus_hwsq_exec(struct nvkm_bus *bus, u32 *data, u32 size)
void void
nv50_bus_intr(struct nvkm_subdev *subdev) nv50_bus_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_bus *bus = nvkm_bus(subdev); struct nvkm_device *device = subdev->device;
struct nvkm_device *device = bus->subdev.device;
u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140); u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140);
if (stat & 0x00000008) { if (stat & 0x00000008) {
u32 addr = nvkm_rd32(device, 0x009084); u32 addr = nvkm_rd32(device, 0x009084);
u32 data = nvkm_rd32(device, 0x009088); u32 data = nvkm_rd32(device, 0x009088);
nv_error(bus, "MMIO %s of 0x%08x FAULT at 0x%06x\n", nvkm_error(subdev, "MMIO %s of %08x FAULT at %06x\n",
(addr & 0x00000002) ? "write" : "read", data, (addr & 0x00000002) ? "write" : "read", data,
(addr & 0x00fffffc)); (addr & 0x00fffffc));
stat &= ~0x00000008; stat &= ~0x00000008;
nvkm_wr32(device, 0x001100, 0x00000008); nvkm_wr32(device, 0x001100, 0x00000008);
} }
if (stat & 0x00010000) { if (stat & 0x00010000) {
subdev = nvkm_subdev(bus, NVDEV_SUBDEV_THERM); struct nvkm_therm *therm = device->therm;
if (subdev && subdev->intr) if (therm && therm->subdev.intr)
subdev->intr(subdev); therm->subdev.intr(&therm->subdev);
stat &= ~0x00010000; stat &= ~0x00010000;
nvkm_wr32(device, 0x001100, 0x00010000); nvkm_wr32(device, 0x001100, 0x00010000);
} }
if (stat) { if (stat) {
nv_error(bus, "unknown intr 0x%08x\n", stat); nvkm_error(subdev, "intr %08x\n", stat);
nvkm_mask(device, 0x001140, stat, 0); nvkm_mask(device, 0x001140, stat, 0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment