Commit 3ecd329b authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fb: switch to subdev printk macros

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent aa860e4b
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
int int
nvkm_fb_bios_memtype(struct nvkm_bios *bios) nvkm_fb_bios_memtype(struct nvkm_bios *bios)
{ {
struct nvkm_device *device = bios->subdev.device; struct nvkm_subdev *subdev = &bios->subdev;
struct nvkm_device *device = subdev->device;
const u8 ramcfg = (nvkm_rd32(device, 0x101000) & 0x0000003c) >> 2; const u8 ramcfg = (nvkm_rd32(device, 0x101000) & 0x0000003c) >> 2;
struct nvbios_M0203E M0203E; struct nvbios_M0203E M0203E;
u8 ver, hdr; u8 ver, hdr;
...@@ -41,12 +42,12 @@ nvkm_fb_bios_memtype(struct nvkm_bios *bios) ...@@ -41,12 +42,12 @@ nvkm_fb_bios_memtype(struct nvkm_bios *bios)
case M0203E_TYPE_GDDR3: return NV_MEM_TYPE_GDDR3; case M0203E_TYPE_GDDR3: return NV_MEM_TYPE_GDDR3;
case M0203E_TYPE_GDDR5: return NV_MEM_TYPE_GDDR5; case M0203E_TYPE_GDDR5: return NV_MEM_TYPE_GDDR5;
default: default:
nv_warn(bios, "M0203E type %02x\n", M0203E.type); nvkm_warn(subdev, "M0203E type %02x\n", M0203E.type);
return NV_MEM_TYPE_UNKNOWN; return NV_MEM_TYPE_UNKNOWN;
} }
} }
nv_warn(bios, "M0203E not matched!\n"); nvkm_warn(subdev, "M0203E not matched!\n");
return NV_MEM_TYPE_UNKNOWN; return NV_MEM_TYPE_UNKNOWN;
} }
...@@ -111,7 +112,7 @@ nvkm_fb_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -111,7 +112,7 @@ nvkm_fb_create_(struct nvkm_object *parent, struct nvkm_object *engine,
{ {
struct nvkm_fb_impl *impl = (void *)oclass; struct nvkm_fb_impl *impl = (void *)oclass;
static const char *name[] = { static const char *name[] = {
[NV_MEM_TYPE_UNKNOWN] = "unknown", [NV_MEM_TYPE_UNKNOWN] = "of unknown memory type",
[NV_MEM_TYPE_STOLEN ] = "stolen system memory", [NV_MEM_TYPE_STOLEN ] = "stolen system memory",
[NV_MEM_TYPE_SGRAM ] = "SGRAM", [NV_MEM_TYPE_SGRAM ] = "SGRAM",
[NV_MEM_TYPE_SDRAM ] = "SDRAM", [NV_MEM_TYPE_SDRAM ] = "SDRAM",
...@@ -140,7 +141,7 @@ nvkm_fb_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -140,7 +141,7 @@ nvkm_fb_create_(struct nvkm_object *parent, struct nvkm_object *engine,
ret = nvkm_object_ctor(nv_object(fb), NULL, impl->ram, NULL, 0, &ram); ret = nvkm_object_ctor(nv_object(fb), NULL, impl->ram, NULL, 0, &ram);
if (ret) { if (ret) {
nv_fatal(fb, "error detecting memory configuration!!\n"); nvkm_error(&fb->subdev, "vram init failed, %d\n", ret);
return ret; return ret;
} }
...@@ -157,10 +158,11 @@ nvkm_fb_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -157,10 +158,11 @@ nvkm_fb_create_(struct nvkm_object *parent, struct nvkm_object *engine,
++fb->ram->tags : 0, 1); ++fb->ram->tags : 0, 1);
if (ret) if (ret)
return ret; return ret;
nvkm_debug(&fb->subdev, "%d compression tags\n", fb->ram->tags);
} }
nv_info(fb, "RAM type: %s\n", name[fb->ram->type]); nvkm_info(&fb->subdev, "%d MiB %s\n", (int)(fb->ram->size >> 20),
nv_info(fb, "RAM size: %d MiB\n", (int)(fb->ram->size >> 20)); name[fb->ram->type]);
nv_info(fb, " ZCOMP: %d tags\n", fb->ram->tags);
return 0; return 0;
} }
...@@ -36,12 +36,11 @@ static void ...@@ -36,12 +36,11 @@ static void
gf100_fb_intr(struct nvkm_subdev *subdev) gf100_fb_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
struct gf100_fb *fb = (void *)subdev;
u32 intr = nvkm_rd32(device, 0x000100); u32 intr = nvkm_rd32(device, 0x000100);
if (intr & 0x08000000) if (intr & 0x08000000)
nv_debug(fb, "PFFB intr\n"); nvkm_debug(subdev, "PFFB intr\n");
if (intr & 0x00002000) if (intr & 0x00002000)
nv_debug(fb, "PBFB intr\n"); nvkm_debug(subdev, "PBFB intr\n");
} }
int int
......
...@@ -144,10 +144,10 @@ static const struct nvkm_enum vm_fault[] = { ...@@ -144,10 +144,10 @@ static const struct nvkm_enum vm_fault[] = {
static void static void
nv50_fb_intr(struct nvkm_subdev *subdev) nv50_fb_intr(struct nvkm_subdev *subdev)
{ {
struct nvkm_device *device = nv_device(subdev);
struct nvkm_engine *engine;
struct nv50_fb *fb = (void *)subdev; struct nv50_fb *fb = (void *)subdev;
const struct nvkm_enum *en, *cl; struct nvkm_device *device = fb->base.subdev.device;
struct nvkm_engine *engine;
const struct nvkm_enum *en, *re, *cl, *sc;
struct nvkm_object *engctx = NULL; struct nvkm_object *engctx = NULL;
u32 trap[6], idx, chan; u32 trap[6], idx, chan;
u8 st0, st1, st2, st3; u8 st0, st1, st2, st3;
...@@ -203,38 +203,22 @@ nv50_fb_intr(struct nvkm_subdev *subdev) ...@@ -203,38 +203,22 @@ nv50_fb_intr(struct nvkm_subdev *subdev)
en = orig_en; en = orig_en;
} }
nv_error(fb, "trapped %s at 0x%02x%04x%04x on channel 0x%08x [%s] ", re = nvkm_enum_find(vm_fault , st1);
cl = nvkm_enum_find(vm_client, st2);
if (cl && cl->data) sc = nvkm_enum_find(cl->data, st3);
else if (en && en->data) sc = nvkm_enum_find(en->data, st3);
else sc = NULL;
nvkm_error(subdev, "trapped %s at %02x%04x%04x on channel "
"%08x [%s] engine %02x [%s] client %02x [%s] "
"subclient %02x [%s] reason %08x [%s]\n",
(trap[5] & 0x00000100) ? "read" : "write", (trap[5] & 0x00000100) ? "read" : "write",
trap[5] & 0xff, trap[4] & 0xffff, trap[3] & 0xffff, chan, trap[5] & 0xff, trap[4] & 0xffff, trap[3] & 0xffff, chan,
nvkm_client_name(engctx)); nvkm_client_name(engctx), st0, en ? en->name : "",
st2, cl ? cl->name : "", st3, sc ? sc->name : "",
st1, re ? re->name : "");
nvkm_engctx_put(engctx); nvkm_engctx_put(engctx);
if (en)
pr_cont("%s/", en->name);
else
pr_cont("%02x/", st0);
cl = nvkm_enum_find(vm_client, st2);
if (cl)
pr_cont("%s/", cl->name);
else
pr_cont("%02x/", st2);
if (cl && cl->data) cl = nvkm_enum_find(cl->data, st3);
else if (en && en->data) cl = nvkm_enum_find(en->data, st3);
else cl = NULL;
if (cl)
pr_cont("%s", cl->name);
else
pr_cont("%02x", st3);
pr_cont(" reason: ");
en = nvkm_enum_find(vm_fault, st1);
if (en)
pr_cont("%s\n", en->name);
else
pr_cont("0x%08x\n", st1);
} }
int int
...@@ -259,7 +243,7 @@ nv50_fb_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -259,7 +243,7 @@ nv50_fb_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
if (dma_mapping_error(nv_device_base(device), fb->r100c08)) if (dma_mapping_error(nv_device_base(device), fb->r100c08))
return -EFAULT; return -EFAULT;
} else { } else {
nv_warn(fb, "failed 0x100c08 page alloc\n"); nvkm_warn(&fb->base.subdev, "failed 100c08 page alloc\n");
} }
nv_subdev(fb)->intr = nv50_fb_intr; nv_subdev(fb)->intr = nv50_fb_intr;
......
...@@ -126,8 +126,10 @@ gf100_ram_train(struct gf100_ramfuc *fuc, u32 magic) ...@@ -126,8 +126,10 @@ gf100_ram_train(struct gf100_ramfuc *fuc, u32 magic)
static int static int
gf100_ram_calc(struct nvkm_fb *fb, u32 freq) gf100_ram_calc(struct nvkm_fb *fb, u32 freq)
{ {
struct nvkm_clk *clk = nvkm_clk(fb); struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_bios *bios = nvkm_bios(fb); struct nvkm_device *device = subdev->device;
struct nvkm_clk *clk = device->clk;
struct nvkm_bios *bios = device->bios;
struct gf100_ram *ram = (void *)fb->ram; struct gf100_ram *ram = (void *)fb->ram;
struct gf100_ramfuc *fuc = &ram->fuc; struct gf100_ramfuc *fuc = &ram->fuc;
struct nvbios_ramcfg cfg; struct nvbios_ramcfg cfg;
...@@ -145,20 +147,20 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -145,20 +147,20 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq)
rammap.data = nvbios_rammapEm(bios, freq / 1000, &ver, &rammap.size, rammap.data = nvbios_rammapEm(bios, freq / 1000, &ver, &rammap.size,
&cnt, &ramcfg.size, &cfg); &cnt, &ramcfg.size, &cfg);
if (!rammap.data || ver != 0x10 || rammap.size < 0x0e) { if (!rammap.data || ver != 0x10 || rammap.size < 0x0e) {
nv_error(fb, "invalid/missing rammap entry\n"); nvkm_error(subdev, "invalid/missing rammap entry\n");
return -EINVAL; return -EINVAL;
} }
/* locate specific data set for the attached memory */ /* locate specific data set for the attached memory */
strap = nvbios_ramcfg_index(nv_subdev(fb)); strap = nvbios_ramcfg_index(nv_subdev(fb));
if (strap >= cnt) { if (strap >= cnt) {
nv_error(fb, "invalid ramcfg strap\n"); nvkm_error(subdev, "invalid ramcfg strap\n");
return -EINVAL; return -EINVAL;
} }
ramcfg.data = rammap.data + rammap.size + (strap * ramcfg.size); ramcfg.data = rammap.data + rammap.size + (strap * ramcfg.size);
if (!ramcfg.data || ver != 0x10 || ramcfg.size < 0x0e) { if (!ramcfg.data || ver != 0x10 || ramcfg.size < 0x0e) {
nv_error(fb, "invalid/missing ramcfg entry\n"); nvkm_error(subdev, "invalid/missing ramcfg entry\n");
return -EINVAL; return -EINVAL;
} }
...@@ -168,7 +170,7 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -168,7 +170,7 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq)
timing.data = nvbios_timingEe(bios, strap, &ver, &timing.size, timing.data = nvbios_timingEe(bios, strap, &ver, &timing.size,
&cnt, &len); &cnt, &len);
if (!timing.data || ver != 0x10 || timing.size < 0x19) { if (!timing.data || ver != 0x10 || timing.size < 0x19) {
nv_error(fb, "invalid/missing timing entry\n"); nvkm_error(subdev, "invalid/missing timing entry\n");
return -EINVAL; return -EINVAL;
} }
} else { } else {
...@@ -213,7 +215,7 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -213,7 +215,7 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq)
ret = gt215_pll_calc(nv_subdev(fb), &ram->refpll, ret = gt215_pll_calc(nv_subdev(fb), &ram->refpll,
ram->mempll.refclk, &N1, NULL, &M1, &P); ram->mempll.refclk, &N1, NULL, &M1, &P);
if (ret <= 0) { if (ret <= 0) {
nv_error(fb, "unable to calc refpll\n"); nvkm_error(subdev, "unable to calc refpll\n");
return ret ? ret : -ERANGE; return ret ? ret : -ERANGE;
} }
...@@ -228,7 +230,7 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -228,7 +230,7 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq)
ret = gt215_pll_calc(nv_subdev(fb), &ram->mempll, freq, ret = gt215_pll_calc(nv_subdev(fb), &ram->mempll, freq,
&N1, NULL, &M1, &P); &N1, NULL, &M1, &P);
if (ret <= 0) { if (ret <= 0) {
nv_error(fb, "unable to calc refpll\n"); nvkm_error(subdev, "unable to calc refpll\n");
return ret ? ret : -ERANGE; return ret ? ret : -ERANGE;
} }
...@@ -508,7 +510,8 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -508,7 +510,8 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine,
void **pobject) void **pobject)
{ {
struct nvkm_fb *fb = nvkm_fb(parent); struct nvkm_fb *fb = nvkm_fb(parent);
struct nvkm_device *device = fb->subdev.device; struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
struct nvkm_bios *bios = device->bios; struct nvkm_bios *bios = device->bios;
struct nvkm_ram *ram; struct nvkm_ram *ram;
const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */ const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
...@@ -525,8 +528,8 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -525,8 +528,8 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine,
if (ret) if (ret)
return ret; return ret;
nv_debug(fb, "0x100800: 0x%08x\n", nvkm_rd32(device, 0x100800)); nvkm_debug(subdev, "100800: %08x\n", nvkm_rd32(device, 0x100800));
nv_debug(fb, "parts 0x%08x mask 0x%08x\n", parts, pmask); nvkm_debug(subdev, "parts %08x mask %08x\n", parts, pmask);
ram->type = nvkm_fb_bios_memtype(bios); ram->type = nvkm_fb_bios_memtype(bios);
ram->ranks = (nvkm_rd32(device, 0x10f200) & 0x00000004) ? 2 : 1; ram->ranks = (nvkm_rd32(device, 0x10f200) & 0x00000004) ? 2 : 1;
...@@ -541,7 +544,7 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -541,7 +544,7 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine,
uniform = false; uniform = false;
} }
nv_debug(fb, "%d: mem_amount 0x%08x\n", part, size); nvkm_debug(subdev, "%d: size %08x\n", part, size);
ram->size += (u64)size << 20; ram->size += (u64)size << 20;
} }
} }
...@@ -628,7 +631,9 @@ gf100_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -628,7 +631,9 @@ gf100_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size, struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nvkm_bios *bios = nvkm_bios(parent); struct nvkm_fb *fb = nvkm_fb(parent);
struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_bios *bios = subdev->device->bios;
struct gf100_ram *ram; struct gf100_ram *ram;
int ret; int ret;
...@@ -639,13 +644,13 @@ gf100_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -639,13 +644,13 @@ gf100_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
ret = nvbios_pll_parse(bios, 0x0c, &ram->refpll); ret = nvbios_pll_parse(bios, 0x0c, &ram->refpll);
if (ret) { if (ret) {
nv_error(ram, "mclk refpll data not found\n"); nvkm_error(subdev, "mclk refpll data not found\n");
return ret; return ret;
} }
ret = nvbios_pll_parse(bios, 0x04, &ram->mempll); ret = nvbios_pll_parse(bios, 0x04, &ram->mempll);
if (ret) { if (ret) {
nv_error(ram, "mclk pll data not found\n"); nvkm_error(subdev, "mclk pll data not found\n");
return ret; return ret;
} }
...@@ -656,7 +661,7 @@ gf100_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -656,7 +661,7 @@ gf100_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
ram->base.tidy = gf100_ram_tidy; ram->base.tidy = gf100_ram_tidy;
break; break;
default: default:
nv_warn(ram, "reclocking of this ram type unsupported\n"); nvkm_warn(subdev, "reclocking of this ram type unsupported\n");
return 0; return 0;
} }
......
...@@ -941,7 +941,7 @@ gk104_ram_calc_data(struct nvkm_fb *fb, u32 khz, struct nvkm_ram_data *data) ...@@ -941,7 +941,7 @@ gk104_ram_calc_data(struct nvkm_fb *fb, u32 khz, struct nvkm_ram_data *data)
} }
} }
nv_error(ram, "ramcfg data for %dMHz not found\n", mhz); nvkm_error(&fb->subdev, "ramcfg data for %dMHz not found\n", mhz);
return -EINVAL; return -EINVAL;
} }
...@@ -950,6 +950,7 @@ gk104_ram_calc_xits(struct nvkm_fb *fb, struct nvkm_ram_data *next) ...@@ -950,6 +950,7 @@ gk104_ram_calc_xits(struct nvkm_fb *fb, struct nvkm_ram_data *next)
{ {
struct gk104_ram *ram = (void *)fb->ram; struct gk104_ram *ram = (void *)fb->ram;
struct gk104_ramfuc *fuc = &ram->fuc; struct gk104_ramfuc *fuc = &ram->fuc;
struct nvkm_subdev *subdev = &fb->subdev;
int refclk, i; int refclk, i;
int ret; int ret;
...@@ -977,7 +978,7 @@ gk104_ram_calc_xits(struct nvkm_fb *fb, struct nvkm_ram_data *next) ...@@ -977,7 +978,7 @@ gk104_ram_calc_xits(struct nvkm_fb *fb, struct nvkm_ram_data *next)
&ram->fN1, &ram->M1, &ram->P1); &ram->fN1, &ram->M1, &ram->P1);
fuc->mempll.refclk = ret; fuc->mempll.refclk = ret;
if (ret <= 0) { if (ret <= 0) {
nv_error(fb, "unable to calc refpll\n"); nvkm_error(subdev, "unable to calc refpll\n");
return -EINVAL; return -EINVAL;
} }
...@@ -993,7 +994,7 @@ gk104_ram_calc_xits(struct nvkm_fb *fb, struct nvkm_ram_data *next) ...@@ -993,7 +994,7 @@ gk104_ram_calc_xits(struct nvkm_fb *fb, struct nvkm_ram_data *next)
ret = gt215_pll_calc(nv_subdev(fb), &fuc->mempll, next->freq, ret = gt215_pll_calc(nv_subdev(fb), &fuc->mempll, next->freq,
&ram->N2, NULL, &ram->M2, &ram->P2); &ram->N2, NULL, &ram->M2, &ram->P2);
if (ret <= 0) { if (ret <= 0) {
nv_error(fb, "unable to calc mempll\n"); nvkm_error(subdev, "unable to calc mempll\n");
return -EINVAL; return -EINVAL;
} }
} }
...@@ -1247,11 +1248,12 @@ gk104_ram_train_type(struct nvkm_fb *fb, int i, u8 ramcfg, ...@@ -1247,11 +1248,12 @@ gk104_ram_train_type(struct nvkm_fb *fb, int i, u8 ramcfg,
static int static int
gk104_ram_train_init_0(struct nvkm_fb *fb, struct gk104_ram_train *train) gk104_ram_train_init_0(struct nvkm_fb *fb, struct gk104_ram_train *train)
{ {
struct nvkm_device *device = fb->subdev.device; struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
int i, j; int i, j;
if ((train->mask & 0x03d3) != 0x03d3) { if ((train->mask & 0x03d3) != 0x03d3) {
nv_warn(fb, "missing link training data\n"); nvkm_warn(subdev, "missing link training data\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1449,7 +1451,8 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -1449,7 +1451,8 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nvkm_fb *fb = nvkm_fb(parent); struct nvkm_fb *fb = nvkm_fb(parent);
struct nvkm_device *device = fb->subdev.device; struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
struct nvkm_bios *bios = device->bios; struct nvkm_bios *bios = device->bios;
struct nvkm_gpio *gpio = device->gpio; struct nvkm_gpio *gpio = device->gpio;
struct dcb_gpio_func func; struct dcb_gpio_func func;
...@@ -1473,7 +1476,7 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -1473,7 +1476,7 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
ram->base.tidy = gk104_ram_tidy; ram->base.tidy = gk104_ram_tidy;
break; break;
default: default:
nv_warn(fb, "reclocking of this RAM type is unsupported\n"); nvkm_warn(subdev, "reclocking of this RAM type is unsupported\n");
break; break;
} }
...@@ -1510,7 +1513,7 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -1510,7 +1513,7 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
for (i = 0; !ret; i++) { for (i = 0; !ret; i++) {
ret = gk104_ram_ctor_data(ram, ramcfg, i); ret = gk104_ram_ctor_data(ram, ramcfg, i);
if (ret && ret != -ENOENT) { if (ret && ret != -ENOENT) {
nv_error(fb, "failed to parse ramcfg data\n"); nvkm_error(subdev, "failed to parse ramcfg data\n");
return ret; return ret;
} }
} }
...@@ -1518,13 +1521,13 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -1518,13 +1521,13 @@ gk104_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
/* parse bios data for both pll's */ /* parse bios data for both pll's */
ret = nvbios_pll_parse(bios, 0x0c, &ram->fuc.refpll); ret = nvbios_pll_parse(bios, 0x0c, &ram->fuc.refpll);
if (ret) { if (ret) {
nv_error(fb, "mclk refpll data not found\n"); nvkm_error(subdev, "mclk refpll data not found\n");
return ret; return ret;
} }
ret = nvbios_pll_parse(bios, 0x04, &ram->fuc.mempll); ret = nvbios_pll_parse(bios, 0x04, &ram->fuc.mempll);
if (ret) { if (ret) {
nv_error(fb, "mclk pll data not found\n"); nvkm_error(subdev, "mclk pll data not found\n");
return ret; return ret;
} }
......
...@@ -155,12 +155,13 @@ gt215_link_train_calc(u32 *vals, struct gt215_ltrain *train) ...@@ -155,12 +155,13 @@ gt215_link_train_calc(u32 *vals, struct gt215_ltrain *train)
int int
gt215_link_train(struct nvkm_fb *fb) gt215_link_train(struct nvkm_fb *fb)
{ {
struct nvkm_bios *bios = nvkm_bios(fb);
struct gt215_ram *ram = (void *)fb->ram; struct gt215_ram *ram = (void *)fb->ram;
struct nvkm_clk *clk = nvkm_clk(fb);
struct gt215_ltrain *train = &ram->ltrain; struct gt215_ltrain *train = &ram->ltrain;
struct nvkm_device *device = nv_device(fb);
struct gt215_ramfuc *fuc = &ram->fuc; struct gt215_ramfuc *fuc = &ram->fuc;
struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
struct nvkm_bios *bios = device->bios;
struct nvkm_clk *clk = device->clk;
u32 *result, r1700; u32 *result, r1700;
int ret, i; int ret, i;
struct nvbios_M0205T M0205T = { 0 }; struct nvbios_M0205T M0205T = { 0 };
...@@ -247,10 +248,10 @@ gt215_link_train(struct nvkm_fb *fb) ...@@ -247,10 +248,10 @@ gt215_link_train(struct nvkm_fb *fb)
ram_train_result(fb, result, 64); ram_train_result(fb, result, 64);
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)
nv_debug(fb, "Train: %08x", result[i]); nvkm_debug(subdev, "Train: %08x", result[i]);
gt215_link_train_calc(result, train); gt215_link_train_calc(result, train);
nv_debug(fb, "Train: %08x %08x %08x", train->r_100720, nvkm_debug(subdev, "Train: %08x %08x %08x", train->r_100720,
train->r_1111e0, train->r_111400); train->r_1111e0, train->r_111400);
kfree(result); kfree(result);
...@@ -352,9 +353,10 @@ gt215_link_train_fini(struct nvkm_fb *fb) ...@@ -352,9 +353,10 @@ gt215_link_train_fini(struct nvkm_fb *fb)
static int static int
gt215_ram_timing_calc(struct nvkm_fb *fb, u32 *timing) gt215_ram_timing_calc(struct nvkm_fb *fb, u32 *timing)
{ {
struct nvkm_device *device = fb->subdev.device;
struct gt215_ram *ram = (void *)fb->ram; struct gt215_ram *ram = (void *)fb->ram;
struct nvbios_ramcfg *cfg = &ram->base.target.bios; struct nvbios_ramcfg *cfg = &ram->base.target.bios;
struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
int tUNK_base, tUNK_40_0, prevCL; int tUNK_base, tUNK_40_0, prevCL;
u32 cur2, cur3, cur7, cur8; u32 cur2, cur3, cur7, cur8;
...@@ -416,11 +418,11 @@ gt215_ram_timing_calc(struct nvkm_fb *fb, u32 *timing) ...@@ -416,11 +418,11 @@ gt215_ram_timing_calc(struct nvkm_fb *fb, u32 *timing)
break; break;
} }
nv_debug(fb, "Entry: 220: %08x %08x %08x %08x\n", nvkm_debug(subdev, "Entry: 220: %08x %08x %08x %08x\n",
timing[0], timing[1], timing[2], timing[3]); timing[0], timing[1], timing[2], timing[3]);
nv_debug(fb, " 230: %08x %08x %08x %08x\n", nvkm_debug(subdev, " 230: %08x %08x %08x %08x\n",
timing[4], timing[5], timing[6], timing[7]); timing[4], timing[5], timing[6], timing[7]);
nv_debug(fb, " 240: %08x\n", timing[8]); nvkm_debug(subdev, " 240: %08x\n", timing[8]);
return 0; return 0;
} }
#undef T #undef T
...@@ -493,10 +495,12 @@ gt215_ram_fbvref(struct gt215_ramfuc *fuc, u32 val) ...@@ -493,10 +495,12 @@ gt215_ram_fbvref(struct gt215_ramfuc *fuc, u32 val)
static int static int
gt215_ram_calc(struct nvkm_fb *fb, u32 freq) gt215_ram_calc(struct nvkm_fb *fb, u32 freq)
{ {
struct nvkm_bios *bios = nvkm_bios(fb);
struct gt215_ram *ram = (void *)fb->ram; struct gt215_ram *ram = (void *)fb->ram;
struct gt215_ramfuc *fuc = &ram->fuc; struct gt215_ramfuc *fuc = &ram->fuc;
struct gt215_ltrain *train = &ram->ltrain; struct gt215_ltrain *train = &ram->ltrain;
struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
struct nvkm_bios *bios = device->bios;
struct gt215_clk_info mclk; struct gt215_clk_info mclk;
struct nvkm_ram_data *next; struct nvkm_ram_data *next;
u8 ver, hdr, cnt, len, strap; u8 ver, hdr, cnt, len, strap;
...@@ -518,21 +522,21 @@ gt215_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -518,21 +522,21 @@ gt215_ram_calc(struct nvkm_fb *fb, u32 freq)
data = nvbios_rammapEm(bios, freq / 1000, &ver, &hdr, &cnt, &len, data = nvbios_rammapEm(bios, freq / 1000, &ver, &hdr, &cnt, &len,
&next->bios); &next->bios);
if (!data || ver != 0x10 || hdr < 0x05) { if (!data || ver != 0x10 || hdr < 0x05) {
nv_error(fb, "invalid/missing rammap entry\n"); nvkm_error(subdev, "invalid/missing rammap entry\n");
return -EINVAL; return -EINVAL;
} }
/* locate specific data set for the attached memory */ /* locate specific data set for the attached memory */
strap = nvbios_ramcfg_index(nv_subdev(fb)); strap = nvbios_ramcfg_index(nv_subdev(fb));
if (strap >= cnt) { if (strap >= cnt) {
nv_error(fb, "invalid ramcfg strap\n"); nvkm_error(subdev, "invalid ramcfg strap\n");
return -EINVAL; return -EINVAL;
} }
data = nvbios_rammapSp(bios, data, ver, hdr, cnt, len, strap, data = nvbios_rammapSp(bios, data, ver, hdr, cnt, len, strap,
&ver, &hdr, &next->bios); &ver, &hdr, &next->bios);
if (!data || ver != 0x10 || hdr < 0x09) { if (!data || ver != 0x10 || hdr < 0x09) {
nv_error(fb, "invalid/missing ramcfg entry\n"); nvkm_error(subdev, "invalid/missing ramcfg entry\n");
return -EINVAL; return -EINVAL;
} }
...@@ -542,14 +546,14 @@ gt215_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -542,14 +546,14 @@ gt215_ram_calc(struct nvkm_fb *fb, u32 freq)
&ver, &hdr, &cnt, &len, &ver, &hdr, &cnt, &len,
&next->bios); &next->bios);
if (!data || ver != 0x10 || hdr < 0x17) { if (!data || ver != 0x10 || hdr < 0x17) {
nv_error(fb, "invalid/missing timing entry\n"); nvkm_error(subdev, "invalid/missing timing entry\n");
return -EINVAL; return -EINVAL;
} }
} }
ret = gt215_pll_info(nvkm_clk(fb), 0x12, 0x4000, freq, &mclk); ret = gt215_pll_info(nvkm_clk(fb), 0x12, 0x4000, freq, &mclk);
if (ret < 0) { if (ret < 0) {
nv_error(fb, "failed mclk calculation\n"); nvkm_error(subdev, "failed mclk calculation\n");
return ret; return ret;
} }
...@@ -922,7 +926,8 @@ gt215_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -922,7 +926,8 @@ gt215_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nvkm_fb *fb = nvkm_fb(parent); struct nvkm_fb *fb = nvkm_fb(parent);
struct nvkm_gpio *gpio = nvkm_gpio(fb); struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_gpio *gpio = subdev->device->gpio;
struct dcb_gpio_func func; struct dcb_gpio_func func;
struct gt215_ram *ram; struct gt215_ram *ram;
int ret, i; int ret, i;
...@@ -942,7 +947,7 @@ gt215_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -942,7 +947,7 @@ gt215_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
ram->base.tidy = gt215_ram_tidy; ram->base.tidy = gt215_ram_tidy;
break; break;
default: default:
nv_warn(ram, "reclocking of this ram type unsupported\n"); nvkm_warn(subdev, "reclocking of this ram type unsupported\n");
return 0; return 0;
} }
......
...@@ -36,7 +36,7 @@ nv1a_ram_create(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -36,7 +36,7 @@ nv1a_ram_create(struct nvkm_object *parent, struct nvkm_object *engine,
bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 1)); bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 1));
if (!bridge) { if (!bridge) {
nv_fatal(fb, "no bridge device\n"); nvkm_error(&fb->subdev, "no bridge device\n");
return -ENODEV; return -ENODEV;
} }
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
int int
nv40_ram_calc(struct nvkm_fb *fb, u32 freq) nv40_ram_calc(struct nvkm_fb *fb, u32 freq)
{ {
struct nvkm_bios *bios = nvkm_bios(fb); struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_bios *bios = subdev->device->bios;
struct nv40_ram *ram = (void *)fb->ram; struct nv40_ram *ram = (void *)fb->ram;
struct nvbios_pll pll; struct nvbios_pll pll;
int N1, M1, N2, M2; int N1, M1, N2, M2;
...@@ -41,7 +42,7 @@ nv40_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -41,7 +42,7 @@ nv40_ram_calc(struct nvkm_fb *fb, u32 freq)
ret = nvbios_pll_parse(bios, 0x04, &pll); ret = nvbios_pll_parse(bios, 0x04, &pll);
if (ret) { if (ret) {
nv_error(fb, "mclk pll data not found\n"); nvkm_error(subdev, "mclk pll data not found\n");
return ret; return ret;
} }
......
...@@ -68,9 +68,10 @@ struct nv50_ram { ...@@ -68,9 +68,10 @@ struct nv50_ram {
static int static int
nv50_ram_timing_calc(struct nvkm_fb *fb, u32 *timing) nv50_ram_timing_calc(struct nvkm_fb *fb, u32 *timing)
{ {
struct nvkm_device *device = fb->subdev.device;
struct nv50_ram *ram = (void *)fb->ram; struct nv50_ram *ram = (void *)fb->ram;
struct nvbios_ramcfg *cfg = &ram->base.target.bios; struct nvbios_ramcfg *cfg = &ram->base.target.bios;
struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
u32 cur2, cur4, cur7, cur8; u32 cur2, cur4, cur7, cur8;
u8 unkt3b; u8 unkt3b;
...@@ -134,11 +135,11 @@ nv50_ram_timing_calc(struct nvkm_fb *fb, u32 *timing) ...@@ -134,11 +135,11 @@ nv50_ram_timing_calc(struct nvkm_fb *fb, u32 *timing)
timing[8] |= (T(CL) - 2); timing[8] |= (T(CL) - 2);
} }
nv_debug(fb, " 220: %08x %08x %08x %08x\n", nvkm_debug(subdev, " 220: %08x %08x %08x %08x\n",
timing[0], timing[1], timing[2], timing[3]); timing[0], timing[1], timing[2], timing[3]);
nv_debug(fb, " 230: %08x %08x %08x %08x\n", nvkm_debug(subdev, " 230: %08x %08x %08x %08x\n",
timing[4], timing[5], timing[6], timing[7]); timing[4], timing[5], timing[6], timing[7]);
nv_debug(fb, " 240: %08x\n", timing[8]); nvkm_debug(subdev, " 240: %08x\n", timing[8]);
return 0; return 0;
} }
#undef T #undef T
...@@ -154,9 +155,10 @@ nvkm_sddr2_dll_reset(struct nv50_ramseq *hwsq) ...@@ -154,9 +155,10 @@ nvkm_sddr2_dll_reset(struct nv50_ramseq *hwsq)
static int static int
nv50_ram_calc(struct nvkm_fb *fb, u32 freq) nv50_ram_calc(struct nvkm_fb *fb, u32 freq)
{ {
struct nvkm_bios *bios = nvkm_bios(fb);
struct nv50_ram *ram = (void *)fb->ram; struct nv50_ram *ram = (void *)fb->ram;
struct nv50_ramseq *hwsq = &ram->hwsq; struct nv50_ramseq *hwsq = &ram->hwsq;
struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_bios *bios = subdev->device->bios;
struct nvbios_perfE perfE; struct nvbios_perfE perfE;
struct nvbios_pll mpll; struct nvbios_pll mpll;
struct nvkm_ram_data *next; struct nvkm_ram_data *next;
...@@ -178,7 +180,7 @@ nv50_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -178,7 +180,7 @@ nv50_ram_calc(struct nvkm_fb *fb, u32 freq)
&size, &perfE); &size, &perfE);
if (!data || (ver < 0x25 || ver >= 0x40) || if (!data || (ver < 0x25 || ver >= 0x40) ||
(size < 2)) { (size < 2)) {
nv_error(fb, "invalid/missing perftab entry\n"); nvkm_error(subdev, "invalid/missing perftab entry\n");
return -EINVAL; return -EINVAL;
} }
} while (perfE.memory < freq); } while (perfE.memory < freq);
...@@ -188,14 +190,14 @@ nv50_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -188,14 +190,14 @@ nv50_ram_calc(struct nvkm_fb *fb, u32 freq)
/* locate specific data set for the attached memory */ /* locate specific data set for the attached memory */
strap = nvbios_ramcfg_index(nv_subdev(fb)); strap = nvbios_ramcfg_index(nv_subdev(fb));
if (strap >= cnt) { if (strap >= cnt) {
nv_error(fb, "invalid ramcfg strap\n"); nvkm_error(subdev, "invalid ramcfg strap\n");
return -EINVAL; return -EINVAL;
} }
data = nvbios_rammapSp_from_perf(bios, data + hdr, size, strap, data = nvbios_rammapSp_from_perf(bios, data + hdr, size, strap,
&next->bios); &next->bios);
if (!data) { if (!data) {
nv_error(fb, "invalid/missing rammap entry "); nvkm_error(subdev, "invalid/missing rammap entry ");
return -EINVAL; return -EINVAL;
} }
...@@ -204,7 +206,7 @@ nv50_ram_calc(struct nvkm_fb *fb, u32 freq) ...@@ -204,7 +206,7 @@ nv50_ram_calc(struct nvkm_fb *fb, u32 freq)
data = nvbios_timingEp(bios, next->bios.ramcfg_timing, data = nvbios_timingEp(bios, next->bios.ramcfg_timing,
&ver, &hdr, &cnt, &len, &next->bios); &ver, &hdr, &cnt, &len, &next->bios);
if (!data || ver != 0x10 || hdr < 0x12) { if (!data || ver != 0x10 || hdr < 0x12) {
nv_error(fb, "invalid/missing timing entry " nvkm_error(subdev, "invalid/missing timing entry "
"%02x %04x %02x %02x\n", "%02x %04x %02x %02x\n",
strap, data, ver, hdr); strap, data, ver, hdr);
return -EINVAL; return -EINVAL;
...@@ -494,7 +496,8 @@ nv50_ram_get(struct nvkm_fb *fb, u64 size, u32 align, u32 ncmin, ...@@ -494,7 +496,8 @@ nv50_ram_get(struct nvkm_fb *fb, u64 size, u32 align, u32 ncmin,
static u32 static u32
nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram) nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram)
{ {
struct nvkm_device *device = fb->subdev.device; struct nvkm_subdev *subdev = &fb->subdev;
struct nvkm_device *device = subdev->device;
int colbits, rowbitsa, rowbitsb, banks; int colbits, rowbitsa, rowbitsb, banks;
u64 rowsize, predicted; u64 rowsize, predicted;
u32 r0, r4, rt, rblock_size; u32 r0, r4, rt, rblock_size;
...@@ -502,7 +505,7 @@ nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram) ...@@ -502,7 +505,7 @@ nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram)
r0 = nvkm_rd32(device, 0x100200); r0 = nvkm_rd32(device, 0x100200);
r4 = nvkm_rd32(device, 0x100204); r4 = nvkm_rd32(device, 0x100204);
rt = nvkm_rd32(device, 0x100250); rt = nvkm_rd32(device, 0x100250);
nv_debug(fb, "memcfg 0x%08x 0x%08x 0x%08x 0x%08x\n", nvkm_debug(subdev, "memcfg %08x %08x %08x %08x\n",
r0, r4, rt, nvkm_rd32(device, 0x001540)); r0, r4, rt, nvkm_rd32(device, 0x001540));
colbits = (r4 & 0x0000f000) >> 12; colbits = (r4 & 0x0000f000) >> 12;
...@@ -516,7 +519,7 @@ nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram) ...@@ -516,7 +519,7 @@ nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram)
predicted += rowsize << rowbitsb; predicted += rowsize << rowbitsb;
if (predicted != ram->size) { if (predicted != ram->size) {
nv_warn(fb, "memory controller reports %d MiB VRAM\n", nvkm_warn(subdev, "memory controller reports %d MiB VRAM\n",
(u32)(ram->size >> 20)); (u32)(ram->size >> 20));
} }
...@@ -524,7 +527,7 @@ nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram) ...@@ -524,7 +527,7 @@ nv50_fb_vram_rblock(struct nvkm_fb *fb, struct nvkm_ram *ram)
if (rt & 1) if (rt & 1)
rblock_size *= 3; rblock_size *= 3;
nv_debug(fb, "rblock %d bytes\n", rblock_size); nvkm_debug(subdev, "rblock %d bytes\n", rblock_size);
return rblock_size; return rblock_size;
} }
...@@ -584,6 +587,8 @@ nv50_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -584,6 +587,8 @@ nv50_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 datasize, struct nvkm_oclass *oclass, void *data, u32 datasize,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
struct nvkm_fb *fb = nvkm_fb(parent);
struct nvkm_subdev *subdev = &fb->subdev;
struct nv50_ram *ram; struct nv50_ram *ram;
int ret, i; int ret, i;
...@@ -600,7 +605,7 @@ nv50_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -600,7 +605,7 @@ nv50_ram_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
break; break;
case NV_MEM_TYPE_DDR2: case NV_MEM_TYPE_DDR2:
default: default:
nv_warn(ram, "reclocking of this ram type unsupported\n"); nvkm_warn(subdev, "reclocking of this ram type unsupported\n");
return 0; return 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