diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-08-25 23:05:23 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-09-20 02:12:21 -0400 |
commit | a14845121c1e9cfe302d23ca4ffcfc62cf8e1033 (patch) | |
tree | 5db9a55bfff0b8a88d2e03444fb1706ff44eb0e7 /drivers/gpu/drm/nouveau | |
parent | 3dcbb02b3a9ad1722005290e7c9ac47097de517d (diff) |
drm/nvc0/fb: slightly improve PMFB intr handling, move out of nvc0_graph.c
I'm still not certain how to determine the number of SUBPs are present on
a given board.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_fb.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_graph.c | 18 |
2 files changed, 27 insertions, 18 deletions
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c index 08e6b118f021..5bf55038fd92 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fb.c +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
@@ -32,6 +32,30 @@ struct nvc0_fb_priv { | |||
32 | dma_addr_t r100c10; | 32 | dma_addr_t r100c10; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static inline void | ||
36 | nvc0_mfb_subp_isr(struct drm_device *dev, int unit, int subp) | ||
37 | { | ||
38 | u32 subp_base = 0x141000 + (unit * 0x2000) + (subp * 0x400); | ||
39 | u32 stat = nv_rd32(dev, subp_base + 0x020); | ||
40 | |||
41 | if (stat) { | ||
42 | NV_INFO(dev, "PMFB%d_SUBP%d: 0x%08x\n", unit, subp, stat); | ||
43 | nv_wr32(dev, subp_base + 0x020, stat); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | static void | ||
48 | nvc0_mfb_isr(struct drm_device *dev) | ||
49 | { | ||
50 | u32 units = nv_rd32(dev, 0x00017c); | ||
51 | while (units) { | ||
52 | u32 subp, unit = ffs(units) - 1; | ||
53 | for (subp = 0; subp < 2; subp++) | ||
54 | nvc0_mfb_subp_isr(dev, unit, subp); | ||
55 | units &= ~(1 << unit); | ||
56 | } | ||
57 | } | ||
58 | |||
35 | static void | 59 | static void |
36 | nvc0_fb_destroy(struct drm_device *dev) | 60 | nvc0_fb_destroy(struct drm_device *dev) |
37 | { | 61 | { |
@@ -39,6 +63,8 @@ nvc0_fb_destroy(struct drm_device *dev) | |||
39 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | 63 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
40 | struct nvc0_fb_priv *priv = pfb->priv; | 64 | struct nvc0_fb_priv *priv = pfb->priv; |
41 | 65 | ||
66 | nouveau_irq_unregister(dev, 25); | ||
67 | |||
42 | if (priv->r100c10_page) { | 68 | if (priv->r100c10_page) { |
43 | pci_unmap_page(dev->pdev, priv->r100c10, PAGE_SIZE, | 69 | pci_unmap_page(dev->pdev, priv->r100c10, PAGE_SIZE, |
44 | PCI_DMA_BIDIRECTIONAL); | 70 | PCI_DMA_BIDIRECTIONAL); |
@@ -74,6 +100,7 @@ nvc0_fb_create(struct drm_device *dev) | |||
74 | return -EFAULT; | 100 | return -EFAULT; |
75 | } | 101 | } |
76 | 102 | ||
103 | nouveau_irq_register(dev, 25, nvc0_mfb_isr); | ||
77 | return 0; | 104 | return 0; |
78 | } | 105 | } |
79 | 106 | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c index ecf0fb469181..4b8d0b3f7d2b 100644 --- a/drivers/gpu/drm/nouveau/nvc0_graph.c +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
@@ -700,22 +700,6 @@ nvc0_graph_isr(struct drm_device *dev) | |||
700 | nv_wr32(dev, 0x400500, 0x00010001); | 700 | nv_wr32(dev, 0x400500, 0x00010001); |
701 | } | 701 | } |
702 | 702 | ||
703 | static void | ||
704 | nvc0_runk140_isr(struct drm_device *dev) | ||
705 | { | ||
706 | u32 units = nv_rd32(dev, 0x00017c) & 0x1f; | ||
707 | |||
708 | while (units) { | ||
709 | u32 unit = ffs(units) - 1; | ||
710 | u32 reg = 0x140000 + unit * 0x2000; | ||
711 | u32 st0 = nv_mask(dev, reg + 0x1020, 0, 0); | ||
712 | u32 st1 = nv_mask(dev, reg + 0x1420, 0, 0); | ||
713 | |||
714 | NV_DEBUG(dev, "PRUNK140: %d 0x%08x 0x%08x\n", unit, st0, st1); | ||
715 | units &= ~(1 << unit); | ||
716 | } | ||
717 | } | ||
718 | |||
719 | static int | 703 | static int |
720 | nvc0_graph_create_fw(struct drm_device *dev, const char *fwname, | 704 | nvc0_graph_create_fw(struct drm_device *dev, const char *fwname, |
721 | struct nvc0_graph_fuc *fuc) | 705 | struct nvc0_graph_fuc *fuc) |
@@ -764,7 +748,6 @@ nvc0_graph_destroy(struct drm_device *dev, int engine) | |||
764 | } | 748 | } |
765 | 749 | ||
766 | nouveau_irq_unregister(dev, 12); | 750 | nouveau_irq_unregister(dev, 12); |
767 | nouveau_irq_unregister(dev, 25); | ||
768 | 751 | ||
769 | nouveau_gpuobj_ref(NULL, &priv->unk4188b8); | 752 | nouveau_gpuobj_ref(NULL, &priv->unk4188b8); |
770 | nouveau_gpuobj_ref(NULL, &priv->unk4188b4); | 753 | nouveau_gpuobj_ref(NULL, &priv->unk4188b4); |
@@ -803,7 +786,6 @@ nvc0_graph_create(struct drm_device *dev) | |||
803 | 786 | ||
804 | NVOBJ_ENGINE_ADD(dev, GR, &priv->base); | 787 | NVOBJ_ENGINE_ADD(dev, GR, &priv->base); |
805 | nouveau_irq_register(dev, 12, nvc0_graph_isr); | 788 | nouveau_irq_register(dev, 12, nvc0_graph_isr); |
806 | nouveau_irq_register(dev, 25, nvc0_runk140_isr); | ||
807 | 789 | ||
808 | if (nouveau_ctxfw) { | 790 | if (nouveau_ctxfw) { |
809 | NV_INFO(dev, "PGRAPH: using external firmware\n"); | 791 | NV_INFO(dev, "PGRAPH: using external firmware\n"); |