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

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