File tree Expand file tree Collapse file tree 5 files changed +22
-33
lines changed Expand file tree Collapse file tree 5 files changed +22
-33
lines changed Original file line number Diff line number Diff line change @@ -109,4 +109,20 @@ extern unsigned long vm_map_base;
109
109
*/
110
110
#define PHYSADDR (a ) ((_ACAST64_(a)) & TO_PHYS_MASK)
111
111
112
+ /*
113
+ * On LoongArch, I/O ports mappring is following:
114
+ *
115
+ * | .... |
116
+ * |-----------------------|
117
+ * | pci io ports(16K~32M) |
118
+ * |-----------------------|
119
+ * | isa io ports(0 ~16K) |
120
+ * PCI_IOBASE ->|-----------------------|
121
+ * | .... |
122
+ */
123
+ #define PCI_IOBASE ((void __iomem *)(vm_map_base + (2 * PAGE_SIZE)))
124
+ #define PCI_IOSIZE SZ_32M
125
+ #define ISA_IOSIZE SZ_16K
126
+ #define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
127
+
112
128
#endif /* _ASM_ADDRSPACE_H */
Original file line number Diff line number Diff line change 7
7
8
8
#define ARCH_HAS_IOREMAP_WC
9
9
10
- #include <linux/compiler.h>
11
10
#include <linux/kernel.h>
12
11
#include <linux/types.h>
13
12
14
13
#include <asm/addrspace.h>
15
- #include <asm/bug.h>
16
- #include <asm/byteorder.h>
17
14
#include <asm/cpu.h>
18
15
#include <asm/page.h>
19
16
#include <asm/pgtable-bits.h>
20
17
#include <asm/string.h>
21
18
22
- /*
23
- * On LoongArch, I/O ports mappring is following:
24
- *
25
- * | .... |
26
- * |-----------------------|
27
- * | pci io ports(64K~32M) |
28
- * |-----------------------|
29
- * | isa io ports(0 ~16K) |
30
- * PCI_IOBASE ->|-----------------------|
31
- * | .... |
32
- */
33
- #define PCI_IOBASE ((void __iomem *)(vm_map_base + (2 * PAGE_SIZE)))
34
- #define PCI_IOSIZE SZ_32M
35
- #define ISA_IOSIZE SZ_16K
36
- #define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
37
-
38
19
/*
39
20
* Change "struct page" to physical address.
40
21
*/
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ static inline int pfn_valid(unsigned long pfn)
95
95
96
96
#endif
97
97
98
- #define virt_to_pfn (kaddr ) PFN_DOWN(virt_to_phys((void *)( kaddr) ))
98
+ #define virt_to_pfn (kaddr ) PFN_DOWN(PHYSADDR( kaddr))
99
99
#define virt_to_page (kaddr ) pfn_to_page(virt_to_pfn(kaddr))
100
100
101
101
extern int __virt_addr_valid (volatile void * kaddr );
Original file line number Diff line number Diff line change 59
59
#include <linux/mm_types.h>
60
60
#include <linux/mmzone.h>
61
61
#include <asm/fixmap.h>
62
- #include <asm/io.h>
63
62
64
63
struct mm_struct ;
65
64
struct vm_area_struct ;
@@ -145,7 +144,7 @@ static inline void set_p4d(p4d_t *p4d, p4d_t p4dval)
145
144
* p4d = p4dval ;
146
145
}
147
146
148
- #define p4d_phys (p4d ) virt_to_phys((void *) p4d_val(p4d))
147
+ #define p4d_phys (p4d ) PHYSADDR( p4d_val(p4d))
149
148
#define p4d_page (p4d ) (pfn_to_page(p4d_phys(p4d) >> PAGE_SHIFT))
150
149
151
150
#endif
@@ -188,7 +187,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
188
187
189
188
#define set_pud (pudptr , pudval ) do { *(pudptr) = (pudval); } while (0)
190
189
191
- #define pud_phys (pud ) virt_to_phys((void *) pud_val(pud))
190
+ #define pud_phys (pud ) PHYSADDR( pud_val(pud))
192
191
#define pud_page (pud ) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
193
192
194
193
#endif
@@ -221,7 +220,7 @@ static inline void pmd_clear(pmd_t *pmdp)
221
220
222
221
#define set_pmd (pmdptr , pmdval ) do { *(pmdptr) = (pmdval); } while (0)
223
222
224
- #define pmd_phys (pmd ) virt_to_phys((void *) pmd_val(pmd))
223
+ #define pmd_phys (pmd ) PHYSADDR( pmd_val(pmd))
225
224
226
225
#ifndef CONFIG_TRANSPARENT_HUGEPAGE
227
226
#define pmd_page (pmd ) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
Original file line number Diff line number Diff line change 2
2
/*
3
3
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4
4
*/
5
- #include <linux/compiler.h>
6
- #include <linux/elf-randomize.h>
7
- #include <linux/errno.h>
5
+ #include <linux/export.h>
8
6
#include <linux/mm.h>
9
7
#include <linux/mman.h>
10
- #include <linux/export.h>
11
- #include <linux/personality.h>
12
- #include <linux/random.h>
13
- #include <linux/sched/signal.h>
14
- #include <linux/sched/mm.h>
15
8
16
9
unsigned long shm_align_mask = PAGE_SIZE - 1 ; /* Sane caches */
17
10
EXPORT_SYMBOL (shm_align_mask );
@@ -120,6 +113,6 @@ int __virt_addr_valid(volatile void *kaddr)
120
113
if ((vaddr < PAGE_OFFSET ) || (vaddr >= vm_map_base ))
121
114
return 0 ;
122
115
123
- return pfn_valid (PFN_DOWN (virt_to_phys (kaddr )));
116
+ return pfn_valid (PFN_DOWN (PHYSADDR (kaddr )));
124
117
}
125
118
EXPORT_SYMBOL_GPL (__virt_addr_valid );
You can’t perform that action at this time.
0 commit comments