aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc64/kernel/pci.c75
-rw-r--r--arch/sparc64/kernel/pci_psycho.c1
-rw-r--r--arch/sparc64/kernel/pci_sabre.c1
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c1
-rw-r--r--include/asm-sparc64/pbm.h3
5 files changed, 12 insertions, 69 deletions
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 6b94d97e56ad..a7809a00324c 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -857,43 +857,12 @@ static int __pci_mmap_make_offset_bus(struct pci_dev *pdev, struct vm_area_struc
857 unsigned long space_size, user_offset, user_size; 857 unsigned long space_size, user_offset, user_size;
858 858
859 p = pbm->parent; 859 p = pbm->parent;
860 if (p->pbms_same_domain) { 860 if (mmap_state == pci_mmap_io) {
861 unsigned long lowest, highest; 861 space_size = (pbm->io_space.end -
862 862 pbm->io_space.start) + 1;
863 lowest = ~0UL; highest = 0UL;
864 if (mmap_state == pci_mmap_io) {
865 if (p->pbm_A.io_space.flags) {
866 lowest = p->pbm_A.io_space.start;
867 highest = p->pbm_A.io_space.end + 1;
868 }
869 if (p->pbm_B.io_space.flags) {
870 if (lowest > p->pbm_B.io_space.start)
871 lowest = p->pbm_B.io_space.start;
872 if (highest < p->pbm_B.io_space.end + 1)
873 highest = p->pbm_B.io_space.end + 1;
874 }
875 space_size = highest - lowest;
876 } else {
877 if (p->pbm_A.mem_space.flags) {
878 lowest = p->pbm_A.mem_space.start;
879 highest = p->pbm_A.mem_space.end + 1;
880 }
881 if (p->pbm_B.mem_space.flags) {
882 if (lowest > p->pbm_B.mem_space.start)
883 lowest = p->pbm_B.mem_space.start;
884 if (highest < p->pbm_B.mem_space.end + 1)
885 highest = p->pbm_B.mem_space.end + 1;
886 }
887 space_size = highest - lowest;
888 }
889 } else { 863 } else {
890 if (mmap_state == pci_mmap_io) { 864 space_size = (pbm->mem_space.end -
891 space_size = (pbm->io_space.end - 865 pbm->mem_space.start) + 1;
892 pbm->io_space.start) + 1;
893 } else {
894 space_size = (pbm->mem_space.end -
895 pbm->mem_space.start) + 1;
896 }
897 } 866 }
898 867
899 /* Make sure the request is in range. */ 868 /* Make sure the request is in range. */
@@ -904,31 +873,12 @@ static int __pci_mmap_make_offset_bus(struct pci_dev *pdev, struct vm_area_struc
904 (user_offset + user_size) > space_size) 873 (user_offset + user_size) > space_size)
905 return -EINVAL; 874 return -EINVAL;
906 875
907 if (p->pbms_same_domain) { 876 if (mmap_state == pci_mmap_io) {
908 unsigned long lowest = ~0UL; 877 vma->vm_pgoff = (pbm->io_space.start +
909 878 user_offset) >> PAGE_SHIFT;
910 if (mmap_state == pci_mmap_io) {
911 if (p->pbm_A.io_space.flags)
912 lowest = p->pbm_A.io_space.start;
913 if (p->pbm_B.io_space.flags &&
914 lowest > p->pbm_B.io_space.start)
915 lowest = p->pbm_B.io_space.start;
916 } else {
917 if (p->pbm_A.mem_space.flags)
918 lowest = p->pbm_A.mem_space.start;
919 if (p->pbm_B.mem_space.flags &&
920 lowest > p->pbm_B.mem_space.start)
921 lowest = p->pbm_B.mem_space.start;
922 }
923 vma->vm_pgoff = (lowest + user_offset) >> PAGE_SHIFT;
924 } else { 879 } else {
925 if (mmap_state == pci_mmap_io) { 880 vma->vm_pgoff = (pbm->mem_space.start +
926 vma->vm_pgoff = (pbm->io_space.start + 881 user_offset) >> PAGE_SHIFT;
927 user_offset) >> PAGE_SHIFT;
928 } else {
929 vma->vm_pgoff = (pbm->mem_space.start +
930 user_offset) >> PAGE_SHIFT;
931 }
932 } 882 }
933 883
934 return 0; 884 return 0;
@@ -1062,9 +1012,8 @@ int pci_domain_nr(struct pci_bus *pbus)
1062 struct pci_controller_info *p = pbm->parent; 1012 struct pci_controller_info *p = pbm->parent;
1063 1013
1064 ret = p->index; 1014 ret = p->index;
1065 if (p->pbms_same_domain == 0) 1015 ret = ((ret << 1) +
1066 ret = ((ret << 1) + 1016 ((pbm == &pbm->parent->pbm_B) ? 1 : 0));
1067 ((pbm == &pbm->parent->pbm_B) ? 1 : 0));
1068 } 1017 }
1069 1018
1070 return ret; 1019 return ret;
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 64bd3579f1ca..0ab2aa0261ce 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -1163,7 +1163,6 @@ void psycho_init(struct device_node *dp, char *model_name)
1163 p->pbm_A.portid = upa_portid; 1163 p->pbm_A.portid = upa_portid;
1164 p->pbm_B.portid = upa_portid; 1164 p->pbm_B.portid = upa_portid;
1165 p->index = pci_num_controllers++; 1165 p->index = pci_num_controllers++;
1166 p->pbms_same_domain = 0;
1167 p->scan_bus = psycho_scan_bus; 1166 p->scan_bus = psycho_scan_bus;
1168 p->pci_ops = &psycho_ops; 1167 p->pci_ops = &psycho_ops;
1169 1168
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index f3ec7bdacdc0..cef81c88548a 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -1052,7 +1052,6 @@ void sabre_init(struct device_node *dp, char *model_name)
1052 1052
1053 p->pbm_A.portid = upa_portid; 1053 p->pbm_A.portid = upa_portid;
1054 p->index = pci_num_controllers++; 1054 p->index = pci_num_controllers++;
1055 p->pbms_same_domain = 1;
1056 p->scan_bus = sabre_scan_bus; 1055 p->scan_bus = sabre_scan_bus;
1057 p->pci_ops = &sabre_ops; 1056 p->pci_ops = &sabre_ops;
1058 1057
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index f9cd9f620d4e..b63ef26abf02 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -1330,7 +1330,6 @@ void sun4v_pci_init(struct device_node *dp, char *model_name)
1330 pci_controller_root = p; 1330 pci_controller_root = p;
1331 1331
1332 p->index = pci_num_controllers++; 1332 p->index = pci_num_controllers++;
1333 p->pbms_same_domain = 0;
1334 1333
1335 p->scan_bus = pci_sun4v_scan_bus; 1334 p->scan_bus = pci_sun4v_scan_bus;
1336#ifdef CONFIG_PCI_MSI 1335#ifdef CONFIG_PCI_MSI
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 07f58adb591a..43b07b9b42c5 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -215,9 +215,6 @@ struct pci_controller_info {
215 */ 215 */
216 int index; 216 int index;
217 217
218 /* Do the PBMs both exist in the same PCI domain? */
219 int pbms_same_domain;
220
221 /* The PCI bus modules controlled by us. */ 218 /* The PCI bus modules controlled by us. */
222 struct pci_pbm_info pbm_A; 219 struct pci_pbm_info pbm_A;
223 struct pci_pbm_info pbm_B; 220 struct pci_pbm_info pbm_B;