aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/pci_sun4v.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-02-16 01:25:27 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 04:13:10 -0500
commite7a0453ef82c1433a35ab82d874296fff68f3639 (patch)
tree0dd18e3742bb838f7351a20186ea3a820d038231 /arch/sparc64/kernel/pci_sun4v.c
parentdb33f9bc09aaf68db7866374f9219c676787b4a2 (diff)
[SPARC64] PCI: Size TSB correctly on SUN4V.
Forgot to multiply by 8 * 1024, oops. Correct the size constant when the virtual-dma arena is 2GB in size, it should bet 256 not 128. Finally, log some info about the TSB at probe time. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/pci_sun4v.c')
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 13b611db0583..902d07c714fb 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -102,6 +102,7 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
102 first_page = __get_free_pages(GFP_ATOMIC, order); 102 first_page = __get_free_pages(GFP_ATOMIC, order);
103 if (first_page == 0UL) 103 if (first_page == 0UL)
104 return NULL; 104 return NULL;
105
105 memset((char *)first_page, 0, PAGE_SIZE << order); 106 memset((char *)first_page, 0, PAGE_SIZE << order);
106 107
107 pcp = pdev->sysdata; 108 pcp = pdev->sysdata;
@@ -805,11 +806,11 @@ static void pbm_register_toplevel_resources(struct pci_controller_info *p,
805 &pbm->mem_space); 806 &pbm->mem_space);
806} 807}
807 808
808static void probe_existing_entries(struct pci_pbm_info *pbm, 809static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
809 struct pci_iommu *iommu) 810 struct pci_iommu *iommu)
810{ 811{
811 struct pci_iommu_arena *arena = &iommu->arena; 812 struct pci_iommu_arena *arena = &iommu->arena;
812 unsigned long i; 813 unsigned long i, cnt = 0;
813 u32 devhandle; 814 u32 devhandle;
814 815
815 devhandle = pbm->devhandle; 816 devhandle = pbm->devhandle;
@@ -819,9 +820,13 @@ static void probe_existing_entries(struct pci_pbm_info *pbm,
819 ret = pci_sun4v_iommu_getmap(devhandle, 820 ret = pci_sun4v_iommu_getmap(devhandle,
820 HV_PCI_TSBID(0, i), 821 HV_PCI_TSBID(0, i),
821 &io_attrs, &ra); 822 &io_attrs, &ra);
822 if (ret == HV_EOK) 823 if (ret == HV_EOK) {
824 cnt++;
823 __set_bit(i, arena->map); 825 __set_bit(i, arena->map);
826 }
824 } 827 }
828
829 return cnt;
825} 830}
826 831
827static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) 832static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
@@ -853,7 +858,7 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
853 858
854 case 0x80000000: 859 case 0x80000000:
855 dma_mask |= 0x7fffffff; 860 dma_mask |= 0x7fffffff;
856 tsbsize = 128; 861 tsbsize = 256;
857 break; 862 break;
858 863
859 default: 864 default:
@@ -861,6 +866,8 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
861 prom_halt(); 866 prom_halt();
862 }; 867 };
863 868
869 tsbsize *= (8 * 1024);
870
864 num_tsb_entries = tsbsize / sizeof(iopte_t); 871 num_tsb_entries = tsbsize / sizeof(iopte_t);
865 872
866 dma_offset = vdma[0]; 873 dma_offset = vdma[0];
@@ -882,7 +889,10 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
882 memset(iommu->arena.map, 0, sz); 889 memset(iommu->arena.map, 0, sz);
883 iommu->arena.limit = num_tsb_entries; 890 iommu->arena.limit = num_tsb_entries;
884 891
885 probe_existing_entries(pbm, iommu); 892 sz = probe_existing_entries(pbm, iommu);
893
894 printk("%s: TSB entries [%lu], existing mapings [%lu]\n",
895 pbm->name, num_tsb_entries, sz);
886} 896}
887 897
888static void pci_sun4v_get_bus_range(struct pci_pbm_info *pbm) 898static void pci_sun4v_get_bus_range(struct pci_pbm_info *pbm)