diff options
Diffstat (limited to 'arch/sparc64/kernel/pci.c')
-rw-r--r-- | arch/sparc64/kernel/pci.c | 75 |
1 files changed, 12 insertions, 63 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; |