Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'asm-generic-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull asm-generic updates from Arnd Bergmann:
"These are a number of unrelated cleanups, generally simplifying the
architecture specific header files:

- A series from Al Viro simplifies asm/vga.h, after it turns out that
most of it can be generalized.

- A series from Julian Vetter adds a common version of
memcpy_{to,from}io() and memset_io() and changes most architectures
to use that instead of their own implementation

- A series from Niklas Schnelle concludes his work to make PC style
inb()/outb() optional

- Nicolas Pitre contributes improvements for the generic do_div()
helper

- Christoph Hellwig adds a generic version of page_to_phys() and
phys_to_page(), replacing the slightly different architecture
specific definitions.

- Uwe Kleine-Koenig has a minor cleanup for ioctl definitions"

* tag 'asm-generic-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (24 commits)
empty include/asm-generic/vga.h
sparc: get rid of asm/vga.h
asm/vga.h: don't bother with scr_mem{cpy,move}v() unless we need to
vt_buffer.h: get rid of dead code in default scr_...() instances
tty: serial: export serial_8250_warn_need_ioport
lib/iomem_copy: fix kerneldoc format style
hexagon: simplify asm/io.h for !HAS_IOPORT
loongarch: Use new fallback IO memcpy/memset
csky: Use new fallback IO memcpy/memset
arm64: Use new fallback IO memcpy/memset
New implementation for IO memcpy and IO memset
watchdog: Add HAS_IOPORT dependency for SBC8360 and SBC7240
__arch_xprod64(): make __always_inline when optimizing for performance
ARM: div64: improve __arch_xprod_64()
asm-generic/div64: optimize/simplify __div64_const32()
lib/math/test_div64: add some edge cases relevant to __div64_const32()
asm-generic: add an optional pfn_valid check to page_to_phys
asm-generic: provide generic page_to_phys and phys_to_page implementations
asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n
tty: serial: handle HAS_IOPORT dependencies
...

+486 -929
-1
arch/alpha/include/asm/io.h
··· 88 88 89 89 #define virt_to_phys virt_to_phys 90 90 #define phys_to_virt phys_to_virt 91 - #define page_to_phys(page) page_to_pa(page) 92 91 93 92 /* Maximum PIO space address supported? */ 94 93 #define IO_SPACE_LIMIT 0xffff
-3
arch/arc/include/asm/io.h
··· 42 42 #define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force u16)cpu_to_be16(v), p); }) 43 43 #define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force u32)cpu_to_be32(v), p); }) 44 44 45 - /* Change struct page to physical address */ 46 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 47 - 48 45 #define __raw_readb __raw_readb 49 46 static inline u8 __raw_readb(const volatile void __iomem *addr) 50 47 {
+10 -3
arch/arm/include/asm/div64.h
··· 52 52 53 53 #else 54 54 55 - static inline uint64_t __arch_xprod_64(uint64_t m, uint64_t n, bool bias) 55 + #ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE 56 + static __always_inline 57 + #else 58 + static inline 59 + #endif 60 + uint64_t __arch_xprod_64(uint64_t m, uint64_t n, bool bias) 56 61 { 57 62 unsigned long long res; 58 63 register unsigned int tmp asm("ip") = 0; 64 + bool no_ovf = __builtin_constant_p(m) && 65 + ((m >> 32) + (m & 0xffffffff) < 0x100000000); 59 66 60 67 if (!bias) { 61 68 asm ( "umull %Q0, %R0, %Q1, %Q2\n\t" ··· 70 63 : "=&r" (res) 71 64 : "r" (m), "r" (n) 72 65 : "cc"); 73 - } else if (!(m & ((1ULL << 63) | (1ULL << 31)))) { 66 + } else if (no_ovf) { 74 67 res = m; 75 68 asm ( "umlal %Q0, %R0, %Q1, %Q2\n\t" 76 69 "mov %Q0, #0" ··· 87 80 : "cc"); 88 81 } 89 82 90 - if (!(m & ((1ULL << 63) | (1ULL << 31)))) { 83 + if (no_ovf) { 91 84 asm ( "umlal %R0, %Q0, %R1, %Q2\n\t" 92 85 "umlal %R0, %Q0, %Q1, %R2\n\t" 93 86 "mov %R0, #0\n\t"
-6
arch/arm/include/asm/memory.h
··· 148 148 #endif 149 149 150 150 /* 151 - * Convert a page to/from a physical address 152 - */ 153 - #define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page))) 154 - #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys))) 155 - 156 - /* 157 151 * PLAT_PHYS_OFFSET is the offset (from zero) of the start of physical 158 152 * memory. This is used for XIP and NoMMU kernels, and on platforms that don't 159 153 * have CONFIG_ARM_PATCH_PHYS_VIRT. Assembly code must always use
-11
arch/arm64/include/asm/io.h
··· 130 130 #define PCI_IOBASE ((void __iomem *)PCI_IO_START) 131 131 132 132 /* 133 - * String version of I/O memory access operations. 134 - */ 135 - extern void __memcpy_fromio(void *, const volatile void __iomem *, size_t); 136 - extern void __memcpy_toio(volatile void __iomem *, const void *, size_t); 137 - extern void __memset_io(volatile void __iomem *, int, size_t); 138 - 139 - #define memset_io(c,v,l) __memset_io((c),(v),(l)) 140 - #define memcpy_fromio(a,c,l) __memcpy_fromio((a),(c),(l)) 141 - #define memcpy_toio(c,a,l) __memcpy_toio((c),(a),(l)) 142 - 143 - /* 144 133 * The ARM64 iowrite implementation is intended to support drivers that want to 145 134 * use write combining. For instance PCI drivers using write combining with a 64 146 135 * byte __iowrite64_copy() expect to get a 64 byte MemWr TLP on the PCIe bus.
-6
arch/arm64/include/asm/memory.h
··· 354 354 #define __phys_to_kimg(x) ((unsigned long)((x) + kimage_voffset)) 355 355 356 356 /* 357 - * Convert a page to/from a physical address 358 - */ 359 - #define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page))) 360 - #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys))) 361 - 362 - /* 363 357 * Note: Drivers should NOT use these. They are the wrong 364 358 * translation for translating DMA addresses. Use the driver 365 359 * DMA support - see dma-mapping.h.
-87
arch/arm64/kernel/io.c
··· 10 10 #include <linux/io.h> 11 11 12 12 /* 13 - * Copy data from IO memory space to "real" memory space. 14 - */ 15 - void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) 16 - { 17 - while (count && !IS_ALIGNED((unsigned long)from, 8)) { 18 - *(u8 *)to = __raw_readb(from); 19 - from++; 20 - to++; 21 - count--; 22 - } 23 - 24 - while (count >= 8) { 25 - *(u64 *)to = __raw_readq(from); 26 - from += 8; 27 - to += 8; 28 - count -= 8; 29 - } 30 - 31 - while (count) { 32 - *(u8 *)to = __raw_readb(from); 33 - from++; 34 - to++; 35 - count--; 36 - } 37 - } 38 - EXPORT_SYMBOL(__memcpy_fromio); 39 - 40 - /* 41 13 * This generates a memcpy that works on a from/to address which is aligned to 42 14 * bits. Count is in terms of the number of bits sized quantities to copy. It 43 15 * optimizes to use the STR groupings when possible so that it is WC friendly. ··· 50 78 dgh(); 51 79 } 52 80 EXPORT_SYMBOL(__iowrite32_copy_full); 53 - 54 - /* 55 - * Copy data from "real" memory space to IO memory space. 56 - */ 57 - void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) 58 - { 59 - while (count && !IS_ALIGNED((unsigned long)to, 8)) { 60 - __raw_writeb(*(u8 *)from, to); 61 - from++; 62 - to++; 63 - count--; 64 - } 65 - 66 - while (count >= 8) { 67 - __raw_writeq(*(u64 *)from, to); 68 - from += 8; 69 - to += 8; 70 - count -= 8; 71 - } 72 - 73 - while (count) { 74 - __raw_writeb(*(u8 *)from, to); 75 - from++; 76 - to++; 77 - count--; 78 - } 79 - } 80 - EXPORT_SYMBOL(__memcpy_toio); 81 - 82 - /* 83 - * "memset" on IO memory space. 84 - */ 85 - void __memset_io(volatile void __iomem *dst, int c, size_t count) 86 - { 87 - u64 qc = (u8)c; 88 - 89 - qc |= qc << 8; 90 - qc |= qc << 16; 91 - qc |= qc << 32; 92 - 93 - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { 94 - __raw_writeb(c, dst); 95 - dst++; 96 - count--; 97 - } 98 - 99 - while (count >= 8) { 100 - __raw_writeq(qc, dst); 101 - dst += 8; 102 - count -= 8; 103 - } 104 - 105 - while (count) { 106 - __raw_writeb(c, dst); 107 - dst++; 108 - count--; 109 - } 110 - } 111 - EXPORT_SYMBOL(__memset_io);
-11
arch/csky/include/asm/io.h
··· 32 32 #endif 33 33 34 34 /* 35 - * String version of I/O memory access operations. 36 - */ 37 - extern void __memcpy_fromio(void *, const volatile void __iomem *, size_t); 38 - extern void __memcpy_toio(volatile void __iomem *, const void *, size_t); 39 - extern void __memset_io(volatile void __iomem *, int, size_t); 40 - 41 - #define memset_io(c,v,l) __memset_io((c),(v),(l)) 42 - #define memcpy_fromio(a,c,l) __memcpy_fromio((a),(c),(l)) 43 - #define memcpy_toio(c,a,l) __memcpy_toio((c),(a),(l)) 44 - 45 - /* 46 35 * I/O memory mapping functions. 47 36 */ 48 37 #define ioremap_wc(addr, size) \
-3
arch/csky/include/asm/page.h
··· 39 39 #define clear_page(page) memset((page), 0, PAGE_SIZE) 40 40 #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) 41 41 42 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 43 - #define phys_to_page(paddr) (pfn_to_page(PFN_DOWN(paddr))) 44 - 45 42 struct page; 46 43 47 44 #include <abi/page.h>
+1 -1
arch/csky/kernel/Makefile
··· 2 2 extra-y := vmlinux.lds 3 3 4 4 obj-y += head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/ 5 - obj-y += power.o syscall.o syscall_table.o setup.o io.o 5 + obj-y += power.o syscall.o syscall_table.o setup.o 6 6 obj-y += process.o cpu-probe.o ptrace.o stacktrace.o 7 7 obj-y += probes/ 8 8
-91
arch/csky/kernel/io.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - #include <linux/export.h> 4 - #include <linux/types.h> 5 - #include <linux/io.h> 6 - 7 - /* 8 - * Copy data from IO memory space to "real" memory space. 9 - */ 10 - void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) 11 - { 12 - while (count && !IS_ALIGNED((unsigned long)from, 4)) { 13 - *(u8 *)to = __raw_readb(from); 14 - from++; 15 - to++; 16 - count--; 17 - } 18 - 19 - while (count >= 4) { 20 - *(u32 *)to = __raw_readl(from); 21 - from += 4; 22 - to += 4; 23 - count -= 4; 24 - } 25 - 26 - while (count) { 27 - *(u8 *)to = __raw_readb(from); 28 - from++; 29 - to++; 30 - count--; 31 - } 32 - } 33 - EXPORT_SYMBOL(__memcpy_fromio); 34 - 35 - /* 36 - * Copy data from "real" memory space to IO memory space. 37 - */ 38 - void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) 39 - { 40 - while (count && !IS_ALIGNED((unsigned long)to, 4)) { 41 - __raw_writeb(*(u8 *)from, to); 42 - from++; 43 - to++; 44 - count--; 45 - } 46 - 47 - while (count >= 4) { 48 - __raw_writel(*(u32 *)from, to); 49 - from += 4; 50 - to += 4; 51 - count -= 4; 52 - } 53 - 54 - while (count) { 55 - __raw_writeb(*(u8 *)from, to); 56 - from++; 57 - to++; 58 - count--; 59 - } 60 - } 61 - EXPORT_SYMBOL(__memcpy_toio); 62 - 63 - /* 64 - * "memset" on IO memory space. 65 - */ 66 - void __memset_io(volatile void __iomem *dst, int c, size_t count) 67 - { 68 - u32 qc = (u8)c; 69 - 70 - qc |= qc << 8; 71 - qc |= qc << 16; 72 - 73 - while (count && !IS_ALIGNED((unsigned long)dst, 4)) { 74 - __raw_writeb(c, dst); 75 - dst++; 76 - count--; 77 - } 78 - 79 - while (count >= 4) { 80 - __raw_writel(qc, dst); 81 - dst += 4; 82 - count -= 4; 83 - } 84 - 85 - while (count) { 86 - __raw_writeb(c, dst); 87 - dst++; 88 - count--; 89 - } 90 - } 91 - EXPORT_SYMBOL(__memset_io);
+3 -2
arch/hexagon/Kconfig
··· 30 30 select HAVE_ARCH_KGDB 31 31 select HAVE_ARCH_TRACEHOOK 32 32 select NEED_SG_DMA_LENGTH 33 - select NO_IOPORT_MAP 34 - select GENERIC_IOMAP 35 33 select GENERIC_IOREMAP 36 34 select GENERIC_SMP_IDLE_THREAD 37 35 select STACKTRACE_SUPPORT ··· 55 57 def_bool y 56 58 57 59 config MMU 60 + def_bool y 61 + 62 + config NO_IOPORT_MAP 58 63 def_bool y 59 64 60 65 config GENERIC_CSUM
+12 -211
arch/hexagon/include/asm/io.h
··· 8 8 #ifndef _ASM_IO_H 9 9 #define _ASM_IO_H 10 10 11 - #ifdef __KERNEL__ 12 - 13 11 #include <linux/types.h> 14 - #include <asm/iomap.h> 15 12 #include <asm/page.h> 16 13 #include <asm/cacheflush.h> 17 14 18 - /* 19 - * We don't have PCI yet. 20 - * _IO_BASE is pointing at what should be unused virtual space. 21 - */ 22 - #define IO_SPACE_LIMIT 0xffff 23 - #define _IO_BASE ((void __iomem *)0xfe000000) 24 - 25 - #define IOMEM(x) ((void __force __iomem *)(x)) 26 - 27 15 extern int remap_area_pages(unsigned long start, unsigned long phys_addr, 28 16 unsigned long end, unsigned long flags); 29 - 30 - /* Defined in lib/io.c, needed for smc91x driver. */ 31 - extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); 32 - extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen); 33 - 34 - extern void __raw_readsl(const void __iomem *addr, void *data, int wordlen); 35 - extern void __raw_writesl(void __iomem *addr, const void *data, int wordlen); 36 - 37 - #define readsw(p, d, l) __raw_readsw(p, d, l) 38 - #define writesw(p, d, l) __raw_writesw(p, d, l) 39 - 40 - #define readsl(p, d, l) __raw_readsl(p, d, l) 41 - #define writesl(p, d, l) __raw_writesl(p, d, l) 42 17 43 18 /* 44 19 * virt_to_phys - map virtual address to physical ··· 34 59 } 35 60 36 61 /* 37 - * IO port access primitives. Hexagon doesn't have special IO access 38 - * instructions; all I/O is memory mapped. 39 - * 40 - * in/out are used for "ports", but we don't have "port instructions", 41 - * so these are really just memory mapped too. 42 - */ 43 - 44 - /* 45 62 * readb - read byte from memory mapped device 46 63 * @addr: pointer to memory 47 64 * 48 - * Operates on "I/O bus memory space" 49 65 */ 50 - static inline u8 readb(const volatile void __iomem *addr) 66 + static inline u8 __raw_readb(const volatile void __iomem *addr) 51 67 { 52 68 u8 val; 53 69 asm volatile( ··· 48 82 ); 49 83 return val; 50 84 } 85 + #define __raw_readb __raw_readb 51 86 52 - static inline u16 readw(const volatile void __iomem *addr) 87 + static inline u16 __raw_readw(const volatile void __iomem *addr) 53 88 { 54 89 u16 val; 55 90 asm volatile( ··· 60 93 ); 61 94 return val; 62 95 } 96 + #define __raw_readw __raw_readw 63 97 64 - static inline u32 readl(const volatile void __iomem *addr) 98 + static inline u32 __raw_readl(const volatile void __iomem *addr) 65 99 { 66 100 u32 val; 67 101 asm volatile( ··· 72 104 ); 73 105 return val; 74 106 } 107 + #define __raw_readl __raw_readl 75 108 76 109 /* 77 110 * writeb - write a byte to a memory location ··· 80 111 * @addr: pointer to memory 81 112 * 82 113 */ 83 - static inline void writeb(u8 data, volatile void __iomem *addr) 114 + static inline void __raw_writeb(u8 data, volatile void __iomem *addr) 84 115 { 85 116 asm volatile( 86 117 "memb(%0) = %1;" ··· 89 120 : "memory" 90 121 ); 91 122 } 123 + #define __raw_writeb __raw_writeb 92 124 93 - static inline void writew(u16 data, volatile void __iomem *addr) 125 + static inline void __raw_writew(u16 data, volatile void __iomem *addr) 94 126 { 95 127 asm volatile( 96 128 "memh(%0) = %1;" ··· 101 131 ); 102 132 103 133 } 134 + #define __raw_writew __raw_writew 104 135 105 - static inline void writel(u32 data, volatile void __iomem *addr) 136 + static inline void __raw_writel(u32 data, volatile void __iomem *addr) 106 137 { 107 138 asm volatile( 108 139 "memw(%0) = %1;" ··· 112 141 : "memory" 113 142 ); 114 143 } 115 - 116 - #define __raw_writeb writeb 117 - #define __raw_writew writew 118 - #define __raw_writel writel 119 - 120 - #define __raw_readb readb 121 - #define __raw_readw readw 122 - #define __raw_readl readl 123 - 124 - /* 125 - * http://comments.gmane.org/gmane.linux.ports.arm.kernel/117626 126 - */ 127 - 128 - #define readb_relaxed __raw_readb 129 - #define readw_relaxed __raw_readw 130 - #define readl_relaxed __raw_readl 131 - 132 - #define writeb_relaxed __raw_writeb 133 - #define writew_relaxed __raw_writew 134 - #define writel_relaxed __raw_writel 144 + #define __raw_writel __raw_writel 135 145 136 146 /* 137 147 * I/O memory mapping functions. 138 148 */ 139 149 #define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ 140 150 (__HEXAGON_C_DEV << 6)) 141 - 142 - #define __raw_writel writel 143 - 144 - static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, 145 - int count) 146 - { 147 - memcpy(dst, (void *) src, count); 148 - } 149 - 150 - static inline void memcpy_toio(volatile void __iomem *dst, const void *src, 151 - int count) 152 - { 153 - memcpy((void *) dst, src, count); 154 - } 155 - 156 - static inline void memset_io(volatile void __iomem *addr, int value, 157 - size_t size) 158 - { 159 - memset((void __force *)addr, value, size); 160 - } 161 - 162 - #define PCI_IO_ADDR (volatile void __iomem *) 163 - 164 - /* 165 - * inb - read byte from I/O port or something 166 - * @port: address in I/O space 167 - * 168 - * Operates on "I/O bus I/O space" 169 - */ 170 - static inline u8 inb(unsigned long port) 171 - { 172 - return readb(_IO_BASE + (port & IO_SPACE_LIMIT)); 173 - } 174 - 175 - static inline u16 inw(unsigned long port) 176 - { 177 - return readw(_IO_BASE + (port & IO_SPACE_LIMIT)); 178 - } 179 - 180 - static inline u32 inl(unsigned long port) 181 - { 182 - return readl(_IO_BASE + (port & IO_SPACE_LIMIT)); 183 - } 184 - 185 - /* 186 - * outb - write a byte to a memory location 187 - * @data: data to write to 188 - * @addr: address in I/O space 189 - */ 190 - static inline void outb(u8 data, unsigned long port) 191 - { 192 - writeb(data, _IO_BASE + (port & IO_SPACE_LIMIT)); 193 - } 194 - 195 - static inline void outw(u16 data, unsigned long port) 196 - { 197 - writew(data, _IO_BASE + (port & IO_SPACE_LIMIT)); 198 - } 199 - 200 - static inline void outl(u32 data, unsigned long port) 201 - { 202 - writel(data, _IO_BASE + (port & IO_SPACE_LIMIT)); 203 - } 204 - 205 - #define outb_p outb 206 - #define outw_p outw 207 - #define outl_p outl 208 - 209 - #define inb_p inb 210 - #define inw_p inw 211 - #define inl_p inl 212 - 213 - static inline void insb(unsigned long port, void *buffer, int count) 214 - { 215 - if (count) { 216 - u8 *buf = buffer; 217 - do { 218 - u8 x = inb(port); 219 - *buf++ = x; 220 - } while (--count); 221 - } 222 - } 223 - 224 - static inline void insw(unsigned long port, void *buffer, int count) 225 - { 226 - if (count) { 227 - u16 *buf = buffer; 228 - do { 229 - u16 x = inw(port); 230 - *buf++ = x; 231 - } while (--count); 232 - } 233 - } 234 - 235 - static inline void insl(unsigned long port, void *buffer, int count) 236 - { 237 - if (count) { 238 - u32 *buf = buffer; 239 - do { 240 - u32 x = inw(port); 241 - *buf++ = x; 242 - } while (--count); 243 - } 244 - } 245 - 246 - static inline void outsb(unsigned long port, const void *buffer, int count) 247 - { 248 - if (count) { 249 - const u8 *buf = buffer; 250 - do { 251 - outb(*buf++, port); 252 - } while (--count); 253 - } 254 - } 255 - 256 - static inline void outsw(unsigned long port, const void *buffer, int count) 257 - { 258 - if (count) { 259 - const u16 *buf = buffer; 260 - do { 261 - outw(*buf++, port); 262 - } while (--count); 263 - } 264 - } 265 - 266 - static inline void outsl(unsigned long port, const void *buffer, int count) 267 - { 268 - if (count) { 269 - const u32 *buf = buffer; 270 - do { 271 - outl(*buf++, port); 272 - } while (--count); 273 - } 274 - } 275 151 276 152 /* 277 153 * These defines are necessary to use the generic io.h for filling in ··· 128 310 */ 129 311 #define virt_to_phys virt_to_phys 130 312 #define phys_to_virt phys_to_virt 131 - #define memset_io memset_io 132 - #define memcpy_fromio memcpy_fromio 133 - #define memcpy_toio memcpy_toio 134 - #define readb readb 135 - #define readw readw 136 - #define readl readl 137 - #define writeb writeb 138 - #define writew writew 139 - #define writel writel 140 - #define insb insb 141 - #define insw insw 142 - #define insl insl 143 - #define outsb outsb 144 - #define outsw outsw 145 - #define outsl outsl 146 313 #include <asm-generic/io.h> 147 - 148 - #endif /* __KERNEL__ */ 149 314 150 315 #endif
-6
arch/hexagon/include/asm/page.h
··· 116 116 #define clear_user_page(page, vaddr, pg) clear_page(page) 117 117 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 118 118 119 - /* 120 - * page_to_phys - convert page to physical address 121 - * @page - pointer to page entry in mem_map 122 - */ 123 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 124 - 125 119 static inline unsigned long virt_to_pfn(const void *kaddr) 126 120 { 127 121 return __pa(kaddr) >> PAGE_SHIFT;
+1 -1
arch/hexagon/lib/Makefile
··· 2 2 # 3 3 # Makefile for hexagon-specific library files. 4 4 # 5 - obj-y = checksum.o io.o memcpy.o memset.o memcpy_likely_aligned.o \ 5 + obj-y = checksum.o memcpy.o memset.o memcpy_likely_aligned.o \ 6 6 divsi3.o modsi3.o udivsi3.o umodsi3.o
-82
arch/hexagon/lib/io.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * I/O access functions for Hexagon 4 - * 5 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 6 - */ 7 - 8 - #include <asm/io.h> 9 - 10 - /* These are all FIFO routines! */ 11 - 12 - /* 13 - * __raw_readsw - read words a short at a time 14 - * @addr: source address 15 - * @data: data address 16 - * @len: number of shorts to read 17 - */ 18 - void __raw_readsw(const void __iomem *addr, void *data, int len) 19 - { 20 - const volatile short int *src = (short int *) addr; 21 - short int *dst = (short int *) data; 22 - 23 - if ((u32)data & 0x1) 24 - panic("unaligned pointer to readsw"); 25 - 26 - while (len-- > 0) 27 - *dst++ = *src; 28 - 29 - } 30 - EXPORT_SYMBOL(__raw_readsw); 31 - 32 - /* 33 - * __raw_writesw - read words a short at a time 34 - * @addr: source address 35 - * @data: data address 36 - * @len: number of shorts to read 37 - */ 38 - void __raw_writesw(void __iomem *addr, const void *data, int len) 39 - { 40 - const short int *src = (short int *)data; 41 - volatile short int *dst = (short int *)addr; 42 - 43 - if ((u32)data & 0x1) 44 - panic("unaligned pointer to writesw"); 45 - 46 - while (len-- > 0) 47 - *dst = *src++; 48 - 49 - 50 - } 51 - EXPORT_SYMBOL(__raw_writesw); 52 - 53 - /* Pretty sure len is pre-adjusted for the length of the access already */ 54 - void __raw_readsl(const void __iomem *addr, void *data, int len) 55 - { 56 - const volatile long *src = (long *) addr; 57 - long *dst = (long *) data; 58 - 59 - if ((u32)data & 0x3) 60 - panic("unaligned pointer to readsl"); 61 - 62 - while (len-- > 0) 63 - *dst++ = *src; 64 - 65 - 66 - } 67 - EXPORT_SYMBOL(__raw_readsl); 68 - 69 - void __raw_writesl(void __iomem *addr, const void *data, int len) 70 - { 71 - const long *src = (long *)data; 72 - volatile long *dst = (long *)addr; 73 - 74 - if ((u32)data & 0x3) 75 - panic("unaligned pointer to writesl"); 76 - 77 - while (len-- > 0) 78 - *dst = *src++; 79 - 80 - 81 - } 82 - EXPORT_SYMBOL(__raw_writesl);
-10
arch/loongarch/include/asm/io.h
··· 62 62 63 63 #define mmiowb() wmb() 64 64 65 - /* 66 - * String version of I/O memory access operations. 67 - */ 68 - extern void __memset_io(volatile void __iomem *dst, int c, size_t count); 69 - extern void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count); 70 - extern void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count); 71 - #define memset_io(c, v, l) __memset_io((c), (v), (l)) 72 - #define memcpy_fromio(a, c, l) __memcpy_fromio((a), (c), (l)) 73 - #define memcpy_toio(c, a, l) __memcpy_toio((c), (a), (l)) 74 - 75 65 #define __io_aw() mmiowb() 76 66 77 67 #ifdef CONFIG_KFENCE
-3
arch/loongarch/include/asm/page.h
··· 76 76 #define pfn_to_phys(pfn) __pfn_to_phys(pfn) 77 77 #define phys_to_pfn(paddr) __phys_to_pfn(paddr) 78 78 79 - #define page_to_phys(page) pfn_to_phys(page_to_pfn(page)) 80 - #define phys_to_page(paddr) pfn_to_page(phys_to_pfn(paddr)) 81 - 82 79 #ifndef CONFIG_KFENCE 83 80 84 81 #define page_to_virt(page) __va(page_to_phys(page))
+1 -1
arch/loongarch/kernel/Makefile
··· 8 8 extra-y := vmlinux.lds 9 9 10 10 obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \ 11 - traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \ 11 + traps.o irq.o idle.o process.o dma.o mem.o reset.o switch.o \ 12 12 elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o \ 13 13 alternative.o unwind.o 14 14
-94
arch/loongarch/kernel/io.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 4 - */ 5 - #include <linux/export.h> 6 - #include <linux/types.h> 7 - #include <linux/io.h> 8 - 9 - /* 10 - * Copy data from IO memory space to "real" memory space. 11 - */ 12 - void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) 13 - { 14 - while (count && !IS_ALIGNED((unsigned long)from, 8)) { 15 - *(u8 *)to = __raw_readb(from); 16 - from++; 17 - to++; 18 - count--; 19 - } 20 - 21 - while (count >= 8) { 22 - *(u64 *)to = __raw_readq(from); 23 - from += 8; 24 - to += 8; 25 - count -= 8; 26 - } 27 - 28 - while (count) { 29 - *(u8 *)to = __raw_readb(from); 30 - from++; 31 - to++; 32 - count--; 33 - } 34 - } 35 - EXPORT_SYMBOL(__memcpy_fromio); 36 - 37 - /* 38 - * Copy data from "real" memory space to IO memory space. 39 - */ 40 - void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) 41 - { 42 - while (count && !IS_ALIGNED((unsigned long)to, 8)) { 43 - __raw_writeb(*(u8 *)from, to); 44 - from++; 45 - to++; 46 - count--; 47 - } 48 - 49 - while (count >= 8) { 50 - __raw_writeq(*(u64 *)from, to); 51 - from += 8; 52 - to += 8; 53 - count -= 8; 54 - } 55 - 56 - while (count) { 57 - __raw_writeb(*(u8 *)from, to); 58 - from++; 59 - to++; 60 - count--; 61 - } 62 - } 63 - EXPORT_SYMBOL(__memcpy_toio); 64 - 65 - /* 66 - * "memset" on IO memory space. 67 - */ 68 - void __memset_io(volatile void __iomem *dst, int c, size_t count) 69 - { 70 - u64 qc = (u8)c; 71 - 72 - qc |= qc << 8; 73 - qc |= qc << 16; 74 - qc |= qc << 32; 75 - 76 - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { 77 - __raw_writeb(c, dst); 78 - dst++; 79 - count--; 80 - } 81 - 82 - while (count >= 8) { 83 - __raw_writeq(qc, dst); 84 - dst += 8; 85 - count -= 8; 86 - } 87 - 88 - while (count) { 89 - __raw_writeb(c, dst); 90 - dst++; 91 - count--; 92 - } 93 - } 94 - EXPORT_SYMBOL(__memset_io);
-3
arch/m68k/include/asm/virtconvert.h
··· 28 28 return __va(address); 29 29 } 30 30 31 - /* Permanent address of a page. */ 32 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 33 - 34 31 /* 35 32 * IO bus memory addresses are 1:1 with the physical address, 36 33 * deprecated globally but still used on two machines.
-1
arch/microblaze/include/asm/page.h
··· 98 98 99 99 # define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)) 100 100 # define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) 101 - # define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 102 101 103 102 # define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT) 104 103 # endif /* __ASSEMBLY__ */
-5
arch/mips/include/asm/io.h
··· 125 125 return virt_to_phys(address); 126 126 } 127 127 128 - /* 129 - * Change "struct page" to physical address. 130 - */ 131 - #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 132 - 133 128 void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size, 134 129 unsigned long prot_val); 135 130 void iounmap(const volatile void __iomem *addr);
-4
arch/mips/include/asm/vga.h
··· 47 47 memset16(s, cpu_to_le16(v), count / 2); 48 48 } 49 49 50 - #define scr_memcpyw(d, s, c) memcpy(d, s, c) 51 - #define scr_memmovew(d, s, c) memmove(d, s, c) 52 - #define VT_BUF_HAVE_MEMCPYW 53 - #define VT_BUF_HAVE_MEMMOVEW 54 50 #define VT_BUF_HAVE_MEMSETW 55 51 56 52 #endif /* _ASM_VGA_H */
-3
arch/nios2/include/asm/io.h
··· 28 28 void __iomem *ioremap(unsigned long physaddr, unsigned long size); 29 29 void iounmap(void __iomem *addr); 30 30 31 - /* Pages to physical address... */ 32 - #define page_to_phys(page) virt_to_phys(page_to_virt(page)) 33 - 34 31 /* Macros used for converting between virtual and physical mappings. */ 35 32 #define phys_to_virt(vaddr) \ 36 33 ((void *)((unsigned long)(vaddr) | CONFIG_NIOS2_KERNEL_REGION_BASE))
-2
arch/openrisc/include/asm/page.h
··· 71 71 #define virt_to_page(addr) \ 72 72 (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) 73 73 74 - #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 75 - 76 74 #define virt_addr_valid(kaddr) (pfn_valid(virt_to_pfn(kaddr))) 77 75 78 76 #endif /* __ASSEMBLY__ */
-1
arch/parisc/include/asm/page.h
··· 166 166 167 167 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 168 168 169 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 170 169 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 171 170 172 171 #include <asm-generic/memory_model.h>
-12
arch/powerpc/include/asm/io.h
··· 970 970 #define phys_to_virt phys_to_virt 971 971 972 972 /* 973 - * Change "struct page" to physical address. 974 - */ 975 - static inline phys_addr_t page_to_phys(struct page *page) 976 - { 977 - unsigned long pfn = page_to_pfn(page); 978 - 979 - WARN_ON(IS_ENABLED(CONFIG_DEBUG_VIRTUAL) && !pfn_valid(pfn)); 980 - 981 - return PFN_PHYS(pfn); 982 - } 983 - 984 - /* 985 973 * 32 bits still uses virt_to_bus() for its implementation of DMA 986 974 * mappings se we have to keep it defined here. We also have some old 987 975 * drivers (shame shame shame) that use bus_to_virt() and haven't been
-5
arch/powerpc/include/asm/vga.h
··· 40 40 memset16(s, cpu_to_le16(v), n / 2); 41 41 } 42 42 43 - #define VT_BUF_HAVE_MEMCPYW 44 - #define VT_BUF_HAVE_MEMMOVEW 45 - #define scr_memcpyw memcpy 46 - #define scr_memmovew memmove 47 - 48 43 #endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */ 49 44 50 45 #ifdef __powerpc64__
-3
arch/riscv/include/asm/page.h
··· 192 192 #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) 193 193 #define page_to_virt(page) (pfn_to_virt(page_to_pfn(page))) 194 194 195 - #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page))) 196 - #define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr))) 197 - 198 195 #define sym_to_pfn(x) __phys_to_pfn(__pa_symbol(x)) 199 196 200 197 unsigned long kaslr_offset(void);
-2
arch/s390/include/asm/page.h
··· 241 241 #define phys_to_pfn(phys) ((phys) >> PAGE_SHIFT) 242 242 #define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 243 243 244 - #define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) 245 244 #define phys_to_folio(phys) page_folio(phys_to_page(phys)) 246 - #define page_to_phys(page) pfn_to_phys(page_to_pfn(page)) 247 245 #define folio_to_phys(page) pfn_to_phys(folio_pfn(folio)) 248 246 249 247 static inline void *pfn_to_virt(unsigned long pfn)
-1
arch/sh/include/asm/page.h
··· 145 145 #endif 146 146 147 147 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 148 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 149 148 150 149 /* 151 150 * PFN = physical frame number (ie PFN 0 == physical address 0)
-7
arch/sh/include/asm/vga.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ASM_SH_VGA_H 3 - #define __ASM_SH_VGA_H 4 - 5 - /* Stupid drivers. */ 6 - 7 - #endif /* __ASM_SH_VGA_H */
-2
arch/sparc/include/asm/page.h
··· 2 2 #ifndef ___ASM_SPARC_PAGE_H 3 3 #define ___ASM_SPARC_PAGE_H 4 4 5 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 6 - 7 5 #if defined(__sparc__) && defined(__arch64__) 8 6 #include <asm/page_64.h> 9 7 #else
-60
arch/sparc/include/asm/vga.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Access to VGA videoram 4 - * 5 - * (c) 1998 Martin Mares <mj@ucw.cz> 6 - */ 7 - 8 - #ifndef _LINUX_ASM_VGA_H_ 9 - #define _LINUX_ASM_VGA_H_ 10 - 11 - #include <linux/bug.h> 12 - #include <linux/string.h> 13 - #include <asm/types.h> 14 - 15 - #define VT_BUF_HAVE_RW 16 - #define VT_BUF_HAVE_MEMSETW 17 - #define VT_BUF_HAVE_MEMCPYW 18 - #define VT_BUF_HAVE_MEMMOVEW 19 - 20 - #undef scr_writew 21 - #undef scr_readw 22 - 23 - static inline void scr_writew(u16 val, u16 *addr) 24 - { 25 - BUG_ON((long) addr >= 0); 26 - 27 - *addr = val; 28 - } 29 - 30 - static inline u16 scr_readw(const u16 *addr) 31 - { 32 - BUG_ON((long) addr >= 0); 33 - 34 - return *addr; 35 - } 36 - 37 - static inline void scr_memsetw(u16 *p, u16 v, unsigned int n) 38 - { 39 - BUG_ON((long) p >= 0); 40 - 41 - memset16(p, cpu_to_le16(v), n / 2); 42 - } 43 - 44 - static inline void scr_memcpyw(u16 *d, u16 *s, unsigned int n) 45 - { 46 - BUG_ON((long) d >= 0); 47 - 48 - memcpy(d, s, n); 49 - } 50 - 51 - static inline void scr_memmovew(u16 *d, u16 *s, unsigned int n) 52 - { 53 - BUG_ON((long) d >= 0); 54 - 55 - memmove(d, s, n); 56 - } 57 - 58 - #define VGA_MAP_MEM(x,s) (x) 59 - 60 - #endif
-2
arch/um/include/asm/pgtable.h
··· 287 287 * and a page entry and page directory to the page they refer to. 288 288 */ 289 289 290 - #define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys)) 291 290 #define __virt_to_page(virt) phys_to_page(__pa(virt)) 292 - #define page_to_phys(page) pfn_to_phys(page_to_pfn(page)) 293 291 #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) 294 292 295 293 #define mk_pte(page, pgprot) \
-5
arch/x86/include/asm/io.h
··· 152 152 #define phys_to_virt phys_to_virt 153 153 154 154 /* 155 - * Change "struct page" to physical address. 156 - */ 157 - #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 158 - 159 - /* 160 155 * ISA I/O bus memory addresses are 1:1 with the physical address. 161 156 * However, we truncate the address to unsigned int to avoid undesirable 162 157 * promotions in legacy drivers.
-1
arch/xtensa/include/asm/page.h
··· 189 189 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 190 190 #define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) 191 191 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 192 - #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 193 192 194 193 #endif /* __ASSEMBLY__ */ 195 194
+3 -3
drivers/bluetooth/Kconfig
··· 336 336 337 337 config BT_HCIDTL1 338 338 tristate "HCI DTL1 (PC Card) driver" 339 - depends on PCMCIA 339 + depends on PCMCIA && HAS_IOPORT 340 340 help 341 341 Bluetooth HCI DTL1 (PC Card) driver. 342 342 This driver provides support for Bluetooth PCMCIA devices with ··· 349 349 350 350 config BT_HCIBT3C 351 351 tristate "HCI BT3C (PC Card) driver" 352 - depends on PCMCIA 352 + depends on PCMCIA && HAS_IOPORT 353 353 select FW_LOADER 354 354 help 355 355 Bluetooth HCI BT3C (PC Card) driver. ··· 363 363 364 364 config BT_HCIBLUECARD 365 365 tristate "HCI BlueCard (PC Card) driver" 366 - depends on PCMCIA 366 + depends on PCMCIA && HAS_IOPORT 367 367 help 368 368 Bluetooth HCI BlueCard (PC Card) driver. 369 369 This driver provides support for Bluetooth PCMCIA devices with
+1 -1
drivers/gpu/drm/gma500/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 config DRM_GMA500 3 3 tristate "Intel GMA500/600/3600/3650 KMS Framebuffer" 4 - depends on DRM && PCI && X86 && MMU 4 + depends on DRM && PCI && X86 && MMU && HAS_IOPORT 5 5 select DRM_KMS_HELPER 6 6 select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION 7 7 select I2C
+1 -1
drivers/gpu/drm/qxl/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 config DRM_QXL 3 3 tristate "QXL virtual GPU" 4 - depends on DRM && PCI && MMU 4 + depends on DRM && PCI && MMU && HAS_IOPORT 5 5 select DRM_KMS_HELPER 6 6 select DRM_TTM 7 7 select DRM_TTM_HELPER
+14 -5
drivers/gpu/drm/tiny/bochs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 3 + #include <linux/bug.h> 3 4 #include <linux/module.h> 4 5 #include <linux/pci.h> 5 6 ··· 96 95 97 96 /* ---------------------------------------------------------------------- */ 98 97 98 + static __always_inline bool bochs_uses_mmio(struct bochs_device *bochs) 99 + { 100 + return !IS_ENABLED(CONFIG_HAS_IOPORT) || bochs->mmio; 101 + } 102 + 99 103 static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val) 100 104 { 101 105 if (WARN_ON(ioport < 0x3c0 || ioport > 0x3df)) 102 106 return; 103 107 104 - if (bochs->mmio) { 108 + if (bochs_uses_mmio(bochs)) { 105 109 int offset = ioport - 0x3c0 + 0x400; 106 110 107 111 writeb(val, bochs->mmio + offset); ··· 120 114 if (WARN_ON(ioport < 0x3c0 || ioport > 0x3df)) 121 115 return 0xff; 122 116 123 - if (bochs->mmio) { 117 + if (bochs_uses_mmio(bochs)) { 124 118 int offset = ioport - 0x3c0 + 0x400; 125 119 126 120 return readb(bochs->mmio + offset); ··· 133 127 { 134 128 u16 ret = 0; 135 129 136 - if (bochs->mmio) { 130 + if (bochs_uses_mmio(bochs)) { 137 131 int offset = 0x500 + (reg << 1); 138 132 139 133 ret = readw(bochs->mmio + offset); ··· 146 140 147 141 static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val) 148 142 { 149 - if (bochs->mmio) { 143 + if (bochs_uses_mmio(bochs)) { 150 144 int offset = 0x500 + (reg << 1); 151 145 152 146 writew(val, bochs->mmio + offset); ··· 234 228 DRM_ERROR("Cannot map mmio region\n"); 235 229 return -ENOMEM; 236 230 } 237 - } else { 231 + } else if (IS_ENABLED(CONFIG_HAS_IOPORT)) { 238 232 ioaddr = VBE_DISPI_IOPORT_INDEX; 239 233 iosize = 2; 240 234 if (!request_region(ioaddr, iosize, "bochs-drm")) { ··· 242 236 return -EBUSY; 243 237 } 244 238 bochs->ioports = 1; 239 + } else { 240 + dev_err(dev->dev, "I/O ports are not supported\n"); 241 + return -EIO; 245 242 } 246 243 247 244 id = bochs_dispi_read(bochs, VBE_DISPI_INDEX_ID);
+2
drivers/gpu/drm/tiny/cirrus.c
··· 509 509 510 510 cirrus_mode_set(cirrus, &crtc_state->mode); 511 511 512 + #ifdef CONFIG_HAS_IOPORT 512 513 /* Unblank (needed on S3 resume, vgabios doesn't do it then) */ 513 514 outb(VGA_AR_ENABLE_DISPLAY, VGA_ATT_W); 515 + #endif 514 516 515 517 drm_dev_exit(idx); 516 518 }
+1 -1
drivers/gpu/drm/xe/Kconfig
··· 49 49 50 50 config DRM_XE_DISPLAY 51 51 bool "Enable display support" 52 - depends on DRM_XE && DRM_XE=m 52 + depends on DRM_XE && DRM_XE=m && HAS_IOPORT 53 53 select FB_IOMEM_HELPERS 54 54 select I2C 55 55 select I2C_ALGOBIT
+2 -2
drivers/tty/Kconfig
··· 220 220 221 221 config MOXA_SMARTIO 222 222 tristate "Moxa SmartIO support v. 2.0" 223 - depends on SERIAL_NONSTANDARD && PCI 223 + depends on SERIAL_NONSTANDARD && PCI && HAS_IOPORT 224 224 help 225 225 Say Y here if you have a Moxa SmartIO multiport serial card and/or 226 226 want to help develop a new version of this driver. ··· 302 302 303 303 config IPWIRELESS 304 304 tristate "IPWireless 3G UMTS PCMCIA card support" 305 - depends on PCMCIA && NETDEVICES 305 + depends on PCMCIA && NETDEVICES && HAS_IOPORT 306 306 select PPP 307 307 help 308 308 This is a driver for 3G UMTS PCMCIA card from IPWireless company. In
+4
drivers/tty/serial/8250/8250_early.c
··· 46 46 return readl(port->membase + offset); 47 47 case UPIO_MEM32BE: 48 48 return ioread32be(port->membase + offset); 49 + #ifdef CONFIG_HAS_IOPORT 49 50 case UPIO_PORT: 50 51 return inb(port->iobase + offset); 52 + #endif 51 53 default: 52 54 return 0; 53 55 } ··· 72 70 case UPIO_MEM32BE: 73 71 iowrite32be(value, port->membase + offset); 74 72 break; 73 + #ifdef CONFIG_HAS_IOPORT 75 74 case UPIO_PORT: 76 75 outb(value, port->iobase + offset); 77 76 break; 77 + #endif 78 78 } 79 79 } 80 80
+40
drivers/tty/serial/8250/8250_pci.c
··· 964 964 struct resource *iobase = NULL; 965 965 u32 miscr, uartbar, ioport; 966 966 967 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 968 + return serial_8250_warn_need_ioport(dev); 969 + 967 970 /* search for the base-ioport */ 968 971 for (i = 0; i < ARRAY_SIZE(inta_addr); i++) { 969 972 iobase = request_region(inta_addr[i], ITE_887x_IOSIZE, ··· 1517 1514 const struct pci_device_id *match; 1518 1515 bool amcc = false; 1519 1516 1517 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1518 + return serial_8250_warn_need_ioport(dev); 1519 + 1520 1520 match = pci_match_id(quatech_cards, dev); 1521 1521 if (match) 1522 1522 amcc = match->driver_data; ··· 1544 1538 const struct pciserial_board *board, 1545 1539 struct uart_8250_port *port, int idx) 1546 1540 { 1541 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1542 + return serial_8250_warn_need_ioport(priv->dev); 1543 + 1547 1544 /* Needed by pci_quatech calls below */ 1548 1545 port->port.iobase = pci_resource_start(priv->dev, FL_GET_BASE(board->flags)); 1549 1546 /* Set up the clocking */ ··· 1664 1655 u8 config_base; 1665 1656 u16 iobase; 1666 1657 1658 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1659 + return serial_8250_warn_need_ioport(pdev); 1660 + 1667 1661 config_base = 0x40 + 0x08 * idx; 1668 1662 1669 1663 /* Get the io address from configuration space */ ··· 1697 1685 resource_size_t bar_data[3]; 1698 1686 u8 config_base; 1699 1687 struct serial_private *priv = pci_get_drvdata(dev); 1688 + 1689 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1690 + return serial_8250_warn_need_ioport(dev); 1700 1691 1701 1692 if (!(pci_resource_flags(dev, 5) & IORESOURCE_IO) || 1702 1693 !(pci_resource_flags(dev, 4) & IORESOURCE_IO) || ··· 1879 1864 const struct pciserial_board *board, 1880 1865 struct uart_8250_port *port, int idx) 1881 1866 { 1867 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1868 + return serial_8250_warn_need_ioport(priv->dev); 1869 + 1882 1870 port->port.flags |= UPF_BUG_THRE; 1883 1871 port->port.serial_in = kt_serial_in; 1884 1872 port->port.handle_break = kt_handle_break; ··· 1902 1884 const struct pciserial_board *board, 1903 1885 struct uart_8250_port *port, int idx) 1904 1886 { 1887 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1888 + return serial_8250_warn_need_ioport(priv->dev); 1889 + 1905 1890 port->port.flags |= UPF_FIXED_TYPE; 1906 1891 port->port.type = PORT_16550A; 1907 1892 return pci_default_setup(priv, board, port, idx); ··· 1915 1894 const struct pciserial_board *board, 1916 1895 struct uart_8250_port *port, int idx) 1917 1896 { 1897 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1898 + return serial_8250_warn_need_ioport(priv->dev); 1899 + 1918 1900 port->port.flags |= UPF_FIXED_TYPE; 1919 1901 port->port.type = PORT_16550A; 1920 1902 return pci_default_setup(priv, board, port, idx); ··· 1928 1904 const struct pciserial_board *board, 1929 1905 struct uart_8250_port *port, int idx) 1930 1906 { 1907 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1908 + return serial_8250_warn_need_ioport(priv->dev); 1909 + 1931 1910 port->port.flags |= UPF_FIXED_TYPE; 1932 1911 port->port.type = PORT_16850; 1933 1912 return pci_default_setup(priv, board, port, idx); ··· 1945 1918 int max_port; 1946 1919 unsigned long iobase; 1947 1920 1921 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 1922 + return serial_8250_warn_need_ioport(dev); 1948 1923 1949 1924 switch (dev->device) { 1950 1925 case 0x3853: /* 8 ports */ ··· 1965 1936 static void pci_wch_ch38x_exit(struct pci_dev *dev) 1966 1937 { 1967 1938 unsigned long iobase; 1939 + 1940 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) { 1941 + serial_8250_warn_need_ioport(dev); 1942 + return; 1943 + } 1968 1944 1969 1945 iobase = pci_resource_start(dev, 0); 1970 1946 outb(0x0, iobase + CH384_XINT_ENABLE_REG); ··· 2086 2052 unsigned int i, num_ports = moxa_get_nports(device); 2087 2053 u8 val, init_mode = MOXA_RS232; 2088 2054 2055 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 2056 + return serial_8250_warn_need_ioport(dev); 2057 + 2089 2058 if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) { 2090 2059 init_mode = MOXA_RS422; 2091 2060 } ··· 2120 2083 { 2121 2084 unsigned int bar = FL_GET_BASE(board->flags); 2122 2085 int offset; 2086 + 2087 + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) 2088 + return serial_8250_warn_need_ioport(priv->dev); 2123 2089 2124 2090 if (board->num_ports == 4 && idx == 3) 2125 2091 offset = 7 * board->uart_offset;
+12 -1
drivers/tty/serial/8250/8250_pcilib.c
··· 12 12 #include "8250.h" 13 13 #include "8250_pcilib.h" 14 14 15 + int serial_8250_warn_need_ioport(struct pci_dev *dev) 16 + { 17 + dev_warn(&dev->dev, 18 + "Serial port not supported because of missing I/O resource\n"); 19 + 20 + return -ENXIO; 21 + } 22 + EXPORT_SYMBOL_NS_GPL(serial_8250_warn_need_ioport, SERIAL_8250_PCI); 23 + 15 24 int serial8250_pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port, 16 25 u8 bar, unsigned int offset, int regshift) 17 26 { ··· 36 27 port->port.mapbase = pci_resource_start(dev, bar) + offset; 37 28 port->port.membase = pcim_iomap_table(dev)[bar] + offset; 38 29 port->port.regshift = regshift; 39 - } else { 30 + } else if (IS_ENABLED(CONFIG_HAS_IOPORT)) { 40 31 port->port.iotype = UPIO_PORT; 41 32 port->port.iobase = pci_resource_start(dev, bar) + offset; 42 33 port->port.mapbase = 0; 43 34 port->port.membase = NULL; 44 35 port->port.regshift = 0; 36 + } else { 37 + return serial_8250_warn_need_ioport(dev); 45 38 } 46 39 return 0; 47 40 }
+2
drivers/tty/serial/8250/8250_pcilib.h
··· 13 13 14 14 int serial8250_pci_setup_port(struct pci_dev *dev, struct uart_8250_port *port, u8 bar, 15 15 unsigned int offset, int regshift); 16 + 17 + int serial_8250_warn_need_ioport(struct pci_dev *dev);
+23 -4
drivers/tty/serial/8250/8250_port.c
··· 338 338 serial_out(up, UART_DLM, value >> 8 & 0xff); 339 339 } 340 340 341 + #ifdef CONFIG_HAS_IOPORT 341 342 static unsigned int hub6_serial_in(struct uart_port *p, int offset) 342 343 { 343 344 offset = offset << p->regshift; ··· 352 351 outb(p->hub6 - 1 + offset, p->iobase); 353 352 outb(value, p->iobase + 1); 354 353 } 354 + #endif /* CONFIG_HAS_IOPORT */ 355 355 356 356 static unsigned int mem_serial_in(struct uart_port *p, int offset) 357 357 { ··· 402 400 return ioread32be(p->membase + offset); 403 401 } 404 402 403 + #ifdef CONFIG_HAS_IOPORT 405 404 static unsigned int io_serial_in(struct uart_port *p, int offset) 406 405 { 407 406 offset = offset << p->regshift; ··· 413 410 { 414 411 offset = offset << p->regshift; 415 412 outb(value, p->iobase + offset); 413 + } 414 + #endif 415 + static unsigned int no_serial_in(struct uart_port *p, int offset) 416 + { 417 + return (unsigned int)-1; 418 + } 419 + 420 + static void no_serial_out(struct uart_port *p, int offset, int value) 421 + { 416 422 } 417 423 418 424 static int serial8250_default_handle_irq(struct uart_port *port); ··· 434 422 up->dl_write = default_serial_dl_write; 435 423 436 424 switch (p->iotype) { 425 + #ifdef CONFIG_HAS_IOPORT 437 426 case UPIO_HUB6: 438 427 p->serial_in = hub6_serial_in; 439 428 p->serial_out = hub6_serial_out; 440 429 break; 430 + #endif 441 431 442 432 case UPIO_MEM: 443 433 p->serial_in = mem_serial_in; ··· 460 446 p->serial_in = mem32be_serial_in; 461 447 p->serial_out = mem32be_serial_out; 462 448 break; 463 - 464 - default: 449 + #ifdef CONFIG_HAS_IOPORT 450 + case UPIO_PORT: 465 451 p->serial_in = io_serial_in; 466 452 p->serial_out = io_serial_out; 467 453 break; 454 + #endif 455 + default: 456 + WARN(1, "Unsupported UART type %x\n", p->iotype); 457 + p->serial_in = no_serial_in; 458 + p->serial_out = no_serial_out; 468 459 } 469 460 /* Remember loaded iotype */ 470 461 up->cur_iotype = p->iotype; ··· 1193 1174 */ 1194 1175 scratch = serial_in(up, UART_IER); 1195 1176 serial_out(up, UART_IER, 0); 1196 - #ifdef __i386__ 1177 + #if defined(__i386__) && defined(CONFIG_HAS_IOPORT) 1197 1178 outb(0xff, 0x080); 1198 1179 #endif 1199 1180 /* ··· 1202 1183 */ 1203 1184 scratch2 = serial_in(up, UART_IER) & UART_IER_ALL_INTR; 1204 1185 serial_out(up, UART_IER, UART_IER_ALL_INTR); 1205 - #ifdef __i386__ 1186 + #if defined(__i386__) && defined(CONFIG_HAS_IOPORT) 1206 1187 outb(0, 0x080); 1207 1188 #endif 1208 1189 scratch3 = serial_in(up, UART_IER) & UART_IER_ALL_INTR;
+2 -2
drivers/tty/serial/8250/Kconfig
··· 72 72 73 73 config SERIAL_8250_FINTEK 74 74 bool "Support for Fintek variants" 75 - depends on SERIAL_8250 75 + depends on SERIAL_8250 && HAS_IOPORT 76 76 help 77 77 Selecting this option will add support for the RS232 and RS485 78 78 capabilities of the Fintek F81216A LPC to 4 UART as well similar ··· 163 163 164 164 config SERIAL_8250_CS 165 165 tristate "8250/16550 PCMCIA device support" 166 - depends on PCMCIA && SERIAL_8250 166 + depends on PCMCIA && SERIAL_8250 && HAS_IOPORT 167 167 help 168 168 Say Y here to enable support for 16-bit PCMCIA serial devices, 169 169 including serial port cards, modems, and the modem functions of
+1 -1
drivers/tty/serial/Kconfig
··· 877 877 878 878 config SERIAL_JSM 879 879 tristate "Digi International NEO and Classic PCI Support" 880 - depends on PCI 880 + depends on PCI && HAS_IOPORT 881 881 select SERIAL_CORE 882 882 help 883 883 This is a driver for Digi International's Neo and Classic series
+2 -2
drivers/watchdog/Kconfig
··· 1519 1519 1520 1520 config SBC8360_WDT 1521 1521 tristate "SBC8360 Watchdog Timer" 1522 - depends on X86_32 1522 + depends on X86_32 && HAS_IOPORT 1523 1523 help 1524 1524 1525 1525 This is the driver for the hardware watchdog on the SBC8360 Single ··· 1532 1532 1533 1533 config SBC7240_WDT 1534 1534 tristate "SBC Nano 7240 Watchdog Timer" 1535 - depends on X86_32 && !UML 1535 + depends on X86_32 && HAS_IOPORT 1536 1536 help 1537 1537 This is the driver for the hardware watchdog found on the IEI 1538 1538 single board computers EPIC Nano 7240 (and likely others). This
+40 -79
include/asm-generic/div64.h
··· 74 74 * do the trick here). \ 75 75 */ \ 76 76 uint64_t ___res, ___x, ___t, ___m, ___n = (n); \ 77 - uint32_t ___p, ___bias; \ 77 + uint32_t ___p; \ 78 + bool ___bias = false; \ 78 79 \ 79 80 /* determine MSB of b */ \ 80 81 ___p = 1 << ilog2(___b); \ ··· 88 87 ___x = ~0ULL / ___b * ___b - 1; \ 89 88 \ 90 89 /* test our ___m with res = m * x / (p << 64) */ \ 91 - ___res = ((___m & 0xffffffff) * (___x & 0xffffffff)) >> 32; \ 92 - ___t = ___res += (___m & 0xffffffff) * (___x >> 32); \ 93 - ___res += (___x & 0xffffffff) * (___m >> 32); \ 94 - ___t = (___res < ___t) ? (1ULL << 32) : 0; \ 95 - ___res = (___res >> 32) + ___t; \ 96 - ___res += (___m >> 32) * (___x >> 32); \ 97 - ___res /= ___p; \ 90 + ___res = (___m & 0xffffffff) * (___x & 0xffffffff); \ 91 + ___t = (___m & 0xffffffff) * (___x >> 32) + (___res >> 32); \ 92 + ___res = (___m >> 32) * (___x >> 32) + (___t >> 32); \ 93 + ___t = (___m >> 32) * (___x & 0xffffffff) + (___t & 0xffffffff);\ 94 + ___res = (___res + (___t >> 32)) / ___p; \ 98 95 \ 99 - /* Now sanitize and optimize what we've got. */ \ 100 - if (~0ULL % (___b / (___b & -___b)) == 0) { \ 101 - /* special case, can be simplified to ... */ \ 102 - ___n /= (___b & -___b); \ 103 - ___m = ~0ULL / (___b / (___b & -___b)); \ 104 - ___p = 1; \ 105 - ___bias = 1; \ 106 - } else if (___res != ___x / ___b) { \ 96 + /* Now validate what we've got. */ \ 97 + if (___res != ___x / ___b) { \ 107 98 /* \ 108 99 * We can't get away without a bias to compensate \ 109 100 * for bit truncation errors. To avoid it we'd need an \ ··· 104 111 * \ 105 112 * Instead we do m = p / b and n / b = (n * m + m) / p. \ 106 113 */ \ 107 - ___bias = 1; \ 114 + ___bias = true; \ 108 115 /* Compute m = (p << 64) / b */ \ 109 116 ___m = (~0ULL / ___b) * ___p; \ 110 117 ___m += ((~0ULL % ___b + 1) * ___p) / ___b; \ 111 - } else { \ 112 - /* \ 113 - * Reduce m / p, and try to clear bit 31 of m when \ 114 - * possible, otherwise that'll need extra overflow \ 115 - * handling later. \ 116 - */ \ 117 - uint32_t ___bits = -(___m & -___m); \ 118 - ___bits |= ___m >> 32; \ 119 - ___bits = (~___bits) << 1; \ 120 - /* \ 121 - * If ___bits == 0 then setting bit 31 is unavoidable. \ 122 - * Simply apply the maximum possible reduction in that \ 123 - * case. Otherwise the MSB of ___bits indicates the \ 124 - * best reduction we should apply. \ 125 - */ \ 126 - if (!___bits) { \ 127 - ___p /= (___m & -___m); \ 128 - ___m /= (___m & -___m); \ 129 - } else { \ 130 - ___p >>= ilog2(___bits); \ 131 - ___m >>= ilog2(___bits); \ 132 - } \ 133 - /* No bias needed. */ \ 134 - ___bias = 0; \ 135 118 } \ 136 119 \ 120 + /* Reduce m / p to help avoid overflow handling later. */ \ 121 + ___p /= (___m & -___m); \ 122 + ___m /= (___m & -___m); \ 123 + \ 137 124 /* \ 138 - * Now we have a combination of 2 conditions: \ 139 - * \ 140 - * 1) whether or not we need to apply a bias, and \ 141 - * \ 142 - * 2) whether or not there might be an overflow in the cross \ 143 - * product determined by (___m & ((1 << 63) | (1 << 31))). \ 144 - * \ 145 - * Select the best way to do (m_bias + m * n) / (1 << 64). \ 125 + * Perform (m_bias + m * n) / (1 << 64). \ 146 126 * From now on there will be actual runtime code generated. \ 147 127 */ \ 148 128 ___res = __arch_xprod_64(___m, ___n, ___bias); \ ··· 131 165 * Semantic: retval = ((bias ? m : 0) + m * n) >> 64 132 166 * 133 167 * The product is a 128-bit value, scaled down to 64 bits. 134 - * Assuming constant propagation to optimize away unused conditional code. 168 + * Hoping for compile-time optimization of conditional code. 135 169 * Architectures may provide their own optimized assembly implementation. 136 170 */ 137 - static inline uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias) 171 + #ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE 172 + static __always_inline 173 + #else 174 + static inline 175 + #endif 176 + uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias) 138 177 { 139 178 uint32_t m_lo = m; 140 179 uint32_t m_hi = m >> 32; 141 180 uint32_t n_lo = n; 142 181 uint32_t n_hi = n >> 32; 143 - uint64_t res; 144 - uint32_t res_lo, res_hi, tmp; 182 + uint64_t x, y; 145 183 146 - if (!bias) { 147 - res = ((uint64_t)m_lo * n_lo) >> 32; 148 - } else if (!(m & ((1ULL << 63) | (1ULL << 31)))) { 149 - /* there can't be any overflow here */ 150 - res = (m + (uint64_t)m_lo * n_lo) >> 32; 184 + /* Determine if overflow handling can be dispensed with. */ 185 + bool no_ovf = __builtin_constant_p(m) && 186 + ((m >> 32) + (m & 0xffffffff) < 0x100000000); 187 + 188 + if (no_ovf) { 189 + x = (uint64_t)m_lo * n_lo + (bias ? m : 0); 190 + x >>= 32; 191 + x += (uint64_t)m_lo * n_hi; 192 + x += (uint64_t)m_hi * n_lo; 193 + x >>= 32; 194 + x += (uint64_t)m_hi * n_hi; 151 195 } else { 152 - res = m + (uint64_t)m_lo * n_lo; 153 - res_lo = res >> 32; 154 - res_hi = (res_lo < m_hi); 155 - res = res_lo | ((uint64_t)res_hi << 32); 196 + x = (uint64_t)m_lo * n_lo + (bias ? m_lo : 0); 197 + y = (uint64_t)m_lo * n_hi + (uint32_t)(x >> 32) + (bias ? m_hi : 0); 198 + x = (uint64_t)m_hi * n_hi + (uint32_t)(y >> 32); 199 + y = (uint64_t)m_hi * n_lo + (uint32_t)y; 200 + x += (uint32_t)(y >> 32); 156 201 } 157 202 158 - if (!(m & ((1ULL << 63) | (1ULL << 31)))) { 159 - /* there can't be any overflow here */ 160 - res += (uint64_t)m_lo * n_hi; 161 - res += (uint64_t)m_hi * n_lo; 162 - res >>= 32; 163 - } else { 164 - res += (uint64_t)m_lo * n_hi; 165 - tmp = res >> 32; 166 - res += (uint64_t)m_hi * n_lo; 167 - res_lo = res >> 32; 168 - res_hi = (res_lo < tmp); 169 - res = res_lo | ((uint64_t)res_hi << 32); 170 - } 171 - 172 - res += (uint64_t)m_hi * n_hi; 173 - 174 - return res; 203 + return x; 175 204 } 176 205 #endif 177 206
+63 -19
include/asm-generic/io.h
··· 540 540 541 541 #if !defined(inb) && !defined(_inb) 542 542 #define _inb _inb 543 + #ifdef CONFIG_HAS_IOPORT 543 544 static inline u8 _inb(unsigned long addr) 544 545 { 545 546 u8 val; ··· 550 549 __io_par(val); 551 550 return val; 552 551 } 552 + #else 553 + u8 _inb(unsigned long addr) 554 + __compiletime_error("inb()) requires CONFIG_HAS_IOPORT"); 555 + #endif 553 556 #endif 554 557 555 558 #if !defined(inw) && !defined(_inw) 556 559 #define _inw _inw 560 + #ifdef CONFIG_HAS_IOPORT 557 561 static inline u16 _inw(unsigned long addr) 558 562 { 559 563 u16 val; ··· 568 562 __io_par(val); 569 563 return val; 570 564 } 565 + #else 566 + u16 _inw(unsigned long addr) 567 + __compiletime_error("inw() requires CONFIG_HAS_IOPORT"); 568 + #endif 571 569 #endif 572 570 573 571 #if !defined(inl) && !defined(_inl) 574 572 #define _inl _inl 573 + #ifdef CONFIG_HAS_IOPORT 575 574 static inline u32 _inl(unsigned long addr) 576 575 { 577 576 u32 val; ··· 586 575 __io_par(val); 587 576 return val; 588 577 } 578 + #else 579 + u32 _inl(unsigned long addr) 580 + __compiletime_error("inl() requires CONFIG_HAS_IOPORT"); 581 + #endif 589 582 #endif 590 583 591 584 #if !defined(outb) && !defined(_outb) 592 585 #define _outb _outb 586 + #ifdef CONFIG_HAS_IOPORT 593 587 static inline void _outb(u8 value, unsigned long addr) 594 588 { 595 589 __io_pbw(); 596 590 __raw_writeb(value, PCI_IOBASE + addr); 597 591 __io_paw(); 598 592 } 593 + #else 594 + void _outb(u8 value, unsigned long addr) 595 + __compiletime_error("outb() requires CONFIG_HAS_IOPORT"); 596 + #endif 599 597 #endif 600 598 601 599 #if !defined(outw) && !defined(_outw) 602 600 #define _outw _outw 601 + #ifdef CONFIG_HAS_IOPORT 603 602 static inline void _outw(u16 value, unsigned long addr) 604 603 { 605 604 __io_pbw(); 606 605 __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); 607 606 __io_paw(); 608 607 } 608 + #else 609 + void _outw(u16 value, unsigned long addr) 610 + __compiletime_error("outw() requires CONFIG_HAS_IOPORT"); 611 + #endif 609 612 #endif 610 613 611 614 #if !defined(outl) && !defined(_outl) 612 615 #define _outl _outl 616 + #ifdef CONFIG_HAS_IOPORT 613 617 static inline void _outl(u32 value, unsigned long addr) 614 618 { 615 619 __io_pbw(); 616 620 __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); 617 621 __io_paw(); 618 622 } 623 + #else 624 + void _outl(u32 value, unsigned long addr) 625 + __compiletime_error("outl() requires CONFIG_HAS_IOPORT"); 626 + #endif 619 627 #endif 620 628 621 629 #include <linux/logic_pio.h> ··· 718 688 719 689 #ifndef insb 720 690 #define insb insb 691 + #ifdef CONFIG_HAS_IOPORT 721 692 static inline void insb(unsigned long addr, void *buffer, unsigned int count) 722 693 { 723 694 readsb(PCI_IOBASE + addr, buffer, count); 724 695 } 696 + #else 697 + void insb(unsigned long addr, void *buffer, unsigned int count) 698 + __compiletime_error("insb() requires HAS_IOPORT"); 699 + #endif 725 700 #endif 726 701 727 702 #ifndef insw 728 703 #define insw insw 704 + #ifdef CONFIG_HAS_IOPORT 729 705 static inline void insw(unsigned long addr, void *buffer, unsigned int count) 730 706 { 731 707 readsw(PCI_IOBASE + addr, buffer, count); 732 708 } 709 + #else 710 + void insw(unsigned long addr, void *buffer, unsigned int count) 711 + __compiletime_error("insw() requires HAS_IOPORT"); 712 + #endif 733 713 #endif 734 714 735 715 #ifndef insl 736 716 #define insl insl 717 + #ifdef CONFIG_HAS_IOPORT 737 718 static inline void insl(unsigned long addr, void *buffer, unsigned int count) 738 719 { 739 720 readsl(PCI_IOBASE + addr, buffer, count); 740 721 } 722 + #else 723 + void insl(unsigned long addr, void *buffer, unsigned int count) 724 + __compiletime_error("insl() requires HAS_IOPORT"); 725 + #endif 741 726 #endif 742 727 743 728 #ifndef outsb 744 729 #define outsb outsb 730 + #ifdef CONFIG_HAS_IOPORT 745 731 static inline void outsb(unsigned long addr, const void *buffer, 746 732 unsigned int count) 747 733 { 748 734 writesb(PCI_IOBASE + addr, buffer, count); 749 735 } 736 + #else 737 + void outsb(unsigned long addr, const void *buffer, unsigned int count) 738 + __compiletime_error("outsb() requires HAS_IOPORT"); 739 + #endif 750 740 #endif 751 741 752 742 #ifndef outsw 753 743 #define outsw outsw 744 + #ifdef CONFIG_HAS_IOPORT 754 745 static inline void outsw(unsigned long addr, const void *buffer, 755 746 unsigned int count) 756 747 { 757 748 writesw(PCI_IOBASE + addr, buffer, count); 758 749 } 750 + #else 751 + void outsw(unsigned long addr, const void *buffer, unsigned int count) 752 + __compiletime_error("outsw() requires HAS_IOPORT"); 753 + #endif 759 754 #endif 760 755 761 756 #ifndef outsl 762 757 #define outsl outsl 758 + #ifdef CONFIG_HAS_IOPORT 763 759 static inline void outsl(unsigned long addr, const void *buffer, 764 760 unsigned int count) 765 761 { 766 762 writesl(PCI_IOBASE + addr, buffer, count); 767 763 } 764 + #else 765 + void outsl(unsigned long addr, const void *buffer, unsigned int count) 766 + __compiletime_error("outsl() requires HAS_IOPORT"); 767 + #endif 768 768 #endif 769 769 770 770 #ifndef insb_p ··· 1211 1151 #endif 1212 1152 1213 1153 #ifndef memset_io 1214 - #define memset_io memset_io 1215 1154 /** 1216 1155 * memset_io Set a range of I/O memory to a constant value 1217 1156 * @addr: The beginning of the I/O-memory range to set ··· 1219 1160 * 1220 1161 * Set a range of I/O memory to a given value. 1221 1162 */ 1222 - static inline void memset_io(volatile void __iomem *addr, int value, 1223 - size_t size) 1224 - { 1225 - memset(__io_virt(addr), value, size); 1226 - } 1163 + void memset_io(volatile void __iomem *addr, int val, size_t count); 1227 1164 #endif 1228 1165 1229 1166 #ifndef memcpy_fromio 1230 - #define memcpy_fromio memcpy_fromio 1231 1167 /** 1232 1168 * memcpy_fromio Copy a block of data from I/O memory 1233 1169 * @dst: The (RAM) destination for the copy ··· 1231 1177 * 1232 1178 * Copy a block of data from I/O memory. 1233 1179 */ 1234 - static inline void memcpy_fromio(void *buffer, 1235 - const volatile void __iomem *addr, 1236 - size_t size) 1237 - { 1238 - memcpy(buffer, __io_virt(addr), size); 1239 - } 1180 + void memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count); 1240 1181 #endif 1241 1182 1242 1183 #ifndef memcpy_toio 1243 - #define memcpy_toio memcpy_toio 1244 1184 /** 1245 1185 * memcpy_toio Copy a block of data into I/O memory 1246 1186 * @dst: The (I/O memory) destination for the copy ··· 1243 1195 * 1244 1196 * Copy a block of data to I/O memory. 1245 1197 */ 1246 - static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer, 1247 - size_t size) 1248 - { 1249 - memcpy(__io_virt(addr), buffer, size); 1250 - } 1198 + void memcpy_toio(volatile void __iomem *dst, const void *src, size_t count); 1251 1199 #endif 1252 1200 1253 1201 extern int devmem_is_allowed(unsigned long pfn);
+13
include/asm-generic/memory_model.h
··· 64 64 #define page_to_pfn __page_to_pfn 65 65 #define pfn_to_page __pfn_to_page 66 66 67 + #ifdef CONFIG_DEBUG_VIRTUAL 68 + #define page_to_phys(page) \ 69 + ({ \ 70 + unsigned long __pfn = page_to_pfn(page); \ 71 + \ 72 + WARN_ON_ONCE(!pfn_valid(__pfn)); \ 73 + PFN_PHYS(__pfn); \ 74 + }) 75 + #else 76 + #define page_to_phys(page) PFN_PHYS(page_to_pfn(page)) 77 + #endif /* CONFIG_DEBUG_VIRTUAL */ 78 + #define phys_to_page(phys) pfn_to_page(PHYS_PFN(phys)) 79 + 67 80 #endif /* __ASSEMBLY__ */ 68 81 69 82 #endif
+1 -22
include/asm-generic/vga.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Access to VGA videoram 4 - * 5 - * (c) 1998 Martin Mares <mj@ucw.cz> 6 - */ 7 2 #ifndef __ASM_GENERIC_VGA_H 8 3 #define __ASM_GENERIC_VGA_H 9 - 10 - /* 11 - * On most architectures that support VGA, we can just 12 - * recalculate addresses and then access the videoram 13 - * directly without any black magic. 14 - * 15 - * Everyone else needs to ioremap the address and use 16 - * proper I/O accesses. 17 - */ 18 - #ifndef VGA_MAP_MEM 19 - #define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x) 20 - #endif 21 - 22 - #define vga_readb(x) (*(x)) 23 - #define vga_writeb(x, y) (*(y) = (x)) 24 - 25 - #endif /* _ASM_GENERIC_VGA_H */ 4 + #endif /* __ASM_GENERIC_VGA_H */
+4
include/linux/serial_core.h
··· 505 505 * The remaining bits are serial-core specific and not modifiable by 506 506 * userspace. 507 507 */ 508 + #ifdef CONFIG_HAS_IOPORT 508 509 #define UPF_FOURPORT ((__force upf_t) ASYNC_FOURPORT /* 1 */ ) 510 + #else 511 + #define UPF_FOURPORT 0 512 + #endif 509 513 #define UPF_SAK ((__force upf_t) ASYNC_SAK /* 2 */ ) 510 514 #define UPF_SPD_HI ((__force upf_t) ASYNC_SPD_HI /* 4 */ ) 511 515 #define UPF_SPD_VHI ((__force upf_t) ASYNC_SPD_VHI /* 5 */ )
-24
include/linux/vt_buffer.h
··· 28 28 #ifndef VT_BUF_HAVE_MEMSETW 29 29 static inline void scr_memsetw(u16 *s, u16 c, unsigned int count) 30 30 { 31 - #ifdef VT_BUF_HAVE_RW 32 - count /= 2; 33 - while (count--) 34 - scr_writew(c, s++); 35 - #else 36 31 memset16(s, c, count / 2); 37 - #endif 38 32 } 39 33 #endif 40 34 41 35 #ifndef VT_BUF_HAVE_MEMCPYW 42 36 static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count) 43 37 { 44 - #ifdef VT_BUF_HAVE_RW 45 - count /= 2; 46 - while (count--) 47 - scr_writew(scr_readw(s++), d++); 48 - #else 49 38 memcpy(d, s, count); 50 - #endif 51 39 } 52 40 #endif 53 41 54 42 #ifndef VT_BUF_HAVE_MEMMOVEW 55 43 static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count) 56 44 { 57 - #ifdef VT_BUF_HAVE_RW 58 - if (d < s) 59 - scr_memcpyw(d, s, count); 60 - else { 61 - count /= 2; 62 - d += count; 63 - s += count; 64 - while (count--) 65 - scr_writew(scr_readw(--s), --d); 66 - } 67 - #else 68 45 memmove(d, s, count); 69 - #endif 70 46 } 71 47 #endif 72 48
+7 -7
include/uapi/asm-generic/ioctl.h
··· 82 82 * NOTE: _IOW means userland is writing and kernel is reading. _IOR 83 83 * means userland is reading and kernel is writing. 84 84 */ 85 - #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) 86 - #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) 87 - #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) 88 - #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) 89 - #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) 90 - #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) 91 - #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) 85 + #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) 86 + #define _IOR(type,nr,argtype) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(argtype))) 87 + #define _IOW(type,nr,argtype) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(argtype))) 88 + #define _IOWR(type,nr,argtype) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(argtype))) 89 + #define _IOR_BAD(type,nr,argtype) _IOC(_IOC_READ,(type),(nr),sizeof(argtype)) 90 + #define _IOW_BAD(type,nr,argtype) _IOC(_IOC_WRITE,(type),(nr),sizeof(argtype)) 91 + #define _IOWR_BAD(type,nr,argtype) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(argtype)) 92 92 93 93 /* used to decode ioctl numbers.. */ 94 94 #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+1 -1
lib/Makefile
··· 35 35 is_single_threaded.o plist.o decompress.o kobject_uevent.o \ 36 36 earlycpio.o seq_buf.o siphash.o dec_and_lock.o \ 37 37 nmi_backtrace.o win_minmax.o memcat_p.o \ 38 - buildid.o objpool.o union_find.o 38 + buildid.o objpool.o union_find.o iomem_copy.o 39 39 40 40 lib-$(CONFIG_PRINTK) += dump_stack.o 41 41 lib-$(CONFIG_SMP) += cpumask.o
+136
lib/iomem_copy.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright 2024 Kalray, Inc. All Rights Reserved. 4 + */ 5 + 6 + #include <linux/align.h> 7 + #include <linux/export.h> 8 + #include <linux/io.h> 9 + #include <linux/types.h> 10 + #include <linux/unaligned.h> 11 + 12 + #ifndef memset_io 13 + /** 14 + * memset_io() - Set a range of I/O memory to a constant value 15 + * @addr: The beginning of the I/O-memory range to set 16 + * @val: The value to set the memory to 17 + * @count: The number of bytes to set 18 + * 19 + * Set a range of I/O memory to a given value. 20 + */ 21 + void memset_io(volatile void __iomem *addr, int val, size_t count) 22 + { 23 + long qc = (u8)val; 24 + 25 + qc *= ~0UL / 0xff; 26 + 27 + while (count && !IS_ALIGNED((long)addr, sizeof(long))) { 28 + __raw_writeb(val, addr); 29 + addr++; 30 + count--; 31 + } 32 + 33 + while (count >= sizeof(long)) { 34 + #ifdef CONFIG_64BIT 35 + __raw_writeq(qc, addr); 36 + #else 37 + __raw_writel(qc, addr); 38 + #endif 39 + 40 + addr += sizeof(long); 41 + count -= sizeof(long); 42 + } 43 + 44 + while (count) { 45 + __raw_writeb(val, addr); 46 + addr++; 47 + count--; 48 + } 49 + } 50 + EXPORT_SYMBOL(memset_io); 51 + #endif 52 + 53 + #ifndef memcpy_fromio 54 + /** 55 + * memcpy_fromio() - Copy a block of data from I/O memory 56 + * @dst: The (RAM) destination for the copy 57 + * @src: The (I/O memory) source for the data 58 + * @count: The number of bytes to copy 59 + * 60 + * Copy a block of data from I/O memory. 61 + */ 62 + void memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count) 63 + { 64 + while (count && !IS_ALIGNED((long)src, sizeof(long))) { 65 + *(u8 *)dst = __raw_readb(src); 66 + src++; 67 + dst++; 68 + count--; 69 + } 70 + 71 + while (count >= sizeof(long)) { 72 + #ifdef CONFIG_64BIT 73 + long val = __raw_readq(src); 74 + #else 75 + long val = __raw_readl(src); 76 + #endif 77 + put_unaligned(val, (long *)dst); 78 + 79 + 80 + src += sizeof(long); 81 + dst += sizeof(long); 82 + count -= sizeof(long); 83 + } 84 + 85 + while (count) { 86 + *(u8 *)dst = __raw_readb(src); 87 + src++; 88 + dst++; 89 + count--; 90 + } 91 + } 92 + EXPORT_SYMBOL(memcpy_fromio); 93 + #endif 94 + 95 + #ifndef memcpy_toio 96 + /** 97 + * memcpy_toio() -Copy a block of data into I/O memory 98 + * @dst: The (I/O memory) destination for the copy 99 + * @src: The (RAM) source for the data 100 + * @count: The number of bytes to copy 101 + * 102 + * Copy a block of data to I/O memory. 103 + */ 104 + void memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) 105 + { 106 + while (count && !IS_ALIGNED((long)dst, sizeof(long))) { 107 + __raw_writeb(*(u8 *)src, dst); 108 + src++; 109 + dst++; 110 + count--; 111 + } 112 + 113 + while (count >= sizeof(long)) { 114 + long val = get_unaligned((long *)src); 115 + #ifdef CONFIG_64BIT 116 + __raw_writeq(val, dst); 117 + #else 118 + __raw_writel(val, dst); 119 + #endif 120 + 121 + src += sizeof(long); 122 + dst += sizeof(long); 123 + count -= sizeof(long); 124 + } 125 + 126 + while (count) { 127 + __raw_writeb(*(u8 *)src, dst); 128 + src++; 129 + dst++; 130 + count--; 131 + } 132 + } 133 + EXPORT_SYMBOL(memcpy_toio); 134 + #endif 135 + 136 +
+83 -2
lib/math/test_div64.c
··· 26 26 0x0072db27380dd689, 27 27 0x0842f488162e2284, 28 28 0xf66745411d8ab063, 29 + 0xfffffffffffffffb, 30 + 0xfffffffffffffffc, 31 + 0xffffffffffffffff, 29 32 }; 30 33 #define SIZE_DIV64_DIVIDENDS ARRAY_SIZE(test_div64_dividends) 31 34 ··· 40 37 #define TEST_DIV64_DIVISOR_5 0x0008a880 41 38 #define TEST_DIV64_DIVISOR_6 0x003fd3ae 42 39 #define TEST_DIV64_DIVISOR_7 0x0b658fac 43 - #define TEST_DIV64_DIVISOR_8 0xdc08b349 40 + #define TEST_DIV64_DIVISOR_8 0x80000001 41 + #define TEST_DIV64_DIVISOR_9 0xdc08b349 42 + #define TEST_DIV64_DIVISOR_A 0xfffffffe 43 + #define TEST_DIV64_DIVISOR_B 0xffffffff 44 44 45 45 static const u32 test_div64_divisors[] = { 46 46 TEST_DIV64_DIVISOR_0, ··· 55 49 TEST_DIV64_DIVISOR_6, 56 50 TEST_DIV64_DIVISOR_7, 57 51 TEST_DIV64_DIVISOR_8, 52 + TEST_DIV64_DIVISOR_9, 53 + TEST_DIV64_DIVISOR_A, 54 + TEST_DIV64_DIVISOR_B, 58 55 }; 59 56 #define SIZE_DIV64_DIVISORS ARRAY_SIZE(test_div64_divisors) 60 57 61 58 static const struct { 62 59 u64 quotient; 63 60 u32 remainder; 64 - } test_div64_results[SIZE_DIV64_DIVISORS][SIZE_DIV64_DIVIDENDS] = { 61 + } test_div64_results[SIZE_DIV64_DIVIDENDS][SIZE_DIV64_DIVISORS] = { 65 62 { 66 63 { 0x0000000013045e47, 0x00000001 }, 67 64 { 0x000000000161596c, 0x00000030 }, ··· 74 65 { 0x00000000000013c4, 0x0004ce80 }, 75 66 { 0x00000000000002ae, 0x001e143c }, 76 67 { 0x000000000000000f, 0x0033e56c }, 68 + { 0x0000000000000001, 0x2b27507f }, 69 + { 0x0000000000000000, 0xab275080 }, 70 + { 0x0000000000000000, 0xab275080 }, 77 71 { 0x0000000000000000, 0xab275080 }, 78 72 }, { 79 73 { 0x00000001c45c02d1, 0x00000000 }, ··· 87 75 { 0x000000000001d637, 0x0004e5d9 }, 88 76 { 0x0000000000003fc9, 0x000713bb }, 89 77 { 0x0000000000000165, 0x029abe7d }, 78 + { 0x000000000000001f, 0x673c193a }, 90 79 { 0x0000000000000012, 0x6e9f7e37 }, 80 + { 0x000000000000000f, 0xe73c1977 }, 81 + { 0x000000000000000f, 0xe73c1968 }, 91 82 }, { 92 83 { 0x000000197a3a0cf7, 0x00000002 }, 93 84 { 0x00000001d9632e5c, 0x00000021 }, ··· 100 85 { 0x00000000001a7bb3, 0x00072331 }, 101 86 { 0x00000000000397ad, 0x0002c61b }, 102 87 { 0x000000000000141e, 0x06ea2e89 }, 88 + { 0x00000000000001ca, 0x4c0a72e7 }, 103 89 { 0x000000000000010a, 0xab002ad7 }, 90 + { 0x00000000000000e5, 0x4c0a767b }, 91 + { 0x00000000000000e5, 0x4c0a7596 }, 104 92 }, { 105 93 { 0x0000017949e37538, 0x00000001 }, 106 94 { 0x0000001b62441f37, 0x00000055 }, ··· 113 95 { 0x0000000001882ec6, 0x0005cbf9 }, 114 96 { 0x000000000035333b, 0x0017abdf }, 115 97 { 0x00000000000129f1, 0x0ab4520d }, 98 + { 0x0000000000001a87, 0x18ff0472 }, 116 99 { 0x0000000000000f6e, 0x8ac0ce9b }, 100 + { 0x0000000000000d43, 0x98ff397f }, 101 + { 0x0000000000000d43, 0x98ff2c3c }, 117 102 }, { 118 103 { 0x000011f321a74e49, 0x00000006 }, 119 104 { 0x0000014d8481d211, 0x0000005b }, ··· 126 105 { 0x0000000012a88828, 0x00036c97 }, 127 106 { 0x000000000287f16f, 0x002c2a25 }, 128 107 { 0x00000000000e2cc7, 0x02d581e3 }, 108 + { 0x0000000000014318, 0x2ee07d7f }, 129 109 { 0x000000000000bbf4, 0x1ba08c03 }, 110 + { 0x000000000000a18c, 0x2ee303af }, 111 + { 0x000000000000a18c, 0x2ee26223 }, 130 112 }, { 131 113 { 0x0000d8db8f72935d, 0x00000005 }, 132 114 { 0x00000fbd5aed7a2e, 0x00000002 }, ··· 139 115 { 0x00000000e16b20fa, 0x0002a14a }, 140 116 { 0x000000001e940d22, 0x00353b2e }, 141 117 { 0x0000000000ab40ac, 0x06fba6ba }, 118 + { 0x00000000000f3f70, 0x0af7eeda }, 142 119 { 0x000000000008debd, 0x72d98365 }, 120 + { 0x0000000000079fb8, 0x0b166dba }, 121 + { 0x0000000000079fb8, 0x0b0ece02 }, 143 122 }, { 144 123 { 0x000cc3045b8fc281, 0x00000000 }, 145 124 { 0x0000ed1f48b5c9fc, 0x00000079 }, ··· 152 125 { 0x0000000d43fce827, 0x00082b09 }, 153 126 { 0x00000001ccaba11a, 0x0037e8dd }, 154 127 { 0x000000000a13f729, 0x0566dffd }, 128 + { 0x0000000000e5b64e, 0x3728203b }, 155 129 { 0x000000000085a14b, 0x23d36726 }, 130 + { 0x000000000072db27, 0x38f38cd7 }, 131 + { 0x000000000072db27, 0x3880b1b0 }, 156 132 }, { 157 133 { 0x00eafeb9c993592b, 0x00000001 }, 158 134 { 0x00110e5befa9a991, 0x00000048 }, ··· 165 135 { 0x000000f4459740fc, 0x00084484 }, 166 136 { 0x0000002122c47bf9, 0x002ca446 }, 167 137 { 0x00000000b9936290, 0x004979c4 }, 138 + { 0x000000001085e910, 0x05a83974 }, 168 139 { 0x00000000099ca89d, 0x9db446bf }, 140 + { 0x000000000842f488, 0x26b40b94 }, 141 + { 0x000000000842f488, 0x1e71170c }, 169 142 }, { 170 143 { 0x1b60cece589da1d2, 0x00000001 }, 171 144 { 0x01fcb42be1453f5b, 0x0000004f }, ··· 178 145 { 0x00001c757dfab350, 0x00048863 }, 179 146 { 0x000003dc4979c652, 0x00224ea7 }, 180 147 { 0x000000159edc3144, 0x06409ab3 }, 148 + { 0x00000001ecce8a7e, 0x30bc25e5 }, 181 149 { 0x000000011eadfee3, 0xa99c48a8 }, 150 + { 0x00000000f6674543, 0x0a593ae9 }, 151 + { 0x00000000f6674542, 0x13f1f5a5 }, 152 + }, { 153 + { 0x1c71c71c71c71c71, 0x00000002 }, 154 + { 0x0210842108421084, 0x0000000b }, 155 + { 0x007f01fc07f01fc0, 0x000000fb }, 156 + { 0x00014245eabf1f9a, 0x0000a63d }, 157 + { 0x0000ffffffffffff, 0x0000fffb }, 158 + { 0x00001d913cecc509, 0x0007937b }, 159 + { 0x00000402c70c678f, 0x0005bfc9 }, 160 + { 0x00000016766cb70b, 0x045edf97 }, 161 + { 0x00000001fffffffb, 0x80000000 }, 162 + { 0x0000000129d84b3a, 0xa2e8fe71 }, 163 + { 0x0000000100000001, 0xfffffffd }, 164 + { 0x0000000100000000, 0xfffffffb }, 165 + }, { 166 + { 0x1c71c71c71c71c71, 0x00000003 }, 167 + { 0x0210842108421084, 0x0000000c }, 168 + { 0x007f01fc07f01fc0, 0x000000fc }, 169 + { 0x00014245eabf1f9a, 0x0000a63e }, 170 + { 0x0000ffffffffffff, 0x0000fffc }, 171 + { 0x00001d913cecc509, 0x0007937c }, 172 + { 0x00000402c70c678f, 0x0005bfca }, 173 + { 0x00000016766cb70b, 0x045edf98 }, 174 + { 0x00000001fffffffc, 0x00000000 }, 175 + { 0x0000000129d84b3a, 0xa2e8fe72 }, 176 + { 0x0000000100000002, 0x00000000 }, 177 + { 0x0000000100000000, 0xfffffffc }, 178 + }, { 179 + { 0x1c71c71c71c71c71, 0x00000006 }, 180 + { 0x0210842108421084, 0x0000000f }, 181 + { 0x007f01fc07f01fc0, 0x000000ff }, 182 + { 0x00014245eabf1f9a, 0x0000a641 }, 183 + { 0x0000ffffffffffff, 0x0000ffff }, 184 + { 0x00001d913cecc509, 0x0007937f }, 185 + { 0x00000402c70c678f, 0x0005bfcd }, 186 + { 0x00000016766cb70b, 0x045edf9b }, 187 + { 0x00000001fffffffc, 0x00000003 }, 188 + { 0x0000000129d84b3a, 0xa2e8fe75 }, 189 + { 0x0000000100000002, 0x00000003 }, 190 + { 0x0000000100000001, 0x00000000 }, 182 191 }, 183 192 }; 184 193 ··· 282 207 if (!test_div64_one(dividend, TEST_DIV64_DIVISOR_7, i, 7)) 283 208 return false; 284 209 if (!test_div64_one(dividend, TEST_DIV64_DIVISOR_8, i, 8)) 210 + return false; 211 + if (!test_div64_one(dividend, TEST_DIV64_DIVISOR_9, i, 9)) 212 + return false; 213 + if (!test_div64_one(dividend, TEST_DIV64_DIVISOR_A, i, 10)) 214 + return false; 215 + if (!test_div64_one(dividend, TEST_DIV64_DIVISOR_B, i, 11)) 285 216 return false; 286 217 for (j = 0; j < SIZE_DIV64_DIVISORS; j++) { 287 218 if (!test_div64_one(dividend, test_div64_divisors[j],