Commit f5e088d6 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/disp/nv50-: fetch mask of available piors during oneinit

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 9fe4e177
...@@ -35,7 +35,7 @@ g84_disp = { ...@@ -35,7 +35,7 @@ g84_disp = {
.head = { .cnt = nv50_head_cnt, .new = nv50_head_new }, .head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new }, .dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
.sor = { .cnt = nv50_sor_cnt, .new = g84_sor_new }, .sor = { .cnt = nv50_sor_cnt, .new = g84_sor_new },
.pior = { .nr = 3, .new = nv50_pior_new }, .pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
}; };
int int
......
...@@ -35,7 +35,7 @@ g94_disp = { ...@@ -35,7 +35,7 @@ g94_disp = {
.head = { .cnt = nv50_head_cnt, .new = nv50_head_new }, .head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new }, .dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
.sor = { .cnt = g94_sor_cnt, .new = g94_sor_new }, .sor = { .cnt = g94_sor_cnt, .new = g94_sor_new },
.pior = { .nr = 3, .new = nv50_pior_new }, .pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
}; };
int int
......
...@@ -35,7 +35,7 @@ gt200_disp = { ...@@ -35,7 +35,7 @@ gt200_disp = {
.head = { .cnt = nv50_head_cnt, .new = nv50_head_new }, .head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new }, .dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
.sor = { .cnt = nv50_sor_cnt, .new = g84_sor_new }, .sor = { .cnt = nv50_sor_cnt, .new = g84_sor_new },
.pior = { .nr = 3, .new = nv50_pior_new }, .pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
}; };
int int
......
...@@ -35,7 +35,7 @@ gt215_disp = { ...@@ -35,7 +35,7 @@ gt215_disp = {
.head = { .cnt = nv50_head_cnt, .new = nv50_head_new }, .head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new }, .dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
.sor = { .cnt = g94_sor_cnt, .new = gt215_sor_new }, .sor = { .cnt = g94_sor_cnt, .new = gt215_sor_new },
.pior = { .nr = 3, .new = nv50_pior_new }, .pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
}; };
int int
......
...@@ -157,6 +157,7 @@ int nv50_dac_new(struct nvkm_disp *, int); ...@@ -157,6 +157,7 @@ int nv50_dac_new(struct nvkm_disp *, int);
int gf119_dac_cnt(struct nvkm_disp *, unsigned long *); int gf119_dac_cnt(struct nvkm_disp *, unsigned long *);
int gf119_dac_new(struct nvkm_disp *, int); int gf119_dac_new(struct nvkm_disp *, int);
int nv50_pior_cnt(struct nvkm_disp *, unsigned long *);
int nv50_pior_new(struct nvkm_disp *, int); int nv50_pior_new(struct nvkm_disp *, int);
int nv50_sor_cnt(struct nvkm_disp *, unsigned long *); int nv50_sor_cnt(struct nvkm_disp *, unsigned long *);
......
...@@ -33,7 +33,7 @@ mcp77_disp = { ...@@ -33,7 +33,7 @@ mcp77_disp = {
.head = { .cnt = nv50_head_cnt, .new = nv50_head_new }, .head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new }, .dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
.sor = { .cnt = g94_sor_cnt, .new = mcp77_sor_new }, .sor = { .cnt = g94_sor_cnt, .new = mcp77_sor_new },
.pior = { .nr = 3, .new = nv50_pior_new }, .pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
}; };
int int
......
...@@ -33,7 +33,7 @@ mcp89_disp = { ...@@ -33,7 +33,7 @@ mcp89_disp = {
.head = { .cnt = nv50_head_cnt, .new = nv50_head_new }, .head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new }, .dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
.sor = { .cnt = g94_sor_cnt, .new = mcp89_sor_new }, .sor = { .cnt = g94_sor_cnt, .new = mcp89_sor_new },
.pior = { .nr = 3, .new = nv50_pior_new }, .pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
}; };
int int
......
...@@ -87,10 +87,15 @@ nv50_disp_oneinit_(struct nvkm_disp *base) ...@@ -87,10 +87,15 @@ nv50_disp_oneinit_(struct nvkm_disp *base)
} }
} }
for (i = 0; func->pior.new && i < func->pior.nr; i++) { if (func->pior.cnt) {
ret = func->pior.new(&disp->base, i); disp->pior.nr = func->pior.cnt(&disp->base, &disp->pior.mask);
if (ret) nvkm_debug(subdev, " PIOR(s): %d (%02lx)\n",
return ret; disp->pior.nr, disp->pior.mask);
for_each_set_bit(i, &disp->pior.mask, disp->pior.nr) {
ret = func->pior.new(&disp->base, i);
if (ret)
return ret;
}
} }
disp->sor.nr = func->sor.cnt(&disp->base, &disp->sor.mask); disp->sor.nr = func->sor.cnt(&disp->base, &disp->sor.mask);
...@@ -647,7 +652,7 @@ nv50_disp = { ...@@ -647,7 +652,7 @@ nv50_disp = {
.head = { .cnt = nv50_head_cnt, .new = nv50_head_new }, .head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new }, .dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
.sor = { .cnt = nv50_sor_cnt, .new = nv50_sor_new }, .sor = { .cnt = nv50_sor_cnt, .new = nv50_sor_new },
.pior = { .nr = 3, .new = nv50_pior_new }, .pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
}; };
int int
......
...@@ -27,6 +27,8 @@ struct nv50_disp { ...@@ -27,6 +27,8 @@ struct nv50_disp {
} sor; } sor;
struct { struct {
unsigned long mask;
int nr;
u8 type[3]; u8 type[3];
} pior; } pior;
...@@ -55,12 +57,7 @@ struct nv50_disp_func { ...@@ -55,12 +57,7 @@ struct nv50_disp_func {
struct { struct {
int (*cnt)(struct nvkm_disp *, unsigned long *mask); int (*cnt)(struct nvkm_disp *, unsigned long *mask);
int (*new)(struct nvkm_disp *, int id); int (*new)(struct nvkm_disp *, int id);
} head, dac, sor; } head, dac, sor, pior;
struct {
int nr;
int (*new)(struct nvkm_disp *, int id);
} pior;
}; };
void nv50_disp_intr(struct nv50_disp *); void nv50_disp_intr(struct nv50_disp *);
......
...@@ -127,8 +127,13 @@ nv50_pior = { ...@@ -127,8 +127,13 @@ nv50_pior = {
int int
nv50_pior_new(struct nvkm_disp *disp, int id) nv50_pior_new(struct nvkm_disp *disp, int id)
{ {
struct nvkm_device *device = disp->engine.subdev.device;
if (!(nvkm_rd32(device, 0x610184) & (0x10000000 << id)))
return 0;
return nvkm_ior_new_(&nv50_pior, disp, PIOR, id); return nvkm_ior_new_(&nv50_pior, disp, PIOR, id);
} }
int
nv50_pior_cnt(struct nvkm_disp *disp, unsigned long *pmask)
{
struct nvkm_device *device = disp->engine.subdev.device;
*pmask = (nvkm_rd32(device, 0x610184) & 0x70000000) >> 28;
return 3;
}
...@@ -439,7 +439,7 @@ nv50_disp_root_init(struct nv50_disp_root *root) ...@@ -439,7 +439,7 @@ nv50_disp_root_init(struct nv50_disp_root *root)
} }
/* ... PIOR caps */ /* ... PIOR caps */
for (i = 0; i < disp->func->pior.nr; i++) { for (i = 0; i < disp->pior.nr; i++) {
tmp = nvkm_rd32(device, 0x61e000 + (i * 0x800)); tmp = nvkm_rd32(device, 0x61e000 + (i * 0x800));
nvkm_wr32(device, 0x6101f0 + (i * 0x04), tmp); nvkm_wr32(device, 0x6101f0 + (i * 0x04), tmp);
} }
......
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