aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/gpio.h52
-rw-r--r--include/asm-generic/io.h33
-rw-r--r--include/asm-generic/pgtable.h136
-rw-r--r--include/asm-generic/signal.h2
-rw-r--r--include/asm-generic/syscalls.h20
-rw-r--r--include/asm-generic/trace_clock.h16
6 files changed, 229 insertions, 30 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index a9432fc6b8ba..20ca7663975f 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -5,6 +5,7 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/of.h> 7#include <linux/of.h>
8#include <linux/pinctrl/pinctrl.h>
8 9
9#ifdef CONFIG_GPIOLIB 10#ifdef CONFIG_GPIOLIB
10 11
@@ -56,6 +57,8 @@ struct device_node;
56 * enabling module power and clock; may sleep 57 * enabling module power and clock; may sleep
57 * @free: optional hook for chip-specific deactivation, such as 58 * @free: optional hook for chip-specific deactivation, such as
58 * disabling module power and clock; may sleep 59 * disabling module power and clock; may sleep
60 * @get_direction: returns direction for signal "offset", 0=out, 1=in,
61 * (same as GPIOF_DIR_XXX), or negative error
59 * @direction_input: configures signal "offset" as input, or returns error 62 * @direction_input: configures signal "offset" as input, or returns error
60 * @get: returns value for signal "offset"; for output signals this 63 * @get: returns value for signal "offset"; for output signals this
61 * returns either the value actually sensed, or zero 64 * returns either the value actually sensed, or zero
@@ -100,7 +103,8 @@ struct gpio_chip {
100 unsigned offset); 103 unsigned offset);
101 void (*free)(struct gpio_chip *chip, 104 void (*free)(struct gpio_chip *chip,
102 unsigned offset); 105 unsigned offset);
103 106 int (*get_direction)(struct gpio_chip *chip,
107 unsigned offset);
104 int (*direction_input)(struct gpio_chip *chip, 108 int (*direction_input)(struct gpio_chip *chip,
105 unsigned offset); 109 unsigned offset);
106 int (*get)(struct gpio_chip *chip, 110 int (*get)(struct gpio_chip *chip,
@@ -134,6 +138,15 @@ struct gpio_chip {
134 int (*of_xlate)(struct gpio_chip *gc, 138 int (*of_xlate)(struct gpio_chip *gc,
135 const struct of_phandle_args *gpiospec, u32 *flags); 139 const struct of_phandle_args *gpiospec, u32 *flags);
136#endif 140#endif
141#ifdef CONFIG_PINCTRL
142 /*
143 * If CONFIG_PINCTRL is enabled, then gpio controllers can optionally
144 * describe the actual pin range which they serve in an SoC. This
145 * information would be used by pinctrl subsystem to configure
146 * corresponding pins for gpio usage.
147 */
148 struct list_head pin_ranges;
149#endif
137}; 150};
138 151
139extern const char *gpiochip_is_requested(struct gpio_chip *chip, 152extern const char *gpiochip_is_requested(struct gpio_chip *chip,
@@ -257,4 +270,41 @@ static inline void gpio_unexport(unsigned gpio)
257} 270}
258#endif /* CONFIG_GPIO_SYSFS */ 271#endif /* CONFIG_GPIO_SYSFS */
259 272
273#ifdef CONFIG_PINCTRL
274
275/**
276 * struct gpio_pin_range - pin range controlled by a gpio chip
277 * @head: list for maintaining set of pin ranges, used internally
278 * @pctldev: pinctrl device which handles corresponding pins
279 * @range: actual range of pins controlled by a gpio controller
280 */
281
282struct gpio_pin_range {
283 struct list_head node;
284 struct pinctrl_dev *pctldev;
285 struct pinctrl_gpio_range range;
286};
287
288int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
289 unsigned int gpio_offset, unsigned int pin_offset,
290 unsigned int npins);
291void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
292
293#else
294
295static inline int
296gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
297 unsigned int gpio_offset, unsigned int pin_offset,
298 unsigned int npins)
299{
300 return 0;
301}
302
303static inline void
304gpiochip_remove_pin_ranges(struct gpio_chip *chip)
305{
306}
307
308#endif /* CONFIG_PINCTRL */
309
260#endif /* _ASM_GENERIC_GPIO_H */ 310#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 063ce7640910..33bbbae4ddc6 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -82,19 +82,25 @@ static inline void __raw_writel(u32 b, volatile void __iomem *addr)
82#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr) 82#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr)
83 83
84#ifdef CONFIG_64BIT 84#ifdef CONFIG_64BIT
85#ifndef __raw_readq
85static inline u64 __raw_readq(const volatile void __iomem *addr) 86static inline u64 __raw_readq(const volatile void __iomem *addr)
86{ 87{
87 return *(const volatile u64 __force *) addr; 88 return *(const volatile u64 __force *) addr;
88} 89}
90#endif
91
89#define readq(addr) __le64_to_cpu(__raw_readq(addr)) 92#define readq(addr) __le64_to_cpu(__raw_readq(addr))
90 93
94#ifndef __raw_writeq
91static inline void __raw_writeq(u64 b, volatile void __iomem *addr) 95static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
92{ 96{
93 *(volatile u64 __force *) addr = b; 97 *(volatile u64 __force *) addr = b;
94} 98}
95#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
96#endif 99#endif
97 100
101#define writeq(b, addr) __raw_writeq(__cpu_to_le64(b), addr)
102#endif /* CONFIG_64BIT */
103
98#ifndef PCI_IOBASE 104#ifndef PCI_IOBASE
99#define PCI_IOBASE ((void __iomem *) 0) 105#define PCI_IOBASE ((void __iomem *) 0)
100#endif 106#endif
@@ -147,7 +153,7 @@ static inline void insb(unsigned long addr, void *buffer, int count)
147 if (count) { 153 if (count) {
148 u8 *buf = buffer; 154 u8 *buf = buffer;
149 do { 155 do {
150 u8 x = inb(addr); 156 u8 x = __raw_readb(addr + PCI_IOBASE);
151 *buf++ = x; 157 *buf++ = x;
152 } while (--count); 158 } while (--count);
153 } 159 }
@@ -160,7 +166,7 @@ static inline void insw(unsigned long addr, void *buffer, int count)
160 if (count) { 166 if (count) {
161 u16 *buf = buffer; 167 u16 *buf = buffer;
162 do { 168 do {
163 u16 x = inw(addr); 169 u16 x = __raw_readw(addr + PCI_IOBASE);
164 *buf++ = x; 170 *buf++ = x;
165 } while (--count); 171 } while (--count);
166 } 172 }
@@ -173,7 +179,7 @@ static inline void insl(unsigned long addr, void *buffer, int count)
173 if (count) { 179 if (count) {
174 u32 *buf = buffer; 180 u32 *buf = buffer;
175 do { 181 do {
176 u32 x = inl(addr); 182 u32 x = __raw_readl(addr + PCI_IOBASE);
177 *buf++ = x; 183 *buf++ = x;
178 } while (--count); 184 } while (--count);
179 } 185 }
@@ -186,7 +192,7 @@ static inline void outsb(unsigned long addr, const void *buffer, int count)
186 if (count) { 192 if (count) {
187 const u8 *buf = buffer; 193 const u8 *buf = buffer;
188 do { 194 do {
189 outb(*buf++, addr); 195 __raw_writeb(*buf++, addr + PCI_IOBASE);
190 } while (--count); 196 } while (--count);
191 } 197 }
192} 198}
@@ -198,7 +204,7 @@ static inline void outsw(unsigned long addr, const void *buffer, int count)
198 if (count) { 204 if (count) {
199 const u16 *buf = buffer; 205 const u16 *buf = buffer;
200 do { 206 do {
201 outw(*buf++, addr); 207 __raw_writew(*buf++, addr + PCI_IOBASE);
202 } while (--count); 208 } while (--count);
203 } 209 }
204} 210}
@@ -210,7 +216,7 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
210 if (count) { 216 if (count) {
211 const u32 *buf = buffer; 217 const u32 *buf = buffer;
212 do { 218 do {
213 outl(*buf++, addr); 219 __raw_writel(*buf++, addr + PCI_IOBASE);
214 } while (--count); 220 } while (--count);
215 } 221 }
216} 222}
@@ -255,15 +261,20 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
255 261
256#ifndef CONFIG_GENERIC_IOMAP 262#ifndef CONFIG_GENERIC_IOMAP
257struct pci_dev; 263struct pci_dev;
264extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
265
266#ifndef pci_iounmap
258static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) 267static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
259{ 268{
260} 269}
270#endif
261#endif /* CONFIG_GENERIC_IOMAP */ 271#endif /* CONFIG_GENERIC_IOMAP */
262 272
263/* 273/*
264 * Change virtual addresses to physical addresses and vv. 274 * Change virtual addresses to physical addresses and vv.
265 * These are pretty trivial 275 * These are pretty trivial
266 */ 276 */
277#ifndef virt_to_phys
267static inline unsigned long virt_to_phys(volatile void *address) 278static inline unsigned long virt_to_phys(volatile void *address)
268{ 279{
269 return __pa((unsigned long)address); 280 return __pa((unsigned long)address);
@@ -273,6 +284,7 @@ static inline void *phys_to_virt(unsigned long address)
273{ 284{
274 return __va(address); 285 return __va(address);
275} 286}
287#endif
276 288
277/* 289/*
278 * Change "struct page" to physical address. 290 * Change "struct page" to physical address.
@@ -332,9 +344,16 @@ static inline void *bus_to_virt(unsigned long address)
332} 344}
333#endif 345#endif
334 346
347#ifndef memset_io
335#define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) 348#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
349#endif
350
351#ifndef memcpy_fromio
336#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c)) 352#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
353#endif
354#ifndef memcpy_toio
337#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c)) 355#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
356#endif
338 357
339#endif /* __KERNEL__ */ 358#endif /* __KERNEL__ */
340 359
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index b36ce40bd1c6..701beab27aab 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -219,6 +219,10 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
219#define move_pte(pte, prot, old_addr, new_addr) (pte) 219#define move_pte(pte, prot, old_addr, new_addr) (pte)
220#endif 220#endif
221 221
222#ifndef pte_accessible
223# define pte_accessible(pte) ((void)(pte),1)
224#endif
225
222#ifndef flush_tlb_fix_spurious_fault 226#ifndef flush_tlb_fix_spurious_fault
223#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) 227#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
224#endif 228#endif
@@ -449,6 +453,32 @@ extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
449 unsigned long size); 453 unsigned long size);
450#endif 454#endif
451 455
456#ifdef __HAVE_COLOR_ZERO_PAGE
457static inline int is_zero_pfn(unsigned long pfn)
458{
459 extern unsigned long zero_pfn;
460 unsigned long offset_from_zero_pfn = pfn - zero_pfn;
461 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
462}
463
464static inline unsigned long my_zero_pfn(unsigned long addr)
465{
466 return page_to_pfn(ZERO_PAGE(addr));
467}
468#else
469static inline int is_zero_pfn(unsigned long pfn)
470{
471 extern unsigned long zero_pfn;
472 return pfn == zero_pfn;
473}
474
475static inline unsigned long my_zero_pfn(unsigned long addr)
476{
477 extern unsigned long zero_pfn;
478 return zero_pfn;
479}
480#endif
481
452#ifdef CONFIG_MMU 482#ifdef CONFIG_MMU
453 483
454#ifndef CONFIG_TRANSPARENT_HUGEPAGE 484#ifndef CONFIG_TRANSPARENT_HUGEPAGE
@@ -554,6 +584,112 @@ static inline int pmd_trans_unstable(pmd_t *pmd)
554#endif 584#endif
555} 585}
556 586
587#ifdef CONFIG_NUMA_BALANCING
588#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
589/*
590 * _PAGE_NUMA works identical to _PAGE_PROTNONE (it's actually the
591 * same bit too). It's set only when _PAGE_PRESET is not set and it's
592 * never set if _PAGE_PRESENT is set.
593 *
594 * pte/pmd_present() returns true if pte/pmd_numa returns true. Page
595 * fault triggers on those regions if pte/pmd_numa returns true
596 * (because _PAGE_PRESENT is not set).
597 */
598#ifndef pte_numa
599static inline int pte_numa(pte_t pte)
600{
601 return (pte_flags(pte) &
602 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
603}
604#endif
605
606#ifndef pmd_numa
607static inline int pmd_numa(pmd_t pmd)
608{
609 return (pmd_flags(pmd) &
610 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
611}
612#endif
613
614/*
615 * pte/pmd_mknuma sets the _PAGE_ACCESSED bitflag automatically
616 * because they're called by the NUMA hinting minor page fault. If we
617 * wouldn't set the _PAGE_ACCESSED bitflag here, the TLB miss handler
618 * would be forced to set it later while filling the TLB after we
619 * return to userland. That would trigger a second write to memory
620 * that we optimize away by setting _PAGE_ACCESSED here.
621 */
622#ifndef pte_mknonnuma
623static inline pte_t pte_mknonnuma(pte_t pte)
624{
625 pte = pte_clear_flags(pte, _PAGE_NUMA);
626 return pte_set_flags(pte, _PAGE_PRESENT|_PAGE_ACCESSED);
627}
628#endif
629
630#ifndef pmd_mknonnuma
631static inline pmd_t pmd_mknonnuma(pmd_t pmd)
632{
633 pmd = pmd_clear_flags(pmd, _PAGE_NUMA);
634 return pmd_set_flags(pmd, _PAGE_PRESENT|_PAGE_ACCESSED);
635}
636#endif
637
638#ifndef pte_mknuma
639static inline pte_t pte_mknuma(pte_t pte)
640{
641 pte = pte_set_flags(pte, _PAGE_NUMA);
642 return pte_clear_flags(pte, _PAGE_PRESENT);
643}
644#endif
645
646#ifndef pmd_mknuma
647static inline pmd_t pmd_mknuma(pmd_t pmd)
648{
649 pmd = pmd_set_flags(pmd, _PAGE_NUMA);
650 return pmd_clear_flags(pmd, _PAGE_PRESENT);
651}
652#endif
653#else
654extern int pte_numa(pte_t pte);
655extern int pmd_numa(pmd_t pmd);
656extern pte_t pte_mknonnuma(pte_t pte);
657extern pmd_t pmd_mknonnuma(pmd_t pmd);
658extern pte_t pte_mknuma(pte_t pte);
659extern pmd_t pmd_mknuma(pmd_t pmd);
660#endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */
661#else
662static inline int pmd_numa(pmd_t pmd)
663{
664 return 0;
665}
666
667static inline int pte_numa(pte_t pte)
668{
669 return 0;
670}
671
672static inline pte_t pte_mknonnuma(pte_t pte)
673{
674 return pte;
675}
676
677static inline pmd_t pmd_mknonnuma(pmd_t pmd)
678{
679 return pmd;
680}
681
682static inline pte_t pte_mknuma(pte_t pte)
683{
684 return pte;
685}
686
687static inline pmd_t pmd_mknuma(pmd_t pmd)
688{
689 return pmd;
690}
691#endif /* CONFIG_NUMA_BALANCING */
692
557#endif /* CONFIG_MMU */ 693#endif /* CONFIG_MMU */
558 694
559#endif /* !__ASSEMBLY__ */ 695#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
index 98caa306122a..d840c90a157a 100644
--- a/include/asm-generic/signal.h
+++ b/include/asm-generic/signal.h
@@ -10,7 +10,5 @@
10#include <asm/sigcontext.h> 10#include <asm/sigcontext.h>
11#undef __HAVE_ARCH_SIG_BITOPS 11#undef __HAVE_ARCH_SIG_BITOPS
12 12
13#define ptrace_signal_deliver(regs, cookie) do { } while (0)
14
15#endif /* __ASSEMBLY__ */ 13#endif /* __ASSEMBLY__ */
16#endif /* _ASM_GENERIC_SIGNAL_H */ 14#endif /* _ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index d89dec864d42..58f466ff00d3 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -8,26 +8,6 @@
8 * Calling conventions for these system calls can differ, so 8 * Calling conventions for these system calls can differ, so
9 * it's possible to override them. 9 * it's possible to override them.
10 */ 10 */
11#ifndef sys_clone
12asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
13 void __user *parent_tid, void __user *child_tid,
14 struct pt_regs *regs);
15#endif
16
17#ifndef sys_fork
18asmlinkage long sys_fork(struct pt_regs *regs);
19#endif
20
21#ifndef sys_vfork
22asmlinkage long sys_vfork(struct pt_regs *regs);
23#endif
24
25#ifndef sys_execve
26asmlinkage long sys_execve(const char __user *filename,
27 const char __user *const __user *argv,
28 const char __user *const __user *envp,
29 struct pt_regs *regs);
30#endif
31 11
32#ifndef sys_mmap2 12#ifndef sys_mmap2
33asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 13asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
diff --git a/include/asm-generic/trace_clock.h b/include/asm-generic/trace_clock.h
new file mode 100644
index 000000000000..6726f1bafb5e
--- /dev/null
+++ b/include/asm-generic/trace_clock.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_GENERIC_TRACE_CLOCK_H
2#define _ASM_GENERIC_TRACE_CLOCK_H
3/*
4 * Arch-specific trace clocks.
5 */
6
7/*
8 * Additional trace clocks added to the trace_clocks
9 * array in kernel/trace/trace.c
10 * None if the architecture has not defined it.
11 */
12#ifndef ARCH_TRACE_CLOCKS
13# define ARCH_TRACE_CLOCKS
14#endif
15
16#endif /* _ASM_GENERIC_TRACE_CLOCK_H */