Merge branch 'master' of /home/trondmy/kernel/linux-2.6/

+3170 -2229
+10
Documentation/feature-removal-schedule.txt
··· 177 177 178 178 --------------------------- 179 179 180 + What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports 181 + (temporary transition config option provided until then) 182 + The transition config option will also be removed at the same time. 183 + When: before 2.6.19 184 + Why: Unused symbols are both increasing the size of the kernel binary 185 + and are often a sign of "wrong API" 186 + Who: Arjan van de Ven <arjan@linux.intel.com> 187 + 188 + --------------------------- 189 + 180 190 What: remove EXPORT_SYMBOL(tasklist_lock) 181 191 When: August 2006 182 192 Files: kernel/fork.c
+2 -71
Documentation/watchdog/pcwd-watchdog.txt
··· 22 22 to run the program with an "&" to run it in the background!) 23 23 24 24 If you want to write a program to be compatible with the PC Watchdog 25 - driver, simply do the following: 25 + driver, simply use of modify the watchdog test program: 26 + Documentation/watchdog/src/watchdog-test.c 26 27 27 - -- Snippet of code -- 28 - /* 29 - * Watchdog Driver Test Program 30 - */ 31 - 32 - #include <stdio.h> 33 - #include <stdlib.h> 34 - #include <string.h> 35 - #include <unistd.h> 36 - #include <fcntl.h> 37 - #include <sys/ioctl.h> 38 - #include <linux/types.h> 39 - #include <linux/watchdog.h> 40 - 41 - int fd; 42 - 43 - /* 44 - * This function simply sends an IOCTL to the driver, which in turn ticks 45 - * the PC Watchdog card to reset its internal timer so it doesn't trigger 46 - * a computer reset. 47 - */ 48 - void keep_alive(void) 49 - { 50 - int dummy; 51 - 52 - ioctl(fd, WDIOC_KEEPALIVE, &dummy); 53 - } 54 - 55 - /* 56 - * The main program. Run the program with "-d" to disable the card, 57 - * or "-e" to enable the card. 58 - */ 59 - int main(int argc, char *argv[]) 60 - { 61 - fd = open("/dev/watchdog", O_WRONLY); 62 - 63 - if (fd == -1) { 64 - fprintf(stderr, "Watchdog device not enabled.\n"); 65 - fflush(stderr); 66 - exit(-1); 67 - } 68 - 69 - if (argc > 1) { 70 - if (!strncasecmp(argv[1], "-d", 2)) { 71 - ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD); 72 - fprintf(stderr, "Watchdog card disabled.\n"); 73 - fflush(stderr); 74 - exit(0); 75 - } else if (!strncasecmp(argv[1], "-e", 2)) { 76 - ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD); 77 - fprintf(stderr, "Watchdog card enabled.\n"); 78 - fflush(stderr); 79 - exit(0); 80 - } else { 81 - fprintf(stderr, "-d to disable, -e to enable.\n"); 82 - fprintf(stderr, "run by itself to tick the card.\n"); 83 - fflush(stderr); 84 - exit(0); 85 - } 86 - } else { 87 - fprintf(stderr, "Watchdog Ticking Away!\n"); 88 - fflush(stderr); 89 - } 90 - 91 - while(1) { 92 - keep_alive(); 93 - sleep(1); 94 - } 95 - } 96 - -- End snippet -- 97 28 98 29 Other IOCTL functions include: 99 30
+15
Documentation/watchdog/src/watchdog-simple.c
··· 1 + #include <stdlib.h> 2 + #include <fcntl.h> 3 + 4 + int main(int argc, const char *argv[]) { 5 + int fd = open("/dev/watchdog", O_WRONLY); 6 + if (fd == -1) { 7 + perror("watchdog"); 8 + exit(1); 9 + } 10 + while (1) { 11 + write(fd, "\0", 1); 12 + fsync(fd); 13 + sleep(10); 14 + } 15 + }
+68
Documentation/watchdog/src/watchdog-test.c
··· 1 + /* 2 + * Watchdog Driver Test Program 3 + */ 4 + 5 + #include <stdio.h> 6 + #include <stdlib.h> 7 + #include <string.h> 8 + #include <unistd.h> 9 + #include <fcntl.h> 10 + #include <sys/ioctl.h> 11 + #include <linux/types.h> 12 + #include <linux/watchdog.h> 13 + 14 + int fd; 15 + 16 + /* 17 + * This function simply sends an IOCTL to the driver, which in turn ticks 18 + * the PC Watchdog card to reset its internal timer so it doesn't trigger 19 + * a computer reset. 20 + */ 21 + void keep_alive(void) 22 + { 23 + int dummy; 24 + 25 + ioctl(fd, WDIOC_KEEPALIVE, &dummy); 26 + } 27 + 28 + /* 29 + * The main program. Run the program with "-d" to disable the card, 30 + * or "-e" to enable the card. 31 + */ 32 + int main(int argc, char *argv[]) 33 + { 34 + fd = open("/dev/watchdog", O_WRONLY); 35 + 36 + if (fd == -1) { 37 + fprintf(stderr, "Watchdog device not enabled.\n"); 38 + fflush(stderr); 39 + exit(-1); 40 + } 41 + 42 + if (argc > 1) { 43 + if (!strncasecmp(argv[1], "-d", 2)) { 44 + ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD); 45 + fprintf(stderr, "Watchdog card disabled.\n"); 46 + fflush(stderr); 47 + exit(0); 48 + } else if (!strncasecmp(argv[1], "-e", 2)) { 49 + ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD); 50 + fprintf(stderr, "Watchdog card enabled.\n"); 51 + fflush(stderr); 52 + exit(0); 53 + } else { 54 + fprintf(stderr, "-d to disable, -e to enable.\n"); 55 + fprintf(stderr, "run by itself to tick the card.\n"); 56 + fflush(stderr); 57 + exit(0); 58 + } 59 + } else { 60 + fprintf(stderr, "Watchdog Ticking Away!\n"); 61 + fflush(stderr); 62 + } 63 + 64 + while(1) { 65 + keep_alive(); 66 + sleep(1); 67 + } 68 + }
+39 -17
Documentation/watchdog/watchdog-api.txt
··· 34 34 the watchdog is pinged within a certain time, this time is called the 35 35 timeout or margin. The simplest way to ping the watchdog is to write 36 36 some data to the device. So a very simple watchdog daemon would look 37 - like this: 38 - 39 - #include <stdlib.h> 40 - #include <fcntl.h> 41 - 42 - int main(int argc, const char *argv[]) { 43 - int fd=open("/dev/watchdog",O_WRONLY); 44 - if (fd==-1) { 45 - perror("watchdog"); 46 - exit(1); 47 - } 48 - while(1) { 49 - write(fd, "\0", 1); 50 - sleep(10); 51 - } 52 - } 37 + like this source file: see Documentation/watchdog/src/watchdog-simple.c 53 38 54 39 A more advanced driver could for example check that a HTTP server is 55 40 still responding before doing the write call to ping the watchdog. ··· 95 110 ioctl(fd, WDIOC_GETTIMEOUT, &timeout); 96 111 printf("The timeout was is %d seconds\n", timeout); 97 112 98 - Envinronmental monitoring: 113 + Pretimeouts: 114 + 115 + Some watchdog timers can be set to have a trigger go off before the 116 + actual time they will reset the system. This can be done with an NMI, 117 + interrupt, or other mechanism. This allows Linux to record useful 118 + information (like panic information and kernel coredumps) before it 119 + resets. 120 + 121 + pretimeout = 10; 122 + ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout); 123 + 124 + Note that the pretimeout is the number of seconds before the time 125 + when the timeout will go off. It is not the number of seconds until 126 + the pretimeout. So, for instance, if you set the timeout to 60 seconds 127 + and the pretimeout to 10 seconds, the pretimout will go of in 50 128 + seconds. Setting a pretimeout to zero disables it. 129 + 130 + There is also a get function for getting the pretimeout: 131 + 132 + ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout); 133 + printf("The pretimeout was is %d seconds\n", timeout); 134 + 135 + Not all watchdog drivers will support a pretimeout. 136 + 137 + Get the number of seconds before reboot: 138 + 139 + Some watchdog drivers have the ability to report the remaining time 140 + before the system will reboot. The WDIOC_GETTIMELEFT is the ioctl 141 + that returns the number of seconds before reboot. 142 + 143 + ioctl(fd, WDIOC_GETTIMELEFT, &timeleft); 144 + printf("The timeout was is %d seconds\n", timeleft); 145 + 146 + Environmental monitoring: 99 147 100 148 All watchdog drivers are required return more information about the system, 101 149 some do temperature, fan and power level monitoring, some can tell you ··· 186 168 The watchdog saw a keepalive ping since it was last queried. 187 169 188 170 WDIOF_SETTIMEOUT Can set/get the timeout 171 + 172 + The watchdog can do pretimeouts. 173 + 174 + WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set 189 175 190 176 191 177 For those drivers that return any bits set in the option field, the
+1 -22
Documentation/watchdog/watchdog.txt
··· 65 65 Minor numbers are however allocated for it. 66 66 67 67 68 - Example Watchdog Driver 69 - ----------------------- 70 - 71 - #include <stdio.h> 72 - #include <unistd.h> 73 - #include <fcntl.h> 74 - 75 - int main(int argc, const char *argv[]) 76 - { 77 - int fd=open("/dev/watchdog",O_WRONLY); 78 - if(fd==-1) 79 - { 80 - perror("watchdog"); 81 - exit(1); 82 - } 83 - while(1) 84 - { 85 - write(fd,"\0",1); 86 - fsync(fd); 87 - sleep(10); 88 - } 89 - } 68 + Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c 90 69 91 70 92 71 Contact Information
+9
arch/arm/Kconfig
··· 188 188 189 189 config ARCH_IOP3XX 190 190 bool "IOP3xx-based" 191 + depends on MMU 191 192 select PCI 192 193 help 193 194 Support for Intel's IOP3XX (XScale) family of processors. 194 195 195 196 config ARCH_IXP4XX 196 197 bool "IXP4xx-based" 198 + depends on MMU 197 199 help 198 200 Support for Intel's IXP4XX (XScale) family of processors. 199 201 200 202 config ARCH_IXP2000 201 203 bool "IXP2400/2800-based" 204 + depends on MMU 202 205 select PCI 203 206 help 204 207 Support for Intel's IXP2400/2800 (XScale) family of processors. 205 208 206 209 config ARCH_IXP23XX 207 210 bool "IXP23XX-based" 211 + depends on MMU 208 212 select PCI 209 213 help 210 214 Support for Intel's IXP23xx (XScale) family of processors. ··· 233 229 234 230 config ARCH_PXA 235 231 bool "PXA2xx-based" 232 + depends on MMU 236 233 select ARCH_MTD_XIP 237 234 help 238 235 Support for Intel's PXA2XX processor line. ··· 343 338 bool 344 339 depends on CPU_XSCALE && !XSCALE_PMU_TIMER 345 340 default y 341 + 342 + if !MMU 343 + source "arch/arm/Kconfig-nommu" 344 + endif 346 345 347 346 endmenu 348 347
+3
arch/arm/kernel/Makefile
··· 22 22 obj-$(CONFIG_SMP) += smp.o 23 23 obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o 24 24 25 + obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o 26 + AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312 27 + 25 28 obj-$(CONFIG_IWMMXT) += iwmmxt.o 26 29 AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 27 30
+8 -5
arch/arm/kernel/armksyms.c
··· 109 109 EXPORT_SYMBOL(__memzero); 110 110 111 111 /* user mem (segment) */ 112 - EXPORT_SYMBOL(__arch_copy_from_user); 113 - EXPORT_SYMBOL(__arch_copy_to_user); 114 - EXPORT_SYMBOL(__arch_clear_user); 115 - EXPORT_SYMBOL(__arch_strnlen_user); 116 - EXPORT_SYMBOL(__arch_strncpy_from_user); 112 + EXPORT_SYMBOL(__strnlen_user); 113 + EXPORT_SYMBOL(__strncpy_from_user); 114 + 115 + #ifdef CONFIG_MMU 116 + EXPORT_SYMBOL(__copy_from_user); 117 + EXPORT_SYMBOL(__copy_to_user); 118 + EXPORT_SYMBOL(__clear_user); 117 119 118 120 EXPORT_SYMBOL(__get_user_1); 119 121 EXPORT_SYMBOL(__get_user_2); ··· 125 123 EXPORT_SYMBOL(__put_user_2); 126 124 EXPORT_SYMBOL(__put_user_4); 127 125 EXPORT_SYMBOL(__put_user_8); 126 + #endif 128 127 129 128 /* crypto hash */ 130 129 EXPORT_SYMBOL(sha_transform);
+3
arch/arm/kernel/asm-offsets.c
··· 60 60 #ifdef CONFIG_IWMMXT 61 61 DEFINE(TI_IWMMXT_STATE, offsetof(struct thread_info, fpstate.iwmmxt)); 62 62 #endif 63 + #ifdef CONFIG_CRUNCH 64 + DEFINE(TI_CRUNCH_STATE, offsetof(struct thread_info, crunchstate)); 65 + #endif 63 66 BLANK(); 64 67 DEFINE(S_R0, offsetof(struct pt_regs, ARM_r0)); 65 68 DEFINE(S_R1, offsetof(struct pt_regs, ARM_r1));
+305
arch/arm/kernel/crunch-bits.S
··· 1 + /* 2 + * arch/arm/kernel/crunch-bits.S 3 + * Cirrus MaverickCrunch context switching and handling 4 + * 5 + * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> 6 + * 7 + * Shamelessly stolen from the iWMMXt code by Nicolas Pitre, which is 8 + * Copyright (c) 2003-2004, MontaVista Software, Inc. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License version 2 as 12 + * published by the Free Software Foundation. 13 + */ 14 + 15 + #include <linux/linkage.h> 16 + #include <asm/ptrace.h> 17 + #include <asm/thread_info.h> 18 + #include <asm/asm-offsets.h> 19 + #include <asm/arch/ep93xx-regs.h> 20 + 21 + /* 22 + * We can't use hex constants here due to a bug in gas. 23 + */ 24 + #define CRUNCH_MVDX0 0 25 + #define CRUNCH_MVDX1 8 26 + #define CRUNCH_MVDX2 16 27 + #define CRUNCH_MVDX3 24 28 + #define CRUNCH_MVDX4 32 29 + #define CRUNCH_MVDX5 40 30 + #define CRUNCH_MVDX6 48 31 + #define CRUNCH_MVDX7 56 32 + #define CRUNCH_MVDX8 64 33 + #define CRUNCH_MVDX9 72 34 + #define CRUNCH_MVDX10 80 35 + #define CRUNCH_MVDX11 88 36 + #define CRUNCH_MVDX12 96 37 + #define CRUNCH_MVDX13 104 38 + #define CRUNCH_MVDX14 112 39 + #define CRUNCH_MVDX15 120 40 + #define CRUNCH_MVAX0L 128 41 + #define CRUNCH_MVAX0M 132 42 + #define CRUNCH_MVAX0H 136 43 + #define CRUNCH_MVAX1L 140 44 + #define CRUNCH_MVAX1M 144 45 + #define CRUNCH_MVAX1H 148 46 + #define CRUNCH_MVAX2L 152 47 + #define CRUNCH_MVAX2M 156 48 + #define CRUNCH_MVAX2H 160 49 + #define CRUNCH_MVAX3L 164 50 + #define CRUNCH_MVAX3M 168 51 + #define CRUNCH_MVAX3H 172 52 + #define CRUNCH_DSPSC 176 53 + 54 + #define CRUNCH_SIZE 184 55 + 56 + .text 57 + 58 + /* 59 + * Lazy switching of crunch coprocessor context 60 + * 61 + * r10 = struct thread_info pointer 62 + * r9 = ret_from_exception 63 + * lr = undefined instr exit 64 + * 65 + * called from prefetch exception handler with interrupts disabled 66 + */ 67 + ENTRY(crunch_task_enable) 68 + ldr r8, =(EP93XX_APB_VIRT_BASE + 0x00130000) @ syscon addr 69 + 70 + ldr r1, [r8, #0x80] 71 + tst r1, #0x00800000 @ access to crunch enabled? 72 + movne pc, lr @ if so no business here 73 + mov r3, #0xaa @ unlock syscon swlock 74 + str r3, [r8, #0xc0] 75 + orr r1, r1, #0x00800000 @ enable access to crunch 76 + str r1, [r8, #0x80] 77 + 78 + ldr r3, =crunch_owner 79 + add r0, r10, #TI_CRUNCH_STATE @ get task crunch save area 80 + ldr r2, [sp, #60] @ current task pc value 81 + ldr r1, [r3] @ get current crunch owner 82 + str r0, [r3] @ this task now owns crunch 83 + sub r2, r2, #4 @ adjust pc back 84 + str r2, [sp, #60] 85 + 86 + ldr r2, [r8, #0x80] 87 + mov r2, r2 @ flush out enable (@@@) 88 + 89 + teq r1, #0 @ test for last ownership 90 + mov lr, r9 @ normal exit from exception 91 + beq crunch_load @ no owner, skip save 92 + 93 + crunch_save: 94 + cfstr64 mvdx0, [r1, #CRUNCH_MVDX0] @ save 64b registers 95 + cfstr64 mvdx1, [r1, #CRUNCH_MVDX1] 96 + cfstr64 mvdx2, [r1, #CRUNCH_MVDX2] 97 + cfstr64 mvdx3, [r1, #CRUNCH_MVDX3] 98 + cfstr64 mvdx4, [r1, #CRUNCH_MVDX4] 99 + cfstr64 mvdx5, [r1, #CRUNCH_MVDX5] 100 + cfstr64 mvdx6, [r1, #CRUNCH_MVDX6] 101 + cfstr64 mvdx7, [r1, #CRUNCH_MVDX7] 102 + cfstr64 mvdx8, [r1, #CRUNCH_MVDX8] 103 + cfstr64 mvdx9, [r1, #CRUNCH_MVDX9] 104 + cfstr64 mvdx10, [r1, #CRUNCH_MVDX10] 105 + cfstr64 mvdx11, [r1, #CRUNCH_MVDX11] 106 + cfstr64 mvdx12, [r1, #CRUNCH_MVDX12] 107 + cfstr64 mvdx13, [r1, #CRUNCH_MVDX13] 108 + cfstr64 mvdx14, [r1, #CRUNCH_MVDX14] 109 + cfstr64 mvdx15, [r1, #CRUNCH_MVDX15] 110 + 111 + #ifdef __ARMEB__ 112 + #error fix me for ARMEB 113 + #endif 114 + 115 + cfmv32al mvfx0, mvax0 @ save 72b accumulators 116 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX0L] 117 + cfmv32am mvfx0, mvax0 118 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX0M] 119 + cfmv32ah mvfx0, mvax0 120 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX0H] 121 + cfmv32al mvfx0, mvax1 122 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX1L] 123 + cfmv32am mvfx0, mvax1 124 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX1M] 125 + cfmv32ah mvfx0, mvax1 126 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX1H] 127 + cfmv32al mvfx0, mvax2 128 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX2L] 129 + cfmv32am mvfx0, mvax2 130 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX2M] 131 + cfmv32ah mvfx0, mvax2 132 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX2H] 133 + cfmv32al mvfx0, mvax3 134 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX3L] 135 + cfmv32am mvfx0, mvax3 136 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX3M] 137 + cfmv32ah mvfx0, mvax3 138 + cfstr32 mvfx0, [r1, #CRUNCH_MVAX3H] 139 + 140 + cfmv32sc mvdx0, dspsc @ save status word 141 + cfstr64 mvdx0, [r1, #CRUNCH_DSPSC] 142 + 143 + teq r0, #0 @ anything to load? 144 + cfldr64eq mvdx0, [r1, #CRUNCH_MVDX0] @ mvdx0 was clobbered 145 + moveq pc, lr 146 + 147 + crunch_load: 148 + cfldr64 mvdx0, [r0, #CRUNCH_DSPSC] @ load status word 149 + cfmvsc32 dspsc, mvdx0 150 + 151 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX0L] @ load 72b accumulators 152 + cfmval32 mvax0, mvfx0 153 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX0M] 154 + cfmvam32 mvax0, mvfx0 155 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX0H] 156 + cfmvah32 mvax0, mvfx0 157 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX1L] 158 + cfmval32 mvax1, mvfx0 159 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX1M] 160 + cfmvam32 mvax1, mvfx0 161 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX1H] 162 + cfmvah32 mvax1, mvfx0 163 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX2L] 164 + cfmval32 mvax2, mvfx0 165 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX2M] 166 + cfmvam32 mvax2, mvfx0 167 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX2H] 168 + cfmvah32 mvax2, mvfx0 169 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX3L] 170 + cfmval32 mvax3, mvfx0 171 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX3M] 172 + cfmvam32 mvax3, mvfx0 173 + cfldr32 mvfx0, [r0, #CRUNCH_MVAX3H] 174 + cfmvah32 mvax3, mvfx0 175 + 176 + cfldr64 mvdx0, [r0, #CRUNCH_MVDX0] @ load 64b registers 177 + cfldr64 mvdx1, [r0, #CRUNCH_MVDX1] 178 + cfldr64 mvdx2, [r0, #CRUNCH_MVDX2] 179 + cfldr64 mvdx3, [r0, #CRUNCH_MVDX3] 180 + cfldr64 mvdx4, [r0, #CRUNCH_MVDX4] 181 + cfldr64 mvdx5, [r0, #CRUNCH_MVDX5] 182 + cfldr64 mvdx6, [r0, #CRUNCH_MVDX6] 183 + cfldr64 mvdx7, [r0, #CRUNCH_MVDX7] 184 + cfldr64 mvdx8, [r0, #CRUNCH_MVDX8] 185 + cfldr64 mvdx9, [r0, #CRUNCH_MVDX9] 186 + cfldr64 mvdx10, [r0, #CRUNCH_MVDX10] 187 + cfldr64 mvdx11, [r0, #CRUNCH_MVDX11] 188 + cfldr64 mvdx12, [r0, #CRUNCH_MVDX12] 189 + cfldr64 mvdx13, [r0, #CRUNCH_MVDX13] 190 + cfldr64 mvdx14, [r0, #CRUNCH_MVDX14] 191 + cfldr64 mvdx15, [r0, #CRUNCH_MVDX15] 192 + 193 + mov pc, lr 194 + 195 + /* 196 + * Back up crunch regs to save area and disable access to them 197 + * (mainly for gdb or sleep mode usage) 198 + * 199 + * r0 = struct thread_info pointer of target task or NULL for any 200 + */ 201 + ENTRY(crunch_task_disable) 202 + stmfd sp!, {r4, r5, lr} 203 + 204 + mrs ip, cpsr 205 + orr r2, ip, #PSR_I_BIT @ disable interrupts 206 + msr cpsr_c, r2 207 + 208 + ldr r4, =(EP93XX_APB_VIRT_BASE + 0x00130000) @ syscon addr 209 + 210 + ldr r3, =crunch_owner 211 + add r2, r0, #TI_CRUNCH_STATE @ get task crunch save area 212 + ldr r1, [r3] @ get current crunch owner 213 + teq r1, #0 @ any current owner? 214 + beq 1f @ no: quit 215 + teq r0, #0 @ any owner? 216 + teqne r1, r2 @ or specified one? 217 + bne 1f @ no: quit 218 + 219 + ldr r5, [r4, #0x80] @ enable access to crunch 220 + mov r2, #0xaa 221 + str r2, [r4, #0xc0] 222 + orr r5, r5, #0x00800000 223 + str r5, [r4, #0x80] 224 + 225 + mov r0, #0 @ nothing to load 226 + str r0, [r3] @ no more current owner 227 + ldr r2, [r4, #0x80] @ flush out enable (@@@) 228 + mov r2, r2 229 + bl crunch_save 230 + 231 + mov r2, #0xaa @ disable access to crunch 232 + str r2, [r4, #0xc0] 233 + bic r5, r5, #0x00800000 234 + str r5, [r4, #0x80] 235 + ldr r5, [r4, #0x80] @ flush out enable (@@@) 236 + mov r5, r5 237 + 238 + 1: msr cpsr_c, ip @ restore interrupt mode 239 + ldmfd sp!, {r4, r5, pc} 240 + 241 + /* 242 + * Copy crunch state to given memory address 243 + * 244 + * r0 = struct thread_info pointer of target task 245 + * r1 = memory address where to store crunch state 246 + * 247 + * this is called mainly in the creation of signal stack frames 248 + */ 249 + ENTRY(crunch_task_copy) 250 + mrs ip, cpsr 251 + orr r2, ip, #PSR_I_BIT @ disable interrupts 252 + msr cpsr_c, r2 253 + 254 + ldr r3, =crunch_owner 255 + add r2, r0, #TI_CRUNCH_STATE @ get task crunch save area 256 + ldr r3, [r3] @ get current crunch owner 257 + teq r2, r3 @ does this task own it... 258 + beq 1f 259 + 260 + @ current crunch values are in the task save area 261 + msr cpsr_c, ip @ restore interrupt mode 262 + mov r0, r1 263 + mov r1, r2 264 + mov r2, #CRUNCH_SIZE 265 + b memcpy 266 + 267 + 1: @ this task owns crunch regs -- grab a copy from there 268 + mov r0, #0 @ nothing to load 269 + mov r3, lr @ preserve return address 270 + bl crunch_save 271 + msr cpsr_c, ip @ restore interrupt mode 272 + mov pc, r3 273 + 274 + /* 275 + * Restore crunch state from given memory address 276 + * 277 + * r0 = struct thread_info pointer of target task 278 + * r1 = memory address where to get crunch state from 279 + * 280 + * this is used to restore crunch state when unwinding a signal stack frame 281 + */ 282 + ENTRY(crunch_task_restore) 283 + mrs ip, cpsr 284 + orr r2, ip, #PSR_I_BIT @ disable interrupts 285 + msr cpsr_c, r2 286 + 287 + ldr r3, =crunch_owner 288 + add r2, r0, #TI_CRUNCH_STATE @ get task crunch save area 289 + ldr r3, [r3] @ get current crunch owner 290 + teq r2, r3 @ does this task own it... 291 + beq 1f 292 + 293 + @ this task doesn't own crunch regs -- use its save area 294 + msr cpsr_c, ip @ restore interrupt mode 295 + mov r0, r2 296 + mov r2, #CRUNCH_SIZE 297 + b memcpy 298 + 299 + 1: @ this task owns crunch regs -- load them directly 300 + mov r0, r1 301 + mov r1, #0 @ nothing to save 302 + mov r3, lr @ preserve return address 303 + bl crunch_load 304 + msr cpsr_c, ip @ restore interrupt mode 305 + mov pc, r3
+83
arch/arm/kernel/crunch.c
··· 1 + /* 2 + * arch/arm/kernel/crunch.c 3 + * Cirrus MaverickCrunch context switching and handling 4 + * 5 + * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + */ 11 + 12 + #include <linux/module.h> 13 + #include <linux/config.h> 14 + #include <linux/types.h> 15 + #include <linux/kernel.h> 16 + #include <linux/signal.h> 17 + #include <linux/sched.h> 18 + #include <linux/init.h> 19 + #include <asm/arch/ep93xx-regs.h> 20 + #include <asm/thread_notify.h> 21 + #include <asm/io.h> 22 + 23 + struct crunch_state *crunch_owner; 24 + 25 + void crunch_task_release(struct thread_info *thread) 26 + { 27 + local_irq_disable(); 28 + if (crunch_owner == &thread->crunchstate) 29 + crunch_owner = NULL; 30 + local_irq_enable(); 31 + } 32 + 33 + static int crunch_enabled(u32 devcfg) 34 + { 35 + return !!(devcfg & EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE); 36 + } 37 + 38 + static int crunch_do(struct notifier_block *self, unsigned long cmd, void *t) 39 + { 40 + struct thread_info *thread = (struct thread_info *)t; 41 + struct crunch_state *crunch_state; 42 + u32 devcfg; 43 + 44 + crunch_state = &thread->crunchstate; 45 + 46 + switch (cmd) { 47 + case THREAD_NOTIFY_FLUSH: 48 + memset(crunch_state, 0, sizeof(*crunch_state)); 49 + 50 + /* 51 + * FALLTHROUGH: Ensure we don't try to overwrite our newly 52 + * initialised state information on the first fault. 53 + */ 54 + 55 + case THREAD_NOTIFY_RELEASE: 56 + crunch_task_release(thread); 57 + break; 58 + 59 + case THREAD_NOTIFY_SWITCH: 60 + devcfg = __raw_readl(EP93XX_SYSCON_DEVICE_CONFIG); 61 + if (crunch_enabled(devcfg) || crunch_owner == crunch_state) { 62 + devcfg ^= EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE; 63 + __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); 64 + __raw_writel(devcfg, EP93XX_SYSCON_DEVICE_CONFIG); 65 + } 66 + break; 67 + } 68 + 69 + return NOTIFY_DONE; 70 + } 71 + 72 + static struct notifier_block crunch_notifier_block = { 73 + .notifier_call = crunch_do, 74 + }; 75 + 76 + static int __init crunch_init(void) 77 + { 78 + thread_register_notifier(&crunch_notifier_block); 79 + 80 + return 0; 81 + } 82 + 83 + late_initcall(crunch_init);
+6
arch/arm/kernel/entry-armv.S
··· 492 492 b do_fpe @ CP#1 (FPE) 493 493 b do_fpe @ CP#2 (FPE) 494 494 mov pc, lr @ CP#3 495 + #ifdef CONFIG_CRUNCH 496 + b crunch_task_enable @ CP#4 (MaverickCrunch) 497 + b crunch_task_enable @ CP#5 (MaverickCrunch) 498 + b crunch_task_enable @ CP#6 (MaverickCrunch) 499 + #else 495 500 mov pc, lr @ CP#4 496 501 mov pc, lr @ CP#5 497 502 mov pc, lr @ CP#6 503 + #endif 498 504 mov pc, lr @ CP#7 499 505 mov pc, lr @ CP#8 500 506 mov pc, lr @ CP#9
+36
arch/arm/kernel/ptrace.c
··· 634 634 635 635 #endif 636 636 637 + #ifdef CONFIG_CRUNCH 638 + /* 639 + * Get the child Crunch state. 640 + */ 641 + static int ptrace_getcrunchregs(struct task_struct *tsk, void __user *ufp) 642 + { 643 + struct thread_info *thread = task_thread_info(tsk); 644 + 645 + crunch_task_disable(thread); /* force it to ram */ 646 + return copy_to_user(ufp, &thread->crunchstate, CRUNCH_SIZE) 647 + ? -EFAULT : 0; 648 + } 649 + 650 + /* 651 + * Set the child Crunch state. 652 + */ 653 + static int ptrace_setcrunchregs(struct task_struct *tsk, void __user *ufp) 654 + { 655 + struct thread_info *thread = task_thread_info(tsk); 656 + 657 + crunch_task_release(thread); /* force a reload */ 658 + return copy_from_user(&thread->crunchstate, ufp, CRUNCH_SIZE) 659 + ? -EFAULT : 0; 660 + } 661 + #endif 662 + 637 663 long arch_ptrace(struct task_struct *child, long request, long addr, long data) 638 664 { 639 665 unsigned long tmp; ··· 790 764 ret = 0; 791 765 child->ptrace_message = data; 792 766 break; 767 + 768 + #ifdef CONFIG_CRUNCH 769 + case PTRACE_GETCRUNCHREGS: 770 + ret = ptrace_getcrunchregs(child, (void __user *)data); 771 + break; 772 + 773 + case PTRACE_SETCRUNCHREGS: 774 + ret = ptrace_setcrunchregs(child, (void __user *)data); 775 + break; 776 + #endif 793 777 794 778 default: 795 779 ret = ptrace_request(child, request, addr, data);
+39
arch/arm/kernel/signal.c
··· 132 132 return ret; 133 133 } 134 134 135 + #ifdef CONFIG_CRUNCH 136 + static int preserve_crunch_context(struct crunch_sigframe *frame) 137 + { 138 + char kbuf[sizeof(*frame) + 8]; 139 + struct crunch_sigframe *kframe; 140 + 141 + /* the crunch context must be 64 bit aligned */ 142 + kframe = (struct crunch_sigframe *)((unsigned long)(kbuf + 8) & ~7); 143 + kframe->magic = CRUNCH_MAGIC; 144 + kframe->size = CRUNCH_STORAGE_SIZE; 145 + crunch_task_copy(current_thread_info(), &kframe->storage); 146 + return __copy_to_user(frame, kframe, sizeof(*frame)); 147 + } 148 + 149 + static int restore_crunch_context(struct crunch_sigframe *frame) 150 + { 151 + char kbuf[sizeof(*frame) + 8]; 152 + struct crunch_sigframe *kframe; 153 + 154 + /* the crunch context must be 64 bit aligned */ 155 + kframe = (struct crunch_sigframe *)((unsigned long)(kbuf + 8) & ~7); 156 + if (__copy_from_user(kframe, frame, sizeof(*frame))) 157 + return -1; 158 + if (kframe->magic != CRUNCH_MAGIC || 159 + kframe->size != CRUNCH_STORAGE_SIZE) 160 + return -1; 161 + crunch_task_restore(current_thread_info(), &kframe->storage); 162 + return 0; 163 + } 164 + #endif 165 + 135 166 #ifdef CONFIG_IWMMXT 136 167 137 168 static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame) ··· 245 214 err |= !valid_user_regs(regs); 246 215 247 216 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; 217 + #ifdef CONFIG_CRUNCH 218 + if (err == 0) 219 + err |= restore_crunch_context(&aux->crunch); 220 + #endif 248 221 #ifdef CONFIG_IWMMXT 249 222 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 250 223 err |= restore_iwmmxt_context(&aux->iwmmxt); ··· 368 333 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); 369 334 370 335 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; 336 + #ifdef CONFIG_CRUNCH 337 + if (err == 0) 338 + err |= preserve_crunch_context(&aux->crunch); 339 + #endif 371 340 #ifdef CONFIG_IWMMXT 372 341 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 373 342 err |= preserve_iwmmxt_context(&aux->iwmmxt);
+8
arch/arm/kernel/vmlinux.lds.S
··· 80 80 *(.exit.text) 81 81 *(.exit.data) 82 82 *(.exitcall.exit) 83 + #ifndef CONFIG_MMU 84 + *(.fixup) 85 + *(__ex_table) 86 + #endif 83 87 } 84 88 85 89 .text : { /* Real text segment */ ··· 91 87 *(.text) 92 88 SCHED_TEXT 93 89 LOCK_TEXT 90 + #ifdef CONFIG_MMU 94 91 *(.fixup) 92 + #endif 95 93 *(.gnu.warning) 96 94 *(.rodata) 97 95 *(.rodata.*) ··· 148 142 */ 149 143 . = ALIGN(32); 150 144 __start___ex_table = .; 145 + #ifdef CONFIG_MMU 151 146 *(__ex_table) 147 + #endif 152 148 __stop___ex_table = .; 153 149 154 150 /*
+8 -5
arch/arm/lib/Makefile
··· 6 6 7 7 lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ 8 8 csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ 9 - copy_page.o delay.o findbit.o memchr.o memcpy.o \ 9 + delay.o findbit.o memchr.o memcpy.o \ 10 10 memmove.o memset.o memzero.o setbit.o \ 11 11 strncpy_from_user.o strnlen_user.o \ 12 12 strchr.o strrchr.o \ 13 13 testchangebit.o testclearbit.o testsetbit.o \ 14 - getuser.o putuser.o clear_user.o \ 15 14 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 16 15 ucmpdi2.o lib1funcs.o div64.o sha1.o \ 17 16 io-readsb.o io-writesb.o io-readsl.o io-writesl.o 18 17 18 + mmu-y := clear_user.o copy_page.o getuser.o putuser.o 19 + 19 20 # the code in uaccess.S is not preemption safe and 20 21 # probably faster on ARMv3 only 21 22 ifeq ($(CONFIG_PREEMPT),y) 22 - lib-y += copy_from_user.o copy_to_user.o 23 + mmu-y += copy_from_user.o copy_to_user.o 23 24 else 24 25 ifneq ($(CONFIG_CPU_32v3),y) 25 - lib-y += copy_from_user.o copy_to_user.o 26 + mmu-y += copy_from_user.o copy_to_user.o 26 27 else 27 - lib-y += uaccess.o 28 + mmu-y += uaccess.o 28 29 endif 29 30 endif 31 + 32 + lib-$(CONFIG_MMU) += $(mmu-y) 30 33 31 34 ifeq ($(CONFIG_CPU_32v3),y) 32 35 lib-y += io-readsw-armv3.o io-writesw-armv3.o
+1 -4
arch/arm/lib/backtrace.S
··· 97 97 b 1007f 98 98 99 99 /* 100 - * Fixup for LDMDB 100 + * Fixup for LDMDB. Note that this must not be in the fixup section. 101 101 */ 102 - .section .fixup,"ax" 103 - .align 0 104 102 1007: ldr r0, =.Lbad 105 103 mov r1, frame 106 104 bl printk 107 105 ldmfd sp!, {r4 - r8, pc} 108 106 .ltorg 109 - .previous 110 107 111 108 .section __ex_table,"a" 112 109 .align 3
+2 -2
arch/arm/lib/clear_user.S
··· 12 12 13 13 .text 14 14 15 - /* Prototype: int __arch_clear_user(void *addr, size_t sz) 15 + /* Prototype: int __clear_user(void *addr, size_t sz) 16 16 * Purpose : clear some user memory 17 17 * Params : addr - user memory address to clear 18 18 * : sz - number of bytes to clear 19 19 * Returns : number of bytes NOT cleared 20 20 */ 21 - ENTRY(__arch_clear_user) 21 + ENTRY(__clear_user) 22 22 stmfd sp!, {r1, lr} 23 23 mov r2, #0 24 24 cmp r1, #4
+2 -2
arch/arm/lib/copy_from_user.S
··· 16 16 /* 17 17 * Prototype: 18 18 * 19 - * size_t __arch_copy_from_user(void *to, const void *from, size_t n) 19 + * size_t __copy_from_user(void *to, const void *from, size_t n) 20 20 * 21 21 * Purpose: 22 22 * ··· 83 83 84 84 .text 85 85 86 - ENTRY(__arch_copy_from_user) 86 + ENTRY(__copy_from_user) 87 87 88 88 #include "copy_template.S" 89 89
+2 -2
arch/arm/lib/copy_to_user.S
··· 16 16 /* 17 17 * Prototype: 18 18 * 19 - * size_t __arch_copy_to_user(void *to, const void *from, size_t n) 19 + * size_t __copy_to_user(void *to, const void *from, size_t n) 20 20 * 21 21 * Purpose: 22 22 * ··· 86 86 87 87 .text 88 88 89 - ENTRY(__arch_copy_to_user) 89 + ENTRY(__copy_to_user) 90 90 91 91 #include "copy_template.S" 92 92
+1 -1
arch/arm/lib/strncpy_from_user.S
··· 20 20 * returns the number of characters copied (strlen of copied string), 21 21 * -EFAULT on exception, or "len" if we fill the whole buffer 22 22 */ 23 - ENTRY(__arch_strncpy_from_user) 23 + ENTRY(__strncpy_from_user) 24 24 mov ip, r1 25 25 1: subs r2, r2, #1 26 26 USER( ldrplbt r3, [r1], #1)
+2 -2
arch/arm/lib/strnlen_user.S
··· 14 14 .text 15 15 .align 5 16 16 17 - /* Prototype: unsigned long __arch_strnlen_user(const char *str, long n) 17 + /* Prototype: unsigned long __strnlen_user(const char *str, long n) 18 18 * Purpose : get length of a string in user memory 19 19 * Params : str - address of string in user memory 20 20 * Returns : length of string *including terminator* 21 21 * or zero on exception, or n + 1 if too long 22 22 */ 23 - ENTRY(__arch_strnlen_user) 23 + ENTRY(__strnlen_user) 24 24 mov r2, r0 25 25 1: 26 26 USER( ldrbt r3, [r0], #1)
+4 -4
arch/arm/lib/uaccess.S
··· 19 19 20 20 #define PAGE_SHIFT 12 21 21 22 - /* Prototype: int __arch_copy_to_user(void *to, const char *from, size_t n) 22 + /* Prototype: int __copy_to_user(void *to, const char *from, size_t n) 23 23 * Purpose : copy a block to user memory from kernel memory 24 24 * Params : to - user memory 25 25 * : from - kernel memory ··· 39 39 sub r2, r2, ip 40 40 b .Lc2u_dest_aligned 41 41 42 - ENTRY(__arch_copy_to_user) 42 + ENTRY(__copy_to_user) 43 43 stmfd sp!, {r2, r4 - r7, lr} 44 44 cmp r2, #4 45 45 blt .Lc2u_not_enough ··· 283 283 9001: ldmfd sp!, {r0, r4 - r7, pc} 284 284 .previous 285 285 286 - /* Prototype: unsigned long __arch_copy_from_user(void *to,const void *from,unsigned long n); 286 + /* Prototype: unsigned long __copy_from_user(void *to,const void *from,unsigned long n); 287 287 * Purpose : copy a block from user memory to kernel memory 288 288 * Params : to - kernel memory 289 289 * : from - user memory ··· 302 302 sub r2, r2, ip 303 303 b .Lcfu_dest_aligned 304 304 305 - ENTRY(__arch_copy_from_user) 305 + ENTRY(__copy_from_user) 306 306 stmfd sp!, {r0, r2, r4 - r7, lr} 307 307 cmp r2, #4 308 308 blt .Lcfu_not_enough
+11
arch/arm/mach-ep93xx/Kconfig
··· 2 2 3 3 menu "Cirrus EP93xx Implementation Options" 4 4 5 + config CRUNCH 6 + bool "Support for MaverickCrunch" 7 + help 8 + Enable kernel support for MaverickCrunch. 9 + 5 10 comment "EP93xx Platforms" 11 + 12 + config MACH_EDB9315 13 + bool "Support Cirrus Logic EDB9315" 14 + help 15 + Say 'Y' here if you want your kernel to support the Cirrus 16 + Logic EDB9315 Evaluation Board. 6 17 7 18 config MACH_GESBC9312 8 19 bool "Support Glomation GESBC-9312-sx"
+1
arch/arm/mach-ep93xx/Makefile
··· 6 6 obj-n := 7 7 obj- := 8 8 9 + obj-$(CONFIG_MACH_EDB9315) += edb9315.o 9 10 obj-$(CONFIG_MACH_GESBC9312) += gesbc9312.o 10 11 obj-$(CONFIG_MACH_TS72XX) += ts72xx.o
+62
arch/arm/mach-ep93xx/edb9315.c
··· 1 + /* 2 + * arch/arm/mach-ep93xx/edb9315.c 3 + * Cirrus Logic EDB9315 support. 4 + * 5 + * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or (at 10 + * your option) any later version. 11 + */ 12 + 13 + #include <linux/config.h> 14 + #include <linux/kernel.h> 15 + #include <linux/init.h> 16 + #include <linux/mm.h> 17 + #include <linux/sched.h> 18 + #include <linux/interrupt.h> 19 + #include <linux/ioport.h> 20 + #include <linux/mtd/physmap.h> 21 + #include <linux/platform_device.h> 22 + #include <asm/io.h> 23 + #include <asm/hardware.h> 24 + #include <asm/mach-types.h> 25 + #include <asm/mach/arch.h> 26 + 27 + static struct physmap_flash_data edb9315_flash_data = { 28 + .width = 4, 29 + }; 30 + 31 + static struct resource edb9315_flash_resource = { 32 + .start = 0x60000000, 33 + .end = 0x61ffffff, 34 + .flags = IORESOURCE_MEM, 35 + }; 36 + 37 + static struct platform_device edb9315_flash = { 38 + .name = "physmap-flash", 39 + .id = 0, 40 + .dev = { 41 + .platform_data = &edb9315_flash_data, 42 + }, 43 + .num_resources = 1, 44 + .resource = &edb9315_flash_resource, 45 + }; 46 + 47 + static void __init edb9315_init_machine(void) 48 + { 49 + ep93xx_init_devices(); 50 + platform_device_register(&edb9315_flash); 51 + } 52 + 53 + MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board") 54 + /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 55 + .phys_io = EP93XX_APB_PHYS_BASE, 56 + .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 57 + .boot_params = 0x00000100, 58 + .map_io = ep93xx_map_io, 59 + .init_irq = ep93xx_init_irq, 60 + .timer = &ep93xx_timer, 61 + .init_machine = edb9315_init_machine, 62 + MACHINE_END
+1 -1
arch/arm/mach-ep93xx/gesbc9312.c
··· 30 30 31 31 static struct resource gesbc9312_flash_resource = { 32 32 .start = 0x60000000, 33 - .end = 0x60800000, 33 + .end = 0x607fffff, 34 34 .flags = IORESOURCE_MEM, 35 35 }; 36 36
+1 -1
arch/arm/mach-ep93xx/ts72xx.c
··· 118 118 119 119 static struct resource ts72xx_flash_resource = { 120 120 .start = TS72XX_NOR_PHYS_BASE, 121 - .end = TS72XX_NOR_PHYS_BASE + 0x01000000, 121 + .end = TS72XX_NOR_PHYS_BASE + 0x00ffffff, 122 122 .flags = IORESOURCE_MEM, 123 123 }; 124 124
+1 -1
arch/arm/mach-ixp23xx/espresso.c
··· 59 59 60 60 static struct resource espresso_flash_resource = { 61 61 .start = 0x90000000, 62 - .end = 0x92000000, 62 + .end = 0x91ffffff, 63 63 .flags = IORESOURCE_MEM, 64 64 }; 65 65
+1 -1
arch/arm/mach-ixp23xx/ixdp2351.c
··· 304 304 305 305 static struct resource ixdp2351_flash_resource = { 306 306 .start = 0x90000000, 307 - .end = 0x94000000, 307 + .end = 0x93ffffff, 308 308 .flags = IORESOURCE_MEM, 309 309 }; 310 310
+1 -1
arch/arm/mach-ixp23xx/roadrunner.c
··· 143 143 144 144 static struct resource roadrunner_flash_resource = { 145 145 .start = 0x90000000, 146 - .end = 0x94000000, 146 + .end = 0x93ffffff, 147 147 .flags = IORESOURCE_MEM, 148 148 }; 149 149
+2 -2
arch/arm/mach-pxa/irq.c
··· 88 88 89 89 if (type == IRQT_PROBE) { 90 90 /* Don't mess with enabled GPIOs using preconfigured edges or 91 - GPIOs set to alternate function during probe */ 92 - if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx]) & 91 + GPIOs set to alternate function or to output during probe */ 92 + if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx] | GPDR(gpio)) & 93 93 GPIO_bit(gpio)) 94 94 return 0; 95 95 if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2)))
+1
arch/arm/mach-s3c2410/s3c244x.c
··· 69 69 70 70 s3c_device_i2c.name = "s3c2440-i2c"; 71 71 s3c_device_nand.name = "s3c2440-nand"; 72 + s3c_device_usbgadget.name = "s3c2440-usbgadget"; 72 73 } 73 74 74 75 void __init s3c244x_init_clocks(int xtal)
+35 -32
arch/arm/mm/Kconfig
··· 15 15 select CPU_32v3 16 16 select CPU_CACHE_V3 17 17 select CPU_CACHE_VIVT 18 - select CPU_COPY_V3 19 - select CPU_TLB_V3 18 + select CPU_COPY_V3 if MMU 19 + select CPU_TLB_V3 if MMU 20 20 help 21 21 The ARM610 is the successor to the ARM3 processor 22 22 and was produced by VLSI Technology Inc. ··· 31 31 select CPU_32v3 32 32 select CPU_CACHE_V3 33 33 select CPU_CACHE_VIVT 34 - select CPU_COPY_V3 35 - select CPU_TLB_V3 34 + select CPU_COPY_V3 if MMU 35 + select CPU_TLB_V3 if MMU 36 36 help 37 37 A 32-bit RISC microprocessor based on the ARM7 processor core 38 38 designed by Advanced RISC Machines Ltd. The ARM710 is the ··· 50 50 select CPU_ABRT_LV4T 51 51 select CPU_CACHE_V4 52 52 select CPU_CACHE_VIVT 53 - select CPU_COPY_V4WT 54 - select CPU_TLB_V4WT 53 + select CPU_COPY_V4WT if MMU 54 + select CPU_TLB_V4WT if MMU 55 55 help 56 56 A 32-bit RISC processor with 8kByte Cache, Write Buffer and 57 57 MMU built around an ARM7TDMI core. ··· 68 68 select CPU_ABRT_EV4T 69 69 select CPU_CACHE_V4WT 70 70 select CPU_CACHE_VIVT 71 - select CPU_COPY_V4WB 72 - select CPU_TLB_V4WBI 71 + select CPU_COPY_V4WB if MMU 72 + select CPU_TLB_V4WBI if MMU 73 73 help 74 74 The ARM920T is licensed to be produced by numerous vendors, 75 75 and is used in the Maverick EP9312 and the Samsung S3C2410. ··· 89 89 select CPU_ABRT_EV4T 90 90 select CPU_CACHE_V4WT 91 91 select CPU_CACHE_VIVT 92 - select CPU_COPY_V4WB 93 - select CPU_TLB_V4WBI 92 + select CPU_COPY_V4WB if MMU 93 + select CPU_TLB_V4WBI if MMU 94 94 help 95 95 The ARM922T is a version of the ARM920T, but with smaller 96 96 instruction and data caches. It is used in Altera's ··· 108 108 select CPU_ABRT_EV4T 109 109 select CPU_CACHE_V4WT 110 110 select CPU_CACHE_VIVT 111 - select CPU_COPY_V4WB 112 - select CPU_TLB_V4WBI 111 + select CPU_COPY_V4WB if MMU 112 + select CPU_TLB_V4WBI if MMU 113 113 help 114 114 The ARM925T is a mix between the ARM920T and ARM926T, but with 115 115 different instruction and data caches. It is used in TI's OMAP ··· 126 126 select CPU_32v5 127 127 select CPU_ABRT_EV5TJ 128 128 select CPU_CACHE_VIVT 129 - select CPU_COPY_V4WB 130 - select CPU_TLB_V4WBI 129 + select CPU_COPY_V4WB if MMU 130 + select CPU_TLB_V4WBI if MMU 131 131 help 132 132 This is a variant of the ARM920. It has slightly different 133 133 instruction sequences for cache and TLB operations. Curiously, ··· 144 144 select CPU_ABRT_EV4T 145 145 select CPU_CACHE_V4WT 146 146 select CPU_CACHE_VIVT 147 - select CPU_COPY_V4WB 148 - select CPU_TLB_V4WBI 147 + select CPU_COPY_V4WB if MMU 148 + select CPU_TLB_V4WBI if MMU 149 149 help 150 150 The ARM1020 is the 32K cached version of the ARM10 processor, 151 151 with an addition of a floating-point unit. ··· 161 161 select CPU_ABRT_EV4T 162 162 select CPU_CACHE_V4WT 163 163 select CPU_CACHE_VIVT 164 - select CPU_COPY_V4WB 165 - select CPU_TLB_V4WBI 164 + select CPU_COPY_V4WB if MMU 165 + select CPU_TLB_V4WBI if MMU 166 166 depends on n 167 167 168 168 # ARM1022E ··· 172 172 select CPU_32v5 173 173 select CPU_ABRT_EV4T 174 174 select CPU_CACHE_VIVT 175 - select CPU_COPY_V4WB # can probably do better 176 - select CPU_TLB_V4WBI 175 + select CPU_COPY_V4WB if MMU # can probably do better 176 + select CPU_TLB_V4WBI if MMU 177 177 help 178 178 The ARM1022E is an implementation of the ARMv5TE architecture 179 179 based upon the ARM10 integer core with a 16KiB L1 Harvard cache, ··· 189 189 select CPU_32v5 190 190 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10 191 191 select CPU_CACHE_VIVT 192 - select CPU_COPY_V4WB # can probably do better 193 - select CPU_TLB_V4WBI 192 + select CPU_COPY_V4WB if MMU # can probably do better 193 + select CPU_TLB_V4WBI if MMU 194 194 help 195 195 The ARM1026EJ-S is an implementation of the ARMv5TEJ architecture 196 196 based upon the ARM10 integer core. ··· 207 207 select CPU_ABRT_EV4 208 208 select CPU_CACHE_V4WB 209 209 select CPU_CACHE_VIVT 210 - select CPU_COPY_V4WB 211 - select CPU_TLB_V4WB 210 + select CPU_COPY_V4WB if MMU 211 + select CPU_TLB_V4WB if MMU 212 212 help 213 213 The Intel StrongARM(R) SA-110 is a 32-bit microprocessor and 214 214 is available at five speeds ranging from 100 MHz to 233 MHz. ··· 227 227 select CPU_ABRT_EV4 228 228 select CPU_CACHE_V4WB 229 229 select CPU_CACHE_VIVT 230 - select CPU_TLB_V4WB 230 + select CPU_TLB_V4WB if MMU 231 231 232 232 # XScale 233 233 config CPU_XSCALE ··· 237 237 select CPU_32v5 238 238 select CPU_ABRT_EV5T 239 239 select CPU_CACHE_VIVT 240 - select CPU_TLB_V4WBI 240 + select CPU_TLB_V4WBI if MMU 241 241 242 242 # XScale Core Version 3 243 243 config CPU_XSC3 ··· 247 247 select CPU_32v5 248 248 select CPU_ABRT_EV5T 249 249 select CPU_CACHE_VIVT 250 - select CPU_TLB_V4WBI 250 + select CPU_TLB_V4WBI if MMU 251 251 select IO_36 252 252 253 253 # ARMv6 ··· 258 258 select CPU_ABRT_EV6 259 259 select CPU_CACHE_V6 260 260 select CPU_CACHE_VIPT 261 - select CPU_COPY_V6 262 - select CPU_TLB_V6 261 + select CPU_COPY_V6 if MMU 262 + select CPU_TLB_V6 if MMU 263 263 264 264 # ARMv6k 265 265 config CPU_32v6K ··· 277 277 # This defines the compiler instruction set which depends on the machine type. 278 278 config CPU_32v3 279 279 bool 280 - select TLS_REG_EMUL if SMP 280 + select TLS_REG_EMUL if SMP || !MMU 281 281 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 282 282 283 283 config CPU_32v4 284 284 bool 285 - select TLS_REG_EMUL if SMP 285 + select TLS_REG_EMUL if SMP || !MMU 286 286 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 287 287 288 288 config CPU_32v5 289 289 bool 290 - select TLS_REG_EMUL if SMP 290 + select TLS_REG_EMUL if SMP || !MMU 291 291 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 292 292 293 293 config CPU_32v6 ··· 334 334 config CPU_CACHE_VIPT 335 335 bool 336 336 337 + if MMU 337 338 # The copy-page model 338 339 config CPU_COPY_V3 339 340 bool ··· 372 371 373 372 config CPU_TLB_V6 374 373 bool 374 + 375 + endif 375 376 376 377 # 377 378 # CPU supports 36-bit I/O
+8 -2
arch/arm/mm/Makefile
··· 2 2 # Makefile for the linux arm-specific parts of the memory manager. 3 3 # 4 4 5 - obj-y := consistent.o extable.o fault-armv.o \ 6 - fault.o flush.o init.o ioremap.o mmap.o \ 5 + obj-y := consistent.o extable.o fault.o init.o \ 6 + iomap.o 7 + 8 + obj-$(CONFIG_MMU) += fault-armv.o flush.o ioremap.o mmap.o \ 7 9 mm-armv.o 10 + 11 + ifneq ($(CONFIG_MMU),y) 12 + obj-y += nommu.o 13 + endif 8 14 9 15 obj-$(CONFIG_MODULES) += proc-syms.o 10 16
-2
arch/arm/mm/init.c
··· 26 26 #include <asm/mach/arch.h> 27 27 #include <asm/mach/map.h> 28 28 29 - #define TABLE_SIZE (2 * PTRS_PER_PTE * sizeof(pte_t)) 30 - 31 29 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 32 30 33 31 extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
+55
arch/arm/mm/iomap.c
··· 1 + /* 2 + * linux/arch/arm/mm/iomap.c 3 + * 4 + * Map IO port and PCI memory spaces so that {read,write}[bwl] can 5 + * be used to access this memory. 6 + */ 7 + #include <linux/module.h> 8 + #include <linux/pci.h> 9 + #include <linux/ioport.h> 10 + 11 + #include <asm/io.h> 12 + 13 + #ifdef __io 14 + void __iomem *ioport_map(unsigned long port, unsigned int nr) 15 + { 16 + return __io(port); 17 + } 18 + EXPORT_SYMBOL(ioport_map); 19 + 20 + void ioport_unmap(void __iomem *addr) 21 + { 22 + } 23 + EXPORT_SYMBOL(ioport_unmap); 24 + #endif 25 + 26 + #ifdef CONFIG_PCI 27 + void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 28 + { 29 + unsigned long start = pci_resource_start(dev, bar); 30 + unsigned long len = pci_resource_len(dev, bar); 31 + unsigned long flags = pci_resource_flags(dev, bar); 32 + 33 + if (!len || !start) 34 + return NULL; 35 + if (maxlen && len > maxlen) 36 + len = maxlen; 37 + if (flags & IORESOURCE_IO) 38 + return ioport_map(start, len); 39 + if (flags & IORESOURCE_MEM) { 40 + if (flags & IORESOURCE_CACHEABLE) 41 + return ioremap(start, len); 42 + return ioremap_nocache(start, len); 43 + } 44 + return NULL; 45 + } 46 + EXPORT_SYMBOL(pci_iomap); 47 + 48 + void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 49 + { 50 + if ((unsigned long)addr >= VMALLOC_START && 51 + (unsigned long)addr < VMALLOC_END) 52 + iounmap(addr); 53 + } 54 + EXPORT_SYMBOL(pci_iounmap); 55 + #endif
-47
arch/arm/mm/ioremap.c
··· 176 176 vunmap((void *)(PAGE_MASK & (unsigned long)addr)); 177 177 } 178 178 EXPORT_SYMBOL(__iounmap); 179 - 180 - #ifdef __io 181 - void __iomem *ioport_map(unsigned long port, unsigned int nr) 182 - { 183 - return __io(port); 184 - } 185 - EXPORT_SYMBOL(ioport_map); 186 - 187 - void ioport_unmap(void __iomem *addr) 188 - { 189 - } 190 - EXPORT_SYMBOL(ioport_unmap); 191 - #endif 192 - 193 - #ifdef CONFIG_PCI 194 - #include <linux/pci.h> 195 - #include <linux/ioport.h> 196 - 197 - void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 198 - { 199 - unsigned long start = pci_resource_start(dev, bar); 200 - unsigned long len = pci_resource_len(dev, bar); 201 - unsigned long flags = pci_resource_flags(dev, bar); 202 - 203 - if (!len || !start) 204 - return NULL; 205 - if (maxlen && len > maxlen) 206 - len = maxlen; 207 - if (flags & IORESOURCE_IO) 208 - return ioport_map(start, len); 209 - if (flags & IORESOURCE_MEM) { 210 - if (flags & IORESOURCE_CACHEABLE) 211 - return ioremap(start, len); 212 - return ioremap_nocache(start, len); 213 - } 214 - return NULL; 215 - } 216 - EXPORT_SYMBOL(pci_iomap); 217 - 218 - void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 219 - { 220 - if ((unsigned long)addr >= VMALLOC_START && 221 - (unsigned long)addr < VMALLOC_END) 222 - iounmap(addr); 223 - } 224 - EXPORT_SYMBOL(pci_iounmap); 225 - #endif
+39
arch/arm/mm/nommu.c
··· 1 + /* 2 + * linux/arch/arm/mm/nommu.c 3 + * 4 + * ARM uCLinux supporting functions. 5 + */ 6 + #include <linux/module.h> 7 + #include <linux/mm.h> 8 + #include <linux/pagemap.h> 9 + 10 + #include <asm/cacheflush.h> 11 + #include <asm/io.h> 12 + #include <asm/page.h> 13 + 14 + void flush_dcache_page(struct page *page) 15 + { 16 + __cpuc_flush_dcache_page(page_address(page)); 17 + } 18 + EXPORT_SYMBOL(flush_dcache_page); 19 + 20 + void __iomem *__ioremap_pfn(unsigned long pfn, unsigned long offset, 21 + size_t size, unsigned long flags) 22 + { 23 + if (pfn >= (0x100000000ULL >> PAGE_SHIFT)) 24 + return NULL; 25 + return (void __iomem *) (offset + (pfn << PAGE_SHIFT)); 26 + } 27 + EXPORT_SYMBOL(__ioremap_pfn); 28 + 29 + void __iomem *__ioremap(unsigned long phys_addr, size_t size, 30 + unsigned long flags) 31 + { 32 + return (void __iomem *)phys_addr; 33 + } 34 + EXPORT_SYMBOL(__ioremap); 35 + 36 + void __iounmap(void __iomem *addr) 37 + { 38 + } 39 + EXPORT_SYMBOL(__iounmap);
+9
arch/arm/mm/proc-arm1020.S
··· 3 3 * 4 4 * Copyright (C) 2000 ARM Limited 5 5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License as published by ··· 102 101 mov ip, #0 103 102 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 104 103 mcr p15, 0, ip, c7, c10, 4 @ drain WB 104 + #ifdef CONFIG_MMU 105 105 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 106 + #endif 106 107 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 107 108 bic ip, ip, #0x000f @ ............wcam 108 109 bic ip, ip, #0x1100 @ ...i...s........ ··· 362 359 */ 363 360 .align 5 364 361 ENTRY(cpu_arm1020_switch_mm) 362 + #ifdef CONFIG_MMU 365 363 #ifndef CONFIG_CPU_DCACHE_DISABLE 366 364 mcr p15, 0, r3, c7, c10, 4 367 365 mov r1, #0xF @ 16 segments ··· 387 383 mcr p15, 0, r1, c7, c10, 4 @ drain WB 388 384 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 389 385 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 386 + #endif /* CONFIG_MMU */ 390 387 mov pc, lr 391 388 392 389 /* ··· 397 392 */ 398 393 .align 5 399 394 ENTRY(cpu_arm1020_set_pte) 395 + #ifdef CONFIG_MMU 400 396 str r1, [r0], #-2048 @ linux version 401 397 402 398 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 427 421 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 428 422 #endif 429 423 mcr p15, 0, r0, c7, c10, 4 @ drain WB 424 + #endif /* CONFIG_MMU */ 430 425 mov pc, lr 431 426 432 427 __INIT ··· 437 430 mov r0, #0 438 431 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 439 432 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 433 + #ifdef CONFIG_MMU 440 434 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 435 + #endif 441 436 mrc p15, 0, r0, c1, c0 @ get control register v4 442 437 ldr r5, arm1020_cr1_clear 443 438 bic r0, r0, r5
+9
arch/arm/mm/proc-arm1020e.S
··· 3 3 * 4 4 * Copyright (C) 2000 ARM Limited 5 5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License as published by ··· 102 101 mov ip, #0 103 102 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 104 103 mcr p15, 0, ip, c7, c10, 4 @ drain WB 104 + #ifdef CONFIG_MMU 105 105 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 106 + #endif 106 107 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 107 108 bic ip, ip, #0x000f @ ............wcam 108 109 bic ip, ip, #0x1100 @ ...i...s........ ··· 347 344 */ 348 345 .align 5 349 346 ENTRY(cpu_arm1020e_switch_mm) 347 + #ifdef CONFIG_MMU 350 348 #ifndef CONFIG_CPU_DCACHE_DISABLE 351 349 mcr p15, 0, r3, c7, c10, 4 352 350 mov r1, #0xF @ 16 segments ··· 371 367 mcr p15, 0, r1, c7, c10, 4 @ drain WB 372 368 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 373 369 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 370 + #endif 374 371 mov pc, lr 375 372 376 373 /* ··· 381 376 */ 382 377 .align 5 383 378 ENTRY(cpu_arm1020e_set_pte) 379 + #ifdef CONFIG_MMU 384 380 str r1, [r0], #-2048 @ linux version 385 381 386 382 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 409 403 #ifndef CONFIG_CPU_DCACHE_DISABLE 410 404 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 411 405 #endif 406 + #endif /* CONFIG_MMU */ 412 407 mov pc, lr 413 408 414 409 __INIT ··· 419 412 mov r0, #0 420 413 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 421 414 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 415 + #ifdef CONFIG_MMU 422 416 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 417 + #endif 423 418 mrc p15, 0, r0, c1, c0 @ get control register v4 424 419 ldr r5, arm1020e_cr1_clear 425 420 bic r0, r0, r5
+9
arch/arm/mm/proc-arm1022.S
··· 3 3 * 4 4 * Copyright (C) 2000 ARM Limited 5 5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License as published by ··· 91 90 mov ip, #0 92 91 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 93 92 mcr p15, 0, ip, c7, c10, 4 @ drain WB 93 + #ifdef CONFIG_MMU 94 94 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 95 + #endif 95 96 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 96 97 bic ip, ip, #0x000f @ ............wcam 97 98 bic ip, ip, #0x1100 @ ...i...s........ ··· 336 333 */ 337 334 .align 5 338 335 ENTRY(cpu_arm1022_switch_mm) 336 + #ifdef CONFIG_MMU 339 337 #ifndef CONFIG_CPU_DCACHE_DISABLE 340 338 mov r1, #(CACHE_DSEGMENTS - 1) << 5 @ 16 segments 341 339 1: orr r3, r1, #(CACHE_DENTRIES - 1) << 26 @ 64 entries ··· 353 349 mcr p15, 0, r1, c7, c10, 4 @ drain WB 354 350 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 355 351 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 352 + #endif 356 353 mov pc, lr 357 354 358 355 /* ··· 363 358 */ 364 359 .align 5 365 360 ENTRY(cpu_arm1022_set_pte) 361 + #ifdef CONFIG_MMU 366 362 str r1, [r0], #-2048 @ linux version 367 363 368 364 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 391 385 #ifndef CONFIG_CPU_DCACHE_DISABLE 392 386 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 393 387 #endif 388 + #endif /* CONFIG_MMU */ 394 389 mov pc, lr 395 390 396 391 __INIT ··· 401 394 mov r0, #0 402 395 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 403 396 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 397 + #ifdef CONFIG_MMU 404 398 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 399 + #endif 405 400 mrc p15, 0, r0, c1, c0 @ get control register v4 406 401 ldr r5, arm1022_cr1_clear 407 402 bic r0, r0, r5
+9
arch/arm/mm/proc-arm1026.S
··· 3 3 * 4 4 * Copyright (C) 2000 ARM Limited 5 5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License as published by ··· 91 90 mov ip, #0 92 91 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 93 92 mcr p15, 0, ip, c7, c10, 4 @ drain WB 93 + #ifdef CONFIG_MMU 94 94 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 95 + #endif 95 96 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 96 97 bic ip, ip, #0x000f @ ............wcam 97 98 bic ip, ip, #0x1100 @ ...i...s........ ··· 330 327 */ 331 328 .align 5 332 329 ENTRY(cpu_arm1026_switch_mm) 330 + #ifdef CONFIG_MMU 333 331 mov r1, #0 334 332 #ifndef CONFIG_CPU_DCACHE_DISABLE 335 333 1: mrc p15, 0, r15, c7, c14, 3 @ test, clean, invalidate ··· 342 338 mcr p15, 0, r1, c7, c10, 4 @ drain WB 343 339 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 344 340 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 341 + #endif 345 342 mov pc, lr 346 343 347 344 /* ··· 352 347 */ 353 348 .align 5 354 349 ENTRY(cpu_arm1026_set_pte) 350 + #ifdef CONFIG_MMU 355 351 str r1, [r0], #-2048 @ linux version 356 352 357 353 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 380 374 #ifndef CONFIG_CPU_DCACHE_DISABLE 381 375 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 382 376 #endif 377 + #endif /* CONFIG_MMU */ 383 378 mov pc, lr 384 379 385 380 ··· 391 384 mov r0, #0 392 385 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 393 386 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 387 + #ifdef CONFIG_MMU 394 388 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 395 389 mcr p15, 0, r4, c2, c0 @ load page table pointer 390 + #endif 396 391 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 397 392 mov r0, #4 @ explicitly disable writeback 398 393 mcr p15, 7, r0, c15, c0, 0
+15
arch/arm/mm/proc-arm6_7.S
··· 2 2 * linux/arch/arm/mm/proc-arm6,7.S 3 3 * 4 4 * Copyright (C) 1997-2000 Russell King 5 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify 7 8 * it under the terms of the GNU General Public License version 2 as ··· 200 199 */ 201 200 ENTRY(cpu_arm6_switch_mm) 202 201 ENTRY(cpu_arm7_switch_mm) 202 + #ifdef CONFIG_MMU 203 203 mov r1, #0 204 204 mcr p15, 0, r1, c7, c0, 0 @ flush cache 205 205 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr 206 206 mcr p15, 0, r1, c5, c0, 0 @ flush TLBs 207 + #endif 207 208 mov pc, lr 208 209 209 210 /* ··· 217 214 .align 5 218 215 ENTRY(cpu_arm6_set_pte) 219 216 ENTRY(cpu_arm7_set_pte) 217 + #ifdef CONFIG_MMU 220 218 str r1, [r0], #-2048 @ linux version 221 219 222 220 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 236 232 movne r2, #0 237 233 238 234 str r2, [r0] @ hardware version 235 + #endif /* CONFIG_MMU */ 239 236 mov pc, lr 240 237 241 238 /* ··· 248 243 ENTRY(cpu_arm7_reset) 249 244 mov r1, #0 250 245 mcr p15, 0, r1, c7, c0, 0 @ flush cache 246 + #ifdef CONFIG_MMU 251 247 mcr p15, 0, r1, c5, c0, 0 @ flush TLB 248 + #endif 252 249 mov r1, #0x30 253 250 mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc 254 251 mov pc, r0 ··· 260 253 .type __arm6_setup, #function 261 254 __arm6_setup: mov r0, #0 262 255 mcr p15, 0, r0, c7, c0 @ flush caches on v3 256 + #ifdef CONFIG_MMU 263 257 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3 264 258 mov r0, #0x3d @ . ..RS BLDP WCAM 265 259 orr r0, r0, #0x100 @ . ..01 0011 1101 260 + #else 261 + mov r0, #0x3c @ . ..RS BLDP WCA. 262 + #endif 266 263 mov pc, lr 267 264 .size __arm6_setup, . - __arm6_setup 268 265 269 266 .type __arm7_setup, #function 270 267 __arm7_setup: mov r0, #0 271 268 mcr p15, 0, r0, c7, c0 @ flush caches on v3 269 + #ifdef CONFIG_MMU 272 270 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3 273 271 mcr p15, 0, r0, c3, c0 @ load domain access register 274 272 mov r0, #0x7d @ . ..RS BLDP WCAM 275 273 orr r0, r0, #0x100 @ . ..01 0111 1101 274 + #else 275 + mov r0, #0x7c @ . ..RS BLDP WCA. 276 + #endif 276 277 mov pc, lr 277 278 .size __arm7_setup, . - __arm7_setup 278 279
+12
arch/arm/mm/proc-arm720.S
··· 4 4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) 5 5 * Rob Scott (rscott@mtrob.fdns.net) 6 6 * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd. 7 + * hacked for non-paged-MM by Hyok S. Choi, 2004. 7 8 * 8 9 * This program is free software; you can redistribute it and/or modify 9 10 * it under the terms of the GNU General Public License as published by ··· 30 29 * out of 'proc-arm6,7.S' per RMK discussion 31 30 * 07-25-2000 SJH Added idle function. 32 31 * 08-25-2000 DBS Updated for integration of ARM Ltd version. 32 + * 04-20-2004 HSC modified for non-paged memory management mode. 33 33 */ 34 34 #include <linux/linkage.h> 35 35 #include <linux/init.h> ··· 77 75 * the new. 78 76 */ 79 77 ENTRY(cpu_arm720_switch_mm) 78 + #ifdef CONFIG_MMU 80 79 mov r1, #0 81 80 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache 82 81 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr 83 82 mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4) 83 + #endif 84 84 mov pc, lr 85 85 86 86 /* ··· 93 89 */ 94 90 .align 5 95 91 ENTRY(cpu_arm720_set_pte) 92 + #ifdef CONFIG_MMU 96 93 str r1, [r0], #-2048 @ linux version 97 94 98 95 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 112 107 movne r2, #0 113 108 114 109 str r2, [r0] @ hardware version 110 + #endif 115 111 mov pc, lr 116 112 117 113 /* ··· 123 117 ENTRY(cpu_arm720_reset) 124 118 mov ip, #0 125 119 mcr p15, 0, ip, c7, c7, 0 @ invalidate cache 120 + #ifdef CONFIG_MMU 126 121 mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4) 122 + #endif 127 123 mrc p15, 0, ip, c1, c0, 0 @ get ctrl register 128 124 bic ip, ip, #0x000f @ ............wcam 129 125 bic ip, ip, #0x2100 @ ..v....s........ ··· 138 130 __arm710_setup: 139 131 mov r0, #0 140 132 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches 133 + #ifdef CONFIG_MMU 141 134 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) 135 + #endif 142 136 mrc p15, 0, r0, c1, c0 @ get control register 143 137 ldr r5, arm710_cr1_clear 144 138 bic r0, r0, r5 ··· 166 156 __arm720_setup: 167 157 mov r0, #0 168 158 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches 159 + #ifdef CONFIG_MMU 169 160 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) 161 + #endif 170 162 mrc p15, 0, r0, c1, c0 @ get control register 171 163 ldr r5, arm720_cr1_clear 172 164 bic r0, r0, r5
+9
arch/arm/mm/proc-arm920.S
··· 3 3 * 4 4 * Copyright (C) 1999,2000 ARM Limited 5 5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License as published by ··· 98 97 mov ip, #0 99 98 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 100 99 mcr p15, 0, ip, c7, c10, 4 @ drain WB 100 + #ifdef CONFIG_MMU 101 101 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 102 + #endif 102 103 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 103 104 bic ip, ip, #0x000f @ ............wcam 104 105 bic ip, ip, #0x1100 @ ...i...s........ ··· 320 317 */ 321 318 .align 5 322 319 ENTRY(cpu_arm920_switch_mm) 320 + #ifdef CONFIG_MMU 323 321 mov ip, #0 324 322 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 325 323 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache ··· 341 337 mcr p15, 0, ip, c7, c10, 4 @ drain WB 342 338 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 343 339 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 340 + #endif 344 341 mov pc, lr 345 342 346 343 /* ··· 351 346 */ 352 347 .align 5 353 348 ENTRY(cpu_arm920_set_pte) 349 + #ifdef CONFIG_MMU 354 350 str r1, [r0], #-2048 @ linux version 355 351 356 352 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 378 372 mov r0, r0 379 373 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 380 374 mcr p15, 0, r0, c7, c10, 4 @ drain WB 375 + #endif /* CONFIG_MMU */ 381 376 mov pc, lr 382 377 383 378 __INIT ··· 388 381 mov r0, #0 389 382 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 390 383 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 384 + #ifdef CONFIG_MMU 391 385 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 386 + #endif 392 387 mrc p15, 0, r0, c1, c0 @ get control register v4 393 388 ldr r5, arm920_cr1_clear 394 389 bic r0, r0, r5
+9
arch/arm/mm/proc-arm922.S
··· 4 4 * Copyright (C) 1999,2000 ARM Limited 5 5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 6 * Copyright (C) 2001 Altera Corporation 7 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 7 8 * 8 9 * This program is free software; you can redistribute it and/or modify 9 10 * it under the terms of the GNU General Public License as published by ··· 100 99 mov ip, #0 101 100 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 102 101 mcr p15, 0, ip, c7, c10, 4 @ drain WB 102 + #ifdef CONFIG_MMU 103 103 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 104 + #endif 104 105 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 105 106 bic ip, ip, #0x000f @ ............wcam 106 107 bic ip, ip, #0x1100 @ ...i...s........ ··· 324 321 */ 325 322 .align 5 326 323 ENTRY(cpu_arm922_switch_mm) 324 + #ifdef CONFIG_MMU 327 325 mov ip, #0 328 326 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 329 327 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache ··· 345 341 mcr p15, 0, ip, c7, c10, 4 @ drain WB 346 342 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 347 343 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 344 + #endif 348 345 mov pc, lr 349 346 350 347 /* ··· 355 350 */ 356 351 .align 5 357 352 ENTRY(cpu_arm922_set_pte) 353 + #ifdef CONFIG_MMU 358 354 str r1, [r0], #-2048 @ linux version 359 355 360 356 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 382 376 mov r0, r0 383 377 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 384 378 mcr p15, 0, r0, c7, c10, 4 @ drain WB 379 + #endif /* CONFIG_MMU */ 385 380 mov pc, lr 386 381 387 382 __INIT ··· 392 385 mov r0, #0 393 386 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 394 387 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 388 + #ifdef CONFIG_MMU 395 389 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 390 + #endif 396 391 mrc p15, 0, r0, c1, c0 @ get control register v4 397 392 ldr r5, arm922_cr1_clear 398 393 bic r0, r0, r5
+10
arch/arm/mm/proc-arm925.S
··· 9 9 * Update for Linux-2.6 and cache flush improvements 10 10 * Copyright (C) 2004 Nokia Corporation by Tony Lindgren <tony@atomide.com> 11 11 * 12 + * hacked for non-paged-MM by Hyok S. Choi, 2004. 13 + * 12 14 * This program is free software; you can redistribute it and/or modify 13 15 * it under the terms of the GNU General Public License as published by 14 16 * the Free Software Foundation; either version 2 of the License, or ··· 124 122 mov ip, #0 125 123 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 126 124 mcr p15, 0, ip, c7, c10, 4 @ drain WB 125 + #ifdef CONFIG_MMU 127 126 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 127 + #endif 128 128 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 129 129 bic ip, ip, #0x000f @ ............wcam 130 130 bic ip, ip, #0x1100 @ ...i...s........ ··· 373 369 */ 374 370 .align 5 375 371 ENTRY(cpu_arm925_switch_mm) 372 + #ifdef CONFIG_MMU 376 373 mov ip, #0 377 374 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 378 375 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache ··· 388 383 mcr p15, 0, ip, c7, c10, 4 @ drain WB 389 384 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 390 385 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 386 + #endif 391 387 mov pc, lr 392 388 393 389 /* ··· 398 392 */ 399 393 .align 5 400 394 ENTRY(cpu_arm925_set_pte) 395 + #ifdef CONFIG_MMU 401 396 str r1, [r0], #-2048 @ linux version 402 397 403 398 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 427 420 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 428 421 #endif 429 422 mcr p15, 0, r0, c7, c10, 4 @ drain WB 423 + #endif /* CONFIG_MMU */ 430 424 mov pc, lr 431 425 432 426 __INIT ··· 446 438 mov r0, #0 447 439 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 448 440 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 441 + #ifdef CONFIG_MMU 449 442 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 443 + #endif 450 444 451 445 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 452 446 mov r0, #4 @ disable write-back on caches explicitly
+9
arch/arm/mm/proc-arm926.S
··· 3 3 * 4 4 * Copyright (C) 1999-2001 ARM Limited 5 5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 6 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License as published by ··· 86 85 mov ip, #0 87 86 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 88 87 mcr p15, 0, ip, c7, c10, 4 @ drain WB 88 + #ifdef CONFIG_MMU 89 89 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 90 + #endif 90 91 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 91 92 bic ip, ip, #0x000f @ ............wcam 92 93 bic ip, ip, #0x1100 @ ...i...s........ ··· 332 329 */ 333 330 .align 5 334 331 ENTRY(cpu_arm926_switch_mm) 332 + #ifdef CONFIG_MMU 335 333 mov ip, #0 336 334 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 337 335 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache ··· 345 341 mcr p15, 0, ip, c7, c10, 4 @ drain WB 346 342 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 347 343 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 344 + #endif 348 345 mov pc, lr 349 346 350 347 /* ··· 355 350 */ 356 351 .align 5 357 352 ENTRY(cpu_arm926_set_pte) 353 + #ifdef CONFIG_MMU 358 354 str r1, [r0], #-2048 @ linux version 359 355 360 356 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 384 378 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 385 379 #endif 386 380 mcr p15, 0, r0, c7, c10, 4 @ drain WB 381 + #endif 387 382 mov pc, lr 388 383 389 384 __INIT ··· 394 387 mov r0, #0 395 388 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 396 389 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 390 + #ifdef CONFIG_MMU 397 391 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 392 + #endif 398 393 399 394 400 395 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
+11
arch/arm/mm/proc-sa110.S
··· 2 2 * linux/arch/arm/mm/proc-sa110.S 3 3 * 4 4 * Copyright (C) 1997-2002 Russell King 5 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify 7 8 * it under the terms of the GNU General Public License version 2 as ··· 68 67 mov ip, #0 69 68 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 70 69 mcr p15, 0, ip, c7, c10, 4 @ drain WB 70 + #ifdef CONFIG_MMU 71 71 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 72 + #endif 72 73 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 73 74 bic ip, ip, #0x000f @ ............wcam 74 75 bic ip, ip, #0x1100 @ ...i...s........ ··· 133 130 */ 134 131 .align 5 135 132 ENTRY(cpu_sa110_switch_mm) 133 + #ifdef CONFIG_MMU 136 134 str lr, [sp, #-4]! 137 135 bl v4wb_flush_kern_cache_all @ clears IP 138 136 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 139 137 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 140 138 ldr pc, [sp], #4 139 + #else 140 + mov pc, lr 141 + #endif 141 142 142 143 /* 143 144 * cpu_sa110_set_pte(ptep, pte) ··· 150 143 */ 151 144 .align 5 152 145 ENTRY(cpu_sa110_set_pte) 146 + #ifdef CONFIG_MMU 153 147 str r1, [r0], #-2048 @ linux version 154 148 155 149 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 172 164 mov r0, r0 173 165 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 174 166 mcr p15, 0, r0, c7, c10, 4 @ drain WB 167 + #endif 175 168 mov pc, lr 176 169 177 170 __INIT ··· 182 173 mov r10, #0 183 174 mcr p15, 0, r10, c7, c7 @ invalidate I,D caches on v4 184 175 mcr p15, 0, r10, c7, c10, 4 @ drain write buffer on v4 176 + #ifdef CONFIG_MMU 185 177 mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4 178 + #endif 186 179 mrc p15, 0, r0, c1, c0 @ get control register v4 187 180 ldr r5, sa110_cr1_clear 188 181 bic r0, r0, r5
+11
arch/arm/mm/proc-sa1100.S
··· 2 2 * linux/arch/arm/mm/proc-sa1100.S 3 3 * 4 4 * Copyright (C) 1997-2002 Russell King 5 + * hacked for non-paged-MM by Hyok S. Choi, 2003. 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify 7 8 * it under the terms of the GNU General Public License version 2 as ··· 78 77 mov ip, #0 79 78 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 80 79 mcr p15, 0, ip, c7, c10, 4 @ drain WB 80 + #ifdef CONFIG_MMU 81 81 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 82 + #endif 82 83 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 83 84 bic ip, ip, #0x000f @ ............wcam 84 85 bic ip, ip, #0x1100 @ ...i...s........ ··· 145 142 */ 146 143 .align 5 147 144 ENTRY(cpu_sa1100_switch_mm) 145 + #ifdef CONFIG_MMU 148 146 str lr, [sp, #-4]! 149 147 bl v4wb_flush_kern_cache_all @ clears IP 150 148 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB 151 149 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 152 150 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 153 151 ldr pc, [sp], #4 152 + #else 153 + mov pc, lr 154 + #endif 154 155 155 156 /* 156 157 * cpu_sa1100_set_pte(ptep, pte) ··· 163 156 */ 164 157 .align 5 165 158 ENTRY(cpu_sa1100_set_pte) 159 + #ifdef CONFIG_MMU 166 160 str r1, [r0], #-2048 @ linux version 167 161 168 162 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY ··· 185 177 mov r0, r0 186 178 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 187 179 mcr p15, 0, r0, c7, c10, 4 @ drain WB 180 + #endif 188 181 mov pc, lr 189 182 190 183 __INIT ··· 195 186 mov r0, #0 196 187 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 197 188 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 189 + #ifdef CONFIG_MMU 198 190 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 191 + #endif 199 192 mrc p15, 0, r0, c1, c0 @ get control register v4 200 193 ldr r5, sa1100_cr1_clear 201 194 bic r0, r0, r5
+7
arch/arm/mm/proc-v6.S
··· 2 2 * linux/arch/arm/mm/proc-v6.S 3 3 * 4 4 * Copyright (C) 2001 Deep Blue Solutions Ltd. 5 + * Modified by Catalin Marinas for noMMU support 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify 7 8 * it under the terms of the GNU General Public License version 2 as ··· 89 88 * - we are not using split page tables 90 89 */ 91 90 ENTRY(cpu_v6_switch_mm) 91 + #ifdef CONFIG_MMU 92 92 mov r2, #0 93 93 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id 94 94 #ifdef CONFIG_SMP ··· 99 97 mcr p15, 0, r2, c7, c10, 4 @ drain write buffer 100 98 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 101 99 mcr p15, 0, r1, c13, c0, 1 @ set context ID 100 + #endif 102 101 mov pc, lr 103 102 104 103 /* ··· 122 119 * 1111 0 1 1 r/w r/w 123 120 */ 124 121 ENTRY(cpu_v6_set_pte) 122 + #ifdef CONFIG_MMU 125 123 str r1, [r0], #-2048 @ linux version 126 124 127 125 bic r2, r1, #0x000003f0 ··· 149 145 150 146 str r2, [r0] 151 147 mcr p15, 0, r0, c7, c10, 1 @ flush_pte 148 + #endif 152 149 mov pc, lr 153 150 154 151 ··· 199 194 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 200 195 mcr p15, 0, r0, c7, c15, 0 @ clean+invalidate cache 201 196 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 197 + #ifdef CONFIG_MMU 202 198 mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs 203 199 mcr p15, 0, r0, c2, c0, 2 @ TTB control register 204 200 #ifdef CONFIG_SMP 205 201 orr r4, r4, #TTB_RGN_WBWA|TTB_S @ mark PTWs shared, outer cacheable 206 202 #endif 207 203 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 204 + #endif /* CONFIG_MMU */ 208 205 #ifdef CONFIG_VFP 209 206 mrc p15, 0, r0, c1, c0, 2 210 207 orr r0, r0, #(0xf << 20)
+6
arch/i386/kernel/irq.c
··· 60 60 u32 *isp; 61 61 #endif 62 62 63 + if (unlikely((unsigned)irq >= NR_IRQS)) { 64 + printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 65 + __FUNCTION__, irq); 66 + BUG(); 67 + } 68 + 63 69 irq_enter(); 64 70 #ifdef CONFIG_DEBUG_STACKOVERFLOW 65 71 /* Debugging check for stack overflow: is there less than 1KB free? */
+1 -1
arch/ia64/configs/tiger_defconfig
··· 114 114 CONFIG_IOSAPIC=y 115 115 CONFIG_FORCE_MAX_ZONEORDER=17 116 116 CONFIG_SMP=y 117 - CONFIG_NR_CPUS=4 117 + CONFIG_NR_CPUS=16 118 118 CONFIG_HOTPLUG_CPU=y 119 119 CONFIG_PERMIT_BSP_REMOVE=y 120 120 CONFIG_FORCE_CPEI_RETARGET=y
+1 -1
arch/ia64/kernel/palinfo.c
··· 998 998 } 999 999 1000 1000 /* Register for future delivery via notify registration */ 1001 - register_cpu_notifier(&palinfo_cpu_notifier); 1001 + register_hotcpu_notifier(&palinfo_cpu_notifier); 1002 1002 1003 1003 return 0; 1004 1004 }
+9 -3
arch/ia64/sn/kernel/setup.c
··· 458 458 * support here so we don't have to listen to failed keyboard probe 459 459 * messages. 460 460 */ 461 - if (version <= 0x0209 && acpi_kbd_controller_present) { 461 + if (is_shub1() && version <= 0x0209 && acpi_kbd_controller_present) { 462 462 printk(KERN_INFO "Disabling legacy keyboard support as prom " 463 463 "is too old and doesn't provide FADT\n"); 464 464 acpi_kbd_controller_present = 0; ··· 577 577 int i; 578 578 static int wars_have_been_checked; 579 579 580 - if (smp_processor_id() == 0 && IS_MEDUSA()) { 580 + cpuid = smp_processor_id(); 581 + if (cpuid == 0 && IS_MEDUSA()) { 581 582 if (ia64_sn_is_fake_prom()) 582 583 sn_prom_type = 2; 583 584 else ··· 598 597 sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2; 599 598 600 599 /* 600 + * Don't check status. The SAL call is not supported on all PROMs 601 + * but a failure is harmless. 602 + */ 603 + (void) ia64_sn_set_cpu_number(cpuid); 604 + 605 + /* 601 606 * The boot cpu makes this call again after platform initialization is 602 607 * complete. 603 608 */ ··· 614 607 if (ia64_sn_get_prom_feature_set(i, &sn_prom_features[i]) != 0) 615 608 break; 616 609 617 - cpuid = smp_processor_id(); 618 610 cpuphyid = get_sapicid(); 619 611 620 612 if (ia64_sn_get_sapic_info(cpuphyid, &nasid, &subnode, &slice))
+1 -1
arch/ia64/sn/pci/tioca_provider.c
··· 595 595 596 596 /* sanity check prom rev */ 597 597 598 - if (sn_sal_rev() < 0x0406) { 598 + if (is_shub1() && sn_sal_rev() < 0x0406) { 599 599 printk 600 600 (KERN_ERR "%s: SGI prom rev 4.06 or greater required " 601 601 "for tioca support\n", __FUNCTION__);
+53
arch/m68knommu/Kconfig
··· 540 540 541 541 endchoice 542 542 543 + comment "ROM configuration" 544 + 545 + config ROM 546 + bool "Specify ROM linker regions" 547 + default n 548 + help 549 + Define a ROM region for the linker script. This creates a kernel 550 + that can be stored in flash, with possibly the text, and data 551 + regions being copied out to RAM at startup. 552 + 553 + config ROMBASE 554 + hex "Address of the base of ROM device" 555 + default "0" 556 + depends on ROM 557 + help 558 + Define the address that the ROM region starts at. Some platforms 559 + use this to set their chip select region accordingly for the boot 560 + device. 561 + 562 + config ROMVEC 563 + hex "Address of the base of the ROM vectors" 564 + default "0" 565 + depends on ROM 566 + help 567 + This is almost always the same as the base of the ROM. Since on all 568 + 68000 type varients the vectors are at the base of the boot device 569 + on system startup. 570 + 571 + config ROMVECSIZE 572 + hex "Size of ROM vector region (in bytes)" 573 + default "0x400" 574 + depends on ROM 575 + help 576 + Define the size of the vector region in ROM. For most 68000 577 + varients this would be 0x400 bytes in size. Set to 0 if you do 578 + not want a vector region at the start of the ROM. 579 + 580 + config ROMSTART 581 + hex "Address of the base of system image in ROM" 582 + default "0x400" 583 + depends on ROM 584 + help 585 + Define the start address of the system image in ROM. Commonly this 586 + is strait after the ROM vectors. 587 + 588 + config ROMSIZE 589 + hex "Size of the ROM device" 590 + default "0x100000" 591 + depends on ROM 592 + help 593 + Size of the ROM device. On some platforms this is used to setup 594 + the chip select that controls the boot ROM device. 595 + 543 596 choice 544 597 prompt "Kernel executes from" 545 598 ---help---
+6 -60
arch/m68knommu/kernel/vmlinux.lds.S
··· 3 3 * 4 4 * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com> 5 5 * 6 - * This ends up looking compilcated, because of the number of 7 - * address variations for ram and rom/flash layouts. The real 8 - * work of the linker script is all at the end, and reasonably 9 - * strait forward. 6 + * This linker script is equiped to build either ROM loaded or RAM 7 + * run kernels. 10 8 */ 11 9 12 10 #include <linux/config.h> 13 11 #include <asm-generic/vmlinux.lds.h> 14 - 15 - /* 16 - * Original Palm pilot (same for Xcopilot). 17 - * There is really only a rom target for this. 18 - */ 19 - #ifdef CONFIG_PILOT3 20 - #define ROMVEC_START 0x10c00000 21 - #define ROMVEC_LENGTH 0x10400 22 - #define ROM_START 0x10c10400 23 - #define ROM_LENGTH 0xfec00 24 - #define ROM_END 0x10d00000 25 - #define DATA_ADDR CONFIG_KERNELBASE 26 - #endif 27 - 28 - /* 29 - * Same setup on both the uCsimm and uCdimm. 30 - */ 31 - #if defined(CONFIG_UCSIMM) || defined(CONFIG_UCDIMM) 32 - #ifdef CONFIG_RAMKERNEL 33 - #define ROMVEC_START 0x10c10000 34 - #define ROMVEC_LENGTH 0x400 35 - #define ROM_START 0x10c10400 36 - #define ROM_LENGTH 0x1efc00 37 - #define ROM_END 0x10e00000 38 - #endif 39 - #ifdef CONFIG_ROMKERNEL 40 - #define ROMVEC_START 0x10c10000 41 - #define ROMVEC_LENGTH 0x400 42 - #define ROM_START 0x10c10400 43 - #define ROM_LENGTH 0x1efc00 44 - #define ROM_END 0x10e00000 45 - #endif 46 - #ifdef CONFIG_HIMEMKERNEL 47 - #define ROMVEC_START 0x00600000 48 - #define ROMVEC_LENGTH 0x400 49 - #define ROM_START 0x00600400 50 - #define ROM_LENGTH 0x1efc00 51 - #define ROM_END 0x007f0000 52 - #endif 53 - #endif 54 - 55 - #ifdef CONFIG_UCQUICC 56 - #define ROMVEC_START 0x00000000 57 - #define ROMVEC_LENGTH 0x404 58 - #define ROM_START 0x00000404 59 - #define ROM_LENGTH 0x1ff6fc 60 - #define ROM_END 0x00200000 61 - #endif 62 12 63 13 #if defined(CONFIG_RAMKERNEL) 64 14 #define RAM_START CONFIG_KERNELBASE ··· 21 71 #if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL) 22 72 #define RAM_START CONFIG_RAMBASE 23 73 #define RAM_LENGTH CONFIG_RAMSIZE 74 + #define ROMVEC_START CONFIG_ROMVEC 75 + #define ROMVEC_LENGTH CONFIG_ROMVECSIZE 76 + #define ROM_START CONFIG_ROMSTART 77 + #define ROM_LENGTH CONFIG_ROMSIZE 24 78 #define TEXT rom 25 79 #define DATA ram 26 80 #define INIT ram ··· 44 90 #ifdef ROM_START 45 91 romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH 46 92 rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH 47 - erom : ORIGIN = ROM_END, LENGTH = 0 48 93 #endif 49 94 } 50 95 ··· 119 166 . = ALIGN(4) ; 120 167 _etext = . ; 121 168 } > TEXT 122 - 123 - #ifdef ROM_END 124 - . = ROM_END ; 125 - .erom : { 126 - __rom_end = . ; 127 - } > erom 128 - #endif 129 169 130 170 .data DATA_ADDR : { 131 171 . = ALIGN(4);
+1
arch/m68knommu/platform/68328/Makefile
··· 8 8 9 9 obj-y += entry.o ints.o timers.o 10 10 obj-$(CONFIG_M68328) += config.o 11 + obj-$(CONFIG_ROM) += romvec.o 11 12 12 13 extra-y := head.o 13 14 extra-$(CONFIG_M68328) += bootlogo.rh head.o
+1 -19
arch/m68knommu/platform/68328/ints.c
··· 18 18 19 19 #include <asm/system.h> 20 20 #include <asm/irq.h> 21 + #include <asm/irqnode.h> 21 22 #include <asm/traps.h> 22 23 #include <asm/io.h> 23 24 #include <asm/machdep.h> ··· 82 81 83 82 /* irq node variables for the 32 (potential) on chip sources */ 84 83 static irq_node_t int_irq_list[NR_IRQS]; 85 - 86 - #if !defined(CONFIG_DRAGEN2) 87 - asm (".global _start, __ramend/n/t" 88 - ".section .romvec/n" 89 - "e_vectors:\n\t" 90 - ".long __ramend-4, _start, buserr, trap, trap, trap, trap, trap\n\t" 91 - ".long trap, trap, trap, trap, trap, trap, trap, trap\n\t" 92 - ".long trap, trap, trap, trap, trap, trap, trap, trap\n\t" 93 - ".long trap, trap, trap, trap\n\t" 94 - ".long trap, trap, trap, trap\n\t" 95 - /*.long inthandler, inthandler, inthandler, inthandler 96 - .long inthandler4, inthandler, inthandler, inthandler */ 97 - /* TRAP #0-15 */ 98 - ".long system_call, trap, trap, trap, trap, trap, trap, trap\n\t" 99 - ".long trap, trap, trap, trap, trap, trap, trap, trap\n\t" 100 - ".long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n\t" 101 - ".text\n" 102 - "ignore: rte"); 103 - #endif 104 84 105 85 /* 106 86 * This function should be called during kernel startup to initialize
+37
arch/m68knommu/platform/68328/romvec.S
··· 1 + /* 2 + * linux/arch/m68knommu/platform/68328/romvec.S 3 + * 4 + * This file is subject to the terms and conditions of the GNU General Public 5 + * License. See the file COPYING in the main directory of this archive 6 + * for more details. 7 + * 8 + * Copyright 1996 Roman Zippel 9 + * Copyright 1999 D. Jeff Dionne <jeff@rt-control.com> 10 + * Copyright 2006 Greg Ungerer <gerg@snapgear.com> 11 + */ 12 + 13 + #include <linux/config.h> 14 + 15 + .global _start 16 + .global _buserr 17 + .global trap 18 + .global system_call 19 + 20 + .section .romvec 21 + 22 + e_vectors: 23 + .long CONFIG_RAMBASE+CONFIG_RAMSIZE-4, _start, buserr, trap 24 + .long trap, trap, trap, trap 25 + .long trap, trap, trap, trap 26 + .long trap, trap, trap, trap 27 + .long trap, trap, trap, trap 28 + .long trap, trap, trap, trap 29 + .long trap, trap, trap, trap 30 + .long trap, trap, trap, trap 31 + /* TRAP #0-15 */ 32 + .long system_call, trap, trap, trap 33 + .long trap, trap, trap, trap 34 + .long trap, trap, trap, trap 35 + .long trap, trap, trap, trap 36 + .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 37 +
+7 -7
arch/m68knommu/platform/68360/config.c
··· 141 141 void BSP_reset (void) 142 142 { 143 143 local_irq_disable(); 144 - asm volatile (" 145 - moveal #_start, %a0; 146 - moveb #0, 0xFFFFF300; 147 - moveal 0(%a0), %sp; 148 - moveal 4(%a0), %a0; 149 - jmp (%a0); 150 - "); 144 + asm volatile ( 145 + "moveal #_start, %a0;\n" 146 + "moveb #0, 0xFFFFF300;\n" 147 + "moveal 0(%a0), %sp;\n" 148 + "moveal 4(%a0), %a0;\n" 149 + "jmp (%a0);\n" 150 + ); 151 151 } 152 152 153 153 unsigned char *scc1_hwaddr;
+1
arch/m68knommu/platform/68360/ints.c
··· 20 20 21 21 #include <asm/system.h> 22 22 #include <asm/irq.h> 23 + #include <asm/irqnode.h> 23 24 #include <asm/traps.h> 24 25 #include <asm/io.h> 25 26 #include <asm/machdep.h>
+7 -7
arch/m68knommu/platform/68EZ328/config.c
··· 42 42 void m68ez328_reset(void) 43 43 { 44 44 local_irq_disable(); 45 - asm volatile (" 46 - moveal #0x10c00000, %a0; 47 - moveb #0, 0xFFFFF300; 48 - moveal 0(%a0), %sp; 49 - moveal 4(%a0), %a0; 50 - jmp (%a0); 51 - "); 45 + asm volatile ( 46 + "moveal #0x10c00000, %a0;\n" 47 + "moveb #0, 0xFFFFF300;\n" 48 + "moveal 0(%a0), %sp;\n" 49 + "moveal 4(%a0), %a0;\n" 50 + "jmp (%a0);\n" 51 + ); 52 52 } 53 53 54 54 /***************************************************************************/
+7 -7
arch/m68knommu/platform/68VZ328/config.c
··· 141 141 static void m68vz328_reset(void) 142 142 { 143 143 local_irq_disable(); 144 - asm volatile (" 145 - moveal #0x10c00000, %a0; 146 - moveb #0, 0xFFFFF300; 147 - moveal 0(%a0), %sp; 148 - moveal 4(%a0), %a0; 149 - jmp (%a0); 150 - "); 144 + asm volatile ( 145 + "moveal #0x10c00000, %a0;\n\t" 146 + "moveb #0, 0xFFFFF300;\n\t" 147 + "moveal 0(%a0), %sp;\n\t" 148 + "moveal 4(%a0), %a0;\n\t" 149 + "jmp (%a0);\n" 150 + ); 151 151 } 152 152 153 153 unsigned char *cs8900a_hwaddr;
+12 -2
arch/powerpc/platforms/powermac/backlight.c
··· 119 119 down(&pmac_backlight->sem); 120 120 props = pmac_backlight->props; 121 121 props->brightness = brightness * 122 - props->max_brightness / OLD_BACKLIGHT_MAX; 122 + (props->max_brightness + 1) / 123 + (OLD_BACKLIGHT_MAX + 1); 124 + 125 + if (props->brightness > props->max_brightness) 126 + props->brightness = props->max_brightness; 127 + else if (props->brightness < 0) 128 + props->brightness = 0; 129 + 123 130 props->update_status(pmac_backlight); 124 131 up(&pmac_backlight->sem); 125 132 ··· 147 140 148 141 down(&pmac_backlight->sem); 149 142 props = pmac_backlight->props; 143 + 150 144 result = props->brightness * 151 - OLD_BACKLIGHT_MAX / props->max_brightness; 145 + (OLD_BACKLIGHT_MAX + 1) / 146 + (props->max_brightness + 1); 147 + 152 148 up(&pmac_backlight->sem); 153 149 } 154 150 mutex_unlock(&pmac_backlight_mutex);
+6
arch/x86_64/kernel/irq.c
··· 118 118 /* high bit used in ret_from_ code */ 119 119 unsigned irq = ~regs->orig_rax; 120 120 121 + if (unlikely(irq >= NR_IRQS)) { 122 + printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 123 + __FUNCTION__, irq); 124 + BUG(); 125 + } 126 + 121 127 exit_idle(); 122 128 irq_enter(); 123 129 #ifdef CONFIG_DEBUG_STACKOVERFLOW
+2
arch/x86_64/kernel/nmi.c
··· 607 607 vmalloc_sync_all(); 608 608 rcu_assign_pointer(nmi_callback, callback); 609 609 } 610 + EXPORT_SYMBOL_GPL(set_nmi_callback); 610 611 611 612 void unset_nmi_callback(void) 612 613 { 613 614 nmi_callback = dummy_nmi_callback; 614 615 } 616 + EXPORT_SYMBOL_GPL(unset_nmi_callback); 615 617 616 618 #ifdef CONFIG_SYSCTL 617 619
+2 -2
drivers/block/loop.c
··· 210 210 { 211 211 struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */ 212 212 struct address_space *mapping = file->f_mapping; 213 - struct address_space_operations *aops = mapping->a_ops; 213 + const struct address_space_operations *aops = mapping->a_ops; 214 214 pgoff_t index; 215 215 unsigned offset, bv_offs; 216 216 int len, ret; ··· 784 784 785 785 error = -EINVAL; 786 786 if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) { 787 - struct address_space_operations *aops = mapping->a_ops; 787 + const struct address_space_operations *aops = mapping->a_ops; 788 788 /* 789 789 * If we can't read - sorry. If we only can't write - well, 790 790 * it's going to be read-only.
+1 -1
drivers/block/rd.c
··· 191 191 return 0; 192 192 } 193 193 194 - static struct address_space_operations ramdisk_aops = { 194 + static const struct address_space_operations ramdisk_aops = { 195 195 .readpage = ramdisk_readpage, 196 196 .prepare_write = ramdisk_prepare_write, 197 197 .commit_write = ramdisk_commit_write,
+2 -5
drivers/char/ipmi/ipmi_msghandler.c
··· 3738 3738 proc_ipmi_root->owner = THIS_MODULE; 3739 3739 #endif /* CONFIG_PROC_FS */ 3740 3740 3741 - init_timer(&ipmi_timer); 3742 - ipmi_timer.data = 0; 3743 - ipmi_timer.function = ipmi_timeout; 3744 - ipmi_timer.expires = jiffies + IPMI_TIMEOUT_JIFFIES; 3745 - add_timer(&ipmi_timer); 3741 + setup_timer(&ipmi_timer, ipmi_timeout, 0); 3742 + mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); 3746 3743 3747 3744 atomic_notifier_chain_register(&panic_notifier_list, &panic_block); 3748 3745
-67
drivers/char/ipmi/ipmi_si_intf.c
··· 55 55 #include <linux/mutex.h> 56 56 #include <linux/kthread.h> 57 57 #include <asm/irq.h> 58 - #ifdef CONFIG_HIGH_RES_TIMERS 59 - #include <linux/hrtime.h> 60 - # if defined(schedule_next_int) 61 - /* Old high-res timer code, do translations. */ 62 - # define get_arch_cycles(a) quick_update_jiffies_sub(a) 63 - # define arch_cycles_per_jiffy cycles_per_jiffies 64 - # endif 65 - static inline void add_usec_to_timer(struct timer_list *t, long v) 66 - { 67 - t->arch_cycle_expires += nsec_to_arch_cycle(v * 1000); 68 - while (t->arch_cycle_expires >= arch_cycles_per_jiffy) 69 - { 70 - t->expires++; 71 - t->arch_cycle_expires -= arch_cycles_per_jiffy; 72 - } 73 - } 74 - #endif 75 58 #include <linux/interrupt.h> 76 59 #include <linux/rcupdate.h> 77 60 #include <linux/ipmi_smi.h> ··· 225 242 { 226 243 return atomic_notifier_chain_register(&xaction_notifier_list, nb); 227 244 } 228 - 229 - static void si_restart_short_timer(struct smi_info *smi_info); 230 245 231 246 static void deliver_recv_msg(struct smi_info *smi_info, 232 247 struct ipmi_smi_msg *msg) ··· 749 768 && (smi_info->curr_msg == NULL)) 750 769 { 751 770 start_next_msg(smi_info); 752 - si_restart_short_timer(smi_info); 753 771 } 754 772 spin_unlock_irqrestore(&(smi_info->si_lock), flags); 755 773 } ··· 813 833 814 834 static int initialized = 0; 815 835 816 - /* Must be called with interrupts off and with the si_lock held. */ 817 - static void si_restart_short_timer(struct smi_info *smi_info) 818 - { 819 - #if defined(CONFIG_HIGH_RES_TIMERS) 820 - unsigned long flags; 821 - unsigned long jiffies_now; 822 - unsigned long seq; 823 - 824 - if (del_timer(&(smi_info->si_timer))) { 825 - /* If we don't delete the timer, then it will go off 826 - immediately, anyway. So we only process if we 827 - actually delete the timer. */ 828 - 829 - do { 830 - seq = read_seqbegin_irqsave(&xtime_lock, flags); 831 - jiffies_now = jiffies; 832 - smi_info->si_timer.expires = jiffies_now; 833 - smi_info->si_timer.arch_cycle_expires 834 - = get_arch_cycles(jiffies_now); 835 - } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 836 - 837 - add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC); 838 - 839 - add_timer(&(smi_info->si_timer)); 840 - spin_lock_irqsave(&smi_info->count_lock, flags); 841 - smi_info->timeout_restarts++; 842 - spin_unlock_irqrestore(&smi_info->count_lock, flags); 843 - } 844 - #endif 845 - } 846 - 847 836 static void smi_timeout(unsigned long data) 848 837 { 849 838 struct smi_info *smi_info = (struct smi_info *) data; ··· 853 904 /* If the state machine asks for a short delay, then shorten 854 905 the timer timeout. */ 855 906 if (smi_result == SI_SM_CALL_WITH_DELAY) { 856 - #if defined(CONFIG_HIGH_RES_TIMERS) 857 - unsigned long seq; 858 - #endif 859 907 spin_lock_irqsave(&smi_info->count_lock, flags); 860 908 smi_info->short_timeouts++; 861 909 spin_unlock_irqrestore(&smi_info->count_lock, flags); 862 - #if defined(CONFIG_HIGH_RES_TIMERS) 863 - do { 864 - seq = read_seqbegin_irqsave(&xtime_lock, flags); 865 - smi_info->si_timer.expires = jiffies; 866 - smi_info->si_timer.arch_cycle_expires 867 - = get_arch_cycles(smi_info->si_timer.expires); 868 - } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 869 - add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC); 870 - #else 871 910 smi_info->si_timer.expires = jiffies + 1; 872 - #endif 873 911 } else { 874 912 spin_lock_irqsave(&smi_info->count_lock, flags); 875 913 smi_info->long_timeouts++; 876 914 spin_unlock_irqrestore(&smi_info->count_lock, flags); 877 915 smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; 878 - #if defined(CONFIG_HIGH_RES_TIMERS) 879 - smi_info->si_timer.arch_cycle_expires = 0; 880 - #endif 881 916 } 882 917 883 918 do_add_timer:
+10 -8
drivers/char/ipmi/ipmi_watchdog.c
··· 949 949 /* Disable the WDT if we are shutting down. */ 950 950 ipmi_watchdog_state = WDOG_TIMEOUT_NONE; 951 951 panic_halt_ipmi_set_timeout(); 952 - } else { 952 + } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { 953 953 /* Set a long timer to let the reboot happens, but 954 - reboot if it hangs. */ 954 + reboot if it hangs, but only if the watchdog 955 + timer was already running. */ 955 956 timeout = 120; 956 957 pretimeout = 0; 957 958 ipmi_watchdog_state = WDOG_TIMEOUT_RESET; ··· 974 973 { 975 974 static int panic_event_handled = 0; 976 975 977 - /* On a panic, if we have a panic timeout, make sure that the thing 978 - reboots, even if it hangs during that panic. */ 979 - if (watchdog_user && !panic_event_handled) { 980 - /* Make sure the panic doesn't hang, and make sure we 981 - do this only once. */ 976 + /* On a panic, if we have a panic timeout, make sure to extend 977 + the watchdog timer to a reasonable value to complete the 978 + panic, if the watchdog timer is running. Plus the 979 + pretimeout is meaningless at panic time. */ 980 + if (watchdog_user && !panic_event_handled && 981 + ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { 982 + /* Make sure we do this only once. */ 982 983 panic_event_handled = 1; 983 984 984 985 timeout = 255; 985 986 pretimeout = 0; 986 - ipmi_watchdog_state = WDOG_TIMEOUT_RESET; 987 987 panic_halt_ipmi_set_timeout(); 988 988 } 989 989
+665 -1150
drivers/char/istallion.c
··· 42 42 #include <linux/devfs_fs_kernel.h> 43 43 #include <linux/device.h> 44 44 #include <linux/wait.h> 45 + #include <linux/eisa.h> 45 46 46 47 #include <asm/io.h> 47 48 #include <asm/uaccess.h> 48 49 49 - #ifdef CONFIG_PCI 50 50 #include <linux/pci.h> 51 - #endif 52 51 53 52 /*****************************************************************************/ 54 53 ··· 136 137 137 138 static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); 138 139 140 + /* stli_lock must NOT be taken holding brd_lock */ 141 + static spinlock_t stli_lock; /* TTY logic lock */ 142 + static spinlock_t brd_lock; /* Board logic lock */ 143 + 139 144 /* 140 145 * There is some experimental EISA board detection code in this driver. 141 146 * By default it is disabled, but for those that want to try it out, ··· 176 173 177 174 static struct tty_driver *stli_serial; 178 175 179 - /* 180 - * We will need to allocate a temporary write buffer for chars that 181 - * come direct from user space. The problem is that a copy from user 182 - * space might cause a page fault (typically on a system that is 183 - * swapping!). All ports will share one buffer - since if the system 184 - * is already swapping a shared buffer won't make things any worse. 185 - */ 186 - static char *stli_tmpwritebuf; 187 176 188 177 #define STLI_TXBUFSIZE 4096 189 178 ··· 414 419 #endif 415 420 416 421 static struct pci_device_id istallion_pci_tbl[] = { 417 - { PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 422 + { PCI_DEVICE(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA), }, 418 423 { 0 } 419 424 }; 420 425 MODULE_DEVICE_TABLE(pci, istallion_pci_tbl); ··· 677 682 static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp); 678 683 static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp); 679 684 static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg); 680 - static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp); 685 + static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp); 681 686 static void stli_poll(unsigned long arg); 682 687 static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp); 683 688 static int stli_initopen(stlibrd_t *brdp, stliport_t *portp); ··· 688 693 static int stli_setport(stliport_t *portp); 689 694 static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); 690 695 static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); 691 - static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp); 696 + static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); 697 + static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp); 692 698 static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp); 693 699 static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); 694 700 static long stli_mktiocm(unsigned long sigvalue); ··· 795 799 796 800 static int __init istallion_module_init(void) 797 801 { 798 - unsigned long flags; 799 - 800 - #ifdef DEBUG 801 - printk("init_module()\n"); 802 - #endif 803 - 804 - save_flags(flags); 805 - cli(); 806 802 stli_init(); 807 - restore_flags(flags); 808 - 809 - return(0); 803 + return 0; 810 804 } 811 805 812 806 /*****************************************************************************/ ··· 805 819 { 806 820 stlibrd_t *brdp; 807 821 stliport_t *portp; 808 - unsigned long flags; 809 822 int i, j; 810 - 811 - #ifdef DEBUG 812 - printk("cleanup_module()\n"); 813 - #endif 814 823 815 824 printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, 816 825 stli_drvversion); 817 826 818 - save_flags(flags); 819 - cli(); 820 - 821 - /* 822 - * Free up all allocated resources used by the ports. This includes 823 - * memory and interrupts. 824 - */ 827 + /* 828 + * Free up all allocated resources used by the ports. This includes 829 + * memory and interrupts. 830 + */ 825 831 if (stli_timeron) { 826 832 stli_timeron = 0; 827 - del_timer(&stli_timerlist); 833 + del_timer_sync(&stli_timerlist); 828 834 } 829 835 830 836 i = tty_unregister_driver(stli_serial); 831 837 if (i) { 832 838 printk("STALLION: failed to un-register tty driver, " 833 839 "errno=%d\n", -i); 834 - restore_flags(flags); 835 840 return; 836 841 } 837 842 put_tty_driver(stli_serial); ··· 836 859 printk("STALLION: failed to un-register serial memory device, " 837 860 "errno=%d\n", -i); 838 861 839 - kfree(stli_tmpwritebuf); 840 862 kfree(stli_txcookbuf); 841 863 842 864 for (i = 0; (i < stli_nrbrds); i++) { 843 - if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL) 865 + if ((brdp = stli_brds[i]) == NULL) 844 866 continue; 845 867 for (j = 0; (j < STL_MAXPORTS); j++) { 846 868 portp = brdp->ports[j]; 847 - if (portp != (stliport_t *) NULL) { 848 - if (portp->tty != (struct tty_struct *) NULL) 869 + if (portp != NULL) { 870 + if (portp->tty != NULL) 849 871 tty_hangup(portp->tty); 850 872 kfree(portp); 851 873 } ··· 854 878 if (brdp->iosize > 0) 855 879 release_region(brdp->iobase, brdp->iosize); 856 880 kfree(brdp); 857 - stli_brds[i] = (stlibrd_t *) NULL; 881 + stli_brds[i] = NULL; 858 882 } 859 - 860 - restore_flags(flags); 861 883 } 862 884 863 885 module_init(istallion_module_init); ··· 869 895 870 896 static void stli_argbrds(void) 871 897 { 872 - stlconf_t conf; 873 - stlibrd_t *brdp; 874 - int i; 875 - 876 - #ifdef DEBUG 877 - printk("stli_argbrds()\n"); 878 - #endif 898 + stlconf_t conf; 899 + stlibrd_t *brdp; 900 + int i; 879 901 880 902 for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { 881 903 memset(&conf, 0, sizeof(conf)); 882 904 if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) 883 905 continue; 884 - if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 906 + if ((brdp = stli_allocbrd()) == NULL) 885 907 continue; 886 908 stli_nrbrds = i + 1; 887 909 brdp->brdnr = i; ··· 896 926 897 927 static unsigned long stli_atol(char *str) 898 928 { 899 - unsigned long val; 900 - int base, c; 901 - char *sp; 929 + unsigned long val; 930 + int base, c; 931 + char *sp; 902 932 903 933 val = 0; 904 934 sp = str; ··· 932 962 933 963 static int stli_parsebrd(stlconf_t *confp, char **argp) 934 964 { 935 - char *sp; 936 - int i; 965 + char *sp; 966 + int i; 937 967 938 - #ifdef DEBUG 939 - printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); 940 - #endif 941 - 942 - if ((argp[0] == (char *) NULL) || (*argp[0] == 0)) 943 - return(0); 968 + if (argp[0] == NULL || *argp[0] == 0) 969 + return 0; 944 970 945 971 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) 946 972 *sp = TOLOWER(*sp); ··· 951 985 } 952 986 953 987 confp->brdtype = stli_brdstr[i].type; 954 - if ((argp[1] != (char *) NULL) && (*argp[1] != 0)) 988 + if (argp[1] != NULL && *argp[1] != 0) 955 989 confp->ioaddr1 = stli_atol(argp[1]); 956 - if ((argp[2] != (char *) NULL) && (*argp[2] != 0)) 990 + if (argp[2] != NULL && *argp[2] != 0) 957 991 confp->memaddr = stli_atol(argp[2]); 958 992 return(1); 959 993 } ··· 964 998 965 999 static int stli_open(struct tty_struct *tty, struct file *filp) 966 1000 { 967 - stlibrd_t *brdp; 968 - stliport_t *portp; 969 - unsigned int minordev; 970 - int brdnr, portnr, rc; 971 - 972 - #ifdef DEBUG 973 - printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty, 974 - (int) filp, tty->name); 975 - #endif 1001 + stlibrd_t *brdp; 1002 + stliport_t *portp; 1003 + unsigned int minordev; 1004 + int brdnr, portnr, rc; 976 1005 977 1006 minordev = tty->index; 978 1007 brdnr = MINOR2BRD(minordev); 979 1008 if (brdnr >= stli_nrbrds) 980 - return(-ENODEV); 1009 + return -ENODEV; 981 1010 brdp = stli_brds[brdnr]; 982 - if (brdp == (stlibrd_t *) NULL) 983 - return(-ENODEV); 1011 + if (brdp == NULL) 1012 + return -ENODEV; 984 1013 if ((brdp->state & BST_STARTED) == 0) 985 - return(-ENODEV); 1014 + return -ENODEV; 986 1015 portnr = MINOR2PORT(minordev); 987 1016 if ((portnr < 0) || (portnr > brdp->nrports)) 988 - return(-ENODEV); 1017 + return -ENODEV; 989 1018 990 1019 portp = brdp->ports[portnr]; 991 - if (portp == (stliport_t *) NULL) 992 - return(-ENODEV); 1020 + if (portp == NULL) 1021 + return -ENODEV; 993 1022 if (portp->devnr < 1) 994 - return(-ENODEV); 1023 + return -ENODEV; 995 1024 996 1025 997 1026 /* ··· 998 1037 if (portp->flags & ASYNC_CLOSING) { 999 1038 interruptible_sleep_on(&portp->close_wait); 1000 1039 if (portp->flags & ASYNC_HUP_NOTIFY) 1001 - return(-EAGAIN); 1002 - return(-ERESTARTSYS); 1040 + return -EAGAIN; 1041 + return -ERESTARTSYS; 1003 1042 } 1004 1043 1005 1044 /* ··· 1015 1054 wait_event_interruptible(portp->raw_wait, 1016 1055 !test_bit(ST_INITIALIZING, &portp->state)); 1017 1056 if (signal_pending(current)) 1018 - return(-ERESTARTSYS); 1057 + return -ERESTARTSYS; 1019 1058 1020 1059 if ((portp->flags & ASYNC_INITIALIZED) == 0) { 1021 1060 set_bit(ST_INITIALIZING, &portp->state); ··· 1026 1065 clear_bit(ST_INITIALIZING, &portp->state); 1027 1066 wake_up_interruptible(&portp->raw_wait); 1028 1067 if (rc < 0) 1029 - return(rc); 1068 + return rc; 1030 1069 } 1031 1070 1032 1071 /* ··· 1038 1077 if (portp->flags & ASYNC_CLOSING) { 1039 1078 interruptible_sleep_on(&portp->close_wait); 1040 1079 if (portp->flags & ASYNC_HUP_NOTIFY) 1041 - return(-EAGAIN); 1042 - return(-ERESTARTSYS); 1080 + return -EAGAIN; 1081 + return -ERESTARTSYS; 1043 1082 } 1044 1083 1045 1084 /* ··· 1049 1088 */ 1050 1089 if (!(filp->f_flags & O_NONBLOCK)) { 1051 1090 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) 1052 - return(rc); 1091 + return rc; 1053 1092 } 1054 1093 portp->flags |= ASYNC_NORMAL_ACTIVE; 1055 - return(0); 1094 + return 0; 1056 1095 } 1057 1096 1058 1097 /*****************************************************************************/ 1059 1098 1060 1099 static void stli_close(struct tty_struct *tty, struct file *filp) 1061 1100 { 1062 - stlibrd_t *brdp; 1063 - stliport_t *portp; 1064 - unsigned long flags; 1065 - 1066 - #ifdef DEBUG 1067 - printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp); 1068 - #endif 1101 + stlibrd_t *brdp; 1102 + stliport_t *portp; 1103 + unsigned long flags; 1069 1104 1070 1105 portp = tty->driver_data; 1071 - if (portp == (stliport_t *) NULL) 1106 + if (portp == NULL) 1072 1107 return; 1073 1108 1074 - save_flags(flags); 1075 - cli(); 1109 + spin_lock_irqsave(&stli_lock, flags); 1076 1110 if (tty_hung_up_p(filp)) { 1077 - restore_flags(flags); 1111 + spin_unlock_irqrestore(&stli_lock, flags); 1078 1112 return; 1079 1113 } 1080 1114 if ((tty->count == 1) && (portp->refcount != 1)) 1081 1115 portp->refcount = 1; 1082 1116 if (portp->refcount-- > 1) { 1083 - restore_flags(flags); 1117 + spin_unlock_irqrestore(&stli_lock, flags); 1084 1118 return; 1085 1119 } 1086 1120 ··· 1090 1134 if (tty == stli_txcooktty) 1091 1135 stli_flushchars(tty); 1092 1136 tty->closing = 1; 1137 + spin_unlock_irqrestore(&stli_lock, flags); 1138 + 1093 1139 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1094 1140 tty_wait_until_sent(tty, portp->closing_wait); 1095 1141 ··· 1115 1157 stli_flushbuffer(tty); 1116 1158 1117 1159 tty->closing = 0; 1118 - portp->tty = (struct tty_struct *) NULL; 1160 + portp->tty = NULL; 1119 1161 1120 1162 if (portp->openwaitcnt) { 1121 1163 if (portp->close_delay) ··· 1125 1167 1126 1168 portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1127 1169 wake_up_interruptible(&portp->close_wait); 1128 - restore_flags(flags); 1129 1170 } 1130 1171 1131 1172 /*****************************************************************************/ ··· 1139 1182 1140 1183 static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) 1141 1184 { 1142 - struct tty_struct *tty; 1143 - asynotify_t nt; 1144 - asyport_t aport; 1145 - int rc; 1146 - 1147 - #ifdef DEBUG 1148 - printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp); 1149 - #endif 1185 + struct tty_struct *tty; 1186 + asynotify_t nt; 1187 + asyport_t aport; 1188 + int rc; 1150 1189 1151 1190 if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0) 1152 - return(rc); 1191 + return rc; 1153 1192 1154 1193 memset(&nt, 0, sizeof(asynotify_t)); 1155 1194 nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK); 1156 1195 nt.signal = SG_DCD; 1157 1196 if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt, 1158 1197 sizeof(asynotify_t), 0)) < 0) 1159 - return(rc); 1198 + return rc; 1160 1199 1161 1200 tty = portp->tty; 1162 - if (tty == (struct tty_struct *) NULL) 1163 - return(-ENODEV); 1201 + if (tty == NULL) 1202 + return -ENODEV; 1164 1203 stli_mkasyport(portp, &aport, tty->termios); 1165 1204 if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, 1166 1205 sizeof(asyport_t), 0)) < 0) 1167 - return(rc); 1206 + return rc; 1168 1207 1169 1208 set_bit(ST_GETSIGS, &portp->state); 1170 1209 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, 1171 1210 sizeof(asysigs_t), 1)) < 0) 1172 - return(rc); 1211 + return rc; 1173 1212 if (test_and_clear_bit(ST_GETSIGS, &portp->state)) 1174 1213 portp->sigs = stli_mktiocm(portp->asig.sigvalue); 1175 1214 stli_mkasysigs(&portp->asig, 1, 1); 1176 1215 if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, 1177 1216 sizeof(asysigs_t), 0)) < 0) 1178 - return(rc); 1217 + return rc; 1179 1218 1180 - return(0); 1219 + return 0; 1181 1220 } 1182 1221 1183 1222 /*****************************************************************************/ ··· 1187 1234 1188 1235 static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) 1189 1236 { 1190 - volatile cdkhdr_t *hdrp; 1191 - volatile cdkctrl_t *cp; 1192 - volatile unsigned char *bits; 1193 - unsigned long flags; 1194 - int rc; 1195 - 1196 - #ifdef DEBUG 1197 - printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n", 1198 - (int) brdp, (int) portp, (int) arg, wait); 1199 - #endif 1237 + cdkhdr_t __iomem *hdrp; 1238 + cdkctrl_t __iomem *cp; 1239 + unsigned char __iomem *bits; 1240 + unsigned long flags; 1241 + int rc; 1200 1242 1201 1243 /* 1202 1244 * Send a message to the slave to open this port. 1203 1245 */ 1204 - save_flags(flags); 1205 - cli(); 1206 1246 1207 1247 /* 1208 1248 * Slave is already closing this port. This can happen if a hangup ··· 1206 1260 wait_event_interruptible(portp->raw_wait, 1207 1261 !test_bit(ST_CLOSING, &portp->state)); 1208 1262 if (signal_pending(current)) { 1209 - restore_flags(flags); 1210 1263 return -ERESTARTSYS; 1211 1264 } 1212 1265 ··· 1214 1269 * memory. Once the message is in set the service bits to say that 1215 1270 * this port wants service. 1216 1271 */ 1272 + spin_lock_irqsave(&brd_lock, flags); 1217 1273 EBRDENABLE(brdp); 1218 - cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 1219 - cp->openarg = arg; 1220 - cp->open = 1; 1221 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1222 - bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1274 + cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 1275 + writel(arg, &cp->openarg); 1276 + writeb(1, &cp->open); 1277 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1278 + bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + 1223 1279 portp->portidx; 1224 - *bits |= portp->portbit; 1280 + writeb(readb(bits) | portp->portbit, bits); 1225 1281 EBRDDISABLE(brdp); 1226 1282 1227 1283 if (wait == 0) { 1228 - restore_flags(flags); 1229 - return(0); 1284 + spin_unlock_irqrestore(&brd_lock, flags); 1285 + return 0; 1230 1286 } 1231 1287 1232 1288 /* ··· 1236 1290 */ 1237 1291 rc = 0; 1238 1292 set_bit(ST_OPENING, &portp->state); 1293 + spin_unlock_irqrestore(&brd_lock, flags); 1294 + 1239 1295 wait_event_interruptible(portp->raw_wait, 1240 1296 !test_bit(ST_OPENING, &portp->state)); 1241 1297 if (signal_pending(current)) 1242 1298 rc = -ERESTARTSYS; 1243 - restore_flags(flags); 1244 1299 1245 1300 if ((rc == 0) && (portp->rc != 0)) 1246 1301 rc = -EIO; 1247 - return(rc); 1302 + return rc; 1248 1303 } 1249 1304 1250 1305 /*****************************************************************************/ ··· 1258 1311 1259 1312 static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) 1260 1313 { 1261 - volatile cdkhdr_t *hdrp; 1262 - volatile cdkctrl_t *cp; 1263 - volatile unsigned char *bits; 1264 - unsigned long flags; 1265 - int rc; 1266 - 1267 - #ifdef DEBUG 1268 - printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n", 1269 - (int) brdp, (int) portp, (int) arg, wait); 1270 - #endif 1271 - 1272 - save_flags(flags); 1273 - cli(); 1314 + cdkhdr_t __iomem *hdrp; 1315 + cdkctrl_t __iomem *cp; 1316 + unsigned char __iomem *bits; 1317 + unsigned long flags; 1318 + int rc; 1274 1319 1275 1320 /* 1276 1321 * Slave is already closing this port. This can happen if a hangup ··· 1272 1333 wait_event_interruptible(portp->raw_wait, 1273 1334 !test_bit(ST_CLOSING, &portp->state)); 1274 1335 if (signal_pending(current)) { 1275 - restore_flags(flags); 1276 1336 return -ERESTARTSYS; 1277 1337 } 1278 1338 } ··· 1279 1341 /* 1280 1342 * Write the close command into shared memory. 1281 1343 */ 1344 + spin_lock_irqsave(&brd_lock, flags); 1282 1345 EBRDENABLE(brdp); 1283 - cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 1284 - cp->closearg = arg; 1285 - cp->close = 1; 1286 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1287 - bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1346 + cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 1347 + writel(arg, &cp->closearg); 1348 + writeb(1, &cp->close); 1349 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1350 + bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + 1288 1351 portp->portidx; 1289 - *bits |= portp->portbit; 1352 + writeb(readb(bits) |portp->portbit, bits); 1290 1353 EBRDDISABLE(brdp); 1291 1354 1292 1355 set_bit(ST_CLOSING, &portp->state); 1293 - if (wait == 0) { 1294 - restore_flags(flags); 1295 - return(0); 1296 - } 1356 + spin_unlock_irqrestore(&brd_lock, flags); 1357 + 1358 + if (wait == 0) 1359 + return 0; 1297 1360 1298 1361 /* 1299 1362 * Slave is in action, so now we must wait for the open acknowledgment ··· 1305 1366 !test_bit(ST_CLOSING, &portp->state)); 1306 1367 if (signal_pending(current)) 1307 1368 rc = -ERESTARTSYS; 1308 - restore_flags(flags); 1309 1369 1310 1370 if ((rc == 0) && (portp->rc != 0)) 1311 1371 rc = -EIO; 1312 - return(rc); 1372 + return rc; 1313 1373 } 1314 1374 1315 1375 /*****************************************************************************/ ··· 1322 1384 1323 1385 static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) 1324 1386 { 1325 - unsigned long flags; 1326 - 1327 - #ifdef DEBUG 1328 - printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," 1329 - "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, 1330 - (int) arg, size, copyback); 1331 - #endif 1332 - 1333 - save_flags(flags); 1334 - cli(); 1335 1387 wait_event_interruptible(portp->raw_wait, 1336 1388 !test_bit(ST_CMDING, &portp->state)); 1337 - if (signal_pending(current)) { 1338 - restore_flags(flags); 1389 + if (signal_pending(current)) 1339 1390 return -ERESTARTSYS; 1340 - } 1341 1391 1342 1392 stli_sendcmd(brdp, portp, cmd, arg, size, copyback); 1343 1393 1344 1394 wait_event_interruptible(portp->raw_wait, 1345 1395 !test_bit(ST_CMDING, &portp->state)); 1346 - if (signal_pending(current)) { 1347 - restore_flags(flags); 1396 + if (signal_pending(current)) 1348 1397 return -ERESTARTSYS; 1349 - } 1350 - restore_flags(flags); 1351 1398 1352 1399 if (portp->rc != 0) 1353 - return(-EIO); 1354 - return(0); 1400 + return -EIO; 1401 + return 0; 1355 1402 } 1356 1403 1357 1404 /*****************************************************************************/ ··· 1348 1425 1349 1426 static int stli_setport(stliport_t *portp) 1350 1427 { 1351 - stlibrd_t *brdp; 1352 - asyport_t aport; 1428 + stlibrd_t *brdp; 1429 + asyport_t aport; 1353 1430 1354 - #ifdef DEBUG 1355 - printk("stli_setport(portp=%x)\n", (int) portp); 1356 - #endif 1357 - 1358 - if (portp == (stliport_t *) NULL) 1359 - return(-ENODEV); 1360 - if (portp->tty == (struct tty_struct *) NULL) 1361 - return(-ENODEV); 1362 - if ((portp->brdnr < 0) && (portp->brdnr >= stli_nrbrds)) 1363 - return(-ENODEV); 1431 + if (portp == NULL) 1432 + return -ENODEV; 1433 + if (portp->tty == NULL) 1434 + return -ENODEV; 1435 + if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds) 1436 + return -ENODEV; 1364 1437 brdp = stli_brds[portp->brdnr]; 1365 - if (brdp == (stlibrd_t *) NULL) 1366 - return(-ENODEV); 1438 + if (brdp == NULL) 1439 + return -ENODEV; 1367 1440 1368 1441 stli_mkasyport(portp, &aport, portp->tty->termios); 1369 1442 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); ··· 1374 1455 1375 1456 static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp) 1376 1457 { 1377 - unsigned long flags; 1378 - int rc, doclocal; 1379 - 1380 - #ifdef DEBUG 1381 - printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n", 1382 - (int) brdp, (int) portp, (int) filp); 1383 - #endif 1458 + unsigned long flags; 1459 + int rc, doclocal; 1384 1460 1385 1461 rc = 0; 1386 1462 doclocal = 0; ··· 1383 1469 if (portp->tty->termios->c_cflag & CLOCAL) 1384 1470 doclocal++; 1385 1471 1386 - save_flags(flags); 1387 - cli(); 1472 + spin_lock_irqsave(&stli_lock, flags); 1388 1473 portp->openwaitcnt++; 1389 1474 if (! tty_hung_up_p(filp)) 1390 1475 portp->refcount--; 1476 + spin_unlock_irqrestore(&stli_lock, flags); 1391 1477 1392 1478 for (;;) { 1393 1479 stli_mkasysigs(&portp->asig, 1, 1); ··· 1413 1499 interruptible_sleep_on(&portp->open_wait); 1414 1500 } 1415 1501 1502 + spin_lock_irqsave(&stli_lock, flags); 1416 1503 if (! tty_hung_up_p(filp)) 1417 1504 portp->refcount++; 1418 1505 portp->openwaitcnt--; 1419 - restore_flags(flags); 1506 + spin_unlock_irqrestore(&stli_lock, flags); 1420 1507 1421 - return(rc); 1508 + return rc; 1422 1509 } 1423 1510 1424 1511 /*****************************************************************************/ ··· 1432 1517 1433 1518 static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count) 1434 1519 { 1435 - volatile cdkasy_t *ap; 1436 - volatile cdkhdr_t *hdrp; 1437 - volatile unsigned char *bits; 1438 - unsigned char *shbuf, *chbuf; 1439 - stliport_t *portp; 1440 - stlibrd_t *brdp; 1441 - unsigned int len, stlen, head, tail, size; 1442 - unsigned long flags; 1520 + cdkasy_t __iomem *ap; 1521 + cdkhdr_t __iomem *hdrp; 1522 + unsigned char __iomem *bits; 1523 + unsigned char __iomem *shbuf; 1524 + unsigned char *chbuf; 1525 + stliport_t *portp; 1526 + stlibrd_t *brdp; 1527 + unsigned int len, stlen, head, tail, size; 1528 + unsigned long flags; 1443 1529 1444 - #ifdef DEBUG 1445 - printk("stli_write(tty=%x,buf=%x,count=%d)\n", 1446 - (int) tty, (int) buf, count); 1447 - #endif 1448 - 1449 - if ((tty == (struct tty_struct *) NULL) || 1450 - (stli_tmpwritebuf == (char *) NULL)) 1451 - return(0); 1452 1530 if (tty == stli_txcooktty) 1453 1531 stli_flushchars(tty); 1454 1532 portp = tty->driver_data; 1455 - if (portp == (stliport_t *) NULL) 1456 - return(0); 1533 + if (portp == NULL) 1534 + return 0; 1457 1535 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1458 - return(0); 1536 + return 0; 1459 1537 brdp = stli_brds[portp->brdnr]; 1460 - if (brdp == (stlibrd_t *) NULL) 1461 - return(0); 1538 + if (brdp == NULL) 1539 + return 0; 1462 1540 chbuf = (unsigned char *) buf; 1463 1541 1464 1542 /* 1465 1543 * All data is now local, shove as much as possible into shared memory. 1466 1544 */ 1467 - save_flags(flags); 1468 - cli(); 1545 + spin_lock_irqsave(&brd_lock, flags); 1469 1546 EBRDENABLE(brdp); 1470 - ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1471 - head = (unsigned int) ap->txq.head; 1472 - tail = (unsigned int) ap->txq.tail; 1473 - if (tail != ((unsigned int) ap->txq.tail)) 1474 - tail = (unsigned int) ap->txq.tail; 1547 + ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); 1548 + head = (unsigned int) readw(&ap->txq.head); 1549 + tail = (unsigned int) readw(&ap->txq.tail); 1550 + if (tail != ((unsigned int) readw(&ap->txq.tail))) 1551 + tail = (unsigned int) readw(&ap->txq.tail); 1475 1552 size = portp->txsize; 1476 1553 if (head >= tail) { 1477 1554 len = size - (head - tail) - 1; ··· 1475 1568 1476 1569 len = MIN(len, count); 1477 1570 count = 0; 1478 - shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset); 1571 + shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset); 1479 1572 1480 1573 while (len > 0) { 1481 1574 stlen = MIN(len, stlen); 1482 - memcpy((shbuf + head), chbuf, stlen); 1575 + memcpy_toio(shbuf + head, chbuf, stlen); 1483 1576 chbuf += stlen; 1484 1577 len -= stlen; 1485 1578 count += stlen; ··· 1490 1583 } 1491 1584 } 1492 1585 1493 - ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1494 - ap->txq.head = head; 1586 + ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); 1587 + writew(head, &ap->txq.head); 1495 1588 if (test_bit(ST_TXBUSY, &portp->state)) { 1496 - if (ap->changed.data & DT_TXEMPTY) 1497 - ap->changed.data &= ~DT_TXEMPTY; 1589 + if (readl(&ap->changed.data) & DT_TXEMPTY) 1590 + writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); 1498 1591 } 1499 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1500 - bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1592 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1593 + bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + 1501 1594 portp->portidx; 1502 - *bits |= portp->portbit; 1595 + writeb(readb(bits) | portp->portbit, bits); 1503 1596 set_bit(ST_TXBUSY, &portp->state); 1504 1597 EBRDDISABLE(brdp); 1505 - 1506 - restore_flags(flags); 1598 + spin_unlock_irqrestore(&brd_lock, flags); 1507 1599 1508 1600 return(count); 1509 1601 } ··· 1519 1613 1520 1614 static void stli_putchar(struct tty_struct *tty, unsigned char ch) 1521 1615 { 1522 - #ifdef DEBUG 1523 - printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch); 1524 - #endif 1525 - 1526 - if (tty == (struct tty_struct *) NULL) 1527 - return; 1528 1616 if (tty != stli_txcooktty) { 1529 - if (stli_txcooktty != (struct tty_struct *) NULL) 1617 + if (stli_txcooktty != NULL) 1530 1618 stli_flushchars(stli_txcooktty); 1531 1619 stli_txcooktty = tty; 1532 1620 } ··· 1540 1640 1541 1641 static void stli_flushchars(struct tty_struct *tty) 1542 1642 { 1543 - volatile cdkhdr_t *hdrp; 1544 - volatile unsigned char *bits; 1545 - volatile cdkasy_t *ap; 1546 - struct tty_struct *cooktty; 1547 - stliport_t *portp; 1548 - stlibrd_t *brdp; 1549 - unsigned int len, stlen, head, tail, size, count, cooksize; 1550 - unsigned char *buf, *shbuf; 1551 - unsigned long flags; 1552 - 1553 - #ifdef DEBUG 1554 - printk("stli_flushchars(tty=%x)\n", (int) tty); 1555 - #endif 1643 + cdkhdr_t __iomem *hdrp; 1644 + unsigned char __iomem *bits; 1645 + cdkasy_t __iomem *ap; 1646 + struct tty_struct *cooktty; 1647 + stliport_t *portp; 1648 + stlibrd_t *brdp; 1649 + unsigned int len, stlen, head, tail, size, count, cooksize; 1650 + unsigned char *buf; 1651 + unsigned char __iomem *shbuf; 1652 + unsigned long flags; 1556 1653 1557 1654 cooksize = stli_txcooksize; 1558 1655 cooktty = stli_txcooktty; 1559 1656 stli_txcooksize = 0; 1560 1657 stli_txcookrealsize = 0; 1561 - stli_txcooktty = (struct tty_struct *) NULL; 1658 + stli_txcooktty = NULL; 1562 1659 1563 - if (tty == (struct tty_struct *) NULL) 1660 + if (tty == NULL) 1564 1661 return; 1565 - if (cooktty == (struct tty_struct *) NULL) 1662 + if (cooktty == NULL) 1566 1663 return; 1567 1664 if (tty != cooktty) 1568 1665 tty = cooktty; ··· 1567 1670 return; 1568 1671 1569 1672 portp = tty->driver_data; 1570 - if (portp == (stliport_t *) NULL) 1673 + if (portp == NULL) 1571 1674 return; 1572 1675 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1573 1676 return; 1574 1677 brdp = stli_brds[portp->brdnr]; 1575 - if (brdp == (stlibrd_t *) NULL) 1678 + if (brdp == NULL) 1576 1679 return; 1577 1680 1578 - save_flags(flags); 1579 - cli(); 1681 + spin_lock_irqsave(&brd_lock, flags); 1580 1682 EBRDENABLE(brdp); 1581 1683 1582 - ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1583 - head = (unsigned int) ap->txq.head; 1584 - tail = (unsigned int) ap->txq.tail; 1585 - if (tail != ((unsigned int) ap->txq.tail)) 1586 - tail = (unsigned int) ap->txq.tail; 1684 + ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); 1685 + head = (unsigned int) readw(&ap->txq.head); 1686 + tail = (unsigned int) readw(&ap->txq.tail); 1687 + if (tail != ((unsigned int) readw(&ap->txq.tail))) 1688 + tail = (unsigned int) readw(&ap->txq.tail); 1587 1689 size = portp->txsize; 1588 1690 if (head >= tail) { 1589 1691 len = size - (head - tail) - 1; ··· 1599 1703 1600 1704 while (len > 0) { 1601 1705 stlen = MIN(len, stlen); 1602 - memcpy((shbuf + head), buf, stlen); 1706 + memcpy_toio(shbuf + head, buf, stlen); 1603 1707 buf += stlen; 1604 1708 len -= stlen; 1605 1709 count += stlen; ··· 1610 1714 } 1611 1715 } 1612 1716 1613 - ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1614 - ap->txq.head = head; 1717 + ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); 1718 + writew(head, &ap->txq.head); 1615 1719 1616 1720 if (test_bit(ST_TXBUSY, &portp->state)) { 1617 - if (ap->changed.data & DT_TXEMPTY) 1618 - ap->changed.data &= ~DT_TXEMPTY; 1721 + if (readl(&ap->changed.data) & DT_TXEMPTY) 1722 + writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); 1619 1723 } 1620 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1621 - bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1724 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1725 + bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + 1622 1726 portp->portidx; 1623 - *bits |= portp->portbit; 1727 + writeb(readb(bits) | portp->portbit, bits); 1624 1728 set_bit(ST_TXBUSY, &portp->state); 1625 1729 1626 1730 EBRDDISABLE(brdp); 1627 - restore_flags(flags); 1731 + spin_unlock_irqrestore(&brd_lock, flags); 1628 1732 } 1629 1733 1630 1734 /*****************************************************************************/ 1631 1735 1632 1736 static int stli_writeroom(struct tty_struct *tty) 1633 1737 { 1634 - volatile cdkasyrq_t *rp; 1635 - stliport_t *portp; 1636 - stlibrd_t *brdp; 1637 - unsigned int head, tail, len; 1638 - unsigned long flags; 1738 + cdkasyrq_t __iomem *rp; 1739 + stliport_t *portp; 1740 + stlibrd_t *brdp; 1741 + unsigned int head, tail, len; 1742 + unsigned long flags; 1639 1743 1640 - #ifdef DEBUG 1641 - printk("stli_writeroom(tty=%x)\n", (int) tty); 1642 - #endif 1643 - 1644 - if (tty == (struct tty_struct *) NULL) 1645 - return(0); 1646 1744 if (tty == stli_txcooktty) { 1647 1745 if (stli_txcookrealsize != 0) { 1648 1746 len = stli_txcookrealsize - stli_txcooksize; 1649 - return(len); 1747 + return len; 1650 1748 } 1651 1749 } 1652 1750 1653 1751 portp = tty->driver_data; 1654 - if (portp == (stliport_t *) NULL) 1655 - return(0); 1752 + if (portp == NULL) 1753 + return 0; 1656 1754 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1657 - return(0); 1755 + return 0; 1658 1756 brdp = stli_brds[portp->brdnr]; 1659 - if (brdp == (stlibrd_t *) NULL) 1660 - return(0); 1757 + if (brdp == NULL) 1758 + return 0; 1661 1759 1662 - save_flags(flags); 1663 - cli(); 1760 + spin_lock_irqsave(&brd_lock, flags); 1664 1761 EBRDENABLE(brdp); 1665 - rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; 1666 - head = (unsigned int) rp->head; 1667 - tail = (unsigned int) rp->tail; 1668 - if (tail != ((unsigned int) rp->tail)) 1669 - tail = (unsigned int) rp->tail; 1762 + rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; 1763 + head = (unsigned int) readw(&rp->head); 1764 + tail = (unsigned int) readw(&rp->tail); 1765 + if (tail != ((unsigned int) readw(&rp->tail))) 1766 + tail = (unsigned int) readw(&rp->tail); 1670 1767 len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head); 1671 1768 len--; 1672 1769 EBRDDISABLE(brdp); 1673 - restore_flags(flags); 1770 + spin_unlock_irqrestore(&brd_lock, flags); 1674 1771 1675 1772 if (tty == stli_txcooktty) { 1676 1773 stli_txcookrealsize = len; 1677 1774 len -= stli_txcooksize; 1678 1775 } 1679 - return(len); 1776 + return len; 1680 1777 } 1681 1778 1682 1779 /*****************************************************************************/ ··· 1684 1795 1685 1796 static int stli_charsinbuffer(struct tty_struct *tty) 1686 1797 { 1687 - volatile cdkasyrq_t *rp; 1688 - stliport_t *portp; 1689 - stlibrd_t *brdp; 1690 - unsigned int head, tail, len; 1691 - unsigned long flags; 1798 + cdkasyrq_t __iomem *rp; 1799 + stliport_t *portp; 1800 + stlibrd_t *brdp; 1801 + unsigned int head, tail, len; 1802 + unsigned long flags; 1692 1803 1693 - #ifdef DEBUG 1694 - printk("stli_charsinbuffer(tty=%x)\n", (int) tty); 1695 - #endif 1696 - 1697 - if (tty == (struct tty_struct *) NULL) 1698 - return(0); 1699 1804 if (tty == stli_txcooktty) 1700 1805 stli_flushchars(tty); 1701 1806 portp = tty->driver_data; 1702 - if (portp == (stliport_t *) NULL) 1703 - return(0); 1807 + if (portp == NULL) 1808 + return 0; 1704 1809 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1705 - return(0); 1810 + return 0; 1706 1811 brdp = stli_brds[portp->brdnr]; 1707 - if (brdp == (stlibrd_t *) NULL) 1708 - return(0); 1812 + if (brdp == NULL) 1813 + return 0; 1709 1814 1710 - save_flags(flags); 1711 - cli(); 1815 + spin_lock_irqsave(&brd_lock, flags); 1712 1816 EBRDENABLE(brdp); 1713 - rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; 1714 - head = (unsigned int) rp->head; 1715 - tail = (unsigned int) rp->tail; 1716 - if (tail != ((unsigned int) rp->tail)) 1717 - tail = (unsigned int) rp->tail; 1817 + rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; 1818 + head = (unsigned int) readw(&rp->head); 1819 + tail = (unsigned int) readw(&rp->tail); 1820 + if (tail != ((unsigned int) readw(&rp->tail))) 1821 + tail = (unsigned int) readw(&rp->tail); 1718 1822 len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head)); 1719 1823 if ((len == 0) && test_bit(ST_TXBUSY, &portp->state)) 1720 1824 len = 1; 1721 1825 EBRDDISABLE(brdp); 1722 - restore_flags(flags); 1826 + spin_unlock_irqrestore(&brd_lock, flags); 1723 1827 1724 - return(len); 1828 + return len; 1725 1829 } 1726 1830 1727 1831 /*****************************************************************************/ ··· 1725 1843 1726 1844 static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) 1727 1845 { 1728 - struct serial_struct sio; 1729 - stlibrd_t *brdp; 1730 - 1731 - #ifdef DEBUG 1732 - printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); 1733 - #endif 1846 + struct serial_struct sio; 1847 + stlibrd_t *brdp; 1734 1848 1735 1849 memset(&sio, 0, sizeof(struct serial_struct)); 1736 1850 sio.type = PORT_UNKNOWN; ··· 1741 1863 sio.hub6 = 0; 1742 1864 1743 1865 brdp = stli_brds[portp->brdnr]; 1744 - if (brdp != (stlibrd_t *) NULL) 1866 + if (brdp != NULL) 1745 1867 sio.port = brdp->iobase; 1746 1868 1747 1869 return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? ··· 1758 1880 1759 1881 static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) 1760 1882 { 1761 - struct serial_struct sio; 1762 - int rc; 1763 - 1764 - #ifdef DEBUG 1765 - printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp); 1766 - #endif 1883 + struct serial_struct sio; 1884 + int rc; 1767 1885 1768 1886 if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) 1769 1887 return -EFAULT; ··· 1768 1894 (sio.close_delay != portp->close_delay) || 1769 1895 ((sio.flags & ~ASYNC_USR_MASK) != 1770 1896 (portp->flags & ~ASYNC_USR_MASK))) 1771 - return(-EPERM); 1897 + return -EPERM; 1772 1898 } 1773 1899 1774 1900 portp->flags = (portp->flags & ~ASYNC_USR_MASK) | ··· 1779 1905 portp->custom_divisor = sio.custom_divisor; 1780 1906 1781 1907 if ((rc = stli_setport(portp)) < 0) 1782 - return(rc); 1783 - return(0); 1908 + return rc; 1909 + return 0; 1784 1910 } 1785 1911 1786 1912 /*****************************************************************************/ ··· 1791 1917 stlibrd_t *brdp; 1792 1918 int rc; 1793 1919 1794 - if (portp == (stliport_t *) NULL) 1795 - return(-ENODEV); 1796 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1797 - return(0); 1920 + if (portp == NULL) 1921 + return -ENODEV; 1922 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 1923 + return 0; 1798 1924 brdp = stli_brds[portp->brdnr]; 1799 - if (brdp == (stlibrd_t *) NULL) 1800 - return(0); 1925 + if (brdp == NULL) 1926 + return 0; 1801 1927 if (tty->flags & (1 << TTY_IO_ERROR)) 1802 - return(-EIO); 1928 + return -EIO; 1803 1929 1804 1930 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, 1805 1931 &portp->asig, sizeof(asysigs_t), 1)) < 0) 1806 - return(rc); 1932 + return rc; 1807 1933 1808 1934 return stli_mktiocm(portp->asig.sigvalue); 1809 1935 } ··· 1815 1941 stlibrd_t *brdp; 1816 1942 int rts = -1, dtr = -1; 1817 1943 1818 - if (portp == (stliport_t *) NULL) 1819 - return(-ENODEV); 1820 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1821 - return(0); 1944 + if (portp == NULL) 1945 + return -ENODEV; 1946 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 1947 + return 0; 1822 1948 brdp = stli_brds[portp->brdnr]; 1823 - if (brdp == (stlibrd_t *) NULL) 1824 - return(0); 1949 + if (brdp == NULL) 1950 + return 0; 1825 1951 if (tty->flags & (1 << TTY_IO_ERROR)) 1826 - return(-EIO); 1952 + return -EIO; 1827 1953 1828 1954 if (set & TIOCM_RTS) 1829 1955 rts = 1; ··· 1842 1968 1843 1969 static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) 1844 1970 { 1845 - stliport_t *portp; 1846 - stlibrd_t *brdp; 1847 - unsigned int ival; 1848 - int rc; 1971 + stliport_t *portp; 1972 + stlibrd_t *brdp; 1973 + unsigned int ival; 1974 + int rc; 1849 1975 void __user *argp = (void __user *)arg; 1850 1976 1851 - #ifdef DEBUG 1852 - printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n", 1853 - (int) tty, (int) file, cmd, (int) arg); 1854 - #endif 1855 - 1856 - if (tty == (struct tty_struct *) NULL) 1857 - return(-ENODEV); 1858 1977 portp = tty->driver_data; 1859 - if (portp == (stliport_t *) NULL) 1860 - return(-ENODEV); 1861 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1862 - return(0); 1978 + if (portp == NULL) 1979 + return -ENODEV; 1980 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 1981 + return 0; 1863 1982 brdp = stli_brds[portp->brdnr]; 1864 - if (brdp == (stlibrd_t *) NULL) 1865 - return(0); 1983 + if (brdp == NULL) 1984 + return 0; 1866 1985 1867 1986 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 1868 1987 (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { 1869 1988 if (tty->flags & (1 << TTY_IO_ERROR)) 1870 - return(-EIO); 1989 + return -EIO; 1871 1990 } 1872 1991 1873 1992 rc = 0; ··· 1907 2040 break; 1908 2041 } 1909 2042 1910 - return(rc); 2043 + return rc; 1911 2044 } 1912 2045 1913 2046 /*****************************************************************************/ ··· 1919 2052 1920 2053 static void stli_settermios(struct tty_struct *tty, struct termios *old) 1921 2054 { 1922 - stliport_t *portp; 1923 - stlibrd_t *brdp; 1924 - struct termios *tiosp; 1925 - asyport_t aport; 2055 + stliport_t *portp; 2056 + stlibrd_t *brdp; 2057 + struct termios *tiosp; 2058 + asyport_t aport; 1926 2059 1927 - #ifdef DEBUG 1928 - printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old); 1929 - #endif 1930 - 1931 - if (tty == (struct tty_struct *) NULL) 2060 + if (tty == NULL) 1932 2061 return; 1933 2062 portp = tty->driver_data; 1934 - if (portp == (stliport_t *) NULL) 2063 + if (portp == NULL) 1935 2064 return; 1936 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2065 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 1937 2066 return; 1938 2067 brdp = stli_brds[portp->brdnr]; 1939 - if (brdp == (stlibrd_t *) NULL) 2068 + if (brdp == NULL) 1940 2069 return; 1941 2070 1942 2071 tiosp = tty->termios; ··· 1965 2102 1966 2103 static void stli_throttle(struct tty_struct *tty) 1967 2104 { 1968 - stliport_t *portp; 1969 - 1970 - #ifdef DEBUG 1971 - printk("stli_throttle(tty=%x)\n", (int) tty); 1972 - #endif 1973 - 1974 - if (tty == (struct tty_struct *) NULL) 2105 + stliport_t *portp = tty->driver_data; 2106 + if (portp == NULL) 1975 2107 return; 1976 - portp = tty->driver_data; 1977 - if (portp == (stliport_t *) NULL) 1978 - return; 1979 - 1980 2108 set_bit(ST_RXSTOP, &portp->state); 1981 2109 } 1982 2110 ··· 1981 2127 1982 2128 static void stli_unthrottle(struct tty_struct *tty) 1983 2129 { 1984 - stliport_t *portp; 1985 - 1986 - #ifdef DEBUG 1987 - printk("stli_unthrottle(tty=%x)\n", (int) tty); 1988 - #endif 1989 - 1990 - if (tty == (struct tty_struct *) NULL) 2130 + stliport_t *portp = tty->driver_data; 2131 + if (portp == NULL) 1991 2132 return; 1992 - portp = tty->driver_data; 1993 - if (portp == (stliport_t *) NULL) 1994 - return; 1995 - 1996 2133 clear_bit(ST_RXSTOP, &portp->state); 1997 2134 } 1998 2135 1999 2136 /*****************************************************************************/ 2000 2137 2001 2138 /* 2002 - * Stop the transmitter. Basically to do this we will just turn TX 2003 - * interrupts off. 2139 + * Stop the transmitter. 2004 2140 */ 2005 2141 2006 2142 static void stli_stop(struct tty_struct *tty) 2007 2143 { 2008 - stlibrd_t *brdp; 2009 - stliport_t *portp; 2010 - asyctrl_t actrl; 2011 - 2012 - #ifdef DEBUG 2013 - printk("stli_stop(tty=%x)\n", (int) tty); 2014 - #endif 2015 - 2016 - if (tty == (struct tty_struct *) NULL) 2017 - return; 2018 - portp = tty->driver_data; 2019 - if (portp == (stliport_t *) NULL) 2020 - return; 2021 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2022 - return; 2023 - brdp = stli_brds[portp->brdnr]; 2024 - if (brdp == (stlibrd_t *) NULL) 2025 - return; 2026 - 2027 - memset(&actrl, 0, sizeof(asyctrl_t)); 2028 - actrl.txctrl = CT_STOPFLOW; 2029 - #if 0 2030 - stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); 2031 - #endif 2032 2144 } 2033 2145 2034 2146 /*****************************************************************************/ 2035 2147 2036 2148 /* 2037 - * Start the transmitter again. Just turn TX interrupts back on. 2149 + * Start the transmitter again. 2038 2150 */ 2039 2151 2040 2152 static void stli_start(struct tty_struct *tty) 2041 2153 { 2042 - stliport_t *portp; 2043 - stlibrd_t *brdp; 2044 - asyctrl_t actrl; 2045 - 2046 - #ifdef DEBUG 2047 - printk("stli_start(tty=%x)\n", (int) tty); 2048 - #endif 2049 - 2050 - if (tty == (struct tty_struct *) NULL) 2051 - return; 2052 - portp = tty->driver_data; 2053 - if (portp == (stliport_t *) NULL) 2054 - return; 2055 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2056 - return; 2057 - brdp = stli_brds[portp->brdnr]; 2058 - if (brdp == (stlibrd_t *) NULL) 2059 - return; 2060 - 2061 - memset(&actrl, 0, sizeof(asyctrl_t)); 2062 - actrl.txctrl = CT_STARTFLOW; 2063 - #if 0 2064 - stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); 2065 - #endif 2066 2154 } 2067 2155 2068 2156 /*****************************************************************************/ ··· 2020 2224 2021 2225 static void stli_dohangup(void *arg) 2022 2226 { 2023 - stliport_t *portp; 2024 - 2025 - #ifdef DEBUG 2026 - printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg); 2027 - #endif 2028 - 2029 - /* 2030 - * FIXME: There's a module removal race here: tty_hangup 2031 - * calls schedule_work which will call into this 2032 - * driver later. 2033 - */ 2034 - portp = (stliport_t *) arg; 2035 - if (portp != (stliport_t *) NULL) { 2036 - if (portp->tty != (struct tty_struct *) NULL) { 2037 - tty_hangup(portp->tty); 2038 - } 2227 + stliport_t *portp = (stliport_t *) arg; 2228 + if (portp->tty != NULL) { 2229 + tty_hangup(portp->tty); 2039 2230 } 2040 2231 } 2041 2232 ··· 2037 2254 2038 2255 static void stli_hangup(struct tty_struct *tty) 2039 2256 { 2040 - stliport_t *portp; 2041 - stlibrd_t *brdp; 2042 - unsigned long flags; 2257 + stliport_t *portp; 2258 + stlibrd_t *brdp; 2259 + unsigned long flags; 2043 2260 2044 - #ifdef DEBUG 2045 - printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty); 2046 - #endif 2047 - 2048 - if (tty == (struct tty_struct *) NULL) 2049 - return; 2050 2261 portp = tty->driver_data; 2051 - if (portp == (stliport_t *) NULL) 2262 + if (portp == NULL) 2052 2263 return; 2053 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2264 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 2054 2265 return; 2055 2266 brdp = stli_brds[portp->brdnr]; 2056 - if (brdp == (stlibrd_t *) NULL) 2267 + if (brdp == NULL) 2057 2268 return; 2058 2269 2059 2270 portp->flags &= ~ASYNC_INITIALIZED; 2060 2271 2061 - save_flags(flags); 2062 - cli(); 2063 - if (! test_bit(ST_CLOSING, &portp->state)) 2272 + if (!test_bit(ST_CLOSING, &portp->state)) 2064 2273 stli_rawclose(brdp, portp, 0, 0); 2274 + 2275 + spin_lock_irqsave(&stli_lock, flags); 2065 2276 if (tty->termios->c_cflag & HUPCL) { 2066 2277 stli_mkasysigs(&portp->asig, 0, 0); 2067 2278 if (test_bit(ST_CMDING, &portp->state)) { ··· 2067 2290 &portp->asig, sizeof(asysigs_t), 0); 2068 2291 } 2069 2292 } 2070 - restore_flags(flags); 2071 2293 2072 2294 clear_bit(ST_TXBUSY, &portp->state); 2073 2295 clear_bit(ST_RXSTOP, &portp->state); 2074 2296 set_bit(TTY_IO_ERROR, &tty->flags); 2075 - portp->tty = (struct tty_struct *) NULL; 2297 + portp->tty = NULL; 2076 2298 portp->flags &= ~ASYNC_NORMAL_ACTIVE; 2077 2299 portp->refcount = 0; 2300 + spin_unlock_irqrestore(&stli_lock, flags); 2301 + 2078 2302 wake_up_interruptible(&portp->open_wait); 2079 2303 } 2080 2304 ··· 2090 2312 2091 2313 static void stli_flushbuffer(struct tty_struct *tty) 2092 2314 { 2093 - stliport_t *portp; 2094 - stlibrd_t *brdp; 2095 - unsigned long ftype, flags; 2315 + stliport_t *portp; 2316 + stlibrd_t *brdp; 2317 + unsigned long ftype, flags; 2096 2318 2097 - #ifdef DEBUG 2098 - printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty); 2099 - #endif 2100 - 2101 - if (tty == (struct tty_struct *) NULL) 2102 - return; 2103 2319 portp = tty->driver_data; 2104 - if (portp == (stliport_t *) NULL) 2320 + if (portp == NULL) 2105 2321 return; 2106 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2322 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 2107 2323 return; 2108 2324 brdp = stli_brds[portp->brdnr]; 2109 - if (brdp == (stlibrd_t *) NULL) 2325 + if (brdp == NULL) 2110 2326 return; 2111 2327 2112 - save_flags(flags); 2113 - cli(); 2328 + spin_lock_irqsave(&brd_lock, flags); 2114 2329 if (tty == stli_txcooktty) { 2115 - stli_txcooktty = (struct tty_struct *) NULL; 2330 + stli_txcooktty = NULL; 2116 2331 stli_txcooksize = 0; 2117 2332 stli_txcookrealsize = 0; 2118 2333 } ··· 2117 2346 ftype |= FLUSHRX; 2118 2347 clear_bit(ST_DOFLUSHRX, &portp->state); 2119 2348 } 2120 - stli_sendcmd(brdp, portp, A_FLUSH, &ftype, 2121 - sizeof(unsigned long), 0); 2349 + __stli_sendcmd(brdp, portp, A_FLUSH, &ftype, sizeof(u32), 0); 2122 2350 } 2123 - restore_flags(flags); 2124 - 2125 - wake_up_interruptible(&tty->write_wait); 2126 - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 2127 - tty->ldisc.write_wakeup) 2128 - (tty->ldisc.write_wakeup)(tty); 2351 + spin_unlock_irqrestore(&brd_lock, flags); 2352 + tty_wakeup(tty); 2129 2353 } 2130 2354 2131 2355 /*****************************************************************************/ ··· 2130 2364 stlibrd_t *brdp; 2131 2365 stliport_t *portp; 2132 2366 long arg; 2133 - /* long savestate, savetime; */ 2134 2367 2135 - #ifdef DEBUG 2136 - printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state); 2137 - #endif 2138 - 2139 - if (tty == (struct tty_struct *) NULL) 2140 - return; 2141 2368 portp = tty->driver_data; 2142 - if (portp == (stliport_t *) NULL) 2369 + if (portp == NULL) 2143 2370 return; 2144 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2371 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 2145 2372 return; 2146 2373 brdp = stli_brds[portp->brdnr]; 2147 - if (brdp == (stlibrd_t *) NULL) 2374 + if (brdp == NULL) 2148 2375 return; 2149 - 2150 - /* 2151 - * Due to a bug in the tty send_break() code we need to preserve 2152 - * the current process state and timeout... 2153 - savetime = current->timeout; 2154 - savestate = current->state; 2155 - */ 2156 2376 2157 2377 arg = (state == -1) ? BREAKON : BREAKOFF; 2158 2378 stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0); 2159 - 2160 - /* 2161 - * 2162 - current->timeout = savetime; 2163 - current->state = savestate; 2164 - */ 2165 2379 } 2166 2380 2167 2381 /*****************************************************************************/ 2168 2382 2169 2383 static void stli_waituntilsent(struct tty_struct *tty, int timeout) 2170 2384 { 2171 - stliport_t *portp; 2172 - unsigned long tend; 2385 + stliport_t *portp; 2386 + unsigned long tend; 2173 2387 2174 - #ifdef DEBUG 2175 - printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout); 2176 - #endif 2177 - 2178 - if (tty == (struct tty_struct *) NULL) 2388 + if (tty == NULL) 2179 2389 return; 2180 2390 portp = tty->driver_data; 2181 - if (portp == (stliport_t *) NULL) 2391 + if (portp == NULL) 2182 2392 return; 2183 2393 2184 2394 if (timeout == 0) ··· 2178 2436 stliport_t *portp; 2179 2437 asyctrl_t actrl; 2180 2438 2181 - #ifdef DEBUG 2182 - printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch); 2183 - #endif 2184 - 2185 - if (tty == (struct tty_struct *) NULL) 2186 - return; 2187 2439 portp = tty->driver_data; 2188 - if (portp == (stliport_t *) NULL) 2440 + if (portp == NULL) 2189 2441 return; 2190 - if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2442 + if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) 2191 2443 return; 2192 2444 brdp = stli_brds[portp->brdnr]; 2193 - if (brdp == (stlibrd_t *) NULL) 2445 + if (brdp == NULL) 2194 2446 return; 2195 2447 2196 2448 memset(&actrl, 0, sizeof(asyctrl_t)); ··· 2196 2460 actrl.txctrl = CT_SENDCHR; 2197 2461 actrl.tximdch = ch; 2198 2462 } 2199 - 2200 2463 stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); 2201 2464 } 2202 2465 ··· 2211 2476 2212 2477 static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos) 2213 2478 { 2214 - char *sp, *uart; 2215 - int rc, cnt; 2479 + char *sp, *uart; 2480 + int rc, cnt; 2216 2481 2217 2482 rc = stli_portcmdstats(portp); 2218 2483 2219 2484 uart = "UNKNOWN"; 2220 2485 if (brdp->state & BST_STARTED) { 2221 2486 switch (stli_comstats.hwid) { 2222 - case 0: uart = "2681"; break; 2223 - case 1: uart = "SC26198"; break; 2224 - default: uart = "CD1400"; break; 2487 + case 0: uart = "2681"; break; 2488 + case 1: uart = "SC26198"; break; 2489 + default:uart = "CD1400"; break; 2225 2490 } 2226 2491 } 2227 2492 ··· 2272 2537 2273 2538 static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) 2274 2539 { 2275 - stlibrd_t *brdp; 2276 - stliport_t *portp; 2277 - int brdnr, portnr, totalport; 2278 - int curoff, maxoff; 2279 - char *pos; 2280 - 2281 - #ifdef DEBUG 2282 - printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x," 2283 - "data=%x\n", (int) page, (int) start, (int) off, count, 2284 - (int) eof, (int) data); 2285 - #endif 2540 + stlibrd_t *brdp; 2541 + stliport_t *portp; 2542 + int brdnr, portnr, totalport; 2543 + int curoff, maxoff; 2544 + char *pos; 2286 2545 2287 2546 pos = page; 2288 2547 totalport = 0; ··· 2297 2568 */ 2298 2569 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { 2299 2570 brdp = stli_brds[brdnr]; 2300 - if (brdp == (stlibrd_t *) NULL) 2571 + if (brdp == NULL) 2301 2572 continue; 2302 2573 if (brdp->state == 0) 2303 2574 continue; ··· 2312 2583 for (portnr = 0; (portnr < brdp->nrports); portnr++, 2313 2584 totalport++) { 2314 2585 portp = brdp->ports[portnr]; 2315 - if (portp == (stliport_t *) NULL) 2586 + if (portp == NULL) 2316 2587 continue; 2317 2588 if (off >= (curoff += MAXLINE)) 2318 2589 continue; ··· 2339 2610 * a poll routine that does not have user context. Therefore you cannot 2340 2611 * copy back directly into user space, or to the kernel stack of a 2341 2612 * process. This routine does not sleep, so can be called from anywhere. 2613 + * 2614 + * The caller must hold the brd_lock (see also stli_sendcmd the usual 2615 + * entry point) 2342 2616 */ 2343 2617 2344 - static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) 2618 + static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) 2345 2619 { 2346 - volatile cdkhdr_t *hdrp; 2347 - volatile cdkctrl_t *cp; 2348 - volatile unsigned char *bits; 2349 - unsigned long flags; 2620 + cdkhdr_t __iomem *hdrp; 2621 + cdkctrl_t __iomem *cp; 2622 + unsigned char __iomem *bits; 2623 + unsigned long flags; 2350 2624 2351 - #ifdef DEBUG 2352 - printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," 2353 - "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, 2354 - (int) arg, size, copyback); 2355 - #endif 2356 - 2357 - save_flags(flags); 2358 - cli(); 2625 + spin_lock_irqsave(&brd_lock, flags); 2359 2626 2360 2627 if (test_bit(ST_CMDING, &portp->state)) { 2361 2628 printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", 2362 2629 (int) cmd); 2363 - restore_flags(flags); 2630 + spin_unlock_irqrestore(&brd_lock, flags); 2364 2631 return; 2365 2632 } 2366 2633 2367 2634 EBRDENABLE(brdp); 2368 - cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 2635 + cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 2369 2636 if (size > 0) { 2370 - memcpy((void *) &(cp->args[0]), arg, size); 2637 + memcpy_toio((void __iomem *) &(cp->args[0]), arg, size); 2371 2638 if (copyback) { 2372 2639 portp->argp = arg; 2373 2640 portp->argsize = size; 2374 2641 } 2375 2642 } 2376 - cp->status = 0; 2377 - cp->cmd = cmd; 2378 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2379 - bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 2643 + writel(0, &cp->status); 2644 + writel(cmd, &cp->cmd); 2645 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2646 + bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + 2380 2647 portp->portidx; 2381 - *bits |= portp->portbit; 2648 + writeb(readb(bits) | portp->portbit, bits); 2382 2649 set_bit(ST_CMDING, &portp->state); 2383 2650 EBRDDISABLE(brdp); 2384 - restore_flags(flags); 2651 + spin_unlock_irqrestore(&brd_lock, flags); 2652 + } 2653 + 2654 + static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) 2655 + { 2656 + unsigned long flags; 2657 + 2658 + spin_lock_irqsave(&brd_lock, flags); 2659 + __stli_sendcmd(brdp, portp, cmd, arg, size, copyback); 2660 + spin_unlock_irqrestore(&brd_lock, flags); 2385 2661 } 2386 2662 2387 2663 /*****************************************************************************/ ··· 2401 2667 2402 2668 static void stli_read(stlibrd_t *brdp, stliport_t *portp) 2403 2669 { 2404 - volatile cdkasyrq_t *rp; 2405 - volatile char *shbuf; 2670 + cdkasyrq_t __iomem *rp; 2671 + char __iomem *shbuf; 2406 2672 struct tty_struct *tty; 2407 - unsigned int head, tail, size; 2408 - unsigned int len, stlen; 2409 - 2410 - #ifdef DEBUG 2411 - printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n", 2412 - (int) brdp, (int) portp); 2413 - #endif 2673 + unsigned int head, tail, size; 2674 + unsigned int len, stlen; 2414 2675 2415 2676 if (test_bit(ST_RXSTOP, &portp->state)) 2416 2677 return; 2417 2678 tty = portp->tty; 2418 - if (tty == (struct tty_struct *) NULL) 2679 + if (tty == NULL) 2419 2680 return; 2420 2681 2421 - rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; 2422 - head = (unsigned int) rp->head; 2423 - if (head != ((unsigned int) rp->head)) 2424 - head = (unsigned int) rp->head; 2425 - tail = (unsigned int) rp->tail; 2682 + rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; 2683 + head = (unsigned int) readw(&rp->head); 2684 + if (head != ((unsigned int) readw(&rp->head))) 2685 + head = (unsigned int) readw(&rp->head); 2686 + tail = (unsigned int) readw(&rp->tail); 2426 2687 size = portp->rxsize; 2427 2688 if (head >= tail) { 2428 2689 len = head - tail; ··· 2428 2699 } 2429 2700 2430 2701 len = tty_buffer_request_room(tty, len); 2431 - /* FIXME : iomap ? */ 2432 - shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset); 2702 + 2703 + shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->rxoffset); 2433 2704 2434 2705 while (len > 0) { 2706 + unsigned char *cptr; 2707 + 2435 2708 stlen = MIN(len, stlen); 2436 - tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen); 2709 + tty_prepare_flip_string(tty, &cptr, stlen); 2710 + memcpy_fromio(cptr, shbuf + tail, stlen); 2437 2711 len -= stlen; 2438 2712 tail += stlen; 2439 2713 if (tail >= size) { ··· 2444 2712 stlen = head; 2445 2713 } 2446 2714 } 2447 - rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; 2448 - rp->tail = tail; 2715 + rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; 2716 + writew(tail, &rp->tail); 2449 2717 2450 2718 if (head != tail) 2451 2719 set_bit(ST_RXING, &portp->state); ··· 2461 2729 * difficult to deal with them here. 2462 2730 */ 2463 2731 2464 - static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) 2732 + static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp) 2465 2733 { 2466 - int cmd; 2734 + int cmd; 2467 2735 2468 2736 if (test_bit(ST_DOSIGS, &portp->state)) { 2469 2737 if (test_bit(ST_DOFLUSHTX, &portp->state) && ··· 2478 2746 clear_bit(ST_DOFLUSHTX, &portp->state); 2479 2747 clear_bit(ST_DOFLUSHRX, &portp->state); 2480 2748 clear_bit(ST_DOSIGS, &portp->state); 2481 - memcpy((void *) &(cp->args[0]), (void *) &portp->asig, 2749 + memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &portp->asig, 2482 2750 sizeof(asysigs_t)); 2483 - cp->status = 0; 2484 - cp->cmd = cmd; 2751 + writel(0, &cp->status); 2752 + writel(cmd, &cp->cmd); 2485 2753 set_bit(ST_CMDING, &portp->state); 2486 2754 } else if (test_bit(ST_DOFLUSHTX, &portp->state) || 2487 2755 test_bit(ST_DOFLUSHRX, &portp->state)) { ··· 2489 2757 cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0); 2490 2758 clear_bit(ST_DOFLUSHTX, &portp->state); 2491 2759 clear_bit(ST_DOFLUSHRX, &portp->state); 2492 - memcpy((void *) &(cp->args[0]), (void *) &cmd, sizeof(int)); 2493 - cp->status = 0; 2494 - cp->cmd = A_FLUSH; 2760 + memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &cmd, sizeof(int)); 2761 + writel(0, &cp->status); 2762 + writel(A_FLUSH, &cp->cmd); 2495 2763 set_bit(ST_CMDING, &portp->state); 2496 2764 } 2497 2765 } ··· 2511 2779 2512 2780 static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) 2513 2781 { 2514 - volatile cdkasy_t *ap; 2515 - volatile cdkctrl_t *cp; 2516 - struct tty_struct *tty; 2517 - asynotify_t nt; 2518 - unsigned long oldsigs; 2519 - int rc, donerx; 2782 + cdkasy_t __iomem *ap; 2783 + cdkctrl_t __iomem *cp; 2784 + struct tty_struct *tty; 2785 + asynotify_t nt; 2786 + unsigned long oldsigs; 2787 + int rc, donerx; 2520 2788 2521 - #ifdef DEBUG 2522 - printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n", 2523 - (int) brdp, channr); 2524 - #endif 2525 - 2526 - ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 2789 + ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); 2527 2790 cp = &ap->ctrl; 2528 2791 2529 2792 /* 2530 2793 * Check if we are waiting for an open completion message. 2531 2794 */ 2532 2795 if (test_bit(ST_OPENING, &portp->state)) { 2533 - rc = (int) cp->openarg; 2534 - if ((cp->open == 0) && (rc != 0)) { 2796 + rc = readl(&cp->openarg); 2797 + if (readb(&cp->open) == 0 && rc != 0) { 2535 2798 if (rc > 0) 2536 2799 rc--; 2537 - cp->openarg = 0; 2800 + writel(0, &cp->openarg); 2538 2801 portp->rc = rc; 2539 2802 clear_bit(ST_OPENING, &portp->state); 2540 2803 wake_up_interruptible(&portp->raw_wait); ··· 2540 2813 * Check if we are waiting for a close completion message. 2541 2814 */ 2542 2815 if (test_bit(ST_CLOSING, &portp->state)) { 2543 - rc = (int) cp->closearg; 2544 - if ((cp->close == 0) && (rc != 0)) { 2816 + rc = (int) readl(&cp->closearg); 2817 + if (readb(&cp->close) == 0 && rc != 0) { 2545 2818 if (rc > 0) 2546 2819 rc--; 2547 - cp->closearg = 0; 2820 + writel(0, &cp->closearg); 2548 2821 portp->rc = rc; 2549 2822 clear_bit(ST_CLOSING, &portp->state); 2550 2823 wake_up_interruptible(&portp->raw_wait); ··· 2556 2829 * need to copy out the command results associated with this command. 2557 2830 */ 2558 2831 if (test_bit(ST_CMDING, &portp->state)) { 2559 - rc = cp->status; 2560 - if ((cp->cmd == 0) && (rc != 0)) { 2832 + rc = readl(&cp->status); 2833 + if (readl(&cp->cmd) == 0 && rc != 0) { 2561 2834 if (rc > 0) 2562 2835 rc--; 2563 - if (portp->argp != (void *) NULL) { 2564 - memcpy(portp->argp, (void *) &(cp->args[0]), 2836 + if (portp->argp != NULL) { 2837 + memcpy_fromio(portp->argp, (void __iomem *) &(cp->args[0]), 2565 2838 portp->argsize); 2566 - portp->argp = (void *) NULL; 2839 + portp->argp = NULL; 2567 2840 } 2568 - cp->status = 0; 2841 + writel(0, &cp->status); 2569 2842 portp->rc = rc; 2570 2843 clear_bit(ST_CMDING, &portp->state); 2571 2844 stli_dodelaycmd(portp, cp); ··· 2604 2877 if (nt.data & DT_TXEMPTY) 2605 2878 clear_bit(ST_TXBUSY, &portp->state); 2606 2879 if (nt.data & (DT_TXEMPTY | DT_TXLOW)) { 2607 - if (tty != (struct tty_struct *) NULL) { 2608 - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 2609 - tty->ldisc.write_wakeup) { 2610 - (tty->ldisc.write_wakeup)(tty); 2611 - EBRDENABLE(brdp); 2612 - } 2880 + if (tty != NULL) { 2881 + tty_wakeup(tty); 2882 + EBRDENABLE(brdp); 2613 2883 wake_up_interruptible(&tty->write_wait); 2614 2884 } 2615 2885 } 2616 2886 2617 2887 if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { 2618 - if (tty != (struct tty_struct *) NULL) { 2888 + if (tty != NULL) { 2619 2889 tty_insert_flip_char(tty, 0, TTY_BREAK); 2620 2890 if (portp->flags & ASYNC_SAK) { 2621 2891 do_SAK(tty); ··· 2656 2932 * at the cdk header structure. 2657 2933 */ 2658 2934 2659 - static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) 2935 + static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp) 2660 2936 { 2661 - stliport_t *portp; 2662 - unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; 2663 - unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; 2664 - unsigned char *slavep; 2665 - int bitpos, bitat, bitsize; 2666 - int channr, nrdevs, slavebitchange; 2937 + stliport_t *portp; 2938 + unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; 2939 + unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; 2940 + unsigned char __iomem *slavep; 2941 + int bitpos, bitat, bitsize; 2942 + int channr, nrdevs, slavebitchange; 2667 2943 2668 2944 bitsize = brdp->bitsize; 2669 2945 nrdevs = brdp->nrdevs; ··· 2675 2951 * 8 service bits at a time in the inner loop, so we can bypass 2676 2952 * the lot if none of them want service. 2677 2953 */ 2678 - memcpy(&hostbits[0], (((unsigned char *) hdrp) + brdp->hostoffset), 2954 + memcpy_fromio(&hostbits[0], (((unsigned char __iomem *) hdrp) + brdp->hostoffset), 2679 2955 bitsize); 2680 2956 2681 2957 memset(&slavebits[0], 0, bitsize); ··· 2702 2978 * service may initiate more slave requests. 2703 2979 */ 2704 2980 if (slavebitchange) { 2705 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2706 - slavep = ((unsigned char *) hdrp) + brdp->slaveoffset; 2981 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2982 + slavep = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset; 2707 2983 for (bitpos = 0; (bitpos < bitsize); bitpos++) { 2708 - if (slavebits[bitpos]) 2709 - slavep[bitpos] &= ~slavebits[bitpos]; 2984 + if (readb(slavebits + bitpos)) 2985 + writeb(readb(slavep + bitpos) & ~slavebits[bitpos], slavebits + bitpos); 2710 2986 } 2711 2987 } 2712 2988 } ··· 2724 3000 2725 3001 static void stli_poll(unsigned long arg) 2726 3002 { 2727 - volatile cdkhdr_t *hdrp; 2728 - stlibrd_t *brdp; 2729 - int brdnr; 3003 + cdkhdr_t __iomem *hdrp; 3004 + stlibrd_t *brdp; 3005 + int brdnr; 2730 3006 2731 3007 stli_timerlist.expires = STLI_TIMEOUT; 2732 3008 add_timer(&stli_timerlist); ··· 2736 3012 */ 2737 3013 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { 2738 3014 brdp = stli_brds[brdnr]; 2739 - if (brdp == (stlibrd_t *) NULL) 3015 + if (brdp == NULL) 2740 3016 continue; 2741 3017 if ((brdp->state & BST_STARTED) == 0) 2742 3018 continue; 2743 3019 3020 + spin_lock(&brd_lock); 2744 3021 EBRDENABLE(brdp); 2745 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2746 - if (hdrp->hostreq) 3022 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 3023 + if (readb(&hdrp->hostreq)) 2747 3024 stli_brdpoll(brdp, hdrp); 2748 3025 EBRDDISABLE(brdp); 3026 + spin_unlock(&brd_lock); 2749 3027 } 2750 3028 } 2751 3029 ··· 2760 3034 2761 3035 static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) 2762 3036 { 2763 - #ifdef DEBUG 2764 - printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n", 2765 - (int) portp, (int) pp, (int) tiosp); 2766 - #endif 2767 - 2768 3037 memset(pp, 0, sizeof(asyport_t)); 2769 3038 2770 3039 /* ··· 2878 3157 2879 3158 static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) 2880 3159 { 2881 - #ifdef DEBUG 2882 - printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n", 2883 - (int) sp, dtr, rts); 2884 - #endif 2885 - 2886 3160 memset(sp, 0, sizeof(asysigs_t)); 2887 3161 if (dtr >= 0) { 2888 3162 sp->signal |= SG_DTR; ··· 2898 3182 2899 3183 static long stli_mktiocm(unsigned long sigvalue) 2900 3184 { 2901 - long tiocm; 2902 - 2903 - #ifdef DEBUG 2904 - printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue); 2905 - #endif 2906 - 2907 - tiocm = 0; 3185 + long tiocm = 0; 2908 3186 tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0); 2909 3187 tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); 2910 3188 tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); ··· 2919 3209 { 2920 3210 stliport_t *portp; 2921 3211 int i, panelnr, panelport; 2922 - 2923 - #ifdef DEBUG 2924 - printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp); 2925 - #endif 2926 3212 2927 3213 for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { 2928 3214 portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); ··· 2946 3240 brdp->ports[i] = portp; 2947 3241 } 2948 3242 2949 - return(0); 3243 + return 0; 2950 3244 } 2951 3245 2952 3246 /*****************************************************************************/ ··· 2958 3252 static void stli_ecpinit(stlibrd_t *brdp) 2959 3253 { 2960 3254 unsigned long memconf; 2961 - 2962 - #ifdef DEBUG 2963 - printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp); 2964 - #endif 2965 3255 2966 3256 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); 2967 3257 udelay(10); ··· 2972 3270 2973 3271 static void stli_ecpenable(stlibrd_t *brdp) 2974 3272 { 2975 - #ifdef DEBUG 2976 - printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp); 2977 - #endif 2978 3273 outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); 2979 3274 } 2980 3275 ··· 2979 3280 2980 3281 static void stli_ecpdisable(stlibrd_t *brdp) 2981 3282 { 2982 - #ifdef DEBUG 2983 - printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp); 2984 - #endif 2985 3283 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); 2986 3284 } 2987 3285 ··· 2986 3290 2987 3291 static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 2988 3292 { 2989 - void *ptr; 2990 - unsigned char val; 2991 - 2992 - #ifdef DEBUG 2993 - printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, 2994 - (int) offset); 2995 - #endif 3293 + void *ptr; 3294 + unsigned char val; 2996 3295 2997 3296 if (offset > brdp->memsize) { 2998 3297 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " ··· 3007 3316 3008 3317 static void stli_ecpreset(stlibrd_t *brdp) 3009 3318 { 3010 - #ifdef DEBUG 3011 - printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp); 3012 - #endif 3013 - 3014 3319 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); 3015 3320 udelay(10); 3016 3321 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); ··· 3017 3330 3018 3331 static void stli_ecpintr(stlibrd_t *brdp) 3019 3332 { 3020 - #ifdef DEBUG 3021 - printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp); 3022 - #endif 3023 3333 outb(0x1, brdp->iobase); 3024 3334 } 3025 3335 ··· 3029 3345 static void stli_ecpeiinit(stlibrd_t *brdp) 3030 3346 { 3031 3347 unsigned long memconf; 3032 - 3033 - #ifdef DEBUG 3034 - printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp); 3035 - #endif 3036 3348 3037 3349 outb(0x1, (brdp->iobase + ECP_EIBRDENAB)); 3038 3350 outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR)); ··· 3062 3382 { 3063 3383 void *ptr; 3064 3384 unsigned char val; 3065 - 3066 - #ifdef DEBUG 3067 - printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n", 3068 - (int) brdp, (int) offset, line); 3069 - #endif 3070 3385 3071 3386 if (offset > brdp->memsize) { 3072 3387 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " ··· 3112 3437 3113 3438 static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3114 3439 { 3115 - void *ptr; 3116 - unsigned char val; 3440 + void *ptr; 3441 + unsigned char val; 3117 3442 3118 3443 if (offset > brdp->memsize) { 3119 3444 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " ··· 3147 3472 3148 3473 static void stli_ecppciinit(stlibrd_t *brdp) 3149 3474 { 3150 - #ifdef DEBUG 3151 - printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp); 3152 - #endif 3153 - 3154 3475 outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR)); 3155 3476 udelay(10); 3156 3477 outb(0, (brdp->iobase + ECP_PCICONFR)); ··· 3159 3488 { 3160 3489 void *ptr; 3161 3490 unsigned char val; 3162 - 3163 - #ifdef DEBUG 3164 - printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n", 3165 - (int) brdp, (int) offset, line); 3166 - #endif 3167 3491 3168 3492 if (offset > brdp->memsize) { 3169 3493 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " ··· 3194 3528 { 3195 3529 unsigned long memconf; 3196 3530 3197 - #ifdef DEBUG 3198 - printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp); 3199 - #endif 3200 - 3201 3531 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); 3202 3532 udelay(10); 3203 3533 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); ··· 3209 3547 3210 3548 static void stli_onbenable(stlibrd_t *brdp) 3211 3549 { 3212 - #ifdef DEBUG 3213 - printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp); 3214 - #endif 3215 3550 outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR)); 3216 3551 } 3217 3552 ··· 3216 3557 3217 3558 static void stli_onbdisable(stlibrd_t *brdp) 3218 3559 { 3219 - #ifdef DEBUG 3220 - printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp); 3221 - #endif 3222 3560 outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR)); 3223 3561 } 3224 3562 ··· 3224 3568 static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3225 3569 { 3226 3570 void *ptr; 3227 - 3228 - #ifdef DEBUG 3229 - printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, 3230 - (int) offset); 3231 - #endif 3232 3571 3233 3572 if (offset > brdp->memsize) { 3234 3573 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " ··· 3240 3589 3241 3590 static void stli_onbreset(stlibrd_t *brdp) 3242 3591 { 3243 - 3244 - #ifdef DEBUG 3245 - printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp); 3246 - #endif 3247 - 3248 3592 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); 3249 3593 udelay(10); 3250 3594 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); ··· 3255 3609 static void stli_onbeinit(stlibrd_t *brdp) 3256 3610 { 3257 3611 unsigned long memconf; 3258 - 3259 - #ifdef DEBUG 3260 - printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp); 3261 - #endif 3262 3612 3263 3613 outb(0x1, (brdp->iobase + ONB_EIBRDENAB)); 3264 3614 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); ··· 3274 3632 3275 3633 static void stli_onbeenable(stlibrd_t *brdp) 3276 3634 { 3277 - #ifdef DEBUG 3278 - printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp); 3279 - #endif 3280 3635 outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); 3281 3636 } 3282 3637 ··· 3281 3642 3282 3643 static void stli_onbedisable(stlibrd_t *brdp) 3283 3644 { 3284 - #ifdef DEBUG 3285 - printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp); 3286 - #endif 3287 3645 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); 3288 3646 } 3289 3647 ··· 3288 3652 3289 3653 static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3290 3654 { 3291 - void *ptr; 3292 - unsigned char val; 3293 - 3294 - #ifdef DEBUG 3295 - printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n", 3296 - (int) brdp, (int) offset, line); 3297 - #endif 3655 + void *ptr; 3656 + unsigned char val; 3298 3657 3299 3658 if (offset > brdp->memsize) { 3300 3659 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " ··· 3312 3681 3313 3682 static void stli_onbereset(stlibrd_t *brdp) 3314 3683 { 3315 - 3316 - #ifdef DEBUG 3317 - printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp); 3318 - #endif 3319 - 3320 3684 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); 3321 3685 udelay(10); 3322 3686 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); ··· 3326 3700 3327 3701 static void stli_bbyinit(stlibrd_t *brdp) 3328 3702 { 3329 - 3330 - #ifdef DEBUG 3331 - printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp); 3332 - #endif 3333 - 3334 3703 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); 3335 3704 udelay(10); 3336 3705 outb(0, (brdp->iobase + BBY_ATCONFR)); ··· 3338 3717 3339 3718 static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3340 3719 { 3341 - void *ptr; 3342 - unsigned char val; 3720 + void *ptr; 3721 + unsigned char val; 3343 3722 3344 - #ifdef DEBUG 3345 - printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp, 3346 - (int) offset); 3347 - #endif 3723 + BUG_ON(offset > brdp->memsize); 3348 3724 3349 - if (offset > brdp->memsize) { 3350 - printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3351 - "range at line=%d(%d), brd=%d\n", 3352 - (int) offset, line, __LINE__, brdp->brdnr); 3353 - ptr = NULL; 3354 - val = 0; 3355 - } else { 3356 - ptr = brdp->membase + (offset % BBY_PAGESIZE); 3357 - val = (unsigned char) (offset / BBY_PAGESIZE); 3358 - } 3725 + ptr = brdp->membase + (offset % BBY_PAGESIZE); 3726 + val = (unsigned char) (offset / BBY_PAGESIZE); 3359 3727 outb(val, (brdp->iobase + BBY_ATCONFR)); 3360 3728 return(ptr); 3361 3729 } ··· 3353 3743 3354 3744 static void stli_bbyreset(stlibrd_t *brdp) 3355 3745 { 3356 - 3357 - #ifdef DEBUG 3358 - printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp); 3359 - #endif 3360 - 3361 3746 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); 3362 3747 udelay(10); 3363 3748 outb(0, (brdp->iobase + BBY_ATCONFR)); ··· 3367 3762 3368 3763 static void stli_stalinit(stlibrd_t *brdp) 3369 3764 { 3370 - 3371 - #ifdef DEBUG 3372 - printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp); 3373 - #endif 3374 - 3375 3765 outb(0x1, brdp->iobase); 3376 3766 mdelay(1000); 3377 3767 } ··· 3375 3775 3376 3776 static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3377 3777 { 3378 - void *ptr; 3379 - 3380 - #ifdef DEBUG 3381 - printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, 3382 - (int) offset); 3383 - #endif 3384 - 3385 - if (offset > brdp->memsize) { 3386 - printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3387 - "range at line=%d(%d), brd=%d\n", 3388 - (int) offset, line, __LINE__, brdp->brdnr); 3389 - ptr = NULL; 3390 - } else { 3391 - ptr = brdp->membase + (offset % STAL_PAGESIZE); 3392 - } 3393 - return(ptr); 3778 + BUG_ON(offset > brdp->memsize); 3779 + return brdp->membase + (offset % STAL_PAGESIZE); 3394 3780 } 3395 3781 3396 3782 /*****************************************************************************/ 3397 3783 3398 3784 static void stli_stalreset(stlibrd_t *brdp) 3399 3785 { 3400 - volatile unsigned long *vecp; 3786 + u32 __iomem *vecp; 3401 3787 3402 - #ifdef DEBUG 3403 - printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp); 3404 - #endif 3405 - 3406 - vecp = (volatile unsigned long *) (brdp->membase + 0x30); 3407 - *vecp = 0xffff0000; 3788 + vecp = (u32 __iomem *) (brdp->membase + 0x30); 3789 + writel(0xffff0000, vecp); 3408 3790 outb(0, brdp->iobase); 3409 3791 mdelay(1000); 3410 3792 } ··· 3400 3818 3401 3819 static int stli_initecp(stlibrd_t *brdp) 3402 3820 { 3403 - cdkecpsig_t sig; 3404 - cdkecpsig_t *sigsp; 3405 - unsigned int status, nxtid; 3406 - char *name; 3407 - int panelnr, nrports; 3408 - 3409 - #ifdef DEBUG 3410 - printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp); 3411 - #endif 3821 + cdkecpsig_t sig; 3822 + cdkecpsig_t __iomem *sigsp; 3823 + unsigned int status, nxtid; 3824 + char *name; 3825 + int panelnr, nrports; 3412 3826 3413 3827 if (!request_region(brdp->iobase, brdp->iosize, "istallion")) 3414 3828 return -EIO; ··· 3412 3834 if ((brdp->iobase == 0) || (brdp->memaddr == 0)) 3413 3835 { 3414 3836 release_region(brdp->iobase, brdp->iosize); 3415 - return(-ENODEV); 3837 + return -ENODEV; 3416 3838 } 3417 3839 3418 3840 brdp->iosize = ECP_IOSIZE; ··· 3481 3903 3482 3904 default: 3483 3905 release_region(brdp->iobase, brdp->iosize); 3484 - return(-EINVAL); 3906 + return -EINVAL; 3485 3907 } 3486 3908 3487 3909 /* ··· 3493 3915 EBRDINIT(brdp); 3494 3916 3495 3917 brdp->membase = ioremap(brdp->memaddr, brdp->memsize); 3496 - if (brdp->membase == (void *) NULL) 3918 + if (brdp->membase == NULL) 3497 3919 { 3498 3920 release_region(brdp->iobase, brdp->iosize); 3499 - return(-ENOMEM); 3921 + return -ENOMEM; 3500 3922 } 3501 3923 3502 3924 /* ··· 3505 3927 * this is, and what it is connected to it. 3506 3928 */ 3507 3929 EBRDENABLE(brdp); 3508 - sigsp = (cdkecpsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); 3930 + sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); 3509 3931 memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); 3510 3932 EBRDDISABLE(brdp); 3511 3933 3512 - #if 0 3513 - printk("%s(%d): sig-> magic=%x rom=%x panel=%x,%x,%x,%x,%x,%x,%x,%x\n", 3514 - __FILE__, __LINE__, (int) sig.magic, sig.romver, sig.panelid[0], 3515 - (int) sig.panelid[1], (int) sig.panelid[2], 3516 - (int) sig.panelid[3], (int) sig.panelid[4], 3517 - (int) sig.panelid[5], (int) sig.panelid[6], 3518 - (int) sig.panelid[7]); 3519 - #endif 3520 - 3521 - if (sig.magic != ECP_MAGIC) 3934 + if (sig.magic != cpu_to_le32(ECP_MAGIC)) 3522 3935 { 3523 3936 release_region(brdp->iobase, brdp->iosize); 3524 - return(-ENODEV); 3937 + return -ENODEV; 3525 3938 } 3526 3939 3527 3940 /* ··· 3536 3967 3537 3968 3538 3969 brdp->state |= BST_FOUND; 3539 - return(0); 3970 + return 0; 3540 3971 } 3541 3972 3542 3973 /*****************************************************************************/ ··· 3548 3979 3549 3980 static int stli_initonb(stlibrd_t *brdp) 3550 3981 { 3551 - cdkonbsig_t sig; 3552 - cdkonbsig_t *sigsp; 3553 - char *name; 3554 - int i; 3555 - 3556 - #ifdef DEBUG 3557 - printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp); 3558 - #endif 3982 + cdkonbsig_t sig; 3983 + cdkonbsig_t __iomem *sigsp; 3984 + char *name; 3985 + int i; 3559 3986 3560 3987 /* 3561 3988 * Do a basic sanity check on the IO and memory addresses. 3562 3989 */ 3563 - if ((brdp->iobase == 0) || (brdp->memaddr == 0)) 3564 - return(-ENODEV); 3990 + if (brdp->iobase == 0 || brdp->memaddr == 0) 3991 + return -ENODEV; 3565 3992 3566 3993 brdp->iosize = ONB_IOSIZE; 3567 3994 ··· 3575 4010 case BRD_ONBOARD2: 3576 4011 case BRD_ONBOARD2_32: 3577 4012 case BRD_ONBOARDRS: 3578 - brdp->membase = (void *) brdp->memaddr; 3579 4013 brdp->memsize = ONB_MEMSIZE; 3580 4014 brdp->pagesize = ONB_ATPAGESIZE; 3581 4015 brdp->init = stli_onbinit; ··· 3592 4028 break; 3593 4029 3594 4030 case BRD_ONBOARDE: 3595 - brdp->membase = (void *) brdp->memaddr; 3596 4031 brdp->memsize = ONB_EIMEMSIZE; 3597 4032 brdp->pagesize = ONB_EIPAGESIZE; 3598 4033 brdp->init = stli_onbeinit; ··· 3607 4044 case BRD_BRUMBY4: 3608 4045 case BRD_BRUMBY8: 3609 4046 case BRD_BRUMBY16: 3610 - brdp->membase = (void *) brdp->memaddr; 3611 4047 brdp->memsize = BBY_MEMSIZE; 3612 4048 brdp->pagesize = BBY_PAGESIZE; 3613 4049 brdp->init = stli_bbyinit; ··· 3620 4058 break; 3621 4059 3622 4060 case BRD_STALLION: 3623 - brdp->membase = (void *) brdp->memaddr; 3624 4061 brdp->memsize = STAL_MEMSIZE; 3625 4062 brdp->pagesize = STAL_PAGESIZE; 3626 4063 brdp->init = stli_stalinit; ··· 3634 4073 3635 4074 default: 3636 4075 release_region(brdp->iobase, brdp->iosize); 3637 - return(-EINVAL); 4076 + return -EINVAL; 3638 4077 } 3639 4078 3640 4079 /* ··· 3646 4085 EBRDINIT(brdp); 3647 4086 3648 4087 brdp->membase = ioremap(brdp->memaddr, brdp->memsize); 3649 - if (brdp->membase == (void *) NULL) 4088 + if (brdp->membase == NULL) 3650 4089 { 3651 4090 release_region(brdp->iobase, brdp->iosize); 3652 - return(-ENOMEM); 4091 + return -ENOMEM; 3653 4092 } 3654 4093 3655 4094 /* ··· 3658 4097 * this is, and how many ports. 3659 4098 */ 3660 4099 EBRDENABLE(brdp); 3661 - sigsp = (cdkonbsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); 3662 - memcpy(&sig, sigsp, sizeof(cdkonbsig_t)); 4100 + sigsp = (cdkonbsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); 4101 + memcpy_fromio(&sig, sigsp, sizeof(cdkonbsig_t)); 3663 4102 EBRDDISABLE(brdp); 3664 4103 3665 - #if 0 3666 - printk("%s(%d): sig-> magic=%x:%x:%x:%x romver=%x amask=%x:%x:%x\n", 3667 - __FILE__, __LINE__, sig.magic0, sig.magic1, sig.magic2, 3668 - sig.magic3, sig.romver, sig.amask0, sig.amask1, sig.amask2); 3669 - #endif 3670 - 3671 - if ((sig.magic0 != ONB_MAGIC0) || (sig.magic1 != ONB_MAGIC1) || 3672 - (sig.magic2 != ONB_MAGIC2) || (sig.magic3 != ONB_MAGIC3)) 4104 + if (sig.magic0 != cpu_to_le16(ONB_MAGIC0) || 4105 + sig.magic1 != cpu_to_le16(ONB_MAGIC1) || 4106 + sig.magic2 != cpu_to_le16(ONB_MAGIC2) || 4107 + sig.magic3 != cpu_to_le16(ONB_MAGIC3)) 3673 4108 { 3674 4109 release_region(brdp->iobase, brdp->iosize); 3675 - return(-ENODEV); 4110 + return -ENODEV; 3676 4111 } 3677 4112 3678 4113 /* ··· 3689 4132 3690 4133 3691 4134 brdp->state |= BST_FOUND; 3692 - return(0); 4135 + return 0; 3693 4136 } 3694 4137 3695 4138 /*****************************************************************************/ ··· 3702 4145 3703 4146 static int stli_startbrd(stlibrd_t *brdp) 3704 4147 { 3705 - volatile cdkhdr_t *hdrp; 3706 - volatile cdkmem_t *memp; 3707 - volatile cdkasy_t *ap; 3708 - unsigned long flags; 3709 - stliport_t *portp; 3710 - int portnr, nrdevs, i, rc; 4148 + cdkhdr_t __iomem *hdrp; 4149 + cdkmem_t __iomem *memp; 4150 + cdkasy_t __iomem *ap; 4151 + unsigned long flags; 4152 + stliport_t *portp; 4153 + int portnr, nrdevs, i, rc = 0; 4154 + u32 memoff; 3711 4155 3712 - #ifdef DEBUG 3713 - printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp); 3714 - #endif 3715 - 3716 - rc = 0; 3717 - 3718 - save_flags(flags); 3719 - cli(); 4156 + spin_lock_irqsave(&brd_lock, flags); 3720 4157 EBRDENABLE(brdp); 3721 - hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 4158 + hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 3722 4159 nrdevs = hdrp->nrdevs; 3723 4160 3724 4161 #if 0 3725 4162 printk("%s(%d): CDK version %d.%d.%d --> " 3726 4163 "nrdevs=%d memp=%x hostp=%x slavep=%x\n", 3727 - __FILE__, __LINE__, hdrp->ver_release, hdrp->ver_modification, 3728 - hdrp->ver_fix, nrdevs, (int) hdrp->memp, (int) hdrp->hostp, 3729 - (int) hdrp->slavep); 4164 + __FILE__, __LINE__, readb(&hdrp->ver_release), readb(&hdrp->ver_modification), 4165 + readb(&hdrp->ver_fix), nrdevs, (int) readl(&hdrp->memp), readl(&hdrp->hostp), 4166 + readl(&hdrp->slavep)); 3730 4167 #endif 3731 4168 3732 4169 if (nrdevs < (brdp->nrports + 1)) { ··· 3732 4181 brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; 3733 4182 brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; 3734 4183 brdp->bitsize = (nrdevs + 7) / 8; 3735 - memp = (volatile cdkmem_t *) hdrp->memp; 3736 - if (((unsigned long) memp) > brdp->memsize) { 4184 + memoff = readl(&hdrp->memp); 4185 + if (memoff > brdp->memsize) { 3737 4186 printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); 3738 4187 rc = -EIO; 3739 4188 goto stli_donestartup; 3740 4189 } 3741 - memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, (unsigned long) memp); 3742 - if (memp->dtype != TYP_ASYNCTRL) { 4190 + memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff); 4191 + if (readw(&memp->dtype) != TYP_ASYNCTRL) { 3743 4192 printk(KERN_ERR "STALLION: no slave control device found\n"); 3744 4193 goto stli_donestartup; 3745 4194 } ··· 3751 4200 * change pages while reading memory map. 3752 4201 */ 3753 4202 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) { 3754 - if (memp->dtype != TYP_ASYNC) 4203 + if (readw(&memp->dtype) != TYP_ASYNC) 3755 4204 break; 3756 4205 portp = brdp->ports[portnr]; 3757 - if (portp == (stliport_t *) NULL) 4206 + if (portp == NULL) 3758 4207 break; 3759 4208 portp->devnr = i; 3760 - portp->addr = memp->offset; 4209 + portp->addr = readl(&memp->offset); 3761 4210 portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs)); 3762 4211 portp->portidx = (unsigned char) (i / 8); 3763 4212 portp->portbit = (unsigned char) (0x1 << (i % 8)); 3764 4213 } 3765 4214 3766 - hdrp->slavereq = 0xff; 4215 + writeb(0xff, &hdrp->slavereq); 3767 4216 3768 4217 /* 3769 4218 * For each port setup a local copy of the RX and TX buffer offsets ··· 3772 4221 */ 3773 4222 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) { 3774 4223 portp = brdp->ports[portnr]; 3775 - if (portp == (stliport_t *) NULL) 4224 + if (portp == NULL) 3776 4225 break; 3777 4226 if (portp->addr == 0) 3778 4227 break; 3779 - ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 3780 - if (ap != (volatile cdkasy_t *) NULL) { 3781 - portp->rxsize = ap->rxq.size; 3782 - portp->txsize = ap->txq.size; 3783 - portp->rxoffset = ap->rxq.offset; 3784 - portp->txoffset = ap->txq.offset; 4228 + ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); 4229 + if (ap != NULL) { 4230 + portp->rxsize = readw(&ap->rxq.size); 4231 + portp->txsize = readw(&ap->txq.size); 4232 + portp->rxoffset = readl(&ap->rxq.offset); 4233 + portp->txoffset = readl(&ap->txq.offset); 3785 4234 } 3786 4235 } 3787 4236 3788 4237 stli_donestartup: 3789 4238 EBRDDISABLE(brdp); 3790 - restore_flags(flags); 4239 + spin_unlock_irqrestore(&brd_lock, flags); 3791 4240 3792 4241 if (rc == 0) 3793 4242 brdp->state |= BST_STARTED; ··· 3798 4247 add_timer(&stli_timerlist); 3799 4248 } 3800 4249 3801 - return(rc); 4250 + return rc; 3802 4251 } 3803 4252 3804 4253 /*****************************************************************************/ ··· 3809 4258 3810 4259 static int __init stli_brdinit(stlibrd_t *brdp) 3811 4260 { 3812 - #ifdef DEBUG 3813 - printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp); 3814 - #endif 3815 - 3816 4261 stli_brds[brdp->brdnr] = brdp; 3817 4262 3818 4263 switch (brdp->brdtype) { ··· 3836 4289 case BRD_ECHPCI: 3837 4290 printk(KERN_ERR "STALLION: %s board type not supported in " 3838 4291 "this driver\n", stli_brdnames[brdp->brdtype]); 3839 - return(ENODEV); 4292 + return -ENODEV; 3840 4293 default: 3841 4294 printk(KERN_ERR "STALLION: board=%d is unknown board " 3842 4295 "type=%d\n", brdp->brdnr, brdp->brdtype); 3843 - return(ENODEV); 4296 + return -ENODEV; 3844 4297 } 3845 4298 3846 4299 if ((brdp->state & BST_FOUND) == 0) { ··· 3848 4301 "io=%x mem=%x\n", 3849 4302 stli_brdnames[brdp->brdtype], brdp->brdnr, 3850 4303 brdp->iobase, (int) brdp->memaddr); 3851 - return(ENODEV); 4304 + return -ENODEV; 3852 4305 } 3853 4306 3854 4307 stli_initports(brdp); ··· 3856 4309 "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], 3857 4310 brdp->brdnr, brdp->iobase, (int) brdp->memaddr, 3858 4311 brdp->nrpanels, brdp->nrports); 3859 - return(0); 4312 + return 0; 3860 4313 } 3861 4314 3862 4315 /*****************************************************************************/ ··· 3868 4321 3869 4322 static int stli_eisamemprobe(stlibrd_t *brdp) 3870 4323 { 3871 - cdkecpsig_t ecpsig, *ecpsigp; 3872 - cdkonbsig_t onbsig, *onbsigp; 4324 + cdkecpsig_t ecpsig, __iomem *ecpsigp; 4325 + cdkonbsig_t onbsig, __iomem *onbsigp; 3873 4326 int i, foundit; 3874 - 3875 - #ifdef DEBUG 3876 - printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp); 3877 - #endif 3878 4327 3879 4328 /* 3880 4329 * First up we reset the board, to get it into a known state. There ··· 3895 4352 mdelay(1); 3896 4353 stli_onbeenable(brdp); 3897 4354 } else { 3898 - return(-ENODEV); 4355 + return -ENODEV; 3899 4356 } 3900 4357 3901 4358 foundit = 0; ··· 3907 4364 */ 3908 4365 for (i = 0; (i < stli_eisamempsize); i++) { 3909 4366 brdp->memaddr = stli_eisamemprobeaddrs[i]; 3910 - brdp->membase = (void *) brdp->memaddr; 3911 4367 brdp->membase = ioremap(brdp->memaddr, brdp->memsize); 3912 - if (brdp->membase == (void *) NULL) 4368 + if (brdp->membase == NULL) 3913 4369 continue; 3914 4370 3915 4371 if (brdp->brdtype == BRD_ECPE) { 3916 - ecpsigp = (cdkecpsig_t *) stli_ecpeigetmemptr(brdp, 4372 + ecpsigp = (cdkecpsig_t __iomem *) stli_ecpeigetmemptr(brdp, 3917 4373 CDK_SIGADDR, __LINE__); 3918 - memcpy(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); 3919 - if (ecpsig.magic == ECP_MAGIC) 4374 + memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); 4375 + if (ecpsig.magic == cpu_to_le32(ECP_MAGIC)) 3920 4376 foundit = 1; 3921 4377 } else { 3922 - onbsigp = (cdkonbsig_t *) stli_onbegetmemptr(brdp, 4378 + onbsigp = (cdkonbsig_t __iomem *) stli_onbegetmemptr(brdp, 3923 4379 CDK_SIGADDR, __LINE__); 3924 - memcpy(&onbsig, onbsigp, sizeof(cdkonbsig_t)); 3925 - if ((onbsig.magic0 == ONB_MAGIC0) && 3926 - (onbsig.magic1 == ONB_MAGIC1) && 3927 - (onbsig.magic2 == ONB_MAGIC2) && 3928 - (onbsig.magic3 == ONB_MAGIC3)) 4380 + memcpy_fromio(&onbsig, onbsigp, sizeof(cdkonbsig_t)); 4381 + if ((onbsig.magic0 == cpu_to_le16(ONB_MAGIC0)) && 4382 + (onbsig.magic1 == cpu_to_le16(ONB_MAGIC1)) && 4383 + (onbsig.magic2 == cpu_to_le16(ONB_MAGIC2)) && 4384 + (onbsig.magic3 == cpu_to_le16(ONB_MAGIC3))) 3929 4385 foundit = 1; 3930 4386 } 3931 4387 ··· 3948 4406 printk(KERN_ERR "STALLION: failed to probe shared memory " 3949 4407 "region for %s in EISA slot=%d\n", 3950 4408 stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); 3951 - return(-ENODEV); 4409 + return -ENODEV; 3952 4410 } 3953 - return(0); 4411 + return 0; 3954 4412 } 3955 4413 3956 4414 static int stli_getbrdnr(void) ··· 3981 4439 3982 4440 static int stli_findeisabrds(void) 3983 4441 { 3984 - stlibrd_t *brdp; 3985 - unsigned int iobase, eid; 3986 - int i; 3987 - 3988 - #ifdef DEBUG 3989 - printk(KERN_DEBUG "stli_findeisabrds()\n"); 3990 - #endif 4442 + stlibrd_t *brdp; 4443 + unsigned int iobase, eid; 4444 + int i; 3991 4445 3992 4446 /* 3993 - * Firstly check if this is an EISA system. Do this by probing for 3994 - * the system board EISA ID. If this is not an EISA system then 4447 + * Firstly check if this is an EISA system. If this is not an EISA system then 3995 4448 * don't bother going any further! 3996 4449 */ 3997 - outb(0xff, 0xc80); 3998 - if (inb(0xc80) == 0xff) 3999 - return(0); 4450 + if (EISA_bus) 4451 + return 0; 4000 4452 4001 4453 /* 4002 4454 * Looks like an EISA system, so go searching for EISA boards. ··· 4008 4472 */ 4009 4473 for (i = 0; (i < STL_MAXBRDS); i++) { 4010 4474 brdp = stli_brds[i]; 4011 - if (brdp == (stlibrd_t *) NULL) 4475 + if (brdp == NULL) 4012 4476 continue; 4013 4477 if (brdp->iobase == iobase) 4014 4478 break; ··· 4020 4484 * We have found a Stallion board and it is not configured already. 4021 4485 * Allocate a board structure and initialize it. 4022 4486 */ 4023 - if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 4024 - return(-ENOMEM); 4487 + if ((brdp = stli_allocbrd()) == NULL) 4488 + return -ENOMEM; 4025 4489 if ((brdp->brdnr = stli_getbrdnr()) < 0) 4026 - return(-ENOMEM); 4490 + return -ENOMEM; 4027 4491 eid = inb(iobase + 0xc82); 4028 4492 if (eid == ECP_EISAID) 4029 4493 brdp->brdtype = BRD_ECPE; ··· 4038 4502 stli_brdinit(brdp); 4039 4503 } 4040 4504 4041 - return(0); 4505 + return 0; 4042 4506 } 4043 4507 4044 4508 /*****************************************************************************/ ··· 4059 4523 4060 4524 static int stli_initpcibrd(int brdtype, struct pci_dev *devp) 4061 4525 { 4062 - stlibrd_t *brdp; 4063 - 4064 - #ifdef DEBUG 4065 - printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n", 4066 - brdtype, dev->bus->number, dev->devfn); 4067 - #endif 4526 + stlibrd_t *brdp; 4068 4527 4069 4528 if (pci_enable_device(devp)) 4070 - return(-EIO); 4071 - if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 4072 - return(-ENOMEM); 4529 + return -EIO; 4530 + if ((brdp = stli_allocbrd()) == NULL) 4531 + return -ENOMEM; 4073 4532 if ((brdp->brdnr = stli_getbrdnr()) < 0) { 4074 4533 printk(KERN_INFO "STALLION: too many boards found, " 4075 4534 "maximum supported %d\n", STL_MAXBRDS); 4076 - return(0); 4535 + return 0; 4077 4536 } 4078 4537 brdp->brdtype = brdtype; 4079 - 4080 - #ifdef DEBUG 4081 - printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__, 4082 - pci_resource_start(devp, 0), 4083 - pci_resource_start(devp, 1), 4084 - pci_resource_start(devp, 2), 4085 - pci_resource_start(devp, 3)); 4086 - #endif 4087 - 4088 4538 /* 4089 4539 * We have all resources from the board, so lets setup the actual 4090 4540 * board structure now. ··· 4079 4557 brdp->memaddr = pci_resource_start(devp, 2); 4080 4558 stli_brdinit(brdp); 4081 4559 4082 - return(0); 4560 + return 0; 4083 4561 } 4084 4562 4085 4563 /*****************************************************************************/ ··· 4091 4569 4092 4570 static int stli_findpcibrds(void) 4093 4571 { 4094 - struct pci_dev *dev = NULL; 4095 - int rc; 4572 + struct pci_dev *dev = NULL; 4096 4573 4097 - #ifdef DEBUG 4098 - printk("stli_findpcibrds()\n"); 4099 - #endif 4100 - 4101 - while ((dev = pci_find_device(PCI_VENDOR_ID_STALLION, 4102 - PCI_DEVICE_ID_ECRA, dev))) { 4103 - if ((rc = stli_initpcibrd(BRD_ECPPCI, dev))) 4104 - return(rc); 4574 + while ((dev = pci_get_device(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, dev))) { 4575 + stli_initpcibrd(BRD_ECPPCI, dev); 4105 4576 } 4106 - 4107 - return(0); 4577 + return 0; 4108 4578 } 4109 4579 4110 4580 #endif ··· 4109 4595 4110 4596 static stlibrd_t *stli_allocbrd(void) 4111 4597 { 4112 - stlibrd_t *brdp; 4598 + stlibrd_t *brdp; 4113 4599 4114 4600 brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); 4115 4601 if (!brdp) { 4116 4602 printk(KERN_ERR "STALLION: failed to allocate memory " 4117 - "(size=%d)\n", sizeof(stlibrd_t)); 4603 + "(size=%Zd)\n", sizeof(stlibrd_t)); 4118 4604 return NULL; 4119 4605 } 4120 - 4121 4606 brdp->magic = STLI_BOARDMAGIC; 4122 - return(brdp); 4607 + return brdp; 4123 4608 } 4124 4609 4125 4610 /*****************************************************************************/ ··· 4130 4617 4131 4618 static int stli_initbrds(void) 4132 4619 { 4133 - stlibrd_t *brdp, *nxtbrdp; 4134 - stlconf_t *confp; 4135 - int i, j; 4136 - 4137 - #ifdef DEBUG 4138 - printk(KERN_DEBUG "stli_initbrds()\n"); 4139 - #endif 4620 + stlibrd_t *brdp, *nxtbrdp; 4621 + stlconf_t *confp; 4622 + int i, j; 4140 4623 4141 4624 if (stli_nrbrds > STL_MAXBRDS) { 4142 4625 printk(KERN_INFO "STALLION: too many boards in configuration " ··· 4147 4638 */ 4148 4639 for (i = 0; (i < stli_nrbrds); i++) { 4149 4640 confp = &stli_brdconf[i]; 4150 - #ifdef MODULE 4151 4641 stli_parsebrd(confp, stli_brdsp[i]); 4152 - #endif 4153 - if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 4154 - return(-ENOMEM); 4642 + if ((brdp = stli_allocbrd()) == NULL) 4643 + return -ENOMEM; 4155 4644 brdp->brdnr = i; 4156 4645 brdp->brdtype = confp->brdtype; 4157 4646 brdp->iobase = confp->ioaddr1; ··· 4161 4654 * Static configuration table done, so now use dynamic methods to 4162 4655 * see if any more boards should be configured. 4163 4656 */ 4164 - #ifdef MODULE 4165 4657 stli_argbrds(); 4166 - #endif 4167 4658 if (STLI_EISAPROBE) 4168 4659 stli_findeisabrds(); 4169 4660 #ifdef CONFIG_PCI ··· 4177 4672 if (stli_nrbrds > 1) { 4178 4673 for (i = 0; (i < stli_nrbrds); i++) { 4179 4674 brdp = stli_brds[i]; 4180 - if (brdp == (stlibrd_t *) NULL) 4675 + if (brdp == NULL) 4181 4676 continue; 4182 4677 for (j = i + 1; (j < stli_nrbrds); j++) { 4183 4678 nxtbrdp = stli_brds[j]; 4184 - if (nxtbrdp == (stlibrd_t *) NULL) 4679 + if (nxtbrdp == NULL) 4185 4680 continue; 4186 4681 if ((brdp->membase >= nxtbrdp->membase) && 4187 4682 (brdp->membase <= (nxtbrdp->membase + ··· 4196 4691 if (stli_shared == 0) { 4197 4692 for (i = 0; (i < stli_nrbrds); i++) { 4198 4693 brdp = stli_brds[i]; 4199 - if (brdp == (stlibrd_t *) NULL) 4694 + if (brdp == NULL) 4200 4695 continue; 4201 4696 if (brdp->state & BST_FOUND) { 4202 4697 EBRDENABLE(brdp); ··· 4206 4701 } 4207 4702 } 4208 4703 4209 - return(0); 4704 + return 0; 4210 4705 } 4211 4706 4212 4707 /*****************************************************************************/ ··· 4219 4714 4220 4715 static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) 4221 4716 { 4222 - unsigned long flags; 4223 - void *memptr; 4224 - stlibrd_t *brdp; 4225 - int brdnr, size, n; 4226 - 4227 - #ifdef DEBUG 4228 - printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n", 4229 - (int) fp, (int) buf, count, (int) offp); 4230 - #endif 4717 + unsigned long flags; 4718 + void *memptr; 4719 + stlibrd_t *brdp; 4720 + int brdnr, size, n; 4721 + void *p; 4722 + loff_t off = *offp; 4231 4723 4232 4724 brdnr = iminor(fp->f_dentry->d_inode); 4233 4725 if (brdnr >= stli_nrbrds) 4234 - return(-ENODEV); 4726 + return -ENODEV; 4235 4727 brdp = stli_brds[brdnr]; 4236 - if (brdp == (stlibrd_t *) NULL) 4237 - return(-ENODEV); 4728 + if (brdp == NULL) 4729 + return -ENODEV; 4238 4730 if (brdp->state == 0) 4239 - return(-ENODEV); 4240 - if (fp->f_pos >= brdp->memsize) 4241 - return(0); 4731 + return -ENODEV; 4732 + if (off >= brdp->memsize || off + count < off) 4733 + return 0; 4242 4734 4243 - size = MIN(count, (brdp->memsize - fp->f_pos)); 4735 + size = MIN(count, (brdp->memsize - off)); 4244 4736 4245 - save_flags(flags); 4246 - cli(); 4247 - EBRDENABLE(brdp); 4737 + /* 4738 + * Copy the data a page at a time 4739 + */ 4740 + 4741 + p = (void *)__get_free_page(GFP_KERNEL); 4742 + if(p == NULL) 4743 + return -ENOMEM; 4744 + 4248 4745 while (size > 0) { 4249 - memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); 4250 - n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); 4251 - if (copy_to_user(buf, memptr, n)) { 4746 + spin_lock_irqsave(&brd_lock, flags); 4747 + EBRDENABLE(brdp); 4748 + memptr = (void *) EBRDGETMEMPTR(brdp, off); 4749 + n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); 4750 + n = MIN(n, PAGE_SIZE); 4751 + memcpy_fromio(p, memptr, n); 4752 + EBRDDISABLE(brdp); 4753 + spin_unlock_irqrestore(&brd_lock, flags); 4754 + if (copy_to_user(buf, p, n)) { 4252 4755 count = -EFAULT; 4253 4756 goto out; 4254 4757 } 4255 - fp->f_pos += n; 4758 + off += n; 4256 4759 buf += n; 4257 4760 size -= n; 4258 4761 } 4259 4762 out: 4260 - EBRDDISABLE(brdp); 4261 - restore_flags(flags); 4262 - 4263 - return(count); 4763 + *offp = off; 4764 + free_page((unsigned long)p); 4765 + return count; 4264 4766 } 4265 4767 4266 4768 /*****************************************************************************/ ··· 4276 4764 * Code to handle an "staliomem" write operation. This device is the 4277 4765 * contents of the board shared memory. It is used for down loading 4278 4766 * the slave image (and debugging :-) 4767 + * 4768 + * FIXME: copy under lock 4279 4769 */ 4280 4770 4281 4771 static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) 4282 4772 { 4283 - unsigned long flags; 4284 - void *memptr; 4285 - stlibrd_t *brdp; 4286 - char __user *chbuf; 4287 - int brdnr, size, n; 4288 - 4289 - #ifdef DEBUG 4290 - printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n", 4291 - (int) fp, (int) buf, count, (int) offp); 4292 - #endif 4773 + unsigned long flags; 4774 + void *memptr; 4775 + stlibrd_t *brdp; 4776 + char __user *chbuf; 4777 + int brdnr, size, n; 4778 + void *p; 4779 + loff_t off = *offp; 4293 4780 4294 4781 brdnr = iminor(fp->f_dentry->d_inode); 4782 + 4295 4783 if (brdnr >= stli_nrbrds) 4296 - return(-ENODEV); 4784 + return -ENODEV; 4297 4785 brdp = stli_brds[brdnr]; 4298 - if (brdp == (stlibrd_t *) NULL) 4299 - return(-ENODEV); 4786 + if (brdp == NULL) 4787 + return -ENODEV; 4300 4788 if (brdp->state == 0) 4301 - return(-ENODEV); 4302 - if (fp->f_pos >= brdp->memsize) 4303 - return(0); 4789 + return -ENODEV; 4790 + if (off >= brdp->memsize || off + count < off) 4791 + return 0; 4304 4792 4305 4793 chbuf = (char __user *) buf; 4306 - size = MIN(count, (brdp->memsize - fp->f_pos)); 4794 + size = MIN(count, (brdp->memsize - off)); 4307 4795 4308 - save_flags(flags); 4309 - cli(); 4310 - EBRDENABLE(brdp); 4796 + /* 4797 + * Copy the data a page at a time 4798 + */ 4799 + 4800 + p = (void *)__get_free_page(GFP_KERNEL); 4801 + if(p == NULL) 4802 + return -ENOMEM; 4803 + 4311 4804 while (size > 0) { 4312 - memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); 4313 - n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); 4314 - if (copy_from_user(memptr, chbuf, n)) { 4315 - count = -EFAULT; 4805 + n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); 4806 + n = MIN(n, PAGE_SIZE); 4807 + if (copy_from_user(p, chbuf, n)) { 4808 + if (count == 0) 4809 + count = -EFAULT; 4316 4810 goto out; 4317 4811 } 4318 - fp->f_pos += n; 4812 + spin_lock_irqsave(&brd_lock, flags); 4813 + EBRDENABLE(brdp); 4814 + memptr = (void *) EBRDGETMEMPTR(brdp, off); 4815 + memcpy_toio(memptr, p, n); 4816 + EBRDDISABLE(brdp); 4817 + spin_unlock_irqrestore(&brd_lock, flags); 4818 + off += n; 4319 4819 chbuf += n; 4320 4820 size -= n; 4321 4821 } 4322 4822 out: 4323 - EBRDDISABLE(brdp); 4324 - restore_flags(flags); 4325 - 4326 - return(count); 4823 + free_page((unsigned long) p); 4824 + *offp = off; 4825 + return count; 4327 4826 } 4328 4827 4329 4828 /*****************************************************************************/ ··· 4345 4822 4346 4823 static int stli_getbrdstats(combrd_t __user *bp) 4347 4824 { 4348 - stlibrd_t *brdp; 4349 - int i; 4825 + stlibrd_t *brdp; 4826 + int i; 4350 4827 4351 4828 if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) 4352 4829 return -EFAULT; 4353 4830 if (stli_brdstats.brd >= STL_MAXBRDS) 4354 - return(-ENODEV); 4831 + return -ENODEV; 4355 4832 brdp = stli_brds[stli_brdstats.brd]; 4356 - if (brdp == (stlibrd_t *) NULL) 4357 - return(-ENODEV); 4833 + if (brdp == NULL) 4834 + return -ENODEV; 4358 4835 4359 4836 memset(&stli_brdstats, 0, sizeof(combrd_t)); 4360 4837 stli_brdstats.brd = brdp->brdnr; ··· 4373 4850 4374 4851 if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t))) 4375 4852 return -EFAULT; 4376 - return(0); 4853 + return 0; 4377 4854 } 4378 4855 4379 4856 /*****************************************************************************/ ··· 4384 4861 4385 4862 static stliport_t *stli_getport(int brdnr, int panelnr, int portnr) 4386 4863 { 4387 - stlibrd_t *brdp; 4388 - int i; 4864 + stlibrd_t *brdp; 4865 + int i; 4389 4866 4390 - if ((brdnr < 0) || (brdnr >= STL_MAXBRDS)) 4391 - return((stliport_t *) NULL); 4867 + if (brdnr < 0 || brdnr >= STL_MAXBRDS) 4868 + return NULL; 4392 4869 brdp = stli_brds[brdnr]; 4393 - if (brdp == (stlibrd_t *) NULL) 4394 - return((stliport_t *) NULL); 4870 + if (brdp == NULL) 4871 + return NULL; 4395 4872 for (i = 0; (i < panelnr); i++) 4396 4873 portnr += brdp->panels[i]; 4397 4874 if ((portnr < 0) || (portnr >= brdp->nrports)) 4398 - return((stliport_t *) NULL); 4399 - return(brdp->ports[portnr]); 4875 + return NULL; 4876 + return brdp->ports[portnr]; 4400 4877 } 4401 4878 4402 4879 /*****************************************************************************/ ··· 4415 4892 4416 4893 memset(&stli_comstats, 0, sizeof(comstats_t)); 4417 4894 4418 - if (portp == (stliport_t *) NULL) 4419 - return(-ENODEV); 4895 + if (portp == NULL) 4896 + return -ENODEV; 4420 4897 brdp = stli_brds[portp->brdnr]; 4421 - if (brdp == (stlibrd_t *) NULL) 4422 - return(-ENODEV); 4898 + if (brdp == NULL) 4899 + return -ENODEV; 4423 4900 4424 4901 if (brdp->state & BST_STARTED) { 4425 4902 if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, 4426 4903 &stli_cdkstats, sizeof(asystats_t), 1)) < 0) 4427 - return(rc); 4904 + return rc; 4428 4905 } else { 4429 4906 memset(&stli_cdkstats, 0, sizeof(asystats_t)); 4430 4907 } ··· 4435 4912 stli_comstats.state = portp->state; 4436 4913 stli_comstats.flags = portp->flags; 4437 4914 4438 - save_flags(flags); 4439 - cli(); 4440 - if (portp->tty != (struct tty_struct *) NULL) { 4915 + spin_lock_irqsave(&brd_lock, flags); 4916 + if (portp->tty != NULL) { 4441 4917 if (portp->tty->driver_data == portp) { 4442 4918 stli_comstats.ttystate = portp->tty->flags; 4443 - stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/; 4444 - if (portp->tty->termios != (struct termios *) NULL) { 4919 + stli_comstats.rxbuffered = -1; 4920 + if (portp->tty->termios != NULL) { 4445 4921 stli_comstats.cflags = portp->tty->termios->c_cflag; 4446 4922 stli_comstats.iflags = portp->tty->termios->c_iflag; 4447 4923 stli_comstats.oflags = portp->tty->termios->c_oflag; ··· 4448 4926 } 4449 4927 } 4450 4928 } 4451 - restore_flags(flags); 4929 + spin_unlock_irqrestore(&brd_lock, flags); 4452 4930 4453 4931 stli_comstats.txtotal = stli_cdkstats.txchars; 4454 4932 stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover; ··· 4470 4948 stli_comstats.hwid = stli_cdkstats.hwid; 4471 4949 stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); 4472 4950 4473 - return(0); 4951 + return 0; 4474 4952 } 4475 4953 4476 4954 /*****************************************************************************/ ··· 4483 4961 4484 4962 static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) 4485 4963 { 4486 - stlibrd_t *brdp; 4487 - int rc; 4964 + stlibrd_t *brdp; 4965 + int rc; 4488 4966 4489 4967 if (!portp) { 4490 4968 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) ··· 4514 4992 4515 4993 static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) 4516 4994 { 4517 - stlibrd_t *brdp; 4518 - int rc; 4995 + stlibrd_t *brdp; 4996 + int rc; 4519 4997 4520 4998 if (!portp) { 4521 4999 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) ··· 4553 5031 4554 5032 static int stli_getportstruct(stliport_t __user *arg) 4555 5033 { 4556 - stliport_t *portp; 5034 + stliport_t *portp; 4557 5035 4558 5036 if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) 4559 5037 return -EFAULT; ··· 4574 5052 4575 5053 static int stli_getbrdstruct(stlibrd_t __user *arg) 4576 5054 { 4577 - stlibrd_t *brdp; 5055 + stlibrd_t *brdp; 4578 5056 4579 5057 if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) 4580 5058 return -EFAULT; ··· 4598 5076 4599 5077 static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) 4600 5078 { 4601 - stlibrd_t *brdp; 4602 - int brdnr, rc, done; 5079 + stlibrd_t *brdp; 5080 + int brdnr, rc, done; 4603 5081 void __user *argp = (void __user *)arg; 4604 - 4605 - #ifdef DEBUG 4606 - printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n", 4607 - (int) ip, (int) fp, cmd, (int) arg); 4608 - #endif 4609 5082 4610 5083 /* 4611 5084 * First up handle the board independent ioctls. ··· 4632 5115 } 4633 5116 4634 5117 if (done) 4635 - return(rc); 5118 + return rc; 4636 5119 4637 5120 /* 4638 5121 * Now handle the board specific ioctls. These all depend on the ··· 4640 5123 */ 4641 5124 brdnr = iminor(ip); 4642 5125 if (brdnr >= STL_MAXBRDS) 4643 - return(-ENODEV); 5126 + return -ENODEV; 4644 5127 brdp = stli_brds[brdnr]; 4645 5128 if (!brdp) 4646 - return(-ENODEV); 5129 + return -ENODEV; 4647 5130 if (brdp->state == 0) 4648 - return(-ENODEV); 5131 + return -ENODEV; 4649 5132 4650 5133 switch (cmd) { 4651 5134 case STL_BINTR: ··· 4669 5152 rc = -ENOIOCTLCMD; 4670 5153 break; 4671 5154 } 4672 - 4673 - return(rc); 5155 + return rc; 4674 5156 } 4675 5157 4676 5158 static struct tty_operations stli_ops = { ··· 4703 5187 int i; 4704 5188 printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); 4705 5189 5190 + spin_lock_init(&stli_lock); 5191 + spin_lock_init(&brd_lock); 5192 + 4706 5193 stli_initbrds(); 4707 5194 4708 5195 stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); ··· 4715 5196 /* 4716 5197 * Allocate a temporary write buffer. 4717 5198 */ 4718 - stli_tmpwritebuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); 4719 - if (!stli_tmpwritebuf) 4720 - printk(KERN_ERR "STALLION: failed to allocate memory " 4721 - "(size=%d)\n", STLI_TXBUFSIZE); 4722 5199 stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); 4723 5200 if (!stli_txcookbuf) 4724 5201 printk(KERN_ERR "STALLION: failed to allocate memory " ··· 4758 5243 printk(KERN_ERR "STALLION: failed to register serial driver\n"); 4759 5244 return -EBUSY; 4760 5245 } 4761 - return(0); 5246 + return 0; 4762 5247 } 4763 5248 4764 5249 /*****************************************************************************/
-1
drivers/char/mxser.c
··· 996 996 997 997 info->session = current->signal->session; 998 998 info->pgrp = process_group(current); 999 - clear_bit(TTY_DONT_FLIP, &tty->flags); 1000 999 1001 1000 /* 1002 1001 status = mxser_get_msr(info->base, 0, info->port);
+1 -5
drivers/char/n_tty.c
··· 1132 1132 * buffer, and once to drain the space from the (physical) beginning of 1133 1133 * the buffer to head pointer. 1134 1134 * 1135 - * Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set 1135 + * Called under the tty->atomic_read_lock sem 1136 1136 * 1137 1137 */ 1138 1138 ··· 1271 1271 } 1272 1272 1273 1273 add_wait_queue(&tty->read_wait, &wait); 1274 - set_bit(TTY_DONT_FLIP, &tty->flags); 1275 1274 while (nr) { 1276 1275 /* First test for status change. */ 1277 1276 if (tty->packet && tty->link->ctrl_status) { ··· 1314 1315 break; 1315 1316 } 1316 1317 n_tty_set_room(tty); 1317 - clear_bit(TTY_DONT_FLIP, &tty->flags); 1318 1318 timeout = schedule_timeout(timeout); 1319 - set_bit(TTY_DONT_FLIP, &tty->flags); 1320 1319 continue; 1321 1320 } 1322 1321 __set_current_state(TASK_RUNNING); ··· 1391 1394 if (time) 1392 1395 timeout = time; 1393 1396 } 1394 - clear_bit(TTY_DONT_FLIP, &tty->flags); 1395 1397 mutex_unlock(&tty->atomic_read_lock); 1396 1398 remove_wait_queue(&tty->read_wait, &wait); 1397 1399
+1 -1
drivers/char/pty.c
··· 101 101 * 102 102 * FIXME: Our pty_write method is called with our ldisc lock held but 103 103 * not our partners. We can't just take the other one blindly without 104 - * risking deadlocks. There is also the small matter of TTY_DONT_FLIP 104 + * risking deadlocks. 105 105 */ 106 106 static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count) 107 107 {
+3
drivers/char/stallion.c
··· 3029 3029 int i; 3030 3030 printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); 3031 3031 3032 + spin_lock_init(&stallion_lock); 3033 + spin_lock_init(&brd_lock); 3034 + 3032 3035 stl_initbrds(); 3033 3036 3034 3037 stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
+30 -38
drivers/char/tty_io.c
··· 267 267 p->used = 0; 268 268 p->size = size; 269 269 p->next = NULL; 270 - p->active = 0; 271 270 p->commit = 0; 272 271 p->read = 0; 273 272 p->char_buf_ptr = (char *)(p->data); ··· 326 327 /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 327 328 remove this conditional if its worth it. This would be invisible 328 329 to the callers */ 329 - if ((b = tty->buf.tail) != NULL) { 330 + if ((b = tty->buf.tail) != NULL) 330 331 left = b->size - b->used; 331 - b->active = 1; 332 - } else 332 + else 333 333 left = 0; 334 334 335 335 if (left < size) { ··· 336 338 if ((n = tty_buffer_find(tty, size)) != NULL) { 337 339 if (b != NULL) { 338 340 b->next = n; 339 - b->active = 0; 340 341 b->commit = b->used; 341 342 } else 342 343 tty->buf.head = n; 343 344 tty->buf.tail = n; 344 - n->active = 1; 345 345 } else 346 346 size = left; 347 347 } ··· 400 404 { 401 405 unsigned long flags; 402 406 spin_lock_irqsave(&tty->buf.lock, flags); 403 - if (tty->buf.tail != NULL) { 404 - tty->buf.tail->active = 0; 407 + if (tty->buf.tail != NULL) 405 408 tty->buf.tail->commit = tty->buf.tail->used; 406 - } 407 409 spin_unlock_irqrestore(&tty->buf.lock, flags); 408 410 schedule_delayed_work(&tty->buf.work, 1); 409 411 } ··· 778 784 } 779 785 780 786 clear_bit(TTY_LDISC, &tty->flags); 781 - clear_bit(TTY_DONT_FLIP, &tty->flags); 782 - if (o_tty) { 787 + if (o_tty) 783 788 clear_bit(TTY_LDISC, &o_tty->flags); 784 - clear_bit(TTY_DONT_FLIP, &o_tty->flags); 785 - } 786 789 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 787 790 788 791 /* ··· 1946 1955 * race with the set_ldisc code path. 1947 1956 */ 1948 1957 clear_bit(TTY_LDISC, &tty->flags); 1949 - clear_bit(TTY_DONT_FLIP, &tty->flags); 1950 1958 cancel_delayed_work(&tty->buf.work); 1951 1959 1952 1960 /* ··· 2765 2775 struct tty_struct *tty = (struct tty_struct *) private_; 2766 2776 unsigned long flags; 2767 2777 struct tty_ldisc *disc; 2768 - struct tty_buffer *tbuf; 2769 - int count; 2778 + struct tty_buffer *tbuf, *head; 2770 2779 char *char_buf; 2771 2780 unsigned char *flag_buf; 2772 2781 ··· 2773 2784 if (disc == NULL) /* !TTY_LDISC */ 2774 2785 return; 2775 2786 2776 - if (test_bit(TTY_DONT_FLIP, &tty->flags)) { 2777 - /* 2778 - * Do it after the next timer tick: 2779 - */ 2780 - schedule_delayed_work(&tty->buf.work, 1); 2781 - goto out; 2782 - } 2783 2787 spin_lock_irqsave(&tty->buf.lock, flags); 2784 - while((tbuf = tty->buf.head) != NULL) { 2785 - while ((count = tbuf->commit - tbuf->read) != 0) { 2786 - char_buf = tbuf->char_buf_ptr + tbuf->read; 2787 - flag_buf = tbuf->flag_buf_ptr + tbuf->read; 2788 - tbuf->read += count; 2788 + head = tty->buf.head; 2789 + if (head != NULL) { 2790 + tty->buf.head = NULL; 2791 + for (;;) { 2792 + int count = head->commit - head->read; 2793 + if (!count) { 2794 + if (head->next == NULL) 2795 + break; 2796 + tbuf = head; 2797 + head = head->next; 2798 + tty_buffer_free(tty, tbuf); 2799 + continue; 2800 + } 2801 + if (!tty->receive_room) { 2802 + schedule_delayed_work(&tty->buf.work, 1); 2803 + break; 2804 + } 2805 + if (count > tty->receive_room) 2806 + count = tty->receive_room; 2807 + char_buf = head->char_buf_ptr + head->read; 2808 + flag_buf = head->flag_buf_ptr + head->read; 2809 + head->read += count; 2789 2810 spin_unlock_irqrestore(&tty->buf.lock, flags); 2790 2811 disc->receive_buf(tty, char_buf, flag_buf, count); 2791 2812 spin_lock_irqsave(&tty->buf.lock, flags); 2792 2813 } 2793 - if (tbuf->active) 2794 - break; 2795 - tty->buf.head = tbuf->next; 2796 - if (tty->buf.head == NULL) 2797 - tty->buf.tail = NULL; 2798 - tty_buffer_free(tty, tbuf); 2814 + tty->buf.head = head; 2799 2815 } 2800 2816 spin_unlock_irqrestore(&tty->buf.lock, flags); 2801 - out: 2817 + 2802 2818 tty_ldisc_deref(disc); 2803 2819 } 2804 2820 ··· 2896 2902 { 2897 2903 unsigned long flags; 2898 2904 spin_lock_irqsave(&tty->buf.lock, flags); 2899 - if (tty->buf.tail != NULL) { 2900 - tty->buf.tail->active = 0; 2905 + if (tty->buf.tail != NULL) 2901 2906 tty->buf.tail->commit = tty->buf.tail->used; 2902 - } 2903 2907 spin_unlock_irqrestore(&tty->buf.lock, flags); 2904 2908 2905 2909 if (tty->low_latency)
+71 -11
drivers/char/watchdog/at91_wdt.c
··· 17 17 #include <linux/miscdevice.h> 18 18 #include <linux/module.h> 19 19 #include <linux/moduleparam.h> 20 + #include <linux/platform_device.h> 20 21 #include <linux/types.h> 21 22 #include <linux/watchdog.h> 22 23 #include <asm/bitops.h> 23 24 #include <asm/uaccess.h> 24 25 25 26 26 - #define WDT_DEFAULT_TIME 5 /* 5 seconds */ 27 - #define WDT_MAX_TIME 256 /* 256 seconds */ 27 + #define WDT_DEFAULT_TIME 5 /* seconds */ 28 + #define WDT_MAX_TIME 256 /* seconds */ 28 29 29 30 static int wdt_time = WDT_DEFAULT_TIME; 30 31 static int nowayout = WATCHDOG_NOWAYOUT; ··· 33 32 module_param(wdt_time, int, 0); 34 33 MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")"); 35 34 35 + #ifdef CONFIG_WATCHDOG_NOWAYOUT 36 36 module_param(nowayout, int, 0); 37 37 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 38 + #endif 38 39 39 40 40 41 static unsigned long at91wdt_busy; ··· 141 138 case WDIOC_SETTIMEOUT: 142 139 if (get_user(new_value, p)) 143 140 return -EFAULT; 144 - 141 + 145 142 if (at91_wdt_settimeout(new_value)) 146 143 return -EINVAL; 147 144 ··· 199 196 .fops = &at91wdt_fops, 200 197 }; 201 198 202 - static int __init at91_wdt_init(void) 199 + static int __init at91wdt_probe(struct platform_device *pdev) 203 200 { 204 201 int res; 205 202 206 - /* Check that the heartbeat value is within range; if not reset to the default */ 207 - if (at91_wdt_settimeout(wdt_time)) { 208 - at91_wdt_settimeout(WDT_DEFAULT_TIME); 209 - printk(KERN_INFO "at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time); 210 - } 203 + if (at91wdt_miscdev.dev) 204 + return -EBUSY; 205 + at91wdt_miscdev.dev = &pdev->dev; 211 206 212 207 res = misc_register(&at91wdt_miscdev); 213 208 if (res) 214 209 return res; 215 210 216 - printk("AT91 Watchdog Timer enabled (%d seconds, nowayout=%d)\n", wdt_time, nowayout); 211 + printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : ""); 217 212 return 0; 213 + } 214 + 215 + static int __exit at91wdt_remove(struct platform_device *pdev) 216 + { 217 + int res; 218 + 219 + res = misc_deregister(&at91wdt_miscdev); 220 + if (!res) 221 + at91wdt_miscdev.dev = NULL; 222 + 223 + return res; 224 + } 225 + 226 + static void at91wdt_shutdown(struct platform_device *pdev) 227 + { 228 + at91_wdt_stop(); 229 + } 230 + 231 + #ifdef CONFIG_PM 232 + 233 + static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message) 234 + { 235 + at91_wdt_stop(); 236 + return 0; 237 + } 238 + 239 + static int at91wdt_resume(struct platform_device *pdev) 240 + { 241 + if (at91wdt_busy) 242 + at91_wdt_start(); 243 + return 0; 244 + } 245 + 246 + #else 247 + #define at91wdt_suspend NULL 248 + #define at91wdt_resume NULL 249 + #endif 250 + 251 + static struct platform_driver at91wdt_driver = { 252 + .probe = at91wdt_probe, 253 + .remove = __exit_p(at91wdt_remove), 254 + .shutdown = at91wdt_shutdown, 255 + .suspend = at91wdt_suspend, 256 + .resume = at91wdt_resume, 257 + .driver = { 258 + .name = "at91_wdt", 259 + .owner = THIS_MODULE, 260 + }, 261 + }; 262 + 263 + static int __init at91_wdt_init(void) 264 + { 265 + /* Check that the heartbeat value is within range; if not reset to the default */ 266 + if (at91_wdt_settimeout(wdt_time)) { 267 + at91_wdt_settimeout(WDT_DEFAULT_TIME); 268 + pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time); 269 + } 270 + 271 + return platform_driver_register(&at91wdt_driver); 218 272 } 219 273 220 274 static void __exit at91_wdt_exit(void) 221 275 { 222 - misc_deregister(&at91wdt_miscdev); 276 + platform_driver_unregister(&at91wdt_driver); 223 277 } 224 278 225 279 module_init(at91_wdt_init);
+27 -1
drivers/char/watchdog/i8xx_tco.c
··· 205 205 return 0; 206 206 } 207 207 208 + static int tco_timer_get_timeleft (int *time_left) 209 + { 210 + unsigned char val; 211 + 212 + spin_lock(&tco_lock); 213 + 214 + /* read the TCO Timer */ 215 + val = inb (TCO1_RLD); 216 + val &= 0x3f; 217 + 218 + spin_unlock(&tco_lock); 219 + 220 + *time_left = (int)((val * 6) / 10); 221 + 222 + return 0; 223 + } 224 + 208 225 /* 209 226 * /dev/watchdog handling 210 227 */ ··· 289 272 { 290 273 int new_options, retval = -EINVAL; 291 274 int new_heartbeat; 275 + int time_left; 292 276 void __user *argp = (void __user *)arg; 293 277 int __user *p = argp; 294 278 static struct watchdog_info ident = { ··· 338 320 return -EFAULT; 339 321 340 322 if (tco_timer_set_heartbeat(new_heartbeat)) 341 - return -EINVAL; 323 + return -EINVAL; 342 324 343 325 tco_timer_keepalive (); 344 326 /* Fall */ ··· 346 328 347 329 case WDIOC_GETTIMEOUT: 348 330 return put_user(heartbeat, p); 331 + 332 + case WDIOC_GETTIMELEFT: 333 + { 334 + if (tco_timer_get_timeleft(&time_left)) 335 + return -EINVAL; 336 + 337 + return put_user(time_left, p); 338 + } 349 339 350 340 default: 351 341 return -ENOIOCTLCMD;
+29 -1
drivers/char/watchdog/pcwd_pci.c
··· 21 21 */ 22 22 23 23 /* 24 - * A bells and whistles driver is available from: 24 + * A bells and whistles driver is available from: 25 25 * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/ 26 26 * 27 27 * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ ··· 390 390 return 0; 391 391 } 392 392 393 + static int pcipcwd_get_timeleft(int *time_left) 394 + { 395 + int msb; 396 + int lsb; 397 + 398 + /* Read the time that's left before rebooting */ 399 + /* Note: if the board is not yet armed then we will read 0xFFFF */ 400 + send_command(CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb); 401 + 402 + *time_left = (msb << 8) + lsb; 403 + 404 + if (debug >= VERBOSE) 405 + printk(KERN_DEBUG PFX "Time left before next reboot: %d\n", 406 + *time_left); 407 + 408 + return 0; 409 + } 410 + 393 411 /* 394 412 * /dev/watchdog handling 395 413 */ ··· 529 511 530 512 case WDIOC_GETTIMEOUT: 531 513 return put_user(heartbeat, p); 514 + 515 + case WDIOC_GETTIMELEFT: 516 + { 517 + int time_left; 518 + 519 + if (pcipcwd_get_timeleft(&time_left)) 520 + return -EFAULT; 521 + 522 + return put_user(time_left, p); 523 + } 532 524 533 525 default: 534 526 return -ENOIOCTLCMD;
+23
drivers/char/watchdog/pcwd_usb.c
··· 317 317 return 0; 318 318 } 319 319 320 + static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd, int *time_left) 321 + { 322 + unsigned char msb, lsb; 323 + 324 + /* Read the time that's left before rebooting */ 325 + /* Note: if the board is not yet armed then we will read 0xFFFF */ 326 + usb_pcwd_send_command(usb_pcwd, CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb); 327 + 328 + *time_left = (msb << 8) + lsb; 329 + 330 + return 0; 331 + } 332 + 320 333 /* 321 334 * /dev/watchdog handling 322 335 */ ··· 434 421 435 422 case WDIOC_GETTIMEOUT: 436 423 return put_user(heartbeat, p); 424 + 425 + case WDIOC_GETTIMELEFT: 426 + { 427 + int time_left; 428 + 429 + if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left)) 430 + return -EFAULT; 431 + 432 + return put_user(time_left, p); 433 + } 437 434 438 435 default: 439 436 return -ENOIOCTLCMD;
+1 -1
drivers/ide/ide-io.c
··· 505 505 } 506 506 } 507 507 508 - if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) 508 + if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) 509 509 try_to_flush_leftover_data(drive); 510 510 511 511 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
+4
drivers/ide/ide-iops.c
··· 597 597 { 598 598 if(HWIF(drive)->udma_four == 0) 599 599 return 0; 600 + 601 + /* Check for SATA but only if we are ATA5 or higher */ 602 + if (drive->id->hw_config == 0 && (drive->id->major_rev_num & 0x7FE0)) 603 + return 1; 600 604 if (!(drive->id->hw_config & 0x6000)) 601 605 return 0; 602 606 #ifndef CONFIG_IDEDMA_IVB
+8 -8
drivers/ide/pci/aec62xx.c
··· 22 22 u8 ultra_settings; 23 23 }; 24 24 25 - static struct chipset_bus_clock_list_entry aec6xxx_33_base [] = { 25 + static const struct chipset_bus_clock_list_entry aec6xxx_33_base [] = { 26 26 { XFER_UDMA_6, 0x31, 0x07 }, 27 27 { XFER_UDMA_5, 0x31, 0x06 }, 28 28 { XFER_UDMA_4, 0x31, 0x05 }, ··· 42 42 { 0, 0x00, 0x00 } 43 43 }; 44 44 45 - static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { 45 + static const struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { 46 46 { XFER_UDMA_6, 0x41, 0x06 }, 47 47 { XFER_UDMA_5, 0x41, 0x05 }, 48 48 { XFER_UDMA_4, 0x41, 0x04 }, ··· 425 425 return d->init_setup(dev, d); 426 426 } 427 427 428 - static struct pci_device_id aec62xx_pci_tbl[] = { 429 - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 430 - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, 431 - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 }, 432 - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3 }, 433 - { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, 428 + static const struct pci_device_id aec62xx_pci_tbl[] = { 429 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF), 0 }, 430 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860), 1 }, 431 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R), 2 }, 432 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865), 3 }, 433 + { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R), 4 }, 434 434 { 0, }, 435 435 }; 436 436 MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl);
-15
drivers/ide/pci/cmd64x.c
··· 190 190 #endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ 191 191 192 192 /* 193 - * Registers and masks for easy access by drive index: 194 - */ 195 - #if 0 196 - static u8 prefetch_regs[4] = {CNTRL, CNTRL, ARTTIM23, ARTTIM23}; 197 - static u8 prefetch_masks[4] = {CNTRL_DIS_RA0, CNTRL_DIS_RA1, ARTTIM23_DIS_RA2, ARTTIM23_DIS_RA3}; 198 - #endif 199 - 200 - /* 201 193 * This routine writes the prepared setup/active/recovery counts 202 194 * for a drive into the cmd646 chipset registers to active them. 203 195 */ ··· 597 605 598 606 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); 599 607 class_rev &= 0xff; 600 - 601 - #ifdef __i386__ 602 - if (dev->resource[PCI_ROM_RESOURCE].start) { 603 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 604 - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start); 605 - } 606 - #endif 607 608 608 609 switch(dev->device) { 609 610 case PCI_DEVICE_ID_CMD_643:
+2
drivers/ide/pci/pdc202xx_new.c
··· 338 338 hwif->ultra_mask = 0x7f; 339 339 hwif->mwdma_mask = 0x07; 340 340 341 + hwif->err_stops_fifo = 1; 342 + 341 343 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate; 342 344 hwif->ide_dma_lostirq = &pdcnew_ide_dma_lostirq; 343 345 hwif->ide_dma_timeout = &pdcnew_ide_dma_timeout;
+5 -110
drivers/ide/pci/pdc202xx_old.c
··· 101 101 #define MC1 0x02 /* DMA"C" timing */ 102 102 #define MC0 0x01 /* DMA"C" timing */ 103 103 104 - #if 0 105 - unsigned long bibma = pci_resource_start(dev, 4); 106 - u8 hi = 0, lo = 0; 107 - 108 - u8 sc1c = inb_p((u16)bibma + 0x1c); 109 - u8 sc1e = inb_p((u16)bibma + 0x1e); 110 - u8 sc1f = inb_p((u16)bibma + 0x1f); 111 - 112 - p += sprintf(p, "Host Mode : %s\n", 113 - (sc1f & 0x08) ? "Tri-Stated" : "Normal"); 114 - p += sprintf(p, "Bus Clocking : %s\n", 115 - ((sc1f & 0xC0) == 0xC0) ? "100 External" : 116 - ((sc1f & 0x80) == 0x80) ? "66 External" : 117 - ((sc1f & 0x40) == 0x40) ? "33 External" : "33 PCI Internal"); 118 - p += sprintf(p, "IO pad select : %s mA\n", 119 - ((sc1c & 0x03) == 0x03) ? "10" : 120 - ((sc1c & 0x02) == 0x02) ? "8" : 121 - ((sc1c & 0x01) == 0x01) ? "6" : 122 - ((sc1c & 0x00) == 0x00) ? "4" : "??"); 123 - hi = sc1e >> 4; 124 - lo = sc1e & 0xf; 125 - p += sprintf(p, "Status Polling Period : %d\n", hi); 126 - p += sprintf(p, "Interrupt Check Status Polling Delay : %d\n", lo); 127 - #endif 128 - 129 104 static u8 pdc202xx_ratemask (ide_drive_t *drive) 130 105 { 131 106 u8 mode; ··· 480 505 481 506 pdc202xx_reset_host(hwif); 482 507 pdc202xx_reset_host(mate); 483 - #if 0 484 - /* 485 - * FIXME: Have to kick all the drives again :-/ 486 - * What a pain in the ACE! 487 - */ 488 - if (hwif->present) { 489 - u16 hunit = 0; 490 - for (hunit = 0; hunit < MAX_DRIVES; ++hunit) { 491 - ide_drive_t *hdrive = &hwif->drives[hunit]; 492 - if (hdrive->present) { 493 - if (hwif->ide_dma_check) 494 - hwif->ide_dma_check(hdrive); 495 - else 496 - hwif->tuneproc(hdrive, 5); 497 - } 498 - } 499 - } 500 - if (mate->present) { 501 - u16 munit = 0; 502 - for (munit = 0; munit < MAX_DRIVES; ++munit) { 503 - ide_drive_t *mdrive = &mate->drives[munit]; 504 - if (mdrive->present) { 505 - if (mate->ide_dma_check) 506 - mate->ide_dma_check(mdrive); 507 - else 508 - mate->tuneproc(mdrive, 5); 509 - } 510 - } 511 - } 512 - #else 513 508 hwif->tuneproc(drive, 5); 514 - #endif 515 509 } 516 510 517 - static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name) 511 + static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, 512 + const char *name) 518 513 { 514 + /* This doesn't appear needed */ 519 515 if (dev->resource[PCI_ROM_RESOURCE].start) { 520 516 pci_write_config_dword(dev, PCI_ROM_ADDRESS, 521 517 dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); ··· 494 548 name, dev->resource[PCI_ROM_RESOURCE].start); 495 549 } 496 550 497 - /* 498 - * software reset - this is required because the bios 499 - * will set UDMA timing on if the hdd supports it. The 500 - * user may want to turn udma off. A bug in the pdc20262 501 - * is that it cannot handle a downgrade in timing from 502 - * UDMA to DMA. Disk accesses after issuing a set 503 - * feature command will result in errors. A software 504 - * reset leaves the timing registers intact, 505 - * but resets the drives. 506 - */ 507 - #if 0 508 - if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) || 509 - (dev->device == PCI_DEVICE_ID_PROMISE_20265) || 510 - (dev->device == PCI_DEVICE_ID_PROMISE_20263) || 511 - (dev->device == PCI_DEVICE_ID_PROMISE_20262)) { 512 - unsigned long high_16 = pci_resource_start(dev, 4); 513 - byte udma_speed_flag = inb(high_16 + 0x001f); 514 - outb(udma_speed_flag | 0x10, high_16 + 0x001f); 515 - mdelay(100); 516 - outb(udma_speed_flag & ~0x10, high_16 + 0x001f); 517 - mdelay(2000); /* 2 seconds ?! */ 518 - } 519 - 520 - #endif 521 551 return dev->irq; 522 552 } 523 553 ··· 520 598 hwif->ultra_mask = 0x3f; 521 599 hwif->mwdma_mask = 0x07; 522 600 hwif->swdma_mask = 0x07; 601 + 602 + hwif->err_stops_fifo = 1; 523 603 524 604 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate; 525 605 hwif->ide_dma_lostirq = &pdc202xx_ide_dma_lostirq; ··· 611 687 "mirror fixed.\n", d->name); 612 688 } 613 689 } 614 - 615 - #if 0 616 - if (dev->device == PCI_DEVICE_ID_PROMISE_20262) 617 - if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 618 - (tmp & e->mask) != e->val)) 619 - 620 - if (d->enablebits[0].reg != d->enablebits[1].reg) { 621 - d->enablebits[0].reg = d->enablebits[1].reg; 622 - d->enablebits[0].mask = d->enablebits[1].mask; 623 - d->enablebits[0].val = d->enablebits[1].val; 624 - } 625 - #endif 626 - 627 690 return ide_setup_pci_device(dev, d); 628 691 } 629 692 ··· 625 714 "attached to I2O RAID controller.\n"); 626 715 return -ENODEV; 627 716 } 628 - 629 - #if 0 630 - { 631 - u8 pri = 0, sec = 0; 632 - 633 - if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 634 - (tmp & e->mask) != e->val)) 635 - 636 - if (d->enablebits[0].reg != d->enablebits[1].reg) { 637 - d->enablebits[0].reg = d->enablebits[1].reg; 638 - d->enablebits[0].mask = d->enablebits[1].mask; 639 - d->enablebits[0].val = d->enablebits[1].val; 640 - } 641 - } 642 - #endif 643 - 644 717 return ide_setup_pci_device(dev, d); 645 718 } 646 719
+1 -3
drivers/ide/pci/sc1200.c
··· 395 395 { 396 396 ide_hwif_t *hwif = NULL; 397 397 398 - printk("SC1200: resume\n"); 399 398 pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state 400 399 dev->current_state = PM_EVENT_ON; 401 400 pci_enable_device(dev); ··· 404 405 while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { 405 406 unsigned int basereg, r, d, format; 406 407 sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; 407 - printk("%s: SC1200: resume\n", hwif->name); 408 408 409 409 // 410 410 // Restore timing registers: this may be unnecessary if BIOS also does it ··· 491 493 } 492 494 493 495 static struct pci_device_id sc1200_pci_tbl[] = { 494 - { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 496 + { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_IDE), 0}, 495 497 { 0, }, 496 498 }; 497 499 MODULE_DEVICE_TABLE(pci, sc1200_pci_tbl);
+16 -37
drivers/ide/pci/serverworks.c
··· 123 123 } 124 124 static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) 125 125 { 126 - u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; 127 - u8 dma_modes[] = { 0x77, 0x21, 0x20 }; 128 - u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 129 - u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 130 - u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; 126 + static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; 127 + static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; 128 + static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 129 + static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 130 + static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; 131 131 132 132 ide_hwif_t *hwif = HWIF(drive); 133 133 struct pci_dev *dev = hwif->pci_dev; ··· 392 392 } 393 393 outb_p(0x06, 0x0c00); 394 394 dev->irq = inb_p(0x0c01); 395 - #if 0 396 - printk("%s: device class (0x%04x)\n", 397 - name, dev->class); 398 - if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { 399 - dev->class &= ~0x000F0F00; 400 - // dev->class |= ~0x00000400; 401 - dev->class |= ~0x00010100; 402 - /**/ 403 - } 404 - #endif 405 395 } else { 406 396 struct pci_dev * findev = NULL; 407 397 u8 reg41 = 0; ··· 442 452 pci_write_config_byte(dev, 0x5A, btr); 443 453 } 444 454 445 - return (dev->irq) ? dev->irq : 0; 455 + return dev->irq; 446 456 } 447 457 448 458 static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif) ··· 490 500 { 491 501 struct pci_dev *dev = hwif->pci_dev; 492 502 493 - /* Per Specified Design by OEM, and ASIC Architect */ 494 - if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || 495 - (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) 496 - return 1; 497 - 498 503 /* Server Works */ 499 504 if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) 500 505 return ata66_svwks_svwks (hwif); ··· 502 517 if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN) 503 518 return ata66_svwks_cobalt (hwif); 504 519 520 + /* Per Specified Design by OEM, and ASIC Architect */ 521 + if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || 522 + (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) 523 + return 1; 524 + 505 525 return 0; 506 526 } 507 527 508 - #undef CAN_SW_DMA 509 528 static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 510 529 { 511 530 u8 dma_stat = 0; ··· 526 537 hwif->ultra_mask = 0x3f; 527 538 528 539 hwif->mwdma_mask = 0x07; 529 - #ifdef CAN_SW_DMA 530 - hwif->swdma_mask = 0x07; 531 - #endif /* CAN_SW_DMA */ 532 540 533 541 hwif->autodma = 0; 534 542 ··· 548 562 hwif->drives[1].autodma = (dma_stat & 0x40); 549 563 hwif->drives[0].autotune = (!(dma_stat & 0x20)); 550 564 hwif->drives[1].autotune = (!(dma_stat & 0x40)); 551 - // hwif->drives[0].autodma = hwif->autodma; 552 - // hwif->drives[1].autodma = hwif->autodma; 553 565 } 554 566 555 567 /* ··· 577 593 if (dev->resource[0].start == 0x01f1) 578 594 d->bootable = ON_BOARD; 579 595 } 580 - #if 0 581 - if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) && 582 - (!(PCI_FUNC(dev->devfn) & 1))) 583 - d->autodma = AUTODMA; 584 - #endif 585 596 586 597 d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || 587 598 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && ··· 650 671 } 651 672 652 673 static struct pci_device_id svwks_pci_tbl[] = { 653 - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 654 - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 655 - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 656 - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 657 - { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 674 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0}, 675 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 1}, 676 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2}, 677 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 3}, 678 + { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4}, 658 679 { 0, }, 659 680 }; 660 681 MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);
+12 -50
drivers/ide/pci/siimage.c
··· 38 38 39 39 #include <asm/io.h> 40 40 41 - #undef SIIMAGE_VIRTUAL_DMAPIO 42 - #undef SIIMAGE_LARGE_DMA 43 - 44 41 /** 45 42 * pdev_is_sata - check if device is SATA 46 43 * @pdev: PCI device to check ··· 458 461 return 0; 459 462 } 460 463 461 - #if 0 462 - /** 463 - * siimage_mmio_ide_dma_count - DMA bytes done 464 - * @drive 465 - * 466 - * If we are doing VDMA the CMD680 requires a little bit 467 - * of more careful handling and we have to read the counts 468 - * off ourselves. For non VDMA life is normal. 469 - */ 470 - 471 - static int siimage_mmio_ide_dma_count (ide_drive_t *drive) 472 - { 473 - #ifdef SIIMAGE_VIRTUAL_DMAPIO 474 - struct request *rq = HWGROUP(drive)->rq; 475 - ide_hwif_t *hwif = HWIF(drive); 476 - u32 count = (rq->nr_sectors * SECTOR_SIZE); 477 - u32 rcount = 0; 478 - unsigned long addr = siimage_selreg(hwif, 0x1C); 479 - 480 - hwif->OUTL(count, addr); 481 - rcount = hwif->INL(addr); 482 - 483 - printk("\n%s: count = %d, rcount = %d, nr_sectors = %lu\n", 484 - drive->name, count, rcount, rq->nr_sectors); 485 - 486 - #endif /* SIIMAGE_VIRTUAL_DMAPIO */ 487 - return __ide_dma_count(drive); 488 - } 489 - #endif 490 - 491 464 /** 492 465 * siimage_mmio_ide_dma_test_irq - check we caused an IRQ 493 466 * @drive: drive we are testing ··· 479 512 u32 sata_error = hwif->INL(SATA_ERROR_REG); 480 513 hwif->OUTL(sata_error, SATA_ERROR_REG); 481 514 watchdog = (sata_error & 0x00680000) ? 1 : 0; 482 - #if 1 483 515 printk(KERN_WARNING "%s: sata_error = 0x%08x, " 484 516 "watchdog = %d, %s\n", 485 517 drive->name, sata_error, watchdog, 486 518 __FUNCTION__); 487 - #endif 488 519 489 520 } else { 490 521 watchdog = (ext_stat & 0x8000) ? 1 : 0; ··· 828 863 * time. 829 864 * 830 865 * The hardware supports buffered taskfiles and also some rather nice 831 - * extended PRD tables. Unfortunately right now we don't. 866 + * extended PRD tables. For better SI3112 support use the libata driver 832 867 */ 833 868 834 869 static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) ··· 865 900 * so we can't currently use it sanely since we want to 866 901 * use LBA48 mode. 867 902 */ 868 - // base += 0x10; 869 - // hwif->no_lba48 = 1; 870 - 871 903 hw.io_ports[IDE_DATA_OFFSET] = base; 872 904 hw.io_ports[IDE_ERROR_OFFSET] = base + 1; 873 905 hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2; ··· 898 936 899 937 base = (unsigned long) addr; 900 938 901 - #ifdef SIIMAGE_LARGE_DMA 902 - /* Watch the brackets - even Ken and Dennis get some language design wrong */ 903 - hwif->dma_base = base + (ch ? 0x18 : 0x10); 904 - hwif->dma_base2 = base + (ch ? 0x08 : 0x00); 905 - hwif->dma_prdtable = hwif->dma_base2 + 4; 906 - #else /* ! SIIMAGE_LARGE_DMA */ 907 939 hwif->dma_base = base + (ch ? 0x08 : 0x00); 908 940 hwif->dma_base2 = base + (ch ? 0x18 : 0x10); 909 - #endif /* SIIMAGE_LARGE_DMA */ 910 941 hwif->mmio = 2; 911 942 } 912 943 ··· 1007 1052 hwif->reset_poll = &siimage_reset_poll; 1008 1053 hwif->pre_reset = &siimage_pre_reset; 1009 1054 1010 - if(is_sata(hwif)) 1055 + if(is_sata(hwif)) { 1056 + static int first = 1; 1057 + 1011 1058 hwif->busproc = &siimage_busproc; 1012 1059 1060 + if (first) { 1061 + printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); 1062 + first = 0; 1063 + } 1064 + } 1013 1065 if (!hwif->dma_base) { 1014 1066 hwif->drives[0].autotune = 1; 1015 1067 hwif->drives[1].autotune = 1; ··· 1083 1121 } 1084 1122 1085 1123 static struct pci_device_id siimage_pci_tbl[] = { 1086 - { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 1124 + { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680), 0}, 1087 1125 #ifdef CONFIG_BLK_DEV_IDE_SATA 1088 - { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 1089 - { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 1126 + { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112), 1}, 1127 + { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA), 2}, 1090 1128 #endif 1091 1129 { 0, }, 1092 1130 };
+1 -3
drivers/ide/pci/sl82c105.c
··· 447 447 printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n", 448 448 hwif->name, rev); 449 449 } else { 450 - #ifdef CONFIG_BLK_DEV_IDEDMA 451 450 dma_state |= 0x60; 452 451 453 452 hwif->atapi_dma = 1; ··· 467 468 468 469 if (hwif->mate) 469 470 hwif->serialized = hwif->mate->serialized = 1; 470 - #endif /* CONFIG_BLK_DEV_IDEDMA */ 471 471 } 472 472 hwif->OUTB(dma_state, hwif->dma_base + 2); 473 473 } ··· 487 489 } 488 490 489 491 static struct pci_device_id sl82c105_pci_tbl[] = { 490 - { PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 492 + { PCI_DEVICE(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105), 0}, 491 493 { 0, }, 492 494 }; 493 495 MODULE_DEVICE_TABLE(pci, sl82c105_pci_tbl);
+3 -8
drivers/ide/pci/slc90e66.c
··· 72 72 u16 master_data; 73 73 u8 slave_data; 74 74 /* ISP RTC */ 75 - u8 timings[][2] = { { 0, 0 }, 75 + static const u8 timings[][2]= { 76 + { 0, 0 }, 76 77 { 0, 0 }, 77 78 { 1, 0 }, 78 79 { 2, 1 }, ··· 120 119 pci_read_config_word(dev, 0x4a, &reg4a); 121 120 122 121 switch(speed) { 123 - #ifdef CONFIG_BLK_DEV_IDEDMA 124 122 case XFER_UDMA_4: u_speed = 4 << (drive->dn * 4); break; 125 123 case XFER_UDMA_3: u_speed = 3 << (drive->dn * 4); break; 126 124 case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break; ··· 128 128 case XFER_MW_DMA_2: 129 129 case XFER_MW_DMA_1: 130 130 case XFER_SW_DMA_2: break; 131 - #endif /* CONFIG_BLK_DEV_IDEDMA */ 132 131 case XFER_PIO_4: 133 132 case XFER_PIO_3: 134 133 case XFER_PIO_2: ··· 155 156 return (ide_config_drive_speed(drive, speed)); 156 157 } 157 158 158 - #ifdef CONFIG_BLK_DEV_IDEDMA 159 159 static int slc90e66_config_drive_for_dma (ide_drive_t *drive) 160 160 { 161 161 u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive)); ··· 192 194 /* IORDY not supported */ 193 195 return 0; 194 196 } 195 - #endif /* CONFIG_BLK_DEV_IDEDMA */ 196 197 197 198 static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) 198 199 { ··· 219 222 hwif->mwdma_mask = 0x07; 220 223 hwif->swdma_mask = 0x07; 221 224 222 - #ifdef CONFIG_BLK_DEV_IDEDMA 223 225 if (!(hwif->udma_four)) 224 226 /* bit[0(1)]: 0:80, 1:40 */ 225 227 hwif->udma_four = (reg47 & mask) ? 0 : 1; ··· 228 232 hwif->autodma = 1; 229 233 hwif->drives[0].autodma = hwif->autodma; 230 234 hwif->drives[1].autodma = hwif->autodma; 231 - #endif /* !CONFIG_BLK_DEV_IDEDMA */ 232 235 } 233 236 234 237 static ide_pci_device_t slc90e66_chipset __devinitdata = { ··· 245 250 } 246 251 247 252 static struct pci_device_id slc90e66_pci_tbl[] = { 248 - { PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 253 + { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1), 0}, 249 254 { 0, }, 250 255 }; 251 256 MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl);
+1 -1
drivers/input/joystick/db9.c
··· 584 584 goto err_out; 585 585 } 586 586 587 - if (db9_mode[mode].bidirectional && !(pp->modes & PARPORT_MODE_TRISTATE)) { 587 + if (db9_mode->bidirectional && !(pp->modes & PARPORT_MODE_TRISTATE)) { 588 588 printk(KERN_ERR "db9.c: specified parport is not bidirectional\n"); 589 589 err = -EINVAL; 590 590 goto err_put_pp;
+1 -1
drivers/input/keyboard/atkbd.c
··· 459 459 } 460 460 461 461 input_regs(dev, regs); 462 - input_report_key(dev, keycode, value); 462 + input_event(dev, EV_KEY, keycode, value); 463 463 input_sync(dev); 464 464 465 465 if (value && add_release_event) {
+19
drivers/input/misc/wistron_btns.c
··· 285 285 { KE_END, 0 } 286 286 }; 287 287 288 + static struct key_entry keymap_wistron_ms2111[] = { 289 + { KE_KEY, 0x11, KEY_PROG1 }, 290 + { KE_KEY, 0x12, KEY_PROG2 }, 291 + { KE_KEY, 0x13, KEY_PROG3 }, 292 + { KE_KEY, 0x31, KEY_MAIL }, 293 + { KE_KEY, 0x36, KEY_WWW }, 294 + { KE_END, 0 } 295 + }; 296 + 288 297 static struct key_entry keymap_wistron_ms2141[] = { 289 298 { KE_KEY, 0x11, KEY_PROG1 }, 290 299 { KE_KEY, 0x12, KEY_PROG2 }, ··· 335 326 { KE_WIFI, 0x30, 0 }, 336 327 { KE_KEY, 0x31, KEY_MAIL }, 337 328 { KE_KEY, 0x36, KEY_WWW }, 329 + { KE_END, 0 }, 338 330 }; 339 331 340 332 /* ··· 397 387 DMI_MATCH(DMI_BOARD_NAME, "E2U"), 398 388 }, 399 389 .driver_data = keymap_aopen_1559as 390 + }, 391 + { 392 + .callback = dmi_matched, 393 + .ident = "Medion MD 9783", 394 + .matches = { 395 + DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), 396 + DMI_MATCH(DMI_PRODUCT_NAME, "MD 9783"), 397 + }, 398 + .driver_data = keymap_wistron_ms2111 400 399 }, 401 400 { NULL, } 402 401 };
+10
drivers/rtc/Kconfig
··· 162 162 This driver can also be built as a module. If so, the module 163 163 will be called rtc-pcf8583. 164 164 165 + config RTC_DRV_RS5C348 166 + tristate "Ricoh RS5C348A/B" 167 + depends on RTC_CLASS && SPI 168 + help 169 + If you say yes here you get support for the 170 + Ricoh RS5C348A and RS5C348B RTC chips. 171 + 172 + This driver can also be built as a module. If so, the module 173 + will be called rtc-rs5c348. 174 + 165 175 config RTC_DRV_RS5C372 166 176 tristate "Ricoh RS5C372A/B" 167 177 depends on RTC_CLASS && I2C
+1
drivers/rtc/Makefile
··· 19 19 obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o 20 20 obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o 21 21 obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o 22 + obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o 22 23 obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o 23 24 obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o 24 25 obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o
+246
drivers/rtc/rtc-rs5c348.c
··· 1 + /* 2 + * A SPI driver for the Ricoh RS5C348 RTC 3 + * 4 + * Copyright (C) 2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * The board specific init code should provide characteristics of this 11 + * device: 12 + * Mode 1 (High-Active, Shift-Then-Sample), High Avtive CS 13 + */ 14 + 15 + #include <linux/bcd.h> 16 + #include <linux/delay.h> 17 + #include <linux/device.h> 18 + #include <linux/errno.h> 19 + #include <linux/init.h> 20 + #include <linux/kernel.h> 21 + #include <linux/string.h> 22 + #include <linux/rtc.h> 23 + #include <linux/workqueue.h> 24 + #include <linux/spi/spi.h> 25 + 26 + #define DRV_VERSION "0.1" 27 + 28 + #define RS5C348_REG_SECS 0 29 + #define RS5C348_REG_MINS 1 30 + #define RS5C348_REG_HOURS 2 31 + #define RS5C348_REG_WDAY 3 32 + #define RS5C348_REG_DAY 4 33 + #define RS5C348_REG_MONTH 5 34 + #define RS5C348_REG_YEAR 6 35 + #define RS5C348_REG_CTL1 14 36 + #define RS5C348_REG_CTL2 15 37 + 38 + #define RS5C348_SECS_MASK 0x7f 39 + #define RS5C348_MINS_MASK 0x7f 40 + #define RS5C348_HOURS_MASK 0x3f 41 + #define RS5C348_WDAY_MASK 0x03 42 + #define RS5C348_DAY_MASK 0x3f 43 + #define RS5C348_MONTH_MASK 0x1f 44 + 45 + #define RS5C348_BIT_PM 0x20 /* REG_HOURS */ 46 + #define RS5C348_BIT_Y2K 0x80 /* REG_MONTH */ 47 + #define RS5C348_BIT_24H 0x20 /* REG_CTL1 */ 48 + #define RS5C348_BIT_XSTP 0x10 /* REG_CTL2 */ 49 + #define RS5C348_BIT_VDET 0x40 /* REG_CTL2 */ 50 + 51 + #define RS5C348_CMD_W(addr) (((addr) << 4) | 0x08) /* single write */ 52 + #define RS5C348_CMD_R(addr) (((addr) << 4) | 0x0c) /* single read */ 53 + #define RS5C348_CMD_MW(addr) (((addr) << 4) | 0x00) /* burst write */ 54 + #define RS5C348_CMD_MR(addr) (((addr) << 4) | 0x04) /* burst read */ 55 + 56 + struct rs5c348_plat_data { 57 + struct rtc_device *rtc; 58 + int rtc_24h; 59 + }; 60 + 61 + static int 62 + rs5c348_rtc_set_time(struct device *dev, struct rtc_time *tm) 63 + { 64 + struct spi_device *spi = to_spi_device(dev); 65 + struct rs5c348_plat_data *pdata = spi->dev.platform_data; 66 + u8 txbuf[5+7], *txp; 67 + int ret; 68 + 69 + /* Transfer 5 bytes before writing SEC. This gives 31us for carry. */ 70 + txp = txbuf; 71 + txbuf[0] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ 72 + txbuf[1] = 0; /* dummy */ 73 + txbuf[2] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ 74 + txbuf[3] = 0; /* dummy */ 75 + txbuf[4] = RS5C348_CMD_MW(RS5C348_REG_SECS); /* cmd, sec, ... */ 76 + txp = &txbuf[5]; 77 + txp[RS5C348_REG_SECS] = BIN2BCD(tm->tm_sec); 78 + txp[RS5C348_REG_MINS] = BIN2BCD(tm->tm_min); 79 + if (pdata->rtc_24h) { 80 + txp[RS5C348_REG_HOURS] = BIN2BCD(tm->tm_hour); 81 + } else { 82 + /* hour 0 is AM12, noon is PM12 */ 83 + txp[RS5C348_REG_HOURS] = BIN2BCD((tm->tm_hour + 11) % 12 + 1) | 84 + (tm->tm_hour >= 12 ? RS5C348_BIT_PM : 0); 85 + } 86 + txp[RS5C348_REG_WDAY] = BIN2BCD(tm->tm_wday); 87 + txp[RS5C348_REG_DAY] = BIN2BCD(tm->tm_mday); 88 + txp[RS5C348_REG_MONTH] = BIN2BCD(tm->tm_mon + 1) | 89 + (tm->tm_year >= 100 ? RS5C348_BIT_Y2K : 0); 90 + txp[RS5C348_REG_YEAR] = BIN2BCD(tm->tm_year % 100); 91 + /* write in one transfer to avoid data inconsistency */ 92 + ret = spi_write_then_read(spi, txbuf, sizeof(txbuf), NULL, 0); 93 + udelay(62); /* Tcsr 62us */ 94 + return ret; 95 + } 96 + 97 + static int 98 + rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm) 99 + { 100 + struct spi_device *spi = to_spi_device(dev); 101 + struct rs5c348_plat_data *pdata = spi->dev.platform_data; 102 + u8 txbuf[5], rxbuf[7]; 103 + int ret; 104 + 105 + /* Transfer 5 byte befores reading SEC. This gives 31us for carry. */ 106 + txbuf[0] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ 107 + txbuf[1] = 0; /* dummy */ 108 + txbuf[2] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ 109 + txbuf[3] = 0; /* dummy */ 110 + txbuf[4] = RS5C348_CMD_MR(RS5C348_REG_SECS); /* cmd, sec, ... */ 111 + 112 + /* read in one transfer to avoid data inconsistency */ 113 + ret = spi_write_then_read(spi, txbuf, sizeof(txbuf), 114 + rxbuf, sizeof(rxbuf)); 115 + udelay(62); /* Tcsr 62us */ 116 + if (ret < 0) 117 + return ret; 118 + 119 + tm->tm_sec = BCD2BIN(rxbuf[RS5C348_REG_SECS] & RS5C348_SECS_MASK); 120 + tm->tm_min = BCD2BIN(rxbuf[RS5C348_REG_MINS] & RS5C348_MINS_MASK); 121 + tm->tm_hour = BCD2BIN(rxbuf[RS5C348_REG_HOURS] & RS5C348_HOURS_MASK); 122 + if (!pdata->rtc_24h) { 123 + tm->tm_hour %= 12; 124 + if (rxbuf[RS5C348_REG_HOURS] & RS5C348_BIT_PM) 125 + tm->tm_hour += 12; 126 + } 127 + tm->tm_wday = BCD2BIN(rxbuf[RS5C348_REG_WDAY] & RS5C348_WDAY_MASK); 128 + tm->tm_mday = BCD2BIN(rxbuf[RS5C348_REG_DAY] & RS5C348_DAY_MASK); 129 + tm->tm_mon = 130 + BCD2BIN(rxbuf[RS5C348_REG_MONTH] & RS5C348_MONTH_MASK) - 1; 131 + /* year is 1900 + tm->tm_year */ 132 + tm->tm_year = BCD2BIN(rxbuf[RS5C348_REG_YEAR]) + 133 + ((rxbuf[RS5C348_REG_MONTH] & RS5C348_BIT_Y2K) ? 100 : 0); 134 + 135 + if (rtc_valid_tm(tm) < 0) { 136 + dev_err(&spi->dev, "retrieved date/time is not valid.\n"); 137 + rtc_time_to_tm(0, tm); 138 + } 139 + 140 + return 0; 141 + } 142 + 143 + static struct rtc_class_ops rs5c348_rtc_ops = { 144 + .read_time = rs5c348_rtc_read_time, 145 + .set_time = rs5c348_rtc_set_time, 146 + }; 147 + 148 + static struct spi_driver rs5c348_driver; 149 + 150 + static int __devinit rs5c348_probe(struct spi_device *spi) 151 + { 152 + int ret; 153 + struct rtc_device *rtc; 154 + struct rs5c348_plat_data *pdata; 155 + 156 + pdata = kzalloc(sizeof(struct rs5c348_plat_data), GFP_KERNEL); 157 + if (!pdata) 158 + return -ENOMEM; 159 + spi->dev.platform_data = pdata; 160 + 161 + /* Check D7 of SECOND register */ 162 + ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_SECS)); 163 + if (ret < 0 || (ret & 0x80)) { 164 + dev_err(&spi->dev, "not found.\n"); 165 + goto kfree_exit; 166 + } 167 + 168 + dev_info(&spi->dev, "chip found, driver version " DRV_VERSION "\n"); 169 + dev_info(&spi->dev, "spiclk %u KHz.\n", 170 + (spi->max_speed_hz + 500) / 1000); 171 + 172 + /* turn RTC on if it was not on */ 173 + ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_CTL2)); 174 + if (ret < 0) 175 + goto kfree_exit; 176 + if (ret & (RS5C348_BIT_XSTP | RS5C348_BIT_VDET)) { 177 + u8 buf[2]; 178 + if (ret & RS5C348_BIT_VDET) 179 + dev_warn(&spi->dev, "voltage-low detected.\n"); 180 + buf[0] = RS5C348_CMD_W(RS5C348_REG_CTL2); 181 + buf[1] = 0; 182 + ret = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); 183 + if (ret < 0) 184 + goto kfree_exit; 185 + } 186 + 187 + ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_CTL1)); 188 + if (ret < 0) 189 + goto kfree_exit; 190 + if (ret & RS5C348_BIT_24H) 191 + pdata->rtc_24h = 1; 192 + 193 + rtc = rtc_device_register(rs5c348_driver.driver.name, &spi->dev, 194 + &rs5c348_rtc_ops, THIS_MODULE); 195 + 196 + if (IS_ERR(rtc)) { 197 + ret = PTR_ERR(rtc); 198 + goto kfree_exit; 199 + } 200 + 201 + pdata->rtc = rtc; 202 + 203 + return 0; 204 + kfree_exit: 205 + kfree(pdata); 206 + return ret; 207 + } 208 + 209 + static int __devexit rs5c348_remove(struct spi_device *spi) 210 + { 211 + struct rs5c348_plat_data *pdata = spi->dev.platform_data; 212 + struct rtc_device *rtc = pdata->rtc; 213 + 214 + if (rtc) 215 + rtc_device_unregister(rtc); 216 + kfree(pdata); 217 + return 0; 218 + } 219 + 220 + static struct spi_driver rs5c348_driver = { 221 + .driver = { 222 + .name = "rs5c348", 223 + .bus = &spi_bus_type, 224 + .owner = THIS_MODULE, 225 + }, 226 + .probe = rs5c348_probe, 227 + .remove = __devexit_p(rs5c348_remove), 228 + }; 229 + 230 + static __init int rs5c348_init(void) 231 + { 232 + return spi_register_driver(&rs5c348_driver); 233 + } 234 + 235 + static __exit void rs5c348_exit(void) 236 + { 237 + spi_unregister_driver(&rs5c348_driver); 238 + } 239 + 240 + module_init(rs5c348_init); 241 + module_exit(rs5c348_exit); 242 + 243 + MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); 244 + MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver"); 245 + MODULE_LICENSE("GPL"); 246 + MODULE_VERSION(DRV_VERSION);
+44 -58
drivers/serial/68328serial.c
··· 131 131 static int m68328_console_cbaud = DEFAULT_CBAUD; 132 132 133 133 134 - /* 135 - * tmp_buf is used as a temporary buffer by serial_write. We need to 136 - * lock it in case the memcpy_fromfs blocks while swapping in a page, 137 - * and some other program tries to do a serial write at the same time. 138 - * Since the lock will only come under contention when the system is 139 - * swapping and available memory is low, it makes sense to share one 140 - * buffer across all the serial ports, since it significantly saves 141 - * memory if large numbers of serial ports are open. 142 - */ 143 - static unsigned char tmp_buf[SERIAL_XMIT_SIZE]; /* This is cheating */ 144 - 145 134 static inline int serial_paranoia_check(struct m68k_serial *info, 146 135 char *name, const char *routine) 147 136 { ··· 200 211 if (serial_paranoia_check(info, tty->name, "rs_stop")) 201 212 return; 202 213 203 - save_flags(flags); cli(); 214 + local_irq_save(flags); 204 215 uart->ustcnt &= ~USTCNT_TXEN; 205 - restore_flags(flags); 216 + local_irq_restore(flags); 206 217 } 207 218 208 219 static void rs_put_char(char ch) 209 220 { 210 221 int flags, loops = 0; 211 222 212 - save_flags(flags); cli(); 223 + local_irq_save(flags); 213 224 214 225 while (!(UTX & UTX_TX_AVAIL) && (loops < 1000)) { 215 226 loops++; ··· 218 229 219 230 UTX_TXDATA = ch; 220 231 udelay(5); 221 - restore_flags(flags); 232 + local_irq_restore(flags); 222 233 } 223 234 224 235 static void rs_start(struct tty_struct *tty) ··· 230 241 if (serial_paranoia_check(info, tty->name, "rs_start")) 231 242 return; 232 243 233 - save_flags(flags); cli(); 244 + local_irq_save(flags); 234 245 if (info->xmit_cnt && info->xmit_buf && !(uart->ustcnt & USTCNT_TXEN)) { 235 246 #ifdef USE_INTS 236 247 uart->ustcnt |= USTCNT_TXEN | USTCNT_TX_INTR_MASK; ··· 238 249 uart->ustcnt |= USTCNT_TXEN; 239 250 #endif 240 251 } 241 - restore_flags(flags); 252 + local_irq_restore(flags); 242 253 } 243 254 244 255 /* Drop into either the boot monitor or kadb upon receiving a break ··· 316 327 if(!tty) 317 328 goto clear_and_exit; 318 329 319 - /* 320 - * Make sure that we do not overflow the buffer 321 - */ 322 - if (tty_request_buffer_room(tty, 1) == 0) { 323 - tty_schedule_flip(tty); 324 - return; 325 - } 326 - 327 330 flag = TTY_NORMAL; 328 331 329 332 if(rx & URX_PARITY_ERROR) { ··· 454 473 return -ENOMEM; 455 474 } 456 475 457 - save_flags(flags); cli(); 476 + local_irq_save(flags); 458 477 459 478 /* 460 479 * Clear the FIFO buffers and disable them ··· 487 506 change_speed(info); 488 507 489 508 info->flags |= S_INITIALIZED; 490 - restore_flags(flags); 509 + local_irq_restore(flags); 491 510 return 0; 492 511 } 493 512 ··· 504 523 if (!(info->flags & S_INITIALIZED)) 505 524 return; 506 525 507 - save_flags(flags); cli(); /* Disable interrupts */ 526 + local_irq_save(flags); 508 527 509 528 if (info->xmit_buf) { 510 529 free_page((unsigned long) info->xmit_buf); ··· 515 534 set_bit(TTY_IO_ERROR, &info->tty->flags); 516 535 517 536 info->flags &= ~S_INITIALIZED; 518 - restore_flags(flags); 537 + local_irq_restore(flags); 519 538 } 520 539 521 540 struct { ··· 636 655 if (info == 0) return; 637 656 if (info->xmit_buf == 0) return; 638 657 639 - save_flags(flags); cli(); 658 + local_irq_save(flags); 640 659 left = info->xmit_cnt; 641 660 while (left != 0) { 642 661 c = info->xmit_buf[info->xmit_tail]; 643 662 info->xmit_tail = (info->xmit_tail+1) & (SERIAL_XMIT_SIZE-1); 644 663 info->xmit_cnt--; 645 - restore_flags(flags); 664 + local_irq_restore(flags); 646 665 647 666 rs_put_char(c); 648 667 649 - save_flags(flags); cli(); 668 + local_irq_save(flags); 650 669 left = min(info->xmit_cnt, left-1); 651 670 } 652 671 653 672 /* Last character is being transmitted now (hopefully). */ 654 673 udelay(5); 655 674 656 - restore_flags(flags); 675 + local_irq_restore(flags); 657 676 return; 658 677 } 659 678 ··· 701 720 #endif 702 721 703 722 /* Enable transmitter */ 704 - save_flags(flags); cli(); 723 + local_irq_save(flags); 705 724 706 725 if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 707 726 !info->xmit_buf) { 708 - restore_flags(flags); 727 + local_irq_restore(flags); 709 728 return; 710 729 } 711 730 ··· 730 749 while (!(uart->utx.w & UTX_TX_AVAIL)) udelay(5); 731 750 } 732 751 #endif 733 - restore_flags(flags); 752 + local_irq_restore(flags); 734 753 } 735 754 736 755 extern void console_printn(const char * b, int count); ··· 749 768 if (!tty || !info->xmit_buf) 750 769 return 0; 751 770 752 - save_flags(flags); 771 + local_save_flags(flags); 753 772 while (1) { 754 - cli(); 773 + local_irq_disable(); 755 774 c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, 756 775 SERIAL_XMIT_SIZE - info->xmit_head)); 776 + local_irq_restore(flags); 777 + 757 778 if (c <= 0) 758 779 break; 759 780 760 781 memcpy(info->xmit_buf + info->xmit_head, buf, c); 782 + 783 + local_irq_disable(); 761 784 info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); 762 785 info->xmit_cnt += c; 763 - restore_flags(flags); 786 + local_irq_restore(flags); 764 787 buf += c; 765 788 count -= c; 766 789 total += c; ··· 772 787 773 788 if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) { 774 789 /* Enable transmitter */ 775 - cli(); 790 + local_irq_disable(); 776 791 #ifndef USE_INTS 777 792 while(info->xmit_cnt) { 778 793 #endif ··· 792 807 #ifndef USE_INTS 793 808 } 794 809 #endif 795 - restore_flags(flags); 810 + local_irq_restore(flags); 796 811 } 797 - restore_flags(flags); 812 + 798 813 return total; 799 814 } 800 815 ··· 823 838 static void rs_flush_buffer(struct tty_struct *tty) 824 839 { 825 840 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; 841 + unsigned long flags; 826 842 827 843 if (serial_paranoia_check(info, tty->name, "rs_flush_buffer")) 828 844 return; 829 - cli(); 845 + local_irq_save(flags); 830 846 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 831 - sti(); 847 + local_irq_restore(flags); 832 848 tty_wakeup(tty); 833 849 } 834 850 ··· 959 973 m68328_uart *uart = &uart_addr[info->line]; 960 974 #endif 961 975 unsigned char status; 976 + unsigned long flags; 962 977 963 - cli(); 978 + local_irq_save(flags); 964 979 #ifdef CONFIG_SERIAL_68328_RTS_CTS 965 980 status = (uart->utx.w & UTX_CTS_STAT) ? 1 : 0; 966 981 #else 967 982 status = 0; 968 983 #endif 969 - sti(); 984 + local_irq_restore(flags); 970 985 put_user(status,value); 971 986 return 0; 972 987 } ··· 981 994 unsigned long flags; 982 995 if (!info->port) 983 996 return; 984 - save_flags(flags); 985 - cli(); 997 + local_irq_save(flags); 986 998 #ifdef USE_INTS 987 999 uart->utx.w |= UTX_SEND_BREAK; 988 1000 msleep_interruptible(duration); 989 1001 uart->utx.w &= ~UTX_SEND_BREAK; 990 1002 #endif 991 - restore_flags(flags); 1003 + local_irq_restore(flags); 992 1004 } 993 1005 994 1006 static int rs_ioctl(struct tty_struct *tty, struct file * file, ··· 1046 1060 (struct serial_struct *) arg); 1047 1061 case TIOCSERGETLSR: /* Get line status register */ 1048 1062 if (access_ok(VERIFY_WRITE, (void *) arg, 1049 - sizeof(unsigned int)); 1063 + sizeof(unsigned int))) 1050 1064 return get_lsr_info(info, (unsigned int *) arg); 1051 1065 return -EFAULT; 1052 1066 case TIOCSERGSTRUCT: ··· 1099 1113 if (!info || serial_paranoia_check(info, tty->name, "rs_close")) 1100 1114 return; 1101 1115 1102 - save_flags(flags); cli(); 1116 + local_irq_save(flags); 1103 1117 1104 1118 if (tty_hung_up_p(filp)) { 1105 - restore_flags(flags); 1119 + local_irq_restore(flags); 1106 1120 return; 1107 1121 } 1108 1122 ··· 1124 1138 info->count = 0; 1125 1139 } 1126 1140 if (info->count) { 1127 - restore_flags(flags); 1141 + local_irq_restore(flags); 1128 1142 return; 1129 1143 } 1130 1144 info->flags |= S_CLOSING; ··· 1172 1186 } 1173 1187 info->flags &= ~(S_NORMAL_ACTIVE|S_CLOSING); 1174 1188 wake_up_interruptible(&info->close_wait); 1175 - restore_flags(flags); 1189 + local_irq_restore(flags); 1176 1190 } 1177 1191 1178 1192 /* ··· 1248 1262 info->count--; 1249 1263 info->blocked_open++; 1250 1264 while (1) { 1251 - cli(); 1265 + local_irq_disable(); 1252 1266 m68k_rtsdtr(info, 1); 1253 - sti(); 1267 + local_irq_enable(); 1254 1268 current->state = TASK_INTERRUPTIBLE; 1255 1269 if (tty_hung_up_p(filp) || 1256 1270 !(info->flags & S_INITIALIZED)) { ··· 1430 1444 return -ENOMEM; 1431 1445 } 1432 1446 1433 - save_flags(flags); cli(); 1447 + local_irq_save(flags); 1434 1448 1435 1449 for(i=0;i<NR_PORTS;i++) { 1436 1450 ··· 1475 1489 serial_pm[i]->data = info; 1476 1490 #endif 1477 1491 } 1478 - restore_flags(flags); 1492 + local_irq_restore(flags); 1479 1493 return 0; 1480 1494 } 1481 1495
-6
drivers/serial/crisv10.c
··· 2573 2573 2574 2574 DFLIP( 2575 2575 if (1) { 2576 - 2577 - if (test_bit(TTY_DONT_FLIP, &tty->flags)) { 2578 - DEBUG_LOG(info->line, "*** TTY_DONT_FLIP set flip.count %i ***\n", tty->flip.count); 2579 - DEBUG_LOG(info->line, "*** recv_cnt %i\n", info->recv_cnt); 2580 - } else { 2581 - } 2582 2576 DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx); 2583 2577 DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty)); 2584 2578 DEBUG_LOG(info->line, "room %lu\n", tty->ldisc.receive_room(tty));
-7
drivers/serial/jsm/jsm_tty.c
··· 589 589 ld = tty_ldisc_ref(tp); 590 590 591 591 /* 592 - * If the DONT_FLIP flag is on, don't flush our buffer, and act 593 - * like the ld doesn't have any space to put the data right now. 594 - */ 595 - if (test_bit(TTY_DONT_FLIP, &tp->flags)) 596 - len = 0; 597 - 598 - /* 599 592 * If we were unable to get a reference to the ld, 600 593 * don't flush our buffer, and act like the ld doesn't 601 594 * have any space to put the data right now.
+1
drivers/spi/spi.c
··· 210 210 proxy->master = master; 211 211 proxy->chip_select = chip->chip_select; 212 212 proxy->max_speed_hz = chip->max_speed_hz; 213 + proxy->mode = chip->mode; 213 214 proxy->irq = chip->irq; 214 215 proxy->modalias = chip->modalias; 215 216
+1 -2
drivers/usb/serial/ir-usb.c
··· 453 453 tty = port->tty; 454 454 455 455 /* 456 - * FIXME: must not do this in IRQ context, 457 - * must honour TTY_DONT_FLIP 456 + * FIXME: must not do this in IRQ context 458 457 */ 459 458 tty->ldisc.receive_buf( 460 459 tty,
+3 -3
drivers/video/aty/radeon_backlight.c
··· 40 40 41 41 mutex_unlock(&info->bl_mutex); 42 42 43 - if (pdata->negative) 44 - rlevel = MAX_RADEON_LEVEL - rlevel; 45 - 46 43 if (rlevel < 0) 47 44 rlevel = 0; 48 45 else if (rlevel > MAX_RADEON_LEVEL) 49 46 rlevel = MAX_RADEON_LEVEL; 47 + 48 + if (pdata->negative) 49 + rlevel = MAX_RADEON_LEVEL - rlevel; 50 50 51 51 return rlevel; 52 52 }
+2
fs/9p/mux.c
··· 932 932 r.rcall || r.err); 933 933 } while (!r.rcall && !r.err && err==-ERESTARTSYS && 934 934 m->trans->status==Connected && !m->err); 935 + 936 + err = -ERESTARTSYS; 935 937 } 936 938 sigpending = 1; 937 939 }
+1 -1
fs/9p/v9fs_vfs.h
··· 38 38 */ 39 39 40 40 extern struct file_system_type v9fs_fs_type; 41 - extern struct address_space_operations v9fs_addr_operations; 41 + extern const struct address_space_operations v9fs_addr_operations; 42 42 extern const struct file_operations v9fs_file_operations; 43 43 extern const struct file_operations v9fs_dir_operations; 44 44 extern struct dentry_operations v9fs_dentry_operations;
+1 -1
fs/9p/vfs_addr.c
··· 103 103 return retval; 104 104 } 105 105 106 - struct address_space_operations v9fs_addr_operations = { 106 + const struct address_space_operations v9fs_addr_operations = { 107 107 .readpage = v9fs_vfs_readpage, 108 108 };
+1 -1
fs/9p/vfs_inode.c
··· 300 300 fid = V9FS_NOFID; 301 301 302 302 put_fid: 303 - if (fid >= 0) 303 + if (fid != V9FS_NOFID) 304 304 v9fs_put_idpool(fid, &v9ses->fidpool); 305 305 306 306 kfree(fcall);
+1 -1
fs/adfs/inode.c
··· 72 72 return generic_block_bmap(mapping, block, adfs_get_block); 73 73 } 74 74 75 - static struct address_space_operations adfs_aops = { 75 + static const struct address_space_operations adfs_aops = { 76 76 .readpage = adfs_readpage, 77 77 .writepage = adfs_writepage, 78 78 .sync_page = block_sync_page,
+3 -3
fs/affs/affs.h
··· 195 195 extern const struct file_operations affs_file_operations; 196 196 extern const struct file_operations affs_file_operations_ofs; 197 197 extern const struct file_operations affs_dir_operations; 198 - extern struct address_space_operations affs_symlink_aops; 199 - extern struct address_space_operations affs_aops; 200 - extern struct address_space_operations affs_aops_ofs; 198 + extern const struct address_space_operations affs_symlink_aops; 199 + extern const struct address_space_operations affs_aops; 200 + extern const struct address_space_operations affs_aops_ofs; 201 201 202 202 extern struct dentry_operations affs_dentry_operations; 203 203 extern struct dentry_operations affs_dentry_operations_intl;
+2 -2
fs/affs/file.c
··· 406 406 { 407 407 return generic_block_bmap(mapping,block,affs_get_block); 408 408 } 409 - struct address_space_operations affs_aops = { 409 + const struct address_space_operations affs_aops = { 410 410 .readpage = affs_readpage, 411 411 .writepage = affs_writepage, 412 412 .sync_page = block_sync_page, ··· 759 759 goto done; 760 760 } 761 761 762 - struct address_space_operations affs_aops_ofs = { 762 + const struct address_space_operations affs_aops_ofs = { 763 763 .readpage = affs_readpage_ofs, 764 764 //.writepage = affs_writepage_ofs, 765 765 //.sync_page = affs_sync_page_ofs,
+1 -1
fs/affs/symlink.c
··· 66 66 return err; 67 67 } 68 68 69 - struct address_space_operations affs_symlink_aops = { 69 + const struct address_space_operations affs_symlink_aops = { 70 70 .readpage = affs_symlink_readpage, 71 71 }; 72 72
+1 -1
fs/afs/file.c
··· 35 35 .getattr = afs_inode_getattr, 36 36 }; 37 37 38 - struct address_space_operations afs_fs_aops = { 38 + const struct address_space_operations afs_fs_aops = { 39 39 .readpage = afs_file_readpage, 40 40 .sync_page = block_sync_page, 41 41 .set_page_dirty = __set_page_dirty_nobuffers,
+1 -1
fs/afs/internal.h
··· 69 69 /* 70 70 * file.c 71 71 */ 72 - extern struct address_space_operations afs_fs_aops; 72 + extern const struct address_space_operations afs_fs_aops; 73 73 extern struct inode_operations afs_file_inode_operations; 74 74 75 75 #ifdef AFS_CACHING_SUPPORT
+1 -1
fs/befs/linuxvfs.c
··· 73 73 .lookup = befs_lookup, 74 74 }; 75 75 76 - static struct address_space_operations befs_aops = { 76 + static const struct address_space_operations befs_aops = { 77 77 .readpage = befs_readpage, 78 78 .sync_page = block_sync_page, 79 79 .bmap = befs_bmap,
+1 -1
fs/bfs/bfs.h
··· 50 50 /* file.c */ 51 51 extern struct inode_operations bfs_file_inops; 52 52 extern const struct file_operations bfs_file_operations; 53 - extern struct address_space_operations bfs_aops; 53 + extern const struct address_space_operations bfs_aops; 54 54 55 55 /* dir.c */ 56 56 extern struct inode_operations bfs_dir_inops;
+1 -1
fs/bfs/file.c
··· 153 153 return generic_block_bmap(mapping, block, bfs_get_block); 154 154 } 155 155 156 - struct address_space_operations bfs_aops = { 156 + const struct address_space_operations bfs_aops = { 157 157 .readpage = bfs_readpage, 158 158 .writepage = bfs_writepage, 159 159 .sync_page = block_sync_page,
+1 -1
fs/block_dev.c
··· 1095 1095 return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); 1096 1096 } 1097 1097 1098 - struct address_space_operations def_blk_aops = { 1098 + const struct address_space_operations def_blk_aops = { 1099 1099 .readpage = blkdev_readpage, 1100 1100 .writepage = blkdev_writepage, 1101 1101 .sync_page = block_sync_page,
+1 -1
fs/buffer.c
··· 2598 2598 unsigned offset = from & (PAGE_CACHE_SIZE-1); 2599 2599 unsigned to; 2600 2600 struct page *page; 2601 - struct address_space_operations *a_ops = mapping->a_ops; 2601 + const struct address_space_operations *a_ops = mapping->a_ops; 2602 2602 char *kaddr; 2603 2603 int ret = 0; 2604 2604
+2 -2
fs/cifs/cifsfs.h
··· 32 32 #define TRUE 1 33 33 #endif 34 34 35 - extern struct address_space_operations cifs_addr_ops; 36 - extern struct address_space_operations cifs_addr_ops_smallbuf; 35 + extern const struct address_space_operations cifs_addr_ops; 36 + extern const struct address_space_operations cifs_addr_ops_smallbuf; 37 37 38 38 /* Functions related to super block operations */ 39 39 extern struct super_operations cifs_super_ops;
+2 -2
fs/cifs/file.c
··· 1942 1942 return 0; 1943 1943 } 1944 1944 1945 - struct address_space_operations cifs_addr_ops = { 1945 + const struct address_space_operations cifs_addr_ops = { 1946 1946 .readpage = cifs_readpage, 1947 1947 .readpages = cifs_readpages, 1948 1948 .writepage = cifs_writepage, ··· 1959 1959 * contain the header plus one complete page of data. Otherwise, we need 1960 1960 * to leave cifs_readpages out of the address space operations. 1961 1961 */ 1962 - struct address_space_operations cifs_addr_ops_smallbuf = { 1962 + const struct address_space_operations cifs_addr_ops_smallbuf = { 1963 1963 .readpage = cifs_readpage, 1964 1964 .writepage = cifs_writepage, 1965 1965 .writepages = cifs_writepages,
+1 -1
fs/coda/symlink.c
··· 50 50 return error; 51 51 } 52 52 53 - struct address_space_operations coda_symlink_aops = { 53 + const struct address_space_operations coda_symlink_aops = { 54 54 .readpage = coda_symlink_filler, 55 55 };
+1 -1
fs/configfs/inode.c
··· 38 38 39 39 extern struct super_block * configfs_sb; 40 40 41 - static struct address_space_operations configfs_aops = { 41 + static const struct address_space_operations configfs_aops = { 42 42 .readpage = simple_readpage, 43 43 .prepare_write = simple_prepare_write, 44 44 .commit_write = simple_commit_write
+2 -2
fs/cramfs/inode.c
··· 30 30 static struct super_operations cramfs_ops; 31 31 static struct inode_operations cramfs_dir_inode_operations; 32 32 static const struct file_operations cramfs_directory_operations; 33 - static struct address_space_operations cramfs_aops; 33 + static const struct address_space_operations cramfs_aops; 34 34 35 35 static DEFINE_MUTEX(read_mutex); 36 36 ··· 501 501 return 0; 502 502 } 503 503 504 - static struct address_space_operations cramfs_aops = { 504 + static const struct address_space_operations cramfs_aops = { 505 505 .readpage = cramfs_readpage 506 506 }; 507 507
+1 -1
fs/efs/inode.c
··· 21 21 { 22 22 return generic_block_bmap(mapping,block,efs_get_block); 23 23 } 24 - static struct address_space_operations efs_aops = { 24 + static const struct address_space_operations efs_aops = { 25 25 .readpage = efs_readpage, 26 26 .sync_page = block_sync_page, 27 27 .bmap = _efs_bmap
+1 -1
fs/efs/symlink.c
··· 53 53 return err; 54 54 } 55 55 56 - struct address_space_operations efs_symlink_aops = { 56 + const struct address_space_operations efs_symlink_aops = { 57 57 .readpage = efs_symlink_readpage 58 58 };
+3 -3
fs/ext2/ext2.h
··· 162 162 extern const struct file_operations ext2_xip_file_operations; 163 163 164 164 /* inode.c */ 165 - extern struct address_space_operations ext2_aops; 166 - extern struct address_space_operations ext2_aops_xip; 167 - extern struct address_space_operations ext2_nobh_aops; 165 + extern const struct address_space_operations ext2_aops; 166 + extern const struct address_space_operations ext2_aops_xip; 167 + extern const struct address_space_operations ext2_nobh_aops; 168 168 169 169 /* namei.c */ 170 170 extern struct inode_operations ext2_dir_inode_operations;
+3 -3
fs/ext2/inode.c
··· 684 684 return mpage_writepages(mapping, wbc, ext2_get_block); 685 685 } 686 686 687 - struct address_space_operations ext2_aops = { 687 + const struct address_space_operations ext2_aops = { 688 688 .readpage = ext2_readpage, 689 689 .readpages = ext2_readpages, 690 690 .writepage = ext2_writepage, ··· 697 697 .migratepage = buffer_migrate_page, 698 698 }; 699 699 700 - struct address_space_operations ext2_aops_xip = { 700 + const struct address_space_operations ext2_aops_xip = { 701 701 .bmap = ext2_bmap, 702 702 .get_xip_page = ext2_get_xip_page, 703 703 }; 704 704 705 - struct address_space_operations ext2_nobh_aops = { 705 + const struct address_space_operations ext2_nobh_aops = { 706 706 .readpage = ext2_readpage, 707 707 .readpages = ext2_readpages, 708 708 .writepage = ext2_nobh_writepage,
+3 -3
fs/ext3/inode.c
··· 1698 1698 return __set_page_dirty_nobuffers(page); 1699 1699 } 1700 1700 1701 - static struct address_space_operations ext3_ordered_aops = { 1701 + static const struct address_space_operations ext3_ordered_aops = { 1702 1702 .readpage = ext3_readpage, 1703 1703 .readpages = ext3_readpages, 1704 1704 .writepage = ext3_ordered_writepage, ··· 1712 1712 .migratepage = buffer_migrate_page, 1713 1713 }; 1714 1714 1715 - static struct address_space_operations ext3_writeback_aops = { 1715 + static const struct address_space_operations ext3_writeback_aops = { 1716 1716 .readpage = ext3_readpage, 1717 1717 .readpages = ext3_readpages, 1718 1718 .writepage = ext3_writeback_writepage, ··· 1726 1726 .migratepage = buffer_migrate_page, 1727 1727 }; 1728 1728 1729 - static struct address_space_operations ext3_journalled_aops = { 1729 + static const struct address_space_operations ext3_journalled_aops = { 1730 1730 .readpage = ext3_readpage, 1731 1731 .readpages = ext3_readpages, 1732 1732 .writepage = ext3_journalled_writepage,
+1 -1
fs/fat/inode.c
··· 196 196 return generic_block_bmap(mapping, block, fat_get_block); 197 197 } 198 198 199 - static struct address_space_operations fat_aops = { 199 + static const struct address_space_operations fat_aops = { 200 200 .readpage = fat_readpage, 201 201 .readpages = fat_readpages, 202 202 .writepage = fat_writepage,
+1 -1
fs/freevxfs/vxfs_immed.c
··· 56 56 /* 57 57 * Adress space operations for immed files and directories. 58 58 */ 59 - struct address_space_operations vxfs_immed_aops = { 59 + const struct address_space_operations vxfs_immed_aops = { 60 60 .readpage = vxfs_immed_readpage, 61 61 }; 62 62
+3 -3
fs/freevxfs/vxfs_inode.c
··· 41 41 #include "vxfs_extern.h" 42 42 43 43 44 - extern struct address_space_operations vxfs_aops; 45 - extern struct address_space_operations vxfs_immed_aops; 44 + extern const struct address_space_operations vxfs_aops; 45 + extern const struct address_space_operations vxfs_immed_aops; 46 46 47 47 extern struct inode_operations vxfs_immed_symlink_iops; 48 48 ··· 295 295 { 296 296 struct super_block *sbp = ip->i_sb; 297 297 struct vxfs_inode_info *vip; 298 - struct address_space_operations *aops; 298 + const struct address_space_operations *aops; 299 299 ino_t ino = ip->i_ino; 300 300 301 301 if (!(vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist)))
+1 -1
fs/freevxfs/vxfs_subr.c
··· 42 42 static int vxfs_readpage(struct file *, struct page *); 43 43 static sector_t vxfs_bmap(struct address_space *, sector_t); 44 44 45 - struct address_space_operations vxfs_aops = { 45 + const struct address_space_operations vxfs_aops = { 46 46 .readpage = vxfs_readpage, 47 47 .bmap = vxfs_bmap, 48 48 .sync_page = block_sync_page,
+1 -1
fs/fuse/file.c
··· 770 770 /* no mmap and sendfile */ 771 771 }; 772 772 773 - static struct address_space_operations fuse_file_aops = { 773 + static const struct address_space_operations fuse_file_aops = { 774 774 .readpage = fuse_readpage, 775 775 .prepare_write = fuse_prepare_write, 776 776 .commit_write = fuse_commit_write,
+2 -2
fs/hfs/hfs_fs.h
··· 182 182 extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); 183 183 184 184 /* inode.c */ 185 - extern struct address_space_operations hfs_aops; 186 - extern struct address_space_operations hfs_btree_aops; 185 + extern const struct address_space_operations hfs_aops; 186 + extern const struct address_space_operations hfs_btree_aops; 187 187 188 188 extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); 189 189 extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
+2 -2
fs/hfs/inode.c
··· 114 114 return mpage_writepages(mapping, wbc, hfs_get_block); 115 115 } 116 116 117 - struct address_space_operations hfs_btree_aops = { 117 + const struct address_space_operations hfs_btree_aops = { 118 118 .readpage = hfs_readpage, 119 119 .writepage = hfs_writepage, 120 120 .sync_page = block_sync_page, ··· 124 124 .releasepage = hfs_releasepage, 125 125 }; 126 126 127 - struct address_space_operations hfs_aops = { 127 + const struct address_space_operations hfs_aops = { 128 128 .readpage = hfs_readpage, 129 129 .writepage = hfs_writepage, 130 130 .sync_page = block_sync_page,
+2 -2
fs/hfsplus/hfsplus_fs.h
··· 323 323 void hfsplus_file_truncate(struct inode *); 324 324 325 325 /* inode.c */ 326 - extern struct address_space_operations hfsplus_aops; 327 - extern struct address_space_operations hfsplus_btree_aops; 326 + extern const struct address_space_operations hfsplus_aops; 327 + extern const struct address_space_operations hfsplus_btree_aops; 328 328 329 329 void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); 330 330 void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
+2 -2
fs/hfsplus/inode.c
··· 109 109 return mpage_writepages(mapping, wbc, hfsplus_get_block); 110 110 } 111 111 112 - struct address_space_operations hfsplus_btree_aops = { 112 + const struct address_space_operations hfsplus_btree_aops = { 113 113 .readpage = hfsplus_readpage, 114 114 .writepage = hfsplus_writepage, 115 115 .sync_page = block_sync_page, ··· 119 119 .releasepage = hfsplus_releasepage, 120 120 }; 121 121 122 - struct address_space_operations hfsplus_aops = { 122 + const struct address_space_operations hfsplus_aops = { 123 123 .readpage = hfsplus_readpage, 124 124 .writepage = hfsplus_writepage, 125 125 .sync_page = block_sync_page,
+3 -3
fs/hostfs/hostfs_kern.c
··· 54 54 55 55 static struct inode_operations hostfs_iops; 56 56 static struct inode_operations hostfs_dir_iops; 57 - static struct address_space_operations hostfs_link_aops; 57 + static const struct address_space_operations hostfs_link_aops; 58 58 59 59 #ifndef MODULE 60 60 static int __init hostfs_args(char *options, int *add) ··· 518 518 return(err); 519 519 } 520 520 521 - static struct address_space_operations hostfs_aops = { 521 + static const struct address_space_operations hostfs_aops = { 522 522 .writepage = hostfs_writepage, 523 523 .readpage = hostfs_readpage, 524 524 .set_page_dirty = __set_page_dirty_nobuffers, ··· 935 935 return(err); 936 936 } 937 937 938 - static struct address_space_operations hostfs_link_aops = { 938 + static const struct address_space_operations hostfs_link_aops = { 939 939 .readpage = hostfs_link_readpage, 940 940 }; 941 941
+1 -1
fs/hpfs/file.c
··· 99 99 { 100 100 return generic_block_bmap(mapping,block,hpfs_get_block); 101 101 } 102 - struct address_space_operations hpfs_aops = { 102 + const struct address_space_operations hpfs_aops = { 103 103 .readpage = hpfs_readpage, 104 104 .writepage = hpfs_writepage, 105 105 .sync_page = block_sync_page,
+2 -2
fs/hpfs/hpfs_fn.h
··· 268 268 int hpfs_file_fsync(struct file *, struct dentry *, int); 269 269 extern const struct file_operations hpfs_file_ops; 270 270 extern struct inode_operations hpfs_file_iops; 271 - extern struct address_space_operations hpfs_aops; 271 + extern const struct address_space_operations hpfs_aops; 272 272 273 273 /* inode.c */ 274 274 ··· 304 304 /* namei.c */ 305 305 306 306 extern struct inode_operations hpfs_dir_iops; 307 - extern struct address_space_operations hpfs_symlink_aops; 307 + extern const struct address_space_operations hpfs_symlink_aops; 308 308 309 309 static inline struct hpfs_inode_info *hpfs_i(struct inode *inode) 310 310 {
+1 -1
fs/hpfs/namei.c
··· 538 538 return err; 539 539 } 540 540 541 - struct address_space_operations hpfs_symlink_aops = { 541 + const struct address_space_operations hpfs_symlink_aops = { 542 542 .readpage = hpfs_symlink_readpage 543 543 }; 544 544
+2 -2
fs/hugetlbfs/inode.c
··· 34 34 #define HUGETLBFS_MAGIC 0x958458f6 35 35 36 36 static struct super_operations hugetlbfs_ops; 37 - static struct address_space_operations hugetlbfs_aops; 37 + static const struct address_space_operations hugetlbfs_aops; 38 38 const struct file_operations hugetlbfs_file_operations; 39 39 static struct inode_operations hugetlbfs_dir_inode_operations; 40 40 static struct inode_operations hugetlbfs_inode_operations; ··· 547 547 kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); 548 548 } 549 549 550 - static struct address_space_operations hugetlbfs_aops = { 550 + static const struct address_space_operations hugetlbfs_aops = { 551 551 .readpage = hugetlbfs_readpage, 552 552 .prepare_write = hugetlbfs_prepare_write, 553 553 .commit_write = hugetlbfs_commit_write,
+1 -1
fs/inode.c
··· 102 102 103 103 static struct inode *alloc_inode(struct super_block *sb) 104 104 { 105 - static struct address_space_operations empty_aops; 105 + static const struct address_space_operations empty_aops; 106 106 static struct inode_operations empty_iops; 107 107 static const struct file_operations empty_fops; 108 108 struct inode *inode;
+1 -1
fs/isofs/compress.c
··· 312 312 return err; 313 313 } 314 314 315 - struct address_space_operations zisofs_aops = { 315 + const struct address_space_operations zisofs_aops = { 316 316 .readpage = zisofs_readpage, 317 317 /* No sync_page operation supported? */ 318 318 /* No bmap operation supported */
+1 -1
fs/isofs/inode.c
··· 1054 1054 return generic_block_bmap(mapping,block,isofs_get_block); 1055 1055 } 1056 1056 1057 - static struct address_space_operations isofs_aops = { 1057 + static const struct address_space_operations isofs_aops = { 1058 1058 .readpage = isofs_readpage, 1059 1059 .sync_page = block_sync_page, 1060 1060 .bmap = _isofs_bmap
+1 -1
fs/isofs/isofs.h
··· 176 176 177 177 extern struct inode_operations isofs_dir_inode_operations; 178 178 extern const struct file_operations isofs_dir_operations; 179 - extern struct address_space_operations isofs_symlink_aops; 179 + extern const struct address_space_operations isofs_symlink_aops; 180 180 extern struct export_operations isofs_export_ops;
+1 -1
fs/isofs/rock.c
··· 754 754 return -EIO; 755 755 } 756 756 757 - struct address_space_operations isofs_symlink_aops = { 757 + const struct address_space_operations isofs_symlink_aops = { 758 758 .readpage = rock_ridge_symlink_readpage 759 759 };
+1 -1
fs/isofs/zisofs.h
··· 15 15 */ 16 16 17 17 #ifdef CONFIG_ZISOFS 18 - extern struct address_space_operations zisofs_aops; 18 + extern const struct address_space_operations zisofs_aops; 19 19 extern int __init zisofs_init(void); 20 20 extern void zisofs_cleanup(void); 21 21 #endif
+2 -2
fs/jffs/inode-v23.c
··· 59 59 static struct inode_operations jffs_file_inode_operations; 60 60 static const struct file_operations jffs_dir_operations; 61 61 static struct inode_operations jffs_dir_inode_operations; 62 - static struct address_space_operations jffs_address_operations; 62 + static const struct address_space_operations jffs_address_operations; 63 63 64 64 kmem_cache_t *node_cache = NULL; 65 65 kmem_cache_t *fm_cache = NULL; ··· 1614 1614 } /* jffs_ioctl() */ 1615 1615 1616 1616 1617 - static struct address_space_operations jffs_address_operations = { 1617 + static const struct address_space_operations jffs_address_operations = { 1618 1618 .readpage = jffs_readpage, 1619 1619 .prepare_write = jffs_prepare_write, 1620 1620 .commit_write = jffs_commit_write,
+1 -1
fs/jffs2/file.c
··· 62 62 .removexattr = jffs2_removexattr 63 63 }; 64 64 65 - struct address_space_operations jffs2_file_address_operations = 65 + const struct address_space_operations jffs2_file_address_operations = 66 66 { 67 67 .readpage = jffs2_readpage, 68 68 .prepare_write =jffs2_prepare_write,
+1 -1
fs/jffs2/os-linux.h
··· 158 158 /* file.c */ 159 159 extern const struct file_operations jffs2_file_operations; 160 160 extern struct inode_operations jffs2_file_inode_operations; 161 - extern struct address_space_operations jffs2_file_address_operations; 161 + extern const struct address_space_operations jffs2_file_address_operations; 162 162 int jffs2_fsync(struct file *, struct dentry *, int); 163 163 int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); 164 164
+1 -1
fs/jfs/inode.c
··· 305 305 offset, nr_segs, jfs_get_block, NULL); 306 306 } 307 307 308 - struct address_space_operations jfs_aops = { 308 + const struct address_space_operations jfs_aops = { 309 309 .readpage = jfs_readpage, 310 310 .readpages = jfs_readpages, 311 311 .writepage = jfs_writepage,
+1 -1
fs/jfs/jfs_inode.h
··· 33 33 extern struct dentry *jfs_get_parent(struct dentry *dentry); 34 34 extern void jfs_set_inode_flags(struct inode *); 35 35 36 - extern struct address_space_operations jfs_aops; 36 + extern const struct address_space_operations jfs_aops; 37 37 extern struct inode_operations jfs_dir_inode_operations; 38 38 extern const struct file_operations jfs_dir_operations; 39 39 extern struct inode_operations jfs_file_inode_operations;
+1 -1
fs/jfs/jfs_metapage.c
··· 577 577 metapage_releasepage(page, 0); 578 578 } 579 579 580 - struct address_space_operations jfs_metapage_aops = { 580 + const struct address_space_operations jfs_metapage_aops = { 581 581 .readpage = metapage_readpage, 582 582 .writepage = metapage_writepage, 583 583 .sync_page = block_sync_page,
+1 -1
fs/jfs/jfs_metapage.h
··· 139 139 put_metapage(mp); 140 140 } 141 141 142 - extern struct address_space_operations jfs_metapage_aops; 142 + extern const struct address_space_operations jfs_metapage_aops; 143 143 144 144 /* 145 145 * This routines invalidate all pages for an extent.
+1 -1
fs/minix/inode.c
··· 335 335 { 336 336 return generic_block_bmap(mapping,block,minix_get_block); 337 337 } 338 - static struct address_space_operations minix_aops = { 338 + static const struct address_space_operations minix_aops = { 339 339 .readpage = minix_readpage, 340 340 .writepage = minix_writepage, 341 341 .sync_page = block_sync_page,
+1 -1
fs/ncpfs/inode.c
··· 105 105 106 106 extern struct dentry_operations ncp_root_dentry_operations; 107 107 #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) 108 - extern struct address_space_operations ncp_symlink_aops; 108 + extern const struct address_space_operations ncp_symlink_aops; 109 109 extern int ncp_symlink(struct inode*, struct dentry*, const char*); 110 110 #endif 111 111
+1 -1
fs/ncpfs/symlink.c
··· 99 99 /* 100 100 * symlinks can't do much... 101 101 */ 102 - struct address_space_operations ncp_symlink_aops = { 102 + const struct address_space_operations ncp_symlink_aops = { 103 103 .readpage = ncp_symlink_readpage, 104 104 }; 105 105
+1 -1
fs/nfs/file.c
··· 315 315 return !nfs_wb_page(page->mapping->host, page); 316 316 } 317 317 318 - struct address_space_operations nfs_file_aops = { 318 + const struct address_space_operations nfs_file_aops = { 319 319 .readpage = nfs_readpage, 320 320 .readpages = nfs_readpages, 321 321 .set_page_dirty = __set_page_dirty_nobuffers,
+2 -2
fs/ntfs/aops.c
··· 1544 1544 /** 1545 1545 * ntfs_aops - general address space operations for inodes and attributes 1546 1546 */ 1547 - struct address_space_operations ntfs_aops = { 1547 + const struct address_space_operations ntfs_aops = { 1548 1548 .readpage = ntfs_readpage, /* Fill page with data. */ 1549 1549 .sync_page = block_sync_page, /* Currently, just unplugs the 1550 1550 disk request queue. */ ··· 1560 1560 * ntfs_mst_aops - general address space operations for mst protecteed inodes 1561 1561 * and attributes 1562 1562 */ 1563 - struct address_space_operations ntfs_mst_aops = { 1563 + const struct address_space_operations ntfs_mst_aops = { 1564 1564 .readpage = ntfs_readpage, /* Fill page with data. */ 1565 1565 .sync_page = block_sync_page, /* Currently, just unplugs the 1566 1566 disk request queue. */
+2 -2
fs/ntfs/ntfs.h
··· 57 57 extern struct kmem_cache *ntfs_index_ctx_cache; 58 58 59 59 /* The various operations structs defined throughout the driver files. */ 60 - extern struct address_space_operations ntfs_aops; 61 - extern struct address_space_operations ntfs_mst_aops; 60 + extern const struct address_space_operations ntfs_aops; 61 + extern const struct address_space_operations ntfs_mst_aops; 62 62 63 63 extern const struct file_operations ntfs_file_ops; 64 64 extern struct inode_operations ntfs_file_inode_ops;
+1 -1
fs/ocfs2/aops.c
··· 666 666 return ret; 667 667 } 668 668 669 - struct address_space_operations ocfs2_aops = { 669 + const struct address_space_operations ocfs2_aops = { 670 670 .readpage = ocfs2_readpage, 671 671 .writepage = ocfs2_writepage, 672 672 .prepare_write = ocfs2_prepare_write,
+1 -1
fs/ocfs2/inode.h
··· 114 114 115 115 extern kmem_cache_t *ocfs2_inode_cache; 116 116 117 - extern struct address_space_operations ocfs2_aops; 117 + extern const struct address_space_operations ocfs2_aops; 118 118 119 119 struct buffer_head *ocfs2_bread(struct inode *inode, int block, 120 120 int *err, int reada);
+1 -1
fs/qnx4/inode.c
··· 450 450 { 451 451 return generic_block_bmap(mapping,block,qnx4_get_block); 452 452 } 453 - static struct address_space_operations qnx4_aops = { 453 + static const struct address_space_operations qnx4_aops = { 454 454 .readpage = qnx4_readpage, 455 455 .writepage = qnx4_writepage, 456 456 .sync_page = block_sync_page,
+1 -1
fs/ramfs/file-mmu.c
··· 26 26 27 27 #include <linux/fs.h> 28 28 29 - struct address_space_operations ramfs_aops = { 29 + const struct address_space_operations ramfs_aops = { 30 30 .readpage = simple_readpage, 31 31 .prepare_write = simple_prepare_write, 32 32 .commit_write = simple_commit_write
+1 -1
fs/ramfs/file-nommu.c
··· 27 27 28 28 static int ramfs_nommu_setattr(struct dentry *, struct iattr *); 29 29 30 - struct address_space_operations ramfs_aops = { 30 + const struct address_space_operations ramfs_aops = { 31 31 .readpage = simple_readpage, 32 32 .prepare_write = simple_prepare_write, 33 33 .commit_write = simple_commit_write
+1 -1
fs/ramfs/internal.h
··· 10 10 */ 11 11 12 12 13 - extern struct address_space_operations ramfs_aops; 13 + extern const struct address_space_operations ramfs_aops; 14 14 extern const struct file_operations ramfs_file_operations; 15 15 extern struct inode_operations ramfs_file_inode_operations;
+1 -1
fs/reiserfs/inode.c
··· 2996 2996 return error; 2997 2997 } 2998 2998 2999 - struct address_space_operations reiserfs_address_space_operations = { 2999 + const struct address_space_operations reiserfs_address_space_operations = { 3000 3000 .writepage = reiserfs_writepage, 3001 3001 .readpage = reiserfs_readpage, 3002 3002 .readpages = reiserfs_readpages,
+1 -1
fs/romfs/inode.c
··· 459 459 460 460 /* Mapping from our types to the kernel */ 461 461 462 - static struct address_space_operations romfs_aops = { 462 + static const struct address_space_operations romfs_aops = { 463 463 .readpage = romfs_readpage 464 464 }; 465 465
+1 -1
fs/smbfs/file.c
··· 306 306 return status; 307 307 } 308 308 309 - struct address_space_operations smb_file_aops = { 309 + const struct address_space_operations smb_file_aops = { 310 310 .readpage = smb_readpage, 311 311 .writepage = smb_writepage, 312 312 .prepare_write = smb_prepare_write,
+1 -1
fs/smbfs/proto.h
··· 63 63 extern int smb_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); 64 64 extern int smb_notify_change(struct dentry *dentry, struct iattr *attr); 65 65 /* file.c */ 66 - extern struct address_space_operations smb_file_aops; 66 + extern const struct address_space_operations smb_file_aops; 67 67 extern const struct file_operations smb_file_operations; 68 68 extern struct inode_operations smb_file_inode_operations; 69 69 /* ioctl.c */
+1 -1
fs/sysfs/inode.c
··· 16 16 17 17 extern struct super_block * sysfs_sb; 18 18 19 - static struct address_space_operations sysfs_aops = { 19 + static const struct address_space_operations sysfs_aops = { 20 20 .readpage = simple_readpage, 21 21 .prepare_write = simple_prepare_write, 22 22 .commit_write = simple_commit_write
+1 -1
fs/sysv/itree.c
··· 465 465 { 466 466 return generic_block_bmap(mapping,block,get_block); 467 467 } 468 - struct address_space_operations sysv_aops = { 468 + const struct address_space_operations sysv_aops = { 469 469 .readpage = sysv_readpage, 470 470 .writepage = sysv_writepage, 471 471 .sync_page = block_sync_page,
+1 -1
fs/sysv/sysv.h
··· 161 161 extern struct inode_operations sysv_fast_symlink_inode_operations; 162 162 extern const struct file_operations sysv_file_operations; 163 163 extern const struct file_operations sysv_dir_operations; 164 - extern struct address_space_operations sysv_aops; 164 + extern const struct address_space_operations sysv_aops; 165 165 extern struct super_operations sysv_sops; 166 166 extern struct dentry_operations sysv_dentry_operations; 167 167
+1 -1
fs/udf/file.c
··· 95 95 return 0; 96 96 } 97 97 98 - struct address_space_operations udf_adinicb_aops = { 98 + const struct address_space_operations udf_adinicb_aops = { 99 99 .readpage = udf_adinicb_readpage, 100 100 .writepage = udf_adinicb_writepage, 101 101 .sync_page = block_sync_page,
+1 -1
fs/udf/inode.c
··· 132 132 return generic_block_bmap(mapping,block,udf_get_block); 133 133 } 134 134 135 - struct address_space_operations udf_aops = { 135 + const struct address_space_operations udf_aops = { 136 136 .readpage = udf_readpage, 137 137 .writepage = udf_writepage, 138 138 .sync_page = block_sync_page,
+1 -1
fs/udf/symlink.c
··· 113 113 /* 114 114 * symlinks can't do much... 115 115 */ 116 - struct address_space_operations udf_symlink_aops = { 116 + const struct address_space_operations udf_symlink_aops = { 117 117 .readpage = udf_symlink_filler, 118 118 };
+3 -3
fs/udf/udfdecl.h
··· 47 47 extern const struct file_operations udf_dir_operations; 48 48 extern struct inode_operations udf_file_inode_operations; 49 49 extern const struct file_operations udf_file_operations; 50 - extern struct address_space_operations udf_aops; 51 - extern struct address_space_operations udf_adinicb_aops; 52 - extern struct address_space_operations udf_symlink_aops; 50 + extern const struct address_space_operations udf_aops; 51 + extern const struct address_space_operations udf_adinicb_aops; 52 + extern const struct address_space_operations udf_symlink_aops; 53 53 54 54 struct udf_fileident_bh 55 55 {
+1 -1
fs/ufs/inode.c
··· 574 574 { 575 575 return generic_block_bmap(mapping,block,ufs_getfrag_block); 576 576 } 577 - struct address_space_operations ufs_aops = { 577 + const struct address_space_operations ufs_aops = { 578 578 .readpage = ufs_readpage, 579 579 .writepage = ufs_writepage, 580 580 .sync_page = block_sync_page,
+1 -1
fs/xfs/linux-2.6/xfs_aops.c
··· 1454 1454 block_invalidatepage(page, offset); 1455 1455 } 1456 1456 1457 - struct address_space_operations xfs_address_space_operations = { 1457 + const struct address_space_operations xfs_address_space_operations = { 1458 1458 .readpage = xfs_vm_readpage, 1459 1459 .readpages = xfs_vm_readpages, 1460 1460 .writepage = xfs_vm_writepage,
+1 -1
fs/xfs/linux-2.6/xfs_aops.h
··· 40 40 struct work_struct io_work; /* xfsdatad work queue */ 41 41 } xfs_ioend_t; 42 42 43 - extern struct address_space_operations xfs_address_space_operations; 43 + extern const struct address_space_operations xfs_address_space_operations; 44 44 extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int); 45 45 46 46 #endif /* __XFS_AOPS_H__ */
+1 -1
fs/xfs/linux-2.6/xfs_buf.c
··· 1520 1520 struct backing_dev_info *bdi; 1521 1521 struct inode *inode; 1522 1522 struct address_space *mapping; 1523 - static struct address_space_operations mapping_aops = { 1523 + static const struct address_space_operations mapping_aops = { 1524 1524 .sync_page = block_sync_page, 1525 1525 .migratepage = fail_migrate_page, 1526 1526 };
-2
include/asm-arm/arch-at91rm9200/memory.h
··· 33 33 * bus_to_virt: Used to convert an address for DMA operations 34 34 * to an address that the kernel can use. 35 35 */ 36 - #define __virt_to_bus__is_a_macro 37 36 #define __virt_to_bus(x) __virt_to_phys(x) 38 - #define __bus_to_virt__is_a_macro 39 37 #define __bus_to_virt(x) __phys_to_virt(x) 40 38 41 39 #endif
-2
include/asm-arm/arch-h720x/memory.h
··· 23 23 * There is something to do here later !, Mar 2000, Jungjun Kim 24 24 */ 25 25 26 - #define __virt_to_bus__is_a_macro 27 26 #define __virt_to_bus(x) __virt_to_phys(x) 28 - #define __bus_to_virt__is_a_macro 29 27 #define __bus_to_virt(x) __phys_to_virt(x) 30 28 31 29 #endif
+2 -4
include/asm-arm/arch-imx/memory.h
··· 30 30 * bus_to_virt: Used to convert an address for DMA operations 31 31 * to an address that the kernel can use. 32 32 */ 33 - #define __virt_to_bus__is_a_macro 34 - #define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET) 35 - #define __bus_to_virt__is_a_macro 36 - #define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET) 33 + #define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET) 34 + #define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET) 37 35 38 36 #endif
-11
include/asm-arm/arch-ixp23xx/ixp23xx.h
··· 295 295 #define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160) 296 296 297 297 298 - #ifndef __ASSEMBLY__ 299 - /* 300 - * Is system memory on the XSI or CPP bus? 301 - */ 302 - static inline unsigned ixp23xx_cpp_boot(void) 303 - { 304 - return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES); 305 - } 306 - #endif 307 - 308 - 309 298 #endif
+10
include/asm-arm/arch-ixp23xx/platform.h
··· 43 43 44 44 #define IXP23XX_UART_XTAL 14745600 45 45 46 + #ifndef __ASSEMBLY__ 47 + /* 48 + * Is system memory on the XSI or CPP bus? 49 + */ 50 + static inline unsigned ixp23xx_cpp_boot(void) 51 + { 52 + return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES); 53 + } 54 + #endif 55 + 46 56 47 57 #endif
+1 -1
include/asm-arm/arch-ixp23xx/uncompress.h
··· 11 11 #ifndef __ASM_ARCH_UNCOMPRESS_H 12 12 #define __ASM_ARCH_UNCOMPRESS_H 13 13 14 - #include <asm/hardware.h> 14 + #include <asm/arch/ixp23xx.h> 15 15 #include <linux/serial_reg.h> 16 16 17 17 #define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS)
+7 -9
include/asm-arm/arch-s3c2410/regs-dsc.h
··· 7 7 * it under the terms of the GNU General Public License version 2 as 8 8 * published by the Free Software Foundation. 9 9 * 10 - * S3C2440 Signal Drive Strength Control 11 - * 12 - * Changelog: 13 - * 11-Aug-2004 BJD Created file 14 - * 25-Aug-2004 BJD Added the _SELECT_* defs for using with functions 10 + * S3C2440/S3C2412 Signal Drive Strength Control 15 11 */ 16 12 17 13 18 14 #ifndef __ASM_ARCH_REGS_DSC_H 19 15 #define __ASM_ARCH_REGS_DSC_H "2440-dsc" 20 16 21 - #ifdef CONFIG_CPU_S3C2440 17 + #if defined(CONFIG_CPU_S3C2412) 18 + #define S3C2412_DSC0 S3C2410_GPIOREG(0xdc) 19 + #define S3C2412_DSC1 S3C2410_GPIOREG(0xe0) 20 + #endif 21 + 22 + #if defined(CONFIG_CPU_S3C2440) 22 23 23 24 #define S3C2440_DSC0 S3C2410_GPIOREG(0xc4) 24 25 #define S3C2440_DSC1 S3C2410_GPIOREG(0xc8) 25 - 26 - #define S3C2412_DSC0 S3C2410_GPIOREG(0xdc) 27 - #define S3C2412_DSC1 S3C2410_GPIOREG(0xe0) 28 26 29 27 #define S3C2440_SELECT_DSC0 (0) 30 28 #define S3C2440_SELECT_DSC1 (1<<31)
+4
include/asm-arm/bugs.h
··· 10 10 #ifndef __ASM_BUGS_H 11 11 #define __ASM_BUGS_H 12 12 13 + #ifdef CONFIG_MMU 13 14 extern void check_writebuffer_bugs(void); 14 15 15 16 #define check_bugs() check_writebuffer_bugs() 17 + #else 18 + #define check_bugs() do { } while (0) 19 + #endif 16 20 17 21 #endif
+7
include/asm-arm/domain.h
··· 50 50 #define domain_val(dom,type) ((type) << (2*(dom))) 51 51 52 52 #ifndef __ASSEMBLY__ 53 + 54 + #ifdef CONFIG_MMU 53 55 #define set_domain(x) \ 54 56 do { \ 55 57 __asm__ __volatile__( \ ··· 67 65 thread->cpu_domain = domain | domain_val(dom, type); \ 68 66 set_domain(thread->cpu_domain); \ 69 67 } while (0) 68 + 69 + #else 70 + #define set_domain(x) do { } while (0) 71 + #define modify_domain(dom,type) do { } while (0) 72 + #endif 70 73 71 74 #endif 72 75 #endif /* !__ASSEMBLY__ */
+8
include/asm-arm/fpstate.h
··· 72 72 73 73 #define FP_SIZE (sizeof(union fp_state) / sizeof(int)) 74 74 75 + struct crunch_state { 76 + unsigned int mvdx[16][2]; 77 + unsigned int mvax[4][3]; 78 + unsigned int dspsc[2]; 79 + }; 80 + 81 + #define CRUNCH_SIZE sizeof(struct crunch_state) 82 + 75 83 #endif 76 84 77 85 #endif
+4 -5
include/asm-arm/mach/map.h
··· 16 16 unsigned int type; 17 17 }; 18 18 19 - struct meminfo; 20 - 21 19 #define MT_DEVICE 0 22 20 #define MT_CACHECLEAN 1 23 21 #define MT_MINICLEAN 2 ··· 26 28 #define MT_IXP2000_DEVICE 7 27 29 #define MT_NONSHARED_DEVICE 8 28 30 29 - extern void create_memmap_holes(struct meminfo *); 30 - extern void memtable_init(struct meminfo *); 31 + #ifdef CONFIG_MMU 31 32 extern void iotable_init(struct map_desc *, int); 32 - extern void setup_io_desc(void); 33 + #else 34 + #define iotable_init(map,num) do { } while (0) 35 + #endif
+57 -18
include/asm-arm/memory.h
··· 2 2 * linux/include/asm-arm/memory.h 3 3 * 4 4 * Copyright (C) 2000-2002 Russell King 5 + * modification for nommu, Hyok S. Choi, 2004 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify 7 8 * it under the terms of the GNU General Public License version 2 as ··· 27 26 #include <asm/arch/memory.h> 28 27 #include <asm/sizes.h> 29 28 29 + #ifdef CONFIG_MMU 30 + 30 31 #ifndef TASK_SIZE 31 32 /* 32 33 * TASK_SIZE - the maximum size of a user space task. ··· 49 46 #ifndef PAGE_OFFSET 50 47 #define PAGE_OFFSET UL(0xc0000000) 51 48 #endif 49 + 50 + /* 51 + * The module space lives between the addresses given by TASK_SIZE 52 + * and PAGE_OFFSET - it must be within 32MB of the kernel text. 53 + */ 54 + #define MODULE_END (PAGE_OFFSET) 55 + #define MODULE_START (MODULE_END - 16*1048576) 56 + 57 + #if TASK_SIZE > MODULE_START 58 + #error Top of user space clashes with start of module space 59 + #endif 60 + 61 + /* 62 + * The XIP kernel gets mapped at the bottom of the module vm area. 63 + * Since we use sections to map it, this macro replaces the physical address 64 + * with its virtual address while keeping offset from the base section. 65 + */ 66 + #define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff)) 67 + 68 + #else /* CONFIG_MMU */ 69 + 70 + /* 71 + * The limitation of user task size can grow up to the end of free ram region. 72 + * It is difficult to define and perhaps will never meet the original meaning 73 + * of this define that was meant to. 74 + * Fortunately, there is no reference for this in noMMU mode, for now. 75 + */ 76 + #ifndef TASK_SIZE 77 + #define TASK_SIZE (CONFIG_DRAM_SIZE) 78 + #endif 79 + 80 + #ifndef TASK_UNMAPPED_BASE 81 + #define TASK_UNMAPPED_BASE UL(0x00000000) 82 + #endif 83 + 84 + #ifndef PHYS_OFFSET 85 + #define PHYS_OFFSET (CONFIG_DRAM_BASE) 86 + #endif 87 + 88 + #ifndef END_MEM 89 + #define END_MEM (CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE) 90 + #endif 91 + 92 + #ifndef PAGE_OFFSET 93 + #define PAGE_OFFSET (PHYS_OFFSET) 94 + #endif 95 + 96 + /* 97 + * The module can be at any place in ram in nommu mode. 98 + */ 99 + #define MODULE_END (END_MEM) 100 + #define MODULE_START (PHYS_OFFSET) 101 + 102 + #endif /* !CONFIG_MMU */ 52 103 53 104 /* 54 105 * Size of DMA-consistent memory region. Must be multiple of 2M, ··· 127 70 */ 128 71 #define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT) 129 72 #define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 130 - 131 - /* 132 - * The module space lives between the addresses given by TASK_SIZE 133 - * and PAGE_OFFSET - it must be within 32MB of the kernel text. 134 - */ 135 - #define MODULE_END (PAGE_OFFSET) 136 - #define MODULE_START (MODULE_END - 16*1048576) 137 - 138 - #if TASK_SIZE > MODULE_START 139 - #error Top of user space clashes with start of module space 140 - #endif 141 - 142 - /* 143 - * The XIP kernel gets mapped at the bottom of the module vm area. 144 - * Since we use sections to map it, this macro replaces the physical address 145 - * with its virtual address while keeping offset from the base section. 146 - */ 147 - #define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff)) 148 73 149 74 #ifndef __ASSEMBLY__ 150 75
+16
include/asm-arm/mmu.h
··· 1 1 #ifndef __ARM_MMU_H 2 2 #define __ARM_MMU_H 3 3 4 + #ifdef CONFIG_MMU 5 + 4 6 typedef struct { 5 7 #if __LINUX_ARM_ARCH__ >= 6 6 8 unsigned int id; ··· 13 11 #define ASID(mm) ((mm)->context.id & 255) 14 12 #else 15 13 #define ASID(mm) (0) 14 + #endif 15 + 16 + #else 17 + 18 + /* 19 + * From nommu.h: 20 + * Copyright (C) 2002, David McCullough <davidm@snapgear.com> 21 + * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com> 22 + */ 23 + typedef struct { 24 + struct vm_list_struct *vmlist; 25 + unsigned long end_brk; 26 + } mm_context_t; 27 + 16 28 #endif 17 29 18 30 #endif
+2
include/asm-arm/mmu_context.h
··· 82 82 switch_mm(struct mm_struct *prev, struct mm_struct *next, 83 83 struct task_struct *tsk) 84 84 { 85 + #ifdef CONFIG_MMU 85 86 unsigned int cpu = smp_processor_id(); 86 87 87 88 if (prev != next) { ··· 92 91 if (cache_is_vivt()) 93 92 cpu_clear(cpu, prev->cpu_vm_mask); 94 93 } 94 + #endif 95 95 } 96 96 97 97 #define deactivate_mm(tsk,mm) do { } while (0)
+51
include/asm-arm/page-nommu.h
··· 1 + /* 2 + * linux/include/asm-arm/page-nommu.h 3 + * 4 + * Copyright (C) 2004 Hyok S. Choi 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + #ifndef _ASMARM_PAGE_NOMMU_H 11 + #define _ASMARM_PAGE_NOMMU_H 12 + 13 + #if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13 14 + #define KTHREAD_SIZE (8192) 15 + #else 16 + #define KTHREAD_SIZE PAGE_SIZE 17 + #endif 18 + 19 + #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) 20 + #define free_user_page(page, addr) free_page(addr) 21 + 22 + #define clear_page(page) memset((page), 0, PAGE_SIZE) 23 + #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) 24 + 25 + #define clear_user_page(page, vaddr, pg) clear_page(page) 26 + #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 27 + 28 + /* 29 + * These are used to make use of C type-checking.. 30 + */ 31 + typedef unsigned long pte_t; 32 + typedef unsigned long pmd_t; 33 + typedef unsigned long pgd_t[2]; 34 + typedef unsigned long pgprot_t; 35 + 36 + #define pte_val(x) (x) 37 + #define pmd_val(x) (x) 38 + #define pgd_val(x) ((x)[0]) 39 + #define pgprot_val(x) (x) 40 + 41 + #define __pte(x) (x) 42 + #define __pmd(x) (x) 43 + #define __pgprot(x) (x) 44 + 45 + /* to align the pointer to the (next) page boundary */ 46 + #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 47 + 48 + extern unsigned long memory_start; 49 + extern unsigned long memory_end; 50 + 51 + #endif
+8
include/asm-arm/page.h
··· 23 23 24 24 #ifndef __ASSEMBLY__ 25 25 26 + #ifndef CONFIG_MMU 27 + 28 + #include "page-nommu.h" 29 + 30 + #else 31 + 26 32 #include <asm/glue.h> 27 33 28 34 /* ··· 176 170 177 171 /* the upper-most page table pointer */ 178 172 extern pmd_t *top_pmd; 173 + 174 + #endif /* CONFIG_MMU */ 179 175 180 176 #include <asm/memory.h> 181 177
+6 -2
include/asm-arm/pgalloc.h
··· 16 16 #include <asm/cacheflush.h> 17 17 #include <asm/tlbflush.h> 18 18 19 + #define check_pgt_cache() do { } while (0) 20 + 21 + #ifdef CONFIG_MMU 22 + 19 23 #define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER)) 20 24 #define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL)) 21 25 ··· 35 31 36 32 #define pgd_alloc(mm) get_pgd_slow(mm) 37 33 #define pgd_free(pgd) free_pgd_slow(pgd) 38 - 39 - #define check_pgt_cache() do { } while (0) 40 34 41 35 /* 42 36 * Allocate one PTE table. ··· 127 125 { 128 126 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE); 129 127 } 128 + 129 + #endif /* CONFIG_MMU */ 130 130 131 131 #endif
+123
include/asm-arm/pgtable-nommu.h
··· 1 + /* 2 + * linux/include/asm-arm/pgtable-nommu.h 3 + * 4 + * Copyright (C) 1995-2002 Russell King 5 + * Copyright (C) 2004 Hyok S. Choi 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + */ 11 + #ifndef _ASMARM_PGTABLE_NOMMU_H 12 + #define _ASMARM_PGTABLE_NOMMU_H 13 + 14 + #ifndef __ASSEMBLY__ 15 + 16 + #include <linux/config.h> 17 + #include <linux/slab.h> 18 + #include <asm/processor.h> 19 + #include <asm/page.h> 20 + #include <asm/io.h> 21 + 22 + /* 23 + * Trivial page table functions. 24 + */ 25 + #define pgd_present(pgd) (1) 26 + #define pgd_none(pgd) (0) 27 + #define pgd_bad(pgd) (0) 28 + #define pgd_clear(pgdp) 29 + #define kern_addr_valid(addr) (1) 30 + #define pmd_offset(a, b) ((void *)0) 31 + /* FIXME */ 32 + /* 33 + * PMD_SHIFT determines the size of the area a second-level page table can map 34 + * PGDIR_SHIFT determines what a third-level page table entry can map 35 + */ 36 + #define PGDIR_SHIFT 21 37 + 38 + #define PGDIR_SIZE (1UL << PGDIR_SHIFT) 39 + #define PGDIR_MASK (~(PGDIR_SIZE-1)) 40 + /* FIXME */ 41 + 42 + #define PAGE_NONE __pgprot(0) 43 + #define PAGE_SHARED __pgprot(0) 44 + #define PAGE_COPY __pgprot(0) 45 + #define PAGE_READONLY __pgprot(0) 46 + #define PAGE_KERNEL __pgprot(0) 47 + 48 + //extern void paging_init(struct meminfo *, struct machine_desc *); 49 + #define swapper_pg_dir ((pgd_t *) 0) 50 + 51 + #define __swp_type(x) (0) 52 + #define __swp_offset(x) (0) 53 + #define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) }) 54 + #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 55 + #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 56 + 57 + 58 + typedef pte_t *pte_addr_t; 59 + 60 + static inline int pte_file(pte_t pte) { return 0; } 61 + 62 + /* 63 + * ZERO_PAGE is a global shared page that is always zero: used 64 + * for zero-mapped memory areas etc.. 65 + */ 66 + #define ZERO_PAGE(vaddr) (virt_to_page(0)) 67 + 68 + /* 69 + * Mark the prot value as uncacheable and unbufferable. 70 + */ 71 + #define pgprot_noncached(prot) __pgprot(0) 72 + #define pgprot_writecombine(prot) __pgprot(0) 73 + 74 + 75 + /* 76 + * These would be in other places but having them here reduces the diffs. 77 + */ 78 + extern unsigned int kobjsize(const void *objp); 79 + extern int is_in_rom(unsigned long); 80 + 81 + /* 82 + * No page table caches to initialise. 83 + */ 84 + #define pgtable_cache_init() do { } while (0) 85 + #define io_remap_page_range remap_page_range 86 + #define io_remap_pfn_range remap_pfn_range 87 + 88 + #define MK_IOSPACE_PFN(space, pfn) (pfn) 89 + #define GET_IOSPACE(pfn) 0 90 + #define GET_PFN(pfn) (pfn) 91 + 92 + 93 + /* 94 + * All 32bit addresses are effectively valid for vmalloc... 95 + * Sort of meaningless for non-VM targets. 96 + */ 97 + #define VMALLOC_START 0 98 + #define VMALLOC_END 0xffffffff 99 + 100 + #define FIRST_USER_ADDRESS (0) 101 + 102 + #else 103 + 104 + /* 105 + * dummy tlb and user structures. 106 + */ 107 + #define v3_tlb_fns (0) 108 + #define v4_tlb_fns (0) 109 + #define v4wb_tlb_fns (0) 110 + #define v4wbi_tlb_fns (0) 111 + #define v6_tlb_fns (0) 112 + 113 + #define v3_user_fns (0) 114 + #define v4_user_fns (0) 115 + #define v4_mc_user_fns (0) 116 + #define v4wb_user_fns (0) 117 + #define v4wt_user_fns (0) 118 + #define v6_user_fns (0) 119 + #define xscale_mc_user_fns (0) 120 + 121 + #endif /*__ASSEMBLY__*/ 122 + 123 + #endif /* _ASMARM_PGTABLE_H */
+9 -1
include/asm-arm/pgtable.h
··· 11 11 #define _ASMARM_PGTABLE_H 12 12 13 13 #include <asm-generic/4level-fixup.h> 14 + #include <asm/proc-fns.h> 15 + 16 + #ifndef CONFIG_MMU 17 + 18 + #include "pgtable-nommu.h" 19 + 20 + #else 14 21 15 22 #include <asm/memory.h> 16 - #include <asm/proc-fns.h> 17 23 #include <asm/arch/vmalloc.h> 18 24 19 25 /* ··· 383 377 #define pgtable_cache_init() do { } while (0) 384 378 385 379 #endif /* !__ASSEMBLY__ */ 380 + 381 + #endif /* CONFIG_MMU */ 386 382 387 383 #endif /* _ASMARM_PGTABLE_H */
+4
include/asm-arm/proc-fns.h
··· 165 165 166 166 #include <asm/memory.h> 167 167 168 + #ifdef CONFIG_MMU 169 + 168 170 #define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm) 169 171 170 172 #define cpu_get_pgd() \ ··· 177 175 pg &= ~0x3fff; \ 178 176 (pgd_t *)phys_to_virt(pg); \ 179 177 }) 178 + 179 + #endif 180 180 181 181 #endif /* __ASSEMBLY__ */ 182 182 #endif /* __KERNEL__ */
+5
include/asm-arm/ptrace.h
··· 25 25 26 26 #define PTRACE_SET_SYSCALL 23 27 27 28 + /* PTRACE_SYSCALL is 24 */ 29 + 30 + #define PTRACE_GETCRUNCHREGS 25 31 + #define PTRACE_SETCRUNCHREGS 26 32 + 28 33 /* 29 34 * PSR bits 30 35 */
+6
include/asm-arm/thread_info.h
··· 59 59 struct cpu_context_save cpu_context; /* cpu context */ 60 60 __u8 used_cp[16]; /* thread used copro */ 61 61 unsigned long tp_value; 62 + struct crunch_state crunchstate; 62 63 union fp_state fpstate __attribute__((aligned(8))); 63 64 union vfp_state vfpstate; 64 65 struct restart_block restart_block; ··· 101 100 ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) 102 101 #define thread_saved_fp(tsk) \ 103 102 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) 103 + 104 + extern void crunch_task_disable(struct thread_info *); 105 + extern void crunch_task_copy(struct thread_info *, void *); 106 + extern void crunch_task_restore(struct thread_info *, void *); 107 + extern void crunch_task_release(struct thread_info *); 104 108 105 109 extern void iwmmxt_task_disable(struct thread_info *); 106 110 extern void iwmmxt_task_copy(struct thread_info *, void *);
+100 -84
include/asm-arm/uaccess.h
··· 41 41 extern int fixup_exception(struct pt_regs *regs); 42 42 43 43 /* 44 + * These two are intentionally not defined anywhere - if the kernel 45 + * code generates any references to them, that's a bug. 46 + */ 47 + extern int __get_user_bad(void); 48 + extern int __put_user_bad(void); 49 + 50 + /* 44 51 * Note that this is actually 0x1,0000,0000 45 52 */ 46 53 #define KERNEL_DS 0x00000000 47 - #define USER_DS TASK_SIZE 48 - 49 54 #define get_ds() (KERNEL_DS) 55 + 56 + #ifdef CONFIG_MMU 57 + 58 + #define USER_DS TASK_SIZE 50 59 #define get_fs() (current_thread_info()->addr_limit) 51 60 52 - static inline void set_fs (mm_segment_t fs) 61 + static inline void set_fs(mm_segment_t fs) 53 62 { 54 63 current_thread_info()->addr_limit = fs; 55 64 modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER); ··· 84 75 : "cc"); \ 85 76 flag; }) 86 77 87 - #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) 88 - 89 78 /* 90 79 * Single-value transfer routines. They automatically use the right 91 80 * size if we just have the right pointer type. Note that the functions ··· 94 87 * fixup code, but there are a few places where it intrudes on the 95 88 * main code path. When we only write to user space, there is no 96 89 * problem. 97 - * 98 - * The "__xxx" versions of the user access functions do not verify the 99 - * address space - it must have been done previously with a separate 100 - * "access_ok()" call. 101 - * 102 - * The "xxx_error" versions set the third argument to EFAULT if an 103 - * error occurs, and leave it unchanged on success. Note that these 104 - * versions are void (ie, don't return a value as such). 105 90 */ 106 - 107 91 extern int __get_user_1(void *); 108 92 extern int __get_user_2(void *); 109 93 extern int __get_user_4(void *); 110 - extern int __get_user_bad(void); 111 94 112 95 #define __get_user_x(__r2,__p,__e,__s,__i...) \ 113 96 __asm__ __volatile__ ( \ ··· 128 131 __e; \ 129 132 }) 130 133 134 + extern int __put_user_1(void *, unsigned int); 135 + extern int __put_user_2(void *, unsigned int); 136 + extern int __put_user_4(void *, unsigned int); 137 + extern int __put_user_8(void *, unsigned long long); 138 + 139 + #define __put_user_x(__r2,__p,__e,__s) \ 140 + __asm__ __volatile__ ( \ 141 + __asmeq("%0", "r0") __asmeq("%2", "r2") \ 142 + "bl __put_user_" #__s \ 143 + : "=&r" (__e) \ 144 + : "0" (__p), "r" (__r2) \ 145 + : "ip", "lr", "cc") 146 + 147 + #define put_user(x,p) \ 148 + ({ \ 149 + const register typeof(*(p)) __r2 asm("r2") = (x); \ 150 + const register typeof(*(p)) __user *__p asm("r0") = (p);\ 151 + register int __e asm("r0"); \ 152 + switch (sizeof(*(__p))) { \ 153 + case 1: \ 154 + __put_user_x(__r2, __p, __e, 1); \ 155 + break; \ 156 + case 2: \ 157 + __put_user_x(__r2, __p, __e, 2); \ 158 + break; \ 159 + case 4: \ 160 + __put_user_x(__r2, __p, __e, 4); \ 161 + break; \ 162 + case 8: \ 163 + __put_user_x(__r2, __p, __e, 8); \ 164 + break; \ 165 + default: __e = __put_user_bad(); break; \ 166 + } \ 167 + __e; \ 168 + }) 169 + 170 + #else /* CONFIG_MMU */ 171 + 172 + /* 173 + * uClinux has only one addr space, so has simplified address limits. 174 + */ 175 + #define USER_DS KERNEL_DS 176 + 177 + #define segment_eq(a,b) (1) 178 + #define __addr_ok(addr) (1) 179 + #define __range_ok(addr,size) (0) 180 + #define get_fs() (KERNEL_DS) 181 + 182 + static inline void set_fs(mm_segment_t fs) 183 + { 184 + } 185 + 186 + #define get_user(x,p) __get_user(x,p) 187 + #define put_user(x,p) __put_user(x,p) 188 + 189 + #endif /* CONFIG_MMU */ 190 + 191 + #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) 192 + 193 + /* 194 + * The "__xxx" versions of the user access functions do not verify the 195 + * address space - it must have been done previously with a separate 196 + * "access_ok()" call. 197 + * 198 + * The "xxx_error" versions set the third argument to EFAULT if an 199 + * error occurs, and leave it unchanged on success. Note that these 200 + * versions are void (ie, don't return a value as such). 201 + */ 131 202 #define __get_user(x,ptr) \ 132 203 ({ \ 133 204 long __gu_err = 0; \ ··· 276 211 : "+r" (err), "=&r" (x) \ 277 212 : "r" (addr), "i" (-EFAULT) \ 278 213 : "cc") 279 - 280 - extern int __put_user_1(void *, unsigned int); 281 - extern int __put_user_2(void *, unsigned int); 282 - extern int __put_user_4(void *, unsigned int); 283 - extern int __put_user_8(void *, unsigned long long); 284 - extern int __put_user_bad(void); 285 - 286 - #define __put_user_x(__r2,__p,__e,__s) \ 287 - __asm__ __volatile__ ( \ 288 - __asmeq("%0", "r0") __asmeq("%2", "r2") \ 289 - "bl __put_user_" #__s \ 290 - : "=&r" (__e) \ 291 - : "0" (__p), "r" (__r2) \ 292 - : "ip", "lr", "cc") 293 - 294 - #define put_user(x,p) \ 295 - ({ \ 296 - const register typeof(*(p)) __r2 asm("r2") = (x); \ 297 - const register typeof(*(p)) __user *__p asm("r0") = (p);\ 298 - register int __e asm("r0"); \ 299 - switch (sizeof(*(__p))) { \ 300 - case 1: \ 301 - __put_user_x(__r2, __p, __e, 1); \ 302 - break; \ 303 - case 2: \ 304 - __put_user_x(__r2, __p, __e, 2); \ 305 - break; \ 306 - case 4: \ 307 - __put_user_x(__r2, __p, __e, 4); \ 308 - break; \ 309 - case 8: \ 310 - __put_user_x(__r2, __p, __e, 8); \ 311 - break; \ 312 - default: __e = __put_user_bad(); break; \ 313 - } \ 314 - __e; \ 315 - }) 316 214 317 215 #define __put_user(x,ptr) \ 318 216 ({ \ ··· 381 353 : "r" (x), "i" (-EFAULT) \ 382 354 : "cc") 383 355 384 - extern unsigned long __arch_copy_from_user(void *to, const void __user *from, unsigned long n); 385 - extern unsigned long __arch_copy_to_user(void __user *to, const void *from, unsigned long n); 386 - extern unsigned long __arch_clear_user(void __user *addr, unsigned long n); 387 - extern unsigned long __arch_strncpy_from_user(char *to, const char __user *from, unsigned long count); 388 - extern unsigned long __arch_strnlen_user(const char __user *s, long n); 356 + 357 + #ifdef CONFIG_MMU 358 + extern unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n); 359 + extern unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n); 360 + extern unsigned long __clear_user(void __user *addr, unsigned long n); 361 + #else 362 + #define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0) 363 + #define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0) 364 + #define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0) 365 + #endif 366 + 367 + extern unsigned long __strncpy_from_user(char *to, const char __user *from, unsigned long count); 368 + extern unsigned long __strnlen_user(const char __user *s, long n); 389 369 390 370 static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) 391 371 { 392 372 if (access_ok(VERIFY_READ, from, n)) 393 - n = __arch_copy_from_user(to, from, n); 373 + n = __copy_from_user(to, from, n); 394 374 else /* security hole - plug it */ 395 375 memzero(to, n); 396 376 return n; 397 377 } 398 378 399 - static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) 400 - { 401 - return __arch_copy_from_user(to, from, n); 402 - } 403 - 404 379 static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) 405 380 { 406 381 if (access_ok(VERIFY_WRITE, to, n)) 407 - n = __arch_copy_to_user(to, from, n); 382 + n = __copy_to_user(to, from, n); 408 383 return n; 409 - } 410 - 411 - static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) 412 - { 413 - return __arch_copy_to_user(to, from, n); 414 384 } 415 385 416 386 #define __copy_to_user_inatomic __copy_to_user 417 387 #define __copy_from_user_inatomic __copy_from_user 418 388 419 - static inline unsigned long clear_user (void __user *to, unsigned long n) 389 + static inline unsigned long clear_user(void __user *to, unsigned long n) 420 390 { 421 391 if (access_ok(VERIFY_WRITE, to, n)) 422 - n = __arch_clear_user(to, n); 392 + n = __clear_user(to, n); 423 393 return n; 424 394 } 425 395 426 - static inline unsigned long __clear_user (void __user *to, unsigned long n) 427 - { 428 - return __arch_clear_user(to, n); 429 - } 430 - 431 - static inline long strncpy_from_user (char *dst, const char __user *src, long count) 396 + static inline long strncpy_from_user(char *dst, const char __user *src, long count) 432 397 { 433 398 long res = -EFAULT; 434 399 if (access_ok(VERIFY_READ, src, 1)) 435 - res = __arch_strncpy_from_user(dst, src, count); 400 + res = __strncpy_from_user(dst, src, count); 436 401 return res; 437 - } 438 - 439 - static inline long __strncpy_from_user (char *dst, const char __user *src, long count) 440 - { 441 - return __arch_strncpy_from_user(dst, src, count); 442 402 } 443 403 444 404 #define strlen_user(s) strnlen_user(s, ~0UL >> 1) ··· 436 420 unsigned long res = 0; 437 421 438 422 if (__addr_ok(s)) 439 - res = __arch_strnlen_user(s, n); 423 + res = __strnlen_user(s, n); 440 424 441 425 return res; 442 426 }
+14
include/asm-arm/ucontext.h
··· 35 35 * bytes, to prevent unpredictable padding in the signal frame. 36 36 */ 37 37 38 + #ifdef CONFIG_CRUNCH 39 + #define CRUNCH_MAGIC 0x5065cf03 40 + #define CRUNCH_STORAGE_SIZE (CRUNCH_SIZE + 8) 41 + 42 + struct crunch_sigframe { 43 + unsigned long magic; 44 + unsigned long size; 45 + struct crunch_state storage; 46 + } __attribute__((__aligned__(8))); 47 + #endif 48 + 38 49 #ifdef CONFIG_IWMMXT 39 50 /* iwmmxt_area is 0x98 bytes long, preceeded by 8 bytes of signature */ 40 51 #define IWMMXT_MAGIC 0x12ef842a ··· 85 74 * one of these. 86 75 */ 87 76 struct aux_sigframe { 77 + #ifdef CONFIG_CRUNCH 78 + struct crunch_sigframe crunch; 79 + #endif 88 80 #ifdef CONFIG_IWMMXT 89 81 struct iwmmxt_sigframe iwmmxt; 90 82 #endif
+28
include/asm-generic/vmlinux.lds.h
··· 58 58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ 59 59 } \ 60 60 \ 61 + /* Kernel symbol table: Normal unused symbols */ \ 62 + __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ 63 + VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ 64 + *(__ksymtab_unused) \ 65 + VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ 66 + } \ 67 + \ 68 + /* Kernel symbol table: GPL-only unused symbols */ \ 69 + __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ 70 + VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ 71 + *(__ksymtab_unused_gpl) \ 72 + VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ 73 + } \ 74 + \ 61 75 /* Kernel symbol table: GPL-future-only symbols */ \ 62 76 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ 63 77 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ ··· 91 77 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \ 92 78 *(__kcrctab_gpl) \ 93 79 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ 80 + } \ 81 + \ 82 + /* Kernel symbol table: Normal unused symbols */ \ 83 + __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \ 84 + VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \ 85 + *(__kcrctab_unused) \ 86 + VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \ 87 + } \ 88 + \ 89 + /* Kernel symbol table: GPL-only unused symbols */ \ 90 + __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ 91 + VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \ 92 + *(__kcrctab_unused_gpl) \ 93 + VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \ 94 94 } \ 95 95 \ 96 96 /* Kernel symbol table: GPL-future-only symbols */ \
+10
include/asm-ia64/sn/sn_sal.h
··· 85 85 #define SN_SAL_GET_PROM_FEATURE_SET 0x02000065 86 86 #define SN_SAL_SET_OS_FEATURE_SET 0x02000066 87 87 #define SN_SAL_INJECT_ERROR 0x02000067 88 + #define SN_SAL_SET_CPU_NUMBER 0x02000068 88 89 89 90 /* 90 91 * Service-specific constants ··· 1150 1149 (u64)ecc, 0, 0, 0, 0); 1151 1150 local_irq_restore(irq_flags); 1152 1151 return ret_stuff.status; 1152 + } 1153 + 1154 + static inline int 1155 + ia64_sn_set_cpu_number(int cpu) 1156 + { 1157 + struct ia64_sal_retval rv; 1158 + 1159 + SAL_CALL_NOLOCK(rv, SN_SAL_SET_CPU_NUMBER, cpu, 0, 0, 0, 0, 0, 0); 1160 + return rv.status; 1153 1161 } 1154 1162 #endif /* _ASM_IA64_SN_SN_SAL_H */
+6 -6
include/asm-m68knommu/bootstd.h
··· 52 52 __asm__ __volatile__ ("trap #2" \ 53 53 : "=g" (__res) \ 54 54 : "0" (__res) \ 55 - : "%d0"); \ 55 + ); \ 56 56 __bsc_return(type,__res); \ 57 57 } 58 58 ··· 64 64 __asm__ __volatile__ ("trap #2" \ 65 65 : "=g" (__res) \ 66 66 : "0" (__res), "d" (__a) \ 67 - : "%d0"); \ 67 + ); \ 68 68 __bsc_return(type,__res); \ 69 69 } 70 70 ··· 77 77 __asm__ __volatile__ ("trap #2" \ 78 78 : "=g" (__res) \ 79 79 : "0" (__res), "d" (__a), "d" (__b) \ 80 - : "%d0"); \ 80 + ); \ 81 81 __bsc_return(type,__res); \ 82 82 } 83 83 ··· 92 92 : "=g" (__res) \ 93 93 : "0" (__res), "d" (__a), "d" (__b), \ 94 94 "d" (__c) \ 95 - : "%d0"); \ 95 + ); \ 96 96 __bsc_return(type,__res); \ 97 97 } 98 98 ··· 108 108 : "=g" (__res) \ 109 109 : "0" (__res), "d" (__a), "d" (__b), \ 110 110 "d" (__c), "d" (__d) \ 111 - : "%d0"); \ 111 + ); \ 112 112 __bsc_return(type,__res); \ 113 113 } 114 114 ··· 125 125 : "=g" (__res) \ 126 126 : "0" (__res), "d" (__a), "d" (__b), \ 127 127 "d" (__c), "d" (__d), "d" (__e) \ 128 - : "%d0"); \ 128 + ); \ 129 129 __bsc_return(type,__res); \ 130 130 } 131 131
+1 -1
include/linux/ac97_codec.h
··· 259 259 int type; 260 260 u32 model; 261 261 262 - int modem:1; 262 + unsigned int modem:1; 263 263 264 264 struct ac97_ops *codec_ops; 265 265
+2 -2
include/linux/coda_linux.h
··· 27 27 extern struct inode_operations coda_file_inode_operations; 28 28 extern struct inode_operations coda_ioctl_inode_operations; 29 29 30 - extern struct address_space_operations coda_file_aops; 31 - extern struct address_space_operations coda_symlink_aops; 30 + extern const struct address_space_operations coda_file_aops; 31 + extern const struct address_space_operations coda_symlink_aops; 32 32 33 33 extern const struct file_operations coda_dir_operations; 34 34 extern const struct file_operations coda_file_operations;
+1 -1
include/linux/efs_fs.h
··· 38 38 39 39 extern struct inode_operations efs_dir_inode_operations; 40 40 extern const struct file_operations efs_dir_operations; 41 - extern struct address_space_operations efs_symlink_aops; 41 + extern const struct address_space_operations efs_symlink_aops; 42 42 43 43 extern void efs_read_inode(struct inode *); 44 44 extern efs_block_t efs_map_block(struct inode *, efs_block_t);
+2 -2
include/linux/fs.h
··· 392 392 unsigned int truncate_count; /* Cover race condition with truncate */ 393 393 unsigned long nrpages; /* number of total pages */ 394 394 pgoff_t writeback_index;/* writeback starts here */ 395 - struct address_space_operations *a_ops; /* methods */ 395 + const struct address_space_operations *a_ops; /* methods */ 396 396 unsigned long flags; /* error bits/gfp mask */ 397 397 struct backing_dev_info *backing_dev_info; /* device readahead, etc */ 398 398 spinlock_t private_lock; /* for use by the address_space */ ··· 1405 1405 extern void bdput(struct block_device *); 1406 1406 extern struct block_device *open_by_devnum(dev_t, unsigned); 1407 1407 extern const struct file_operations def_blk_fops; 1408 - extern struct address_space_operations def_blk_aops; 1408 + extern const struct address_space_operations def_blk_aops; 1409 1409 extern const struct file_operations def_chr_fops; 1410 1410 extern const struct file_operations bad_sock_fops; 1411 1411 extern const struct file_operations def_fifo_fops;
+1
include/linux/ide.h
··· 793 793 unsigned auto_poll : 1; /* supports nop auto-poll */ 794 794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 795 795 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ 796 + unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */ 796 797 797 798 struct device gendev; 798 799 struct completion gendev_rel_comp; /* To deal with device release() */
+1 -3
include/linux/kbd_kern.h
··· 155 155 { 156 156 unsigned long flags; 157 157 spin_lock_irqsave(&t->buf.lock, flags); 158 - if (t->buf.tail != NULL) { 159 - t->buf.tail->active = 0; 158 + if (t->buf.tail != NULL) 160 159 t->buf.tail->commit = t->buf.tail->used; 161 - } 162 160 spin_unlock_irqrestore(&t->buf.lock, flags); 163 161 schedule_work(&t->buf.work); 164 162 }
+20
include/linux/module.h
··· 203 203 #define EXPORT_SYMBOL_GPL_FUTURE(sym) \ 204 204 __EXPORT_SYMBOL(sym, "_gpl_future") 205 205 206 + 207 + #ifdef CONFIG_UNUSED_SYMBOLS 208 + #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") 209 + #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") 210 + #else 211 + #define EXPORT_UNUSED_SYMBOL(sym) 212 + #define EXPORT_UNUSED_SYMBOL_GPL(sym) 213 + #endif 214 + 206 215 #endif 207 216 208 217 struct module_ref ··· 269 260 const struct kernel_symbol *gpl_syms; 270 261 unsigned int num_gpl_syms; 271 262 const unsigned long *gpl_crcs; 263 + 264 + /* unused exported symbols. */ 265 + const struct kernel_symbol *unused_syms; 266 + unsigned int num_unused_syms; 267 + const unsigned long *unused_crcs; 268 + /* GPL-only, unused exported symbols. */ 269 + const struct kernel_symbol *unused_gpl_syms; 270 + unsigned int num_unused_gpl_syms; 271 + const unsigned long *unused_gpl_crcs; 272 272 273 273 /* symbols that will be GPL-only in the near future. */ 274 274 const struct kernel_symbol *gpl_future_syms; ··· 474 456 #define EXPORT_SYMBOL(sym) 475 457 #define EXPORT_SYMBOL_GPL(sym) 476 458 #define EXPORT_SYMBOL_GPL_FUTURE(sym) 459 + #define EXPORT_UNUSED_SYMBOL(sym) 460 + #define EXPORT_UNUSED_SYMBOL_GPL(sym) 477 461 478 462 /* Given an address, look for it in the exception tables. */ 479 463 static inline const struct exception_table_entry *
+1 -1
include/linux/nfs_fs.h
··· 335 335 extern struct inode_operations nfs3_file_inode_operations; 336 336 #endif /* CONFIG_NFS_V3 */ 337 337 extern const struct file_operations nfs_file_operations; 338 - extern struct address_space_operations nfs_file_aops; 338 + extern const struct address_space_operations nfs_file_aops; 339 339 340 340 static inline struct rpc_cred *nfs_file_cred(struct file *file) 341 341 {
+1
include/linux/plist.h
··· 73 73 #ifndef _LINUX_PLIST_H_ 74 74 #define _LINUX_PLIST_H_ 75 75 76 + #include <linux/kernel.h> 76 77 #include <linux/list.h> 77 78 #include <linux/spinlock_types.h> 78 79
+1 -1
include/linux/reiserfs_fs.h
··· 1973 1973 /* file.c */ 1974 1974 extern struct inode_operations reiserfs_file_inode_operations; 1975 1975 extern const struct file_operations reiserfs_file_operations; 1976 - extern struct address_space_operations reiserfs_address_space_operations; 1976 + extern const struct address_space_operations reiserfs_address_space_operations; 1977 1977 1978 1978 /* fix_nodes.c */ 1979 1979
+5 -1
include/linux/spi/spi.h
··· 642 642 u16 bus_num; 643 643 u16 chip_select; 644 644 645 + /* mode becomes spi_device.mode, and is essential for chips 646 + * where the default of SPI_CS_HIGH = 0 is wrong. 647 + */ 648 + u8 mode; 649 + 645 650 /* ... may need additional spi_device chip config data here. 646 651 * avoid stuff protocol drivers can set; but include stuff 647 652 * needed to behave without being bound to a driver: 648 - * - chipselect polarity 649 653 * - quirks like clock rate mattering when not selected 650 654 */ 651 655 };
-2
include/linux/tty.h
··· 57 57 unsigned char *flag_buf_ptr; 58 58 int used; 59 59 int size; 60 - int active; 61 60 int commit; 62 61 int read; 63 62 /* Data points here */ ··· 258 259 #define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 259 260 #define TTY_PUSH 6 /* n_tty private */ 260 261 #define TTY_CLOSING 7 /* ->close() in progress */ 261 - #define TTY_DONT_FLIP 8 /* Defer buffer flip */ 262 262 #define TTY_LDISC 9 /* Line discipline attached */ 263 263 #define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ 264 264 #define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
+1 -1
include/linux/tty_flip.h
··· 12 12 unsigned char ch, char flag) 13 13 { 14 14 struct tty_buffer *tb = tty->buf.tail; 15 - if (tb && tb->active && tb->used < tb->size) { 15 + if (tb && tb->used < tb->size) { 16 16 tb->flag_buf_ptr[tb->used] = flag; 17 17 tb->char_buf_ptr[tb->used++] = ch; 18 18 return 1;
+1 -1
include/linux/ufs_fs.h
··· 966 966 extern struct inode_operations ufs_file_inode_operations; 967 967 extern const struct file_operations ufs_file_operations; 968 968 969 - extern struct address_space_operations ufs_aops; 969 + extern const struct address_space_operations ufs_aops; 970 970 971 971 /* ialloc.c */ 972 972 extern void ufs_free_inode (struct inode *inode);
+7 -3
include/linux/watchdog.h
··· 28 28 #define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) 29 29 #define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) 30 30 #define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) 31 + #define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int) 32 + #define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int) 33 + #define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int) 31 34 32 35 #define WDIOF_UNKNOWN -1 /* Unknown flag error */ 33 36 #define WDIOS_UNKNOWN -1 /* Unknown status error */ ··· 41 38 #define WDIOF_EXTERN2 0x0008 /* External relay 2 */ 42 39 #define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ 43 40 #define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ 44 - #define WDIOF_POWEROVER 0x0040 /* Power over voltage */ 45 - #define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ 46 - #define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ 41 + #define WDIOF_POWEROVER 0x0040 /* Power over voltage */ 42 + #define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ 43 + #define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ 44 + #define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */ 47 45 #define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ 48 46 49 47 #define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
+95 -6
kernel/module.c
··· 1 - /* Rewritten by Rusty Russell, on the backs of many others... 1 + /* 2 2 Copyright (C) 2002 Richard Henderson 3 3 Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM. 4 4 ··· 122 122 extern const struct kernel_symbol __stop___ksymtab_gpl[]; 123 123 extern const struct kernel_symbol __start___ksymtab_gpl_future[]; 124 124 extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; 125 + extern const struct kernel_symbol __start___ksymtab_unused[]; 126 + extern const struct kernel_symbol __stop___ksymtab_unused[]; 127 + extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; 128 + extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; 129 + extern const struct kernel_symbol __start___ksymtab_gpl_future[]; 130 + extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; 125 131 extern const unsigned long __start___kcrctab[]; 126 132 extern const unsigned long __start___kcrctab_gpl[]; 127 133 extern const unsigned long __start___kcrctab_gpl_future[]; 134 + extern const unsigned long __start___kcrctab_unused[]; 135 + extern const unsigned long __start___kcrctab_unused_gpl[]; 128 136 129 137 #ifndef CONFIG_MODVERSIONS 130 138 #define symversion(base, idx) NULL ··· 150 142 if (strcmp(ks->name, name) == 0) 151 143 return ks; 152 144 return NULL; 145 + } 146 + 147 + static void printk_unused_warning(const char *name) 148 + { 149 + printk(KERN_WARNING "Symbol %s is marked as UNUSED, " 150 + "however this module is using it.\n", name); 151 + printk(KERN_WARNING "This symbol will go away in the future.\n"); 152 + printk(KERN_WARNING "Please evalute if this is the right api to use, " 153 + "and if it really is, submit a report the linux kernel " 154 + "mailinglist together with submitting your code for " 155 + "inclusion.\n"); 153 156 } 154 157 155 158 /* Find a symbol, return value, crc and module which owns it */ ··· 205 186 return ks->value; 206 187 } 207 188 189 + ks = lookup_symbol(name, __start___ksymtab_unused, 190 + __stop___ksymtab_unused); 191 + if (ks) { 192 + printk_unused_warning(name); 193 + *crc = symversion(__start___kcrctab_unused, 194 + (ks - __start___ksymtab_unused)); 195 + return ks->value; 196 + } 197 + 198 + if (gplok) 199 + ks = lookup_symbol(name, __start___ksymtab_unused_gpl, 200 + __stop___ksymtab_unused_gpl); 201 + if (ks) { 202 + printk_unused_warning(name); 203 + *crc = symversion(__start___kcrctab_unused_gpl, 204 + (ks - __start___ksymtab_unused_gpl)); 205 + return ks->value; 206 + } 207 + 208 208 /* Now try modules. */ 209 209 list_for_each_entry(mod, &modules, list) { 210 210 *owner = mod; ··· 239 201 if (ks) { 240 202 *crc = symversion(mod->gpl_crcs, 241 203 (ks - mod->gpl_syms)); 204 + return ks->value; 205 + } 206 + } 207 + ks = lookup_symbol(name, mod->unused_syms, mod->unused_syms + mod->num_unused_syms); 208 + if (ks) { 209 + printk_unused_warning(name); 210 + *crc = symversion(mod->unused_crcs, (ks - mod->unused_syms)); 211 + return ks->value; 212 + } 213 + 214 + if (gplok) { 215 + ks = lookup_symbol(name, mod->unused_gpl_syms, 216 + mod->unused_gpl_syms + mod->num_unused_gpl_syms); 217 + if (ks) { 218 + printk_unused_warning(name); 219 + *crc = symversion(mod->unused_gpl_crcs, 220 + (ks - mod->unused_gpl_syms)); 242 221 return ks->value; 243 222 } 244 223 } ··· 1458 1403 Elf_Ehdr *hdr; 1459 1404 Elf_Shdr *sechdrs; 1460 1405 char *secstrings, *args, *modmagic, *strtab = NULL; 1461 - unsigned int i, symindex = 0, strindex = 0, setupindex, exindex, 1462 - exportindex, modindex, obsparmindex, infoindex, gplindex, 1463 - crcindex, gplcrcindex, versindex, pcpuindex, gplfutureindex, 1464 - gplfuturecrcindex, unwindex = 0; 1406 + unsigned int i; 1407 + unsigned int symindex = 0; 1408 + unsigned int strindex = 0; 1409 + unsigned int setupindex; 1410 + unsigned int exindex; 1411 + unsigned int exportindex; 1412 + unsigned int modindex; 1413 + unsigned int obsparmindex; 1414 + unsigned int infoindex; 1415 + unsigned int gplindex; 1416 + unsigned int crcindex; 1417 + unsigned int gplcrcindex; 1418 + unsigned int versindex; 1419 + unsigned int pcpuindex; 1420 + unsigned int gplfutureindex; 1421 + unsigned int gplfuturecrcindex; 1422 + unsigned int unwindex = 0; 1423 + unsigned int unusedindex; 1424 + unsigned int unusedcrcindex; 1425 + unsigned int unusedgplindex; 1426 + unsigned int unusedgplcrcindex; 1465 1427 struct module *mod; 1466 1428 long err = 0; 1467 1429 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ ··· 1559 1487 exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab"); 1560 1488 gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl"); 1561 1489 gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future"); 1490 + unusedindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused"); 1491 + unusedgplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused_gpl"); 1562 1492 crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab"); 1563 1493 gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl"); 1564 1494 gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future"); 1495 + unusedcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused"); 1496 + unusedgplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused_gpl"); 1565 1497 setupindex = find_sec(hdr, sechdrs, secstrings, "__param"); 1566 1498 exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table"); 1567 1499 obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm"); ··· 1714 1638 mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr; 1715 1639 mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size / 1716 1640 sizeof(*mod->gpl_future_syms); 1641 + mod->num_unused_syms = sechdrs[unusedindex].sh_size / 1642 + sizeof(*mod->unused_syms); 1643 + mod->num_unused_gpl_syms = sechdrs[unusedgplindex].sh_size / 1644 + sizeof(*mod->unused_gpl_syms); 1717 1645 mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr; 1718 1646 if (gplfuturecrcindex) 1719 1647 mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr; 1720 1648 1649 + mod->unused_syms = (void *)sechdrs[unusedindex].sh_addr; 1650 + if (unusedcrcindex) 1651 + mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr; 1652 + mod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr; 1653 + if (unusedgplcrcindex) 1654 + mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr; 1655 + 1721 1656 #ifdef CONFIG_MODVERSIONS 1722 1657 if ((mod->num_syms && !crcindex) || 1723 1658 (mod->num_gpl_syms && !gplcrcindex) || 1724 - (mod->num_gpl_future_syms && !gplfuturecrcindex)) { 1659 + (mod->num_gpl_future_syms && !gplfuturecrcindex) || 1660 + (mod->num_unused_syms && !unusedcrcindex) || 1661 + (mod->num_unused_gpl_syms && !unusedgplcrcindex)) { 1725 1662 printk(KERN_WARNING "%s: No versions for exported symbols." 1726 1663 " Tainting kernel.\n", mod->name); 1727 1664 add_taint(TAINT_FORCED_MODULE);
+16
lib/Kconfig.debug
··· 23 23 keys are documented in <file:Documentation/sysrq.txt>. Don't say Y 24 24 unless you really know what this hack does. 25 25 26 + config UNUSED_SYMBOLS 27 + bool "Enable unused/obsolete exported symbols" 28 + default y if X86 29 + help 30 + Unused but exported symbols make the kernel needlessly bigger. For 31 + that reason most of these unused exports will soon be removed. This 32 + option is provided temporarily to provide a transition period in case 33 + some external kernel module needs one of these symbols anyway. If you 34 + encounter such a case in your module, consider if you are actually 35 + using the right API. (rationale: since nobody in the kernel is using 36 + this in a module, there is a pretty good chance it's actually the 37 + wrong interface to use). If you really need the symbol, please send a 38 + mail to the linux kernel mailing list mentioning the symbol and why 39 + you really need it, and what the merge plan to the mainline kernel for 40 + your module is. 41 + 26 42 config DEBUG_KERNEL 27 43 bool "Kernel debugging" 28 44 help
+1 -1
lib/vsprintf.c
··· 489 489 if (str < end) 490 490 *str = '\0'; 491 491 else 492 - *end = '\0'; 492 + end[-1] = '\0'; 493 493 } 494 494 /* the trailing null byte doesn't count towards the total */ 495 495 return str-buf;
+2 -2
mm/filemap.c
··· 2069 2069 { 2070 2070 struct file *file = iocb->ki_filp; 2071 2071 struct address_space * mapping = file->f_mapping; 2072 - struct address_space_operations *a_ops = mapping->a_ops; 2072 + const struct address_space_operations *a_ops = mapping->a_ops; 2073 2073 struct inode *inode = mapping->host; 2074 2074 long status = 0; 2075 2075 struct page *page; ··· 2219 2219 unsigned long nr_segs, loff_t *ppos) 2220 2220 { 2221 2221 struct file *file = iocb->ki_filp; 2222 - struct address_space * mapping = file->f_mapping; 2222 + const struct address_space * mapping = file->f_mapping; 2223 2223 size_t ocount; /* original count */ 2224 2224 size_t count; /* after file limit checks */ 2225 2225 struct inode *inode = mapping->host;
+1 -1
mm/filemap_xip.c
··· 273 273 size_t count, loff_t pos, loff_t *ppos) 274 274 { 275 275 struct address_space * mapping = filp->f_mapping; 276 - struct address_space_operations *a_ops = mapping->a_ops; 276 + const struct address_space_operations *a_ops = mapping->a_ops; 277 277 struct inode *inode = mapping->host; 278 278 long status = 0; 279 279 struct page *page;
+2 -2
mm/shmem.c
··· 174 174 } 175 175 176 176 static struct super_operations shmem_ops; 177 - static struct address_space_operations shmem_aops; 177 + static const struct address_space_operations shmem_aops; 178 178 static struct file_operations shmem_file_operations; 179 179 static struct inode_operations shmem_inode_operations; 180 180 static struct inode_operations shmem_dir_inode_operations; ··· 2162 2162 printk(KERN_INFO "shmem_inode_cache: not all structures were freed\n"); 2163 2163 } 2164 2164 2165 - static struct address_space_operations shmem_aops = { 2165 + static const struct address_space_operations shmem_aops = { 2166 2166 .writepage = shmem_writepage, 2167 2167 .set_page_dirty = __set_page_dirty_nobuffers, 2168 2168 #ifdef CONFIG_TMPFS
+1 -1
mm/swap_state.c
··· 24 24 * vmscan's shrink_list, to make sync_page look nicer, and to allow 25 25 * future use of radix_tree tags in the swap cache. 26 26 */ 27 - static struct address_space_operations swap_aops = { 27 + static const struct address_space_operations swap_aops = { 28 28 .writepage = swap_writepage, 29 29 .sync_page = block_sync_page, 30 30 .set_page_dirty = __set_page_dirty_nobuffers,
+2 -6
net/bluetooth/rfcomm/tty.c
··· 480 480 481 481 BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len); 482 482 483 - if (test_bit(TTY_DONT_FLIP, &tty->flags)) { 484 - tty_buffer_request_room(tty, skb->len); 485 - tty_insert_flip_string(tty, skb->data, skb->len); 486 - tty_flip_buffer_push(tty); 487 - } else 488 - tty->ldisc.receive_buf(tty, skb->data, NULL, skb->len); 483 + tty_insert_flip_string(tty, skb->data, skb->len); 484 + tty_flip_buffer_push(tty); 489 485 490 486 kfree_skb(skb); 491 487 }
+1 -1
sound/oss/cs4232.c
··· 405 405 406 406 MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table); 407 407 408 - static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) 408 + static int __init cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) 409 409 { 410 410 struct address_info *isapnpcfg; 411 411
+1 -1
sound/oss/via82cxxx_audio.c
··· 309 309 unsigned sixchannel: 1; /* 8233/35 with 6 channel support */ 310 310 unsigned volume: 1; 311 311 312 - int locked_rate : 1; 312 + unsigned locked_rate : 1; 313 313 314 314 int mixer_vol; /* 8233/35 volume - not yet implemented */ 315 315