int
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;
struct nvbios_M0203E M0203E;
u8 ver, hdr;
case M0203E_TYPE_GDDR3: return NV_MEM_TYPE_GDDR3;
case M0203E_TYPE_GDDR5: return NV_MEM_TYPE_GDDR5;
default:
- nv_warn(bios, "M0203E type %02x\n", M0203E.type);
+ nvkm_warn(subdev, "M0203E type %02x\n", M0203E.type);
return NV_MEM_TYPE_UNKNOWN;
}
}
- nv_warn(bios, "M0203E not matched!\n");
+ nvkm_warn(subdev, "M0203E not matched!\n");
return NV_MEM_TYPE_UNKNOWN;
}
{
struct nvkm_fb_impl *impl = (void *)oclass;
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_SGRAM ] = "SGRAM",
[NV_MEM_TYPE_SDRAM ] = "SDRAM",
ret = nvkm_object_ctor(nv_object(fb), NULL, impl->ram, NULL, 0, &ram);
if (ret) {
- nv_fatal(fb, "error detecting memory configuration!!\n");
+ nvkm_error(&fb->subdev, "vram init failed, %d\n", ret);
return ret;
}
++fb->ram->tags : 0, 1);
if (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]);
- nv_info(fb, "RAM size: %d MiB\n", (int)(fb->ram->size >> 20));
- nv_info(fb, " ZCOMP: %d tags\n", fb->ram->tags);
+ nvkm_info(&fb->subdev, "%d MiB %s\n", (int)(fb->ram->size >> 20),
+ name[fb->ram->type]);
return 0;
}
gf100_fb_intr(struct nvkm_subdev *subdev)
{
struct nvkm_device *device = subdev->device;
- struct gf100_fb *fb = (void *)subdev;
u32 intr = nvkm_rd32(device, 0x000100);
if (intr & 0x08000000)
- nv_debug(fb, "PFFB intr\n");
+ nvkm_debug(subdev, "PFFB intr\n");
if (intr & 0x00002000)
- nv_debug(fb, "PBFB intr\n");
+ nvkm_debug(subdev, "PBFB intr\n");
}
int
static void
nv50_fb_intr(struct nvkm_subdev *subdev)
{
- struct nvkm_device *device = nv_device(subdev);
- struct nvkm_engine *engine;
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;
u32 trap[6], idx, chan;
u8 st0, st1, st2, st3;
en = orig_en;
}
- nv_error(fb, "trapped %s at 0x%02x%04x%04x on channel 0x%08x [%s] ",
- (trap[5] & 0x00000100) ? "read" : "write",
- trap[5] & 0xff, trap[4] & 0xffff, trap[3] & 0xffff, chan,
- nvkm_client_name(engctx));
+ 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] & 0xff, trap[4] & 0xffff, trap[3] & 0xffff, chan,
+ nvkm_client_name(engctx), st0, en ? en->name : "",
+ st2, cl ? cl->name : "", st3, sc ? sc->name : "",
+ st1, re ? re->name : "");
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
if (dma_mapping_error(nv_device_base(device), fb->r100c08))
return -EFAULT;
} 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;
static int
gf100_ram_calc(struct nvkm_fb *fb, u32 freq)
{
- struct nvkm_clk *clk = nvkm_clk(fb);
- struct nvkm_bios *bios = nvkm_bios(fb);
+ struct nvkm_subdev *subdev = &fb->subdev;
+ 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_ramfuc *fuc = &ram->fuc;
struct nvbios_ramcfg cfg;
rammap.data = nvbios_rammapEm(bios, freq / 1000, &ver, &rammap.size,
&cnt, &ramcfg.size, &cfg);
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;
}
/* locate specific data set for the attached memory */
strap = nvbios_ramcfg_index(nv_subdev(fb));
if (strap >= cnt) {
- nv_error(fb, "invalid ramcfg strap\n");
+ nvkm_error(subdev, "invalid ramcfg strap\n");
return -EINVAL;
}
ramcfg.data = rammap.data + rammap.size + (strap * ramcfg.size);
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;
}
timing.data = nvbios_timingEe(bios, strap, &ver, &timing.size,
&cnt, &len);
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;
}
} else {
ret = gt215_pll_calc(nv_subdev(fb), &ram->refpll,
ram->mempll.refclk, &N1, NULL, &M1, &P);
if (ret <= 0) {
- nv_error(fb, "unable to calc refpll\n");
+ nvkm_error(subdev, "unable to calc refpll\n");
return ret ? ret : -ERANGE;
}
ret = gt215_pll_calc(nv_subdev(fb), &ram->mempll, freq,
&N1, NULL, &M1, &P);
if (ret <= 0) {
- nv_error(fb, "unable to calc refpll\n");
+ nvkm_error(subdev, "unable to calc refpll\n");
return ret ? ret : -ERANGE;
}
void **pobject)
{
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_ram *ram;
const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
if (ret)
return ret;
- nv_debug(fb, "0x100800: 0x%08x\n", nvkm_rd32(device, 0x100800));
- nv_debug(fb, "parts 0x%08x mask 0x%08x\n", parts, pmask);
+ nvkm_debug(subdev, "100800: %08x\n", nvkm_rd32(device, 0x100800));
+ nvkm_debug(subdev, "parts %08x mask %08x\n", parts, pmask);
ram->type = nvkm_fb_bios_memtype(bios);
ram->ranks = (nvkm_rd32(device, 0x10f200) & 0x00000004) ? 2 : 1;
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;
}
}
struct nvkm_oclass *oclass, void *data, u32 size,
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;
int ret;
ret = nvbios_pll_parse(bios, 0x0c, &ram->refpll);
if (ret) {
- nv_error(ram, "mclk refpll data not found\n");
+ nvkm_error(subdev, "mclk refpll data not found\n");
return ret;
}
ret = nvbios_pll_parse(bios, 0x04, &ram->mempll);
if (ret) {
- nv_error(ram, "mclk pll data not found\n");
+ nvkm_error(subdev, "mclk pll data not found\n");
return ret;
}
ram->base.tidy = gf100_ram_tidy;
break;
default:
- nv_warn(ram, "reclocking of this ram type unsupported\n");
+ nvkm_warn(subdev, "reclocking of this ram type unsupported\n");
return 0;
}
}
}
- 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;
}
{
struct gk104_ram *ram = (void *)fb->ram;
struct gk104_ramfuc *fuc = &ram->fuc;
+ struct nvkm_subdev *subdev = &fb->subdev;
int refclk, i;
int ret;
&ram->fN1, &ram->M1, &ram->P1);
fuc->mempll.refclk = ret;
if (ret <= 0) {
- nv_error(fb, "unable to calc refpll\n");
+ nvkm_error(subdev, "unable to calc refpll\n");
return -EINVAL;
}
ret = gt215_pll_calc(nv_subdev(fb), &fuc->mempll, next->freq,
&ram->N2, NULL, &ram->M2, &ram->P2);
if (ret <= 0) {
- nv_error(fb, "unable to calc mempll\n");
+ nvkm_error(subdev, "unable to calc mempll\n");
return -EINVAL;
}
}
static int
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;
if ((train->mask & 0x03d3) != 0x03d3) {
- nv_warn(fb, "missing link training data\n");
+ nvkm_warn(subdev, "missing link training data\n");
return -EINVAL;
}
struct nvkm_object **pobject)
{
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_gpio *gpio = device->gpio;
struct dcb_gpio_func func;
ram->base.tidy = gk104_ram_tidy;
break;
default:
- nv_warn(fb, "reclocking of this RAM type is unsupported\n");
+ nvkm_warn(subdev, "reclocking of this RAM type is unsupported\n");
break;
}
for (i = 0; !ret; i++) {
ret = gk104_ram_ctor_data(ram, ramcfg, i);
if (ret && ret != -ENOENT) {
- nv_error(fb, "failed to parse ramcfg data\n");
+ nvkm_error(subdev, "failed to parse ramcfg data\n");
return ret;
}
}
/* parse bios data for both pll's */
ret = nvbios_pll_parse(bios, 0x0c, &ram->fuc.refpll);
if (ret) {
- nv_error(fb, "mclk refpll data not found\n");
+ nvkm_error(subdev, "mclk refpll data not found\n");
return ret;
}
ret = nvbios_pll_parse(bios, 0x04, &ram->fuc.mempll);
if (ret) {
- nv_error(fb, "mclk pll data not found\n");
+ nvkm_error(subdev, "mclk pll data not found\n");
return ret;
}
int
gt215_link_train(struct nvkm_fb *fb)
{
- struct nvkm_bios *bios = nvkm_bios(fb);
struct gt215_ram *ram = (void *)fb->ram;
- struct nvkm_clk *clk = nvkm_clk(fb);
struct gt215_ltrain *train = &ram->ltrain;
- struct nvkm_device *device = nv_device(fb);
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;
int ret, i;
struct nvbios_M0205T M0205T = { 0 };
ram_train_result(fb, result, 64);
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);
- nv_debug(fb, "Train: %08x %08x %08x", train->r_100720,
- train->r_1111e0, train->r_111400);
+ nvkm_debug(subdev, "Train: %08x %08x %08x", train->r_100720,
+ train->r_1111e0, train->r_111400);
kfree(result);
static int
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 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;
u32 cur2, cur3, cur7, cur8;
break;
}
- nv_debug(fb, "Entry: 220: %08x %08x %08x %08x\n",
- timing[0], timing[1], timing[2], timing[3]);
- nv_debug(fb, " 230: %08x %08x %08x %08x\n",
- timing[4], timing[5], timing[6], timing[7]);
- nv_debug(fb, " 240: %08x\n", timing[8]);
+ nvkm_debug(subdev, "Entry: 220: %08x %08x %08x %08x\n",
+ timing[0], timing[1], timing[2], timing[3]);
+ nvkm_debug(subdev, " 230: %08x %08x %08x %08x\n",
+ timing[4], timing[5], timing[6], timing[7]);
+ nvkm_debug(subdev, " 240: %08x\n", timing[8]);
return 0;
}
#undef T
static int
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_ramfuc *fuc = &ram->fuc;
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 nvkm_ram_data *next;
u8 ver, hdr, cnt, len, strap;
data = nvbios_rammapEm(bios, freq / 1000, &ver, &hdr, &cnt, &len,
&next->bios);
if (!data || ver != 0x10 || hdr < 0x05) {
- nv_error(fb, "invalid/missing rammap entry\n");
+ nvkm_error(subdev, "invalid/missing rammap entry\n");
return -EINVAL;
}
/* locate specific data set for the attached memory */
strap = nvbios_ramcfg_index(nv_subdev(fb));
if (strap >= cnt) {
- nv_error(fb, "invalid ramcfg strap\n");
+ nvkm_error(subdev, "invalid ramcfg strap\n");
return -EINVAL;
}
data = nvbios_rammapSp(bios, data, ver, hdr, cnt, len, strap,
&ver, &hdr, &next->bios);
if (!data || ver != 0x10 || hdr < 0x09) {
- nv_error(fb, "invalid/missing ramcfg entry\n");
+ nvkm_error(subdev, "invalid/missing ramcfg entry\n");
return -EINVAL;
}
&ver, &hdr, &cnt, &len,
&next->bios);
if (!data || ver != 0x10 || hdr < 0x17) {
- nv_error(fb, "invalid/missing timing entry\n");
+ nvkm_error(subdev, "invalid/missing timing entry\n");
return -EINVAL;
}
}
ret = gt215_pll_info(nvkm_clk(fb), 0x12, 0x4000, freq, &mclk);
if (ret < 0) {
- nv_error(fb, "failed mclk calculation\n");
+ nvkm_error(subdev, "failed mclk calculation\n");
return ret;
}
struct nvkm_object **pobject)
{
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 gt215_ram *ram;
int ret, i;
ram->base.tidy = gt215_ram_tidy;
break;
default:
- nv_warn(ram, "reclocking of this ram type unsupported\n");
+ nvkm_warn(subdev, "reclocking of this ram type unsupported\n");
return 0;
}
bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 1));
if (!bridge) {
- nv_fatal(fb, "no bridge device\n");
+ nvkm_error(&fb->subdev, "no bridge device\n");
return -ENODEV;
}
int
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 nvbios_pll pll;
int N1, M1, N2, M2;
ret = nvbios_pll_parse(bios, 0x04, &pll);
if (ret) {
- nv_error(fb, "mclk pll data not found\n");
+ nvkm_error(subdev, "mclk pll data not found\n");
return ret;
}
static int
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 nvbios_ramcfg *cfg = &ram->base.target.bios;
+ struct nvkm_subdev *subdev = &fb->subdev;
+ struct nvkm_device *device = subdev->device;
u32 cur2, cur4, cur7, cur8;
u8 unkt3b;
timing[8] |= (T(CL) - 2);
}
- nv_debug(fb, " 220: %08x %08x %08x %08x\n",
- timing[0], timing[1], timing[2], timing[3]);
- nv_debug(fb, " 230: %08x %08x %08x %08x\n",
- timing[4], timing[5], timing[6], timing[7]);
- nv_debug(fb, " 240: %08x\n", timing[8]);
+ nvkm_debug(subdev, " 220: %08x %08x %08x %08x\n",
+ timing[0], timing[1], timing[2], timing[3]);
+ nvkm_debug(subdev, " 230: %08x %08x %08x %08x\n",
+ timing[4], timing[5], timing[6], timing[7]);
+ nvkm_debug(subdev, " 240: %08x\n", timing[8]);
return 0;
}
#undef T
static int
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_ramseq *hwsq = &ram->hwsq;
+ struct nvkm_subdev *subdev = &fb->subdev;
+ struct nvkm_bios *bios = subdev->device->bios;
struct nvbios_perfE perfE;
struct nvbios_pll mpll;
struct nvkm_ram_data *next;
&size, &perfE);
if (!data || (ver < 0x25 || ver >= 0x40) ||
(size < 2)) {
- nv_error(fb, "invalid/missing perftab entry\n");
+ nvkm_error(subdev, "invalid/missing perftab entry\n");
return -EINVAL;
}
} while (perfE.memory < freq);
/* locate specific data set for the attached memory */
strap = nvbios_ramcfg_index(nv_subdev(fb));
if (strap >= cnt) {
- nv_error(fb, "invalid ramcfg strap\n");
+ nvkm_error(subdev, "invalid ramcfg strap\n");
return -EINVAL;
}
data = nvbios_rammapSp_from_perf(bios, data + hdr, size, strap,
&next->bios);
if (!data) {
- nv_error(fb, "invalid/missing rammap entry ");
+ nvkm_error(subdev, "invalid/missing rammap entry ");
return -EINVAL;
}
data = nvbios_timingEp(bios, next->bios.ramcfg_timing,
&ver, &hdr, &cnt, &len, &next->bios);
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",
strap, data, ver, hdr);
return -EINVAL;
static u32
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;
u64 rowsize, predicted;
u32 r0, r4, rt, rblock_size;
r0 = nvkm_rd32(device, 0x100200);
r4 = nvkm_rd32(device, 0x100204);
rt = nvkm_rd32(device, 0x100250);
- nv_debug(fb, "memcfg 0x%08x 0x%08x 0x%08x 0x%08x\n",
- r0, r4, rt, nvkm_rd32(device, 0x001540));
+ nvkm_debug(subdev, "memcfg %08x %08x %08x %08x\n",
+ r0, r4, rt, nvkm_rd32(device, 0x001540));
colbits = (r4 & 0x0000f000) >> 12;
rowbitsa = ((r4 & 0x000f0000) >> 16) + 8;
predicted += rowsize << rowbitsb;
if (predicted != ram->size) {
- nv_warn(fb, "memory controller reports %d MiB VRAM\n",
- (u32)(ram->size >> 20));
+ nvkm_warn(subdev, "memory controller reports %d MiB VRAM\n",
+ (u32)(ram->size >> 20));
}
rblock_size = rowsize;
if (rt & 1)
rblock_size *= 3;
- nv_debug(fb, "rblock %d bytes\n", rblock_size);
+ nvkm_debug(subdev, "rblock %d bytes\n", rblock_size);
return rblock_size;
}
struct nvkm_oclass *oclass, void *data, u32 datasize,
struct nvkm_object **pobject)
{
+ struct nvkm_fb *fb = nvkm_fb(parent);
+ struct nvkm_subdev *subdev = &fb->subdev;
struct nv50_ram *ram;
int ret, i;
break;
case NV_MEM_TYPE_DDR2:
default:
- nv_warn(ram, "reclocking of this ram type unsupported\n");
+ nvkm_warn(subdev, "reclocking of this ram type unsupported\n");
return 0;
}