diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2006-10-04 14:02:23 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-10-04 14:02:23 -0400 |
commit | 0b2b6e1ddce4696cb7afcbb15a654fe95428a498 (patch) | |
tree | a6dd837de5ce7088ab1009d125e8bcd6cfeaa1e1 | |
parent | 7676bef9c183fd573822cac9992927ef596d584c (diff) |
[S390] Remove open-coded mem_map usage.
Use page_to_phys and pfn_to_page to avoid open-coded mem_map usage.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
-rw-r--r-- | arch/s390/mm/init.c | 10 | ||||
-rw-r--r-- | include/asm-s390/io.h | 5 | ||||
-rw-r--r-- | include/asm-s390/page.h | 1 | ||||
-rw-r--r-- | include/asm-s390/pgalloc.h | 2 | ||||
-rw-r--r-- | include/asm-s390/pgtable.h | 18 |
5 files changed, 17 insertions, 19 deletions
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index c302508ae31e..d99891718709 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -62,19 +62,21 @@ void show_mem(void) | |||
62 | { | 62 | { |
63 | int i, total = 0, reserved = 0; | 63 | int i, total = 0, reserved = 0; |
64 | int shared = 0, cached = 0; | 64 | int shared = 0, cached = 0; |
65 | struct page *page; | ||
65 | 66 | ||
66 | printk("Mem-info:\n"); | 67 | printk("Mem-info:\n"); |
67 | show_free_areas(); | 68 | show_free_areas(); |
68 | printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); | 69 | printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); |
69 | i = max_mapnr; | 70 | i = max_mapnr; |
70 | while (i-- > 0) { | 71 | while (i-- > 0) { |
72 | page = pfn_to_page(i); | ||
71 | total++; | 73 | total++; |
72 | if (PageReserved(mem_map+i)) | 74 | if (PageReserved(page)) |
73 | reserved++; | 75 | reserved++; |
74 | else if (PageSwapCache(mem_map+i)) | 76 | else if (PageSwapCache(page)) |
75 | cached++; | 77 | cached++; |
76 | else if (page_count(mem_map+i)) | 78 | else if (page_count(page)) |
77 | shared += page_count(mem_map+i) - 1; | 79 | shared += page_count(page) - 1; |
78 | } | 80 | } |
79 | printk("%d pages of RAM\n",total); | 81 | printk("%d pages of RAM\n",total); |
80 | printk("%d reserved pages\n",reserved); | 82 | printk("%d reserved pages\n",reserved); |
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h index 63c78b9399c4..efb7de9c1c6b 100644 --- a/include/asm-s390/io.h +++ b/include/asm-s390/io.h | |||
@@ -45,11 +45,6 @@ static inline void * phys_to_virt(unsigned long address) | |||
45 | return __io_virt(address); | 45 | return __io_virt(address); |
46 | } | 46 | } |
47 | 47 | ||
48 | /* | ||
49 | * Change "struct page" to physical address. | ||
50 | */ | ||
51 | #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) | ||
52 | |||
53 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); | 48 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); |
54 | 49 | ||
55 | static inline void * ioremap (unsigned long offset, unsigned long size) | 50 | static inline void * ioremap (unsigned long offset, unsigned long size) |
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index 796c400f2b79..363ea761d5ee 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h | |||
@@ -137,6 +137,7 @@ page_get_storage_key(unsigned long addr) | |||
137 | #define __pa(x) (unsigned long)(x) | 137 | #define __pa(x) (unsigned long)(x) |
138 | #define __va(x) (void *)(unsigned long)(x) | 138 | #define __va(x) (void *)(unsigned long)(x) |
139 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 139 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
140 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | ||
140 | 141 | ||
141 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 142 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
142 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 143 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h index 803bc7064418..28619de5ecae 100644 --- a/include/asm-s390/pgalloc.h +++ b/include/asm-s390/pgalloc.h | |||
@@ -116,7 +116,7 @@ pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) | |||
116 | static inline void | 116 | static inline void |
117 | pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) | 117 | pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) |
118 | { | 118 | { |
119 | pmd_populate_kernel(mm, pmd, (pte_t *)((page-mem_map) << PAGE_SHIFT)); | 119 | pmd_populate_kernel(mm, pmd, (pte_t *)page_to_phys(page)); |
120 | } | 120 | } |
121 | 121 | ||
122 | /* | 122 | /* |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index ecdff13b2505..519f0a5ff181 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -599,7 +599,7 @@ ptep_establish(struct vm_area_struct *vma, | |||
599 | */ | 599 | */ |
600 | static inline int page_test_and_clear_dirty(struct page *page) | 600 | static inline int page_test_and_clear_dirty(struct page *page) |
601 | { | 601 | { |
602 | unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT); | 602 | unsigned long physpage = page_to_phys(page); |
603 | int skey = page_get_storage_key(physpage); | 603 | int skey = page_get_storage_key(physpage); |
604 | 604 | ||
605 | if (skey & _PAGE_CHANGED) | 605 | if (skey & _PAGE_CHANGED) |
@@ -612,13 +612,13 @@ static inline int page_test_and_clear_dirty(struct page *page) | |||
612 | */ | 612 | */ |
613 | static inline int page_test_and_clear_young(struct page *page) | 613 | static inline int page_test_and_clear_young(struct page *page) |
614 | { | 614 | { |
615 | unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT); | 615 | unsigned long physpage = page_to_phys(page); |
616 | int ccode; | 616 | int ccode; |
617 | 617 | ||
618 | asm volatile ( | 618 | asm volatile( |
619 | "rrbe 0,%1\n" | 619 | " rrbe 0,%1\n" |
620 | "ipm %0\n" | 620 | " ipm %0\n" |
621 | "srl %0,28\n" | 621 | " srl %0,28\n" |
622 | : "=d" (ccode) : "a" (physpage) : "cc" ); | 622 | : "=d" (ccode) : "a" (physpage) : "cc" ); |
623 | return ccode & 2; | 623 | return ccode & 2; |
624 | } | 624 | } |
@@ -636,7 +636,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) | |||
636 | 636 | ||
637 | static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) | 637 | static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) |
638 | { | 638 | { |
639 | unsigned long physpage = __pa((page - mem_map) << PAGE_SHIFT); | 639 | unsigned long physpage = page_to_phys(page); |
640 | 640 | ||
641 | return mk_pte_phys(physpage, pgprot); | 641 | return mk_pte_phys(physpage, pgprot); |
642 | } | 642 | } |
@@ -664,11 +664,11 @@ static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot) | |||
664 | 664 | ||
665 | #define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK) | 665 | #define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK) |
666 | 666 | ||
667 | #define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) | 667 | #define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT) |
668 | 668 | ||
669 | #define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK) | 669 | #define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK) |
670 | 670 | ||
671 | #define pgd_page(pgd) (mem_map+(pgd_val(pgd) >> PAGE_SHIFT)) | 671 | #define pgd_page(pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT) |
672 | 672 | ||
673 | /* to find an entry in a page-table-directory */ | 673 | /* to find an entry in a page-table-directory */ |
674 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | 674 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |