diff options
| author | Pierre Moreau <pierre.morrow@free.fr> | 2014-12-15 18:47:40 -0500 |
|---|---|---|
| committer | Ben Skeggs <bskeggs@redhat.com> | 2014-12-21 17:37:38 -0500 |
| commit | e9d91238990d89421315a556a3ba4dbbae35ffbf (patch) | |
| tree | f1879fda4d90a722cee497fc174bdf99dec7c399 | |
| parent | 5f3ac299c0b76addcf3706cb6cc9d04dad26dab0 (diff) | |
drm/nouveau/fb/ram/mcp77: enable NISO poller
Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
| -rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c index f56ee5527006..033a8e999497 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | struct nvaa_ram_priv { | 27 | struct nvaa_ram_priv { |
| 28 | struct nouveau_ram base; | 28 | struct nouveau_ram base; |
| 29 | u64 poller_base; | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | static int | 32 | static int |
| @@ -33,8 +34,8 @@ nvaa_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
| 33 | struct nouveau_oclass *oclass, void *data, u32 datasize, | 34 | struct nouveau_oclass *oclass, void *data, u32 datasize, |
| 34 | struct nouveau_object **pobject) | 35 | struct nouveau_object **pobject) |
| 35 | { | 36 | { |
| 36 | const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */ | 37 | u32 rsvd_head = ( 256 * 1024); /* vga memory */ |
| 37 | const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */ | 38 | u32 rsvd_tail = (1024 * 1024); /* vbios etc */ |
| 38 | struct nouveau_fb *pfb = nouveau_fb(parent); | 39 | struct nouveau_fb *pfb = nouveau_fb(parent); |
| 39 | struct nvaa_ram_priv *priv; | 40 | struct nvaa_ram_priv *priv; |
| 40 | int ret; | 41 | int ret; |
| @@ -48,8 +49,12 @@ nvaa_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
| 48 | priv->base.stolen = (u64)nv_rd32(pfb, 0x100e10) << 12; | 49 | priv->base.stolen = (u64)nv_rd32(pfb, 0x100e10) << 12; |
| 49 | priv->base.size = (u64)nv_rd32(pfb, 0x100e14) << 12; | 50 | priv->base.size = (u64)nv_rd32(pfb, 0x100e14) << 12; |
| 50 | 51 | ||
| 51 | ret = nouveau_mm_init(&pfb->vram, rsvd_head, (priv->base.size >> 12) - | 52 | rsvd_tail += 0x1000; |
| 52 | (rsvd_head + rsvd_tail), 1); | 53 | priv->poller_base = priv->base.size - rsvd_tail; |
| 54 | |||
| 55 | ret = nouveau_mm_init(&pfb->vram, rsvd_head >> 12, | ||
| 56 | (priv->base.size - (rsvd_head + rsvd_tail)) >> 12, | ||
| 57 | 1); | ||
| 53 | if (ret) | 58 | if (ret) |
| 54 | return ret; | 59 | return ret; |
| 55 | 60 | ||
| @@ -58,12 +63,41 @@ nvaa_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
| 58 | return 0; | 63 | return 0; |
| 59 | } | 64 | } |
| 60 | 65 | ||
| 66 | static int | ||
| 67 | nvaa_ram_init(struct nouveau_object *object) | ||
| 68 | { | ||
| 69 | struct nouveau_fb *pfb = nouveau_fb(object); | ||
| 70 | struct nvaa_ram_priv *priv = (void *)object; | ||
| 71 | int ret; | ||
| 72 | u64 dniso, hostnb, flush; | ||
| 73 | |||
| 74 | ret = nouveau_ram_init(&priv->base); | ||
| 75 | if (ret) | ||
| 76 | return ret; | ||
| 77 | |||
| 78 | dniso = ((priv->base.size - (priv->poller_base + 0x00)) >> 5) - 1; | ||
| 79 | hostnb = ((priv->base.size - (priv->poller_base + 0x20)) >> 5) - 1; | ||
| 80 | flush = ((priv->base.size - (priv->poller_base + 0x40)) >> 5) - 1; | ||
| 81 | |||
| 82 | /* Enable NISO poller for various clients and set their associated | ||
| 83 | * read address, only for MCP77/78 and MCP79/7A. (fd#25701) | ||
| 84 | */ | ||
| 85 | nv_wr32(pfb, 0x100c18, dniso); | ||
| 86 | nv_mask(pfb, 0x100c14, 0x00000000, 0x00000001); | ||
| 87 | nv_wr32(pfb, 0x100c1c, hostnb); | ||
| 88 | nv_mask(pfb, 0x100c14, 0x00000000, 0x00000002); | ||
| 89 | nv_wr32(pfb, 0x100c24, flush); | ||
| 90 | nv_mask(pfb, 0x100c14, 0x00000000, 0x00010000); | ||
| 91 | |||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 61 | struct nouveau_oclass | 95 | struct nouveau_oclass |
| 62 | nvaa_ram_oclass = { | 96 | nvaa_ram_oclass = { |
| 63 | .ofuncs = &(struct nouveau_ofuncs) { | 97 | .ofuncs = &(struct nouveau_ofuncs) { |
| 64 | .ctor = nvaa_ram_ctor, | 98 | .ctor = nvaa_ram_ctor, |
| 65 | .dtor = _nouveau_ram_dtor, | 99 | .dtor = _nouveau_ram_dtor, |
| 66 | .init = _nouveau_ram_init, | 100 | .init = nvaa_ram_init, |
| 67 | .fini = _nouveau_ram_fini, | 101 | .fini = _nouveau_ram_fini, |
| 68 | }, | 102 | }, |
| 69 | }; | 103 | }; |
