aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-28 23:27:48 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-06-28 23:27:48 -0400
commit9f2fa466383ce100b90fe52cb4489d7a26bf72a9 (patch)
tree7b72b1fae85137435d5b98f4614df2195f612acc
parent607f31e80b6f982d7c0dd7a5045377fc368fe507 (diff)
parent0a6047eef1c465c38aacfbdab193161b3f0cd144 (diff)
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
-rw-r--r--Documentation/feature-removal-schedule.txt10
-rw-r--r--Documentation/watchdog/pcwd-watchdog.txt75
-rw-r--r--Documentation/watchdog/src/watchdog-simple.c15
-rw-r--r--Documentation/watchdog/src/watchdog-test.c68
-rw-r--r--Documentation/watchdog/watchdog-api.txt56
-rw-r--r--Documentation/watchdog/watchdog.txt23
-rw-r--r--arch/arm/Kconfig9
-rw-r--r--arch/arm/kernel/Makefile3
-rw-r--r--arch/arm/kernel/armksyms.c13
-rw-r--r--arch/arm/kernel/asm-offsets.c3
-rw-r--r--arch/arm/kernel/crunch-bits.S305
-rw-r--r--arch/arm/kernel/crunch.c83
-rw-r--r--arch/arm/kernel/entry-armv.S6
-rw-r--r--arch/arm/kernel/ptrace.c36
-rw-r--r--arch/arm/kernel/signal.c39
-rw-r--r--arch/arm/kernel/vmlinux.lds.S8
-rw-r--r--arch/arm/lib/Makefile13
-rw-r--r--arch/arm/lib/backtrace.S5
-rw-r--r--arch/arm/lib/clear_user.S4
-rw-r--r--arch/arm/lib/copy_from_user.S4
-rw-r--r--arch/arm/lib/copy_to_user.S4
-rw-r--r--arch/arm/lib/strncpy_from_user.S2
-rw-r--r--arch/arm/lib/strnlen_user.S4
-rw-r--r--arch/arm/lib/uaccess.S8
-rw-r--r--arch/arm/mach-ep93xx/Kconfig11
-rw-r--r--arch/arm/mach-ep93xx/Makefile1
-rw-r--r--arch/arm/mach-ep93xx/edb9315.c62
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c2
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c2
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c2
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c2
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c2
-rw-r--r--arch/arm/mach-pxa/irq.c4
-rw-r--r--arch/arm/mach-s3c2410/s3c244x.c1
-rw-r--r--arch/arm/mm/Kconfig67
-rw-r--r--arch/arm/mm/Makefile10
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm/mm/iomap.c55
-rw-r--r--arch/arm/mm/ioremap.c47
-rw-r--r--arch/arm/mm/nommu.c39
-rw-r--r--arch/arm/mm/proc-arm1020.S9
-rw-r--r--arch/arm/mm/proc-arm1020e.S9
-rw-r--r--arch/arm/mm/proc-arm1022.S9
-rw-r--r--arch/arm/mm/proc-arm1026.S9
-rw-r--r--arch/arm/mm/proc-arm6_7.S15
-rw-r--r--arch/arm/mm/proc-arm720.S12
-rw-r--r--arch/arm/mm/proc-arm920.S9
-rw-r--r--arch/arm/mm/proc-arm922.S9
-rw-r--r--arch/arm/mm/proc-arm925.S10
-rw-r--r--arch/arm/mm/proc-arm926.S9
-rw-r--r--arch/arm/mm/proc-sa110.S11
-rw-r--r--arch/arm/mm/proc-sa1100.S11
-rw-r--r--arch/arm/mm/proc-v6.S7
-rw-r--r--arch/i386/kernel/irq.c6
-rw-r--r--arch/ia64/configs/tiger_defconfig2
-rw-r--r--arch/ia64/kernel/palinfo.c2
-rw-r--r--arch/ia64/sn/kernel/setup.c12
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c2
-rw-r--r--arch/m68knommu/Kconfig53
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S66
-rw-r--r--arch/m68knommu/platform/68328/Makefile1
-rw-r--r--arch/m68knommu/platform/68328/ints.c20
-rw-r--r--arch/m68knommu/platform/68328/romvec.S37
-rw-r--r--arch/m68knommu/platform/68360/config.c14
-rw-r--r--arch/m68knommu/platform/68360/ints.c1
-rw-r--r--arch/m68knommu/platform/68EZ328/config.c14
-rw-r--r--arch/m68knommu/platform/68VZ328/config.c14
-rw-r--r--arch/powerpc/platforms/powermac/backlight.c14
-rw-r--r--arch/x86_64/kernel/irq.c6
-rw-r--r--arch/x86_64/kernel/nmi.c2
-rw-r--r--drivers/block/loop.c4
-rw-r--r--drivers/block/rd.c2
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c7
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c67
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c18
-rw-r--r--drivers/char/istallion.c1819
-rw-r--r--drivers/char/mxser.c1
-rw-r--r--drivers/char/n_tty.c6
-rw-r--r--drivers/char/pty.c2
-rw-r--r--drivers/char/stallion.c3
-rw-r--r--drivers/char/tty_io.c68
-rw-r--r--drivers/char/watchdog/at91_wdt.c82
-rw-r--r--drivers/char/watchdog/i8xx_tco.c28
-rw-r--r--drivers/char/watchdog/pcwd_pci.c30
-rw-r--r--drivers/char/watchdog/pcwd_usb.c23
-rw-r--r--drivers/ide/ide-io.c2
-rw-r--r--drivers/ide/ide-iops.c4
-rw-r--r--drivers/ide/pci/aec62xx.c16
-rw-r--r--drivers/ide/pci/cmd64x.c15
-rw-r--r--drivers/ide/pci/pdc202xx_new.c2
-rw-r--r--drivers/ide/pci/pdc202xx_old.c115
-rw-r--r--drivers/ide/pci/sc1200.c4
-rw-r--r--drivers/ide/pci/serverworks.c53
-rw-r--r--drivers/ide/pci/siimage.c62
-rw-r--r--drivers/ide/pci/sl82c105.c4
-rw-r--r--drivers/ide/pci/slc90e66.c11
-rw-r--r--drivers/input/joystick/db9.c2
-rw-r--r--drivers/input/keyboard/atkbd.c2
-rw-r--r--drivers/input/misc/wistron_btns.c19
-rw-r--r--drivers/rtc/Kconfig10
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/rtc-rs5c348.c246
-rw-r--r--drivers/serial/68328serial.c102
-rw-r--r--drivers/serial/crisv10.c6
-rw-r--r--drivers/serial/jsm/jsm_tty.c7
-rw-r--r--drivers/spi/spi.c1
-rw-r--r--drivers/usb/serial/ir-usb.c3
-rw-r--r--drivers/video/aty/radeon_backlight.c6
-rw-r--r--fs/9p/mux.c2
-rw-r--r--fs/9p/v9fs_vfs.h2
-rw-r--r--fs/9p/vfs_addr.c2
-rw-r--r--fs/9p/vfs_inode.c2
-rw-r--r--fs/adfs/inode.c2
-rw-r--r--fs/affs/affs.h6
-rw-r--r--fs/affs/file.c4
-rw-r--r--fs/affs/symlink.c2
-rw-r--r--fs/afs/file.c2
-rw-r--r--fs/afs/internal.h2
-rw-r--r--fs/befs/linuxvfs.c2
-rw-r--r--fs/bfs/bfs.h2
-rw-r--r--fs/bfs/file.c2
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/cifs/cifsfs.h4
-rw-r--r--fs/cifs/file.c4
-rw-r--r--fs/coda/symlink.c2
-rw-r--r--fs/configfs/inode.c2
-rw-r--r--fs/cramfs/inode.c4
-rw-r--r--fs/efs/inode.c2
-rw-r--r--fs/efs/symlink.c2
-rw-r--r--fs/ext2/ext2.h6
-rw-r--r--fs/ext2/inode.c6
-rw-r--r--fs/ext3/inode.c6
-rw-r--r--fs/fat/inode.c2
-rw-r--r--fs/freevxfs/vxfs_immed.c2
-rw-r--r--fs/freevxfs/vxfs_inode.c6
-rw-r--r--fs/freevxfs/vxfs_subr.c2
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/hfs/hfs_fs.h4
-rw-r--r--fs/hfs/inode.c4
-rw-r--r--fs/hfsplus/hfsplus_fs.h4
-rw-r--r--fs/hfsplus/inode.c4
-rw-r--r--fs/hostfs/hostfs_kern.c6
-rw-r--r--fs/hpfs/file.c2
-rw-r--r--fs/hpfs/hpfs_fn.h4
-rw-r--r--fs/hpfs/namei.c2
-rw-r--r--fs/hugetlbfs/inode.c4
-rw-r--r--fs/inode.c2
-rw-r--r--fs/isofs/compress.c2
-rw-r--r--fs/isofs/inode.c2
-rw-r--r--fs/isofs/isofs.h2
-rw-r--r--fs/isofs/rock.c2
-rw-r--r--fs/isofs/zisofs.h2
-rw-r--r--fs/jffs/inode-v23.c4
-rw-r--r--fs/jffs2/file.c2
-rw-r--r--fs/jffs2/os-linux.h2
-rw-r--r--fs/jfs/inode.c2
-rw-r--r--fs/jfs/jfs_inode.h2
-rw-r--r--fs/jfs/jfs_metapage.c2
-rw-r--r--fs/jfs/jfs_metapage.h2
-rw-r--r--fs/minix/inode.c2
-rw-r--r--fs/ncpfs/inode.c2
-rw-r--r--fs/ncpfs/symlink.c2
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/ntfs/aops.c4
-rw-r--r--fs/ntfs/ntfs.h4
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/ocfs2/inode.h2
-rw-r--r--fs/qnx4/inode.c2
-rw-r--r--fs/ramfs/file-mmu.c2
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/ramfs/internal.h2
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/romfs/inode.c2
-rw-r--r--fs/smbfs/file.c2
-rw-r--r--fs/smbfs/proto.h2
-rw-r--r--fs/sysfs/inode.c2
-rw-r--r--fs/sysv/itree.c2
-rw-r--r--fs/sysv/sysv.h2
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/udf/inode.c2
-rw-r--r--fs/udf/symlink.c2
-rw-r--r--fs/udf/udfdecl.h6
-rw-r--r--fs/ufs/inode.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c2
-rw-r--r--include/asm-arm/arch-at91rm9200/memory.h2
-rw-r--r--include/asm-arm/arch-h720x/memory.h2
-rw-r--r--include/asm-arm/arch-imx/memory.h6
-rw-r--r--include/asm-arm/arch-ixp23xx/ixp23xx.h11
-rw-r--r--include/asm-arm/arch-ixp23xx/platform.h10
-rw-r--r--include/asm-arm/arch-ixp23xx/uncompress.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-dsc.h16
-rw-r--r--include/asm-arm/bugs.h4
-rw-r--r--include/asm-arm/domain.h7
-rw-r--r--include/asm-arm/fpstate.h8
-rw-r--r--include/asm-arm/mach/map.h9
-rw-r--r--include/asm-arm/memory.h75
-rw-r--r--include/asm-arm/mmu.h16
-rw-r--r--include/asm-arm/mmu_context.h2
-rw-r--r--include/asm-arm/page-nommu.h51
-rw-r--r--include/asm-arm/page.h8
-rw-r--r--include/asm-arm/pgalloc.h8
-rw-r--r--include/asm-arm/pgtable-nommu.h123
-rw-r--r--include/asm-arm/pgtable.h10
-rw-r--r--include/asm-arm/proc-fns.h4
-rw-r--r--include/asm-arm/ptrace.h5
-rw-r--r--include/asm-arm/thread_info.h6
-rw-r--r--include/asm-arm/uaccess.h184
-rw-r--r--include/asm-arm/ucontext.h14
-rw-r--r--include/asm-generic/vmlinux.lds.h28
-rw-r--r--include/asm-ia64/sn/sn_sal.h10
-rw-r--r--include/asm-m68knommu/bootstd.h12
-rw-r--r--include/linux/ac97_codec.h2
-rw-r--r--include/linux/coda_linux.h4
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/fs.h4
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/kbd_kern.h4
-rw-r--r--include/linux/module.h20
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/plist.h1
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_flip.h2
-rw-r--r--include/linux/ufs_fs.h2
-rw-r--r--include/linux/watchdog.h10
-rw-r--r--kernel/module.c101
-rw-r--r--lib/Kconfig.debug16
-rw-r--r--lib/vsprintf.c2
-rw-r--r--mm/filemap.c4
-rw-r--r--mm/filemap_xip.c2
-rw-r--r--mm/shmem.c4
-rw-r--r--mm/swap_state.c2
-rw-r--r--net/bluetooth/rfcomm/tty.c8
-rw-r--r--sound/oss/cs4232.c2
-rw-r--r--sound/oss/via82cxxx_audio.c2
239 files changed, 3173 insertions, 2232 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 027285d0c26c..033ac91da07a 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -177,6 +177,16 @@ Who: Jean Delvare <khali@linux-fr.org>
177 177
178--------------------------- 178---------------------------
179 179
180What: 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.
183When: before 2.6.19
184Why: Unused symbols are both increasing the size of the kernel binary
185 and are often a sign of "wrong API"
186Who: Arjan van de Ven <arjan@linux.intel.com>
187
188---------------------------
189
180What: remove EXPORT_SYMBOL(tasklist_lock) 190What: remove EXPORT_SYMBOL(tasklist_lock)
181When: August 2006 191When: August 2006
182Files: kernel/fork.c 192Files: kernel/fork.c
diff --git a/Documentation/watchdog/pcwd-watchdog.txt b/Documentation/watchdog/pcwd-watchdog.txt
index 12187a33e310..d9ee6336c1d4 100644
--- a/Documentation/watchdog/pcwd-watchdog.txt
+++ b/Documentation/watchdog/pcwd-watchdog.txt
@@ -22,78 +22,9 @@
22 to run the program with an "&" to run it in the background!) 22 to run the program with an "&" to run it in the background!)
23 23
24 If you want to write a program to be compatible with the PC Watchdog 24 If you want to write a program to be compatible with the PC Watchdog
25 driver, simply do the following: 25 driver, simply use of modify the watchdog test program:
26 26 Documentation/watchdog/src/watchdog-test.c
27-- Snippet of code -- 27
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
41int 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 */
48void 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 */
59int main(int argc, char *argv[])
60{
61 fd = open("/dev/watchdog", O_WRONLY);
62
63 if (fd == -1) {
64 fprintf(stderr, "Watchdog device not enabled.\n");
65 fflush(stderr);
66 exit(-1);
67 }
68
69 if (argc > 1) {
70 if (!strncasecmp(argv[1], "-d", 2)) {
71 ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);
72 fprintf(stderr, "Watchdog card disabled.\n");
73 fflush(stderr);
74 exit(0);
75 } else if (!strncasecmp(argv[1], "-e", 2)) {
76 ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);
77 fprintf(stderr, "Watchdog card enabled.\n");
78 fflush(stderr);
79 exit(0);
80 } else {
81 fprintf(stderr, "-d to disable, -e to enable.\n");
82 fprintf(stderr, "run by itself to tick the card.\n");
83 fflush(stderr);
84 exit(0);
85 }
86 } else {
87 fprintf(stderr, "Watchdog Ticking Away!\n");
88 fflush(stderr);
89 }
90
91 while(1) {
92 keep_alive();
93 sleep(1);
94 }
95}
96-- End snippet --
97 28
98 Other IOCTL functions include: 29 Other IOCTL functions include:
99 30
diff --git a/Documentation/watchdog/src/watchdog-simple.c b/Documentation/watchdog/src/watchdog-simple.c
new file mode 100644
index 000000000000..85cf17c48669
--- /dev/null
+++ b/Documentation/watchdog/src/watchdog-simple.c
@@ -0,0 +1,15 @@
1#include <stdlib.h>
2#include <fcntl.h>
3
4int 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}
diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c
new file mode 100644
index 000000000000..65f6c19cb865
--- /dev/null
+++ b/Documentation/watchdog/src/watchdog-test.c
@@ -0,0 +1,68 @@
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
14int 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 */
21void 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 */
32int 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}
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt
index 21ed51173662..958ff3d48be3 100644
--- a/Documentation/watchdog/watchdog-api.txt
+++ b/Documentation/watchdog/watchdog-api.txt
@@ -34,22 +34,7 @@ activates as soon as /dev/watchdog is opened and will reboot unless
34the watchdog is pinged within a certain time, this time is called the 34the watchdog is pinged within a certain time, this time is called the
35timeout or margin. The simplest way to ping the watchdog is to write 35timeout or margin. The simplest way to ping the watchdog is to write
36some data to the device. So a very simple watchdog daemon would look 36some data to the device. So a very simple watchdog daemon would look
37like this: 37like this source file: see Documentation/watchdog/src/watchdog-simple.c
38
39#include <stdlib.h>
40#include <fcntl.h>
41
42int 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 38
54A more advanced driver could for example check that a HTTP server is 39A more advanced driver could for example check that a HTTP server is
55still responding before doing the write call to ping the watchdog. 40still responding before doing the write call to ping the watchdog.
@@ -110,7 +95,40 @@ current timeout using the GETTIMEOUT ioctl.
110 ioctl(fd, WDIOC_GETTIMEOUT, &timeout); 95 ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
111 printf("The timeout was is %d seconds\n", timeout); 96 printf("The timeout was is %d seconds\n", timeout);
112 97
113Envinronmental monitoring: 98Pretimeouts:
99
100Some watchdog timers can be set to have a trigger go off before the
101actual time they will reset the system. This can be done with an NMI,
102interrupt, or other mechanism. This allows Linux to record useful
103information (like panic information and kernel coredumps) before it
104resets.
105
106 pretimeout = 10;
107 ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout);
108
109Note that the pretimeout is the number of seconds before the time
110when the timeout will go off. It is not the number of seconds until
111the pretimeout. So, for instance, if you set the timeout to 60 seconds
112and the pretimeout to 10 seconds, the pretimout will go of in 50
113seconds. Setting a pretimeout to zero disables it.
114
115There is also a get function for getting the pretimeout:
116
117 ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout);
118 printf("The pretimeout was is %d seconds\n", timeout);
119
120Not all watchdog drivers will support a pretimeout.
121
122Get the number of seconds before reboot:
123
124Some watchdog drivers have the ability to report the remaining time
125before the system will reboot. The WDIOC_GETTIMELEFT is the ioctl
126that returns the number of seconds before reboot.
127
128 ioctl(fd, WDIOC_GETTIMELEFT, &timeleft);
129 printf("The timeout was is %d seconds\n", timeleft);
130
131Environmental monitoring:
114 132
115All watchdog drivers are required return more information about the system, 133All watchdog drivers are required return more information about the system,
116some do temperature, fan and power level monitoring, some can tell you 134some do temperature, fan and power level monitoring, some can tell you
@@ -169,6 +187,10 @@ The watchdog saw a keepalive ping since it was last queried.
169 187
170 WDIOF_SETTIMEOUT Can set/get the timeout 188 WDIOF_SETTIMEOUT Can set/get the timeout
171 189
190The watchdog can do pretimeouts.
191
192 WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set
193
172 194
173For those drivers that return any bits set in the option field, the 195For those drivers that return any bits set in the option field, the
174GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current 196GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current
diff --git a/Documentation/watchdog/watchdog.txt b/Documentation/watchdog/watchdog.txt
index dffda29c8799..4b1ff69cc19a 100644
--- a/Documentation/watchdog/watchdog.txt
+++ b/Documentation/watchdog/watchdog.txt
@@ -65,28 +65,7 @@ The external event interfaces on the WDT boards are not currently supported.
65Minor numbers are however allocated for it. 65Minor numbers are however allocated for it.
66 66
67 67
68Example Watchdog Driver 68Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c
69-----------------------
70
71#include <stdio.h>
72#include <unistd.h>
73#include <fcntl.h>
74
75int 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 69
91 70
92Contact Information 71Contact Information
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3d1a3fb7d5fc..f123c7c9fc98 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -188,23 +188,27 @@ config ARCH_IMX
188 188
189config ARCH_IOP3XX 189config ARCH_IOP3XX
190 bool "IOP3xx-based" 190 bool "IOP3xx-based"
191 depends on MMU
191 select PCI 192 select PCI
192 help 193 help
193 Support for Intel's IOP3XX (XScale) family of processors. 194 Support for Intel's IOP3XX (XScale) family of processors.
194 195
195config ARCH_IXP4XX 196config ARCH_IXP4XX
196 bool "IXP4xx-based" 197 bool "IXP4xx-based"
198 depends on MMU
197 help 199 help
198 Support for Intel's IXP4XX (XScale) family of processors. 200 Support for Intel's IXP4XX (XScale) family of processors.
199 201
200config ARCH_IXP2000 202config ARCH_IXP2000
201 bool "IXP2400/2800-based" 203 bool "IXP2400/2800-based"
204 depends on MMU
202 select PCI 205 select PCI
203 help 206 help
204 Support for Intel's IXP2400/2800 (XScale) family of processors. 207 Support for Intel's IXP2400/2800 (XScale) family of processors.
205 208
206config ARCH_IXP23XX 209config ARCH_IXP23XX
207 bool "IXP23XX-based" 210 bool "IXP23XX-based"
211 depends on MMU
208 select PCI 212 select PCI
209 help 213 help
210 Support for Intel's IXP23xx (XScale) family of processors. 214 Support for Intel's IXP23xx (XScale) family of processors.
@@ -229,6 +233,7 @@ config ARCH_PNX4008
229 233
230config ARCH_PXA 234config ARCH_PXA
231 bool "PXA2xx-based" 235 bool "PXA2xx-based"
236 depends on MMU
232 select ARCH_MTD_XIP 237 select ARCH_MTD_XIP
233 help 238 help
234 Support for Intel's PXA2XX processor line. 239 Support for Intel's PXA2XX processor line.
@@ -339,6 +344,10 @@ config XSCALE_PMU
339 depends on CPU_XSCALE && !XSCALE_PMU_TIMER 344 depends on CPU_XSCALE && !XSCALE_PMU_TIMER
340 default y 345 default y
341 346
347if !MMU
348source "arch/arm/Kconfig-nommu"
349endif
350
342endmenu 351endmenu
343 352
344source "arch/arm/common/Kconfig" 353source "arch/arm/common/Kconfig"
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index a601b8b55f35..7cffbaef064b 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -22,6 +22,9 @@ obj-$(CONFIG_PCI) += bios32.o
22obj-$(CONFIG_SMP) += smp.o 22obj-$(CONFIG_SMP) += smp.o
23obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o 23obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
24 24
25obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
26AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
27
25obj-$(CONFIG_IWMMXT) += iwmmxt.o 28obj-$(CONFIG_IWMMXT) += iwmmxt.o
26AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 29AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
27 30
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index c49b5d4d7fca..da69e660574b 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -109,11 +109,13 @@ EXPORT_SYMBOL(memchr);
109EXPORT_SYMBOL(__memzero); 109EXPORT_SYMBOL(__memzero);
110 110
111 /* user mem (segment) */ 111 /* user mem (segment) */
112EXPORT_SYMBOL(__arch_copy_from_user); 112EXPORT_SYMBOL(__strnlen_user);
113EXPORT_SYMBOL(__arch_copy_to_user); 113EXPORT_SYMBOL(__strncpy_from_user);
114EXPORT_SYMBOL(__arch_clear_user); 114
115EXPORT_SYMBOL(__arch_strnlen_user); 115#ifdef CONFIG_MMU
116EXPORT_SYMBOL(__arch_strncpy_from_user); 116EXPORT_SYMBOL(__copy_from_user);
117EXPORT_SYMBOL(__copy_to_user);
118EXPORT_SYMBOL(__clear_user);
117 119
118EXPORT_SYMBOL(__get_user_1); 120EXPORT_SYMBOL(__get_user_1);
119EXPORT_SYMBOL(__get_user_2); 121EXPORT_SYMBOL(__get_user_2);
@@ -123,6 +125,7 @@ EXPORT_SYMBOL(__put_user_1);
123EXPORT_SYMBOL(__put_user_2); 125EXPORT_SYMBOL(__put_user_2);
124EXPORT_SYMBOL(__put_user_4); 126EXPORT_SYMBOL(__put_user_4);
125EXPORT_SYMBOL(__put_user_8); 127EXPORT_SYMBOL(__put_user_8);
128#endif
126 129
127 /* crypto hash */ 130 /* crypto hash */
128EXPORT_SYMBOL(sha_transform); 131EXPORT_SYMBOL(sha_transform);
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 396efba9bacd..447ede5143a8 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -60,6 +60,9 @@ int main(void)
60#ifdef CONFIG_IWMMXT 60#ifdef CONFIG_IWMMXT
61 DEFINE(TI_IWMMXT_STATE, offsetof(struct thread_info, fpstate.iwmmxt)); 61 DEFINE(TI_IWMMXT_STATE, offsetof(struct thread_info, fpstate.iwmmxt));
62#endif 62#endif
63#ifdef CONFIG_CRUNCH
64 DEFINE(TI_CRUNCH_STATE, offsetof(struct thread_info, crunchstate));
65#endif
63 BLANK(); 66 BLANK();
64 DEFINE(S_R0, offsetof(struct pt_regs, ARM_r0)); 67 DEFINE(S_R0, offsetof(struct pt_regs, ARM_r0));
65 DEFINE(S_R1, offsetof(struct pt_regs, ARM_r1)); 68 DEFINE(S_R1, offsetof(struct pt_regs, ARM_r1));
diff --git a/arch/arm/kernel/crunch-bits.S b/arch/arm/kernel/crunch-bits.S
new file mode 100644
index 000000000000..a26886758c67
--- /dev/null
+++ b/arch/arm/kernel/crunch-bits.S
@@ -0,0 +1,305 @@
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 */
67ENTRY(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
93crunch_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
147crunch_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 */
201ENTRY(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
2381: 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 */
249ENTRY(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
2671: @ 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 */
282ENTRY(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
2991: @ 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
diff --git a/arch/arm/kernel/crunch.c b/arch/arm/kernel/crunch.c
new file mode 100644
index 000000000000..748175921f9b
--- /dev/null
+++ b/arch/arm/kernel/crunch.c
@@ -0,0 +1,83 @@
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
23struct crunch_state *crunch_owner;
24
25void 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
33static int crunch_enabled(u32 devcfg)
34{
35 return !!(devcfg & EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE);
36}
37
38static 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
72static struct notifier_block crunch_notifier_block = {
73 .notifier_call = crunch_do,
74};
75
76static int __init crunch_init(void)
77{
78 thread_register_notifier(&crunch_notifier_block);
79
80 return 0;
81}
82
83late_initcall(crunch_init);
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 86c92523a346..6423a38839b8 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -492,9 +492,15 @@ call_fpe:
492 b do_fpe @ CP#1 (FPE) 492 b do_fpe @ CP#1 (FPE)
493 b do_fpe @ CP#2 (FPE) 493 b do_fpe @ CP#2 (FPE)
494 mov pc, lr @ CP#3 494 mov pc, lr @ CP#3
495#ifdef CONFIG_CRUNCH
496 b crunch_task_enable @ CP#4 (MaverickCrunch)
497 b crunch_task_enable @ CP#5 (MaverickCrunch)
498 b crunch_task_enable @ CP#6 (MaverickCrunch)
499#else
495 mov pc, lr @ CP#4 500 mov pc, lr @ CP#4
496 mov pc, lr @ CP#5 501 mov pc, lr @ CP#5
497 mov pc, lr @ CP#6 502 mov pc, lr @ CP#6
503#endif
498 mov pc, lr @ CP#7 504 mov pc, lr @ CP#7
499 mov pc, lr @ CP#8 505 mov pc, lr @ CP#8
500 mov pc, lr @ CP#9 506 mov pc, lr @ CP#9
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index a1d1b2906e8d..c40bdc770054 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -634,6 +634,32 @@ static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp)
634 634
635#endif 635#endif
636 636
637#ifdef CONFIG_CRUNCH
638/*
639 * Get the child Crunch state.
640 */
641static 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 */
653static 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
637long arch_ptrace(struct task_struct *child, long request, long addr, long data) 663long arch_ptrace(struct task_struct *child, long request, long addr, long data)
638{ 664{
639 unsigned long tmp; 665 unsigned long tmp;
@@ -765,6 +791,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
765 child->ptrace_message = data; 791 child->ptrace_message = data;
766 break; 792 break;
767 793
794#ifdef CONFIG_CRUNCH
795 case PTRACE_GETCRUNCHREGS:
796 ret = ptrace_getcrunchregs(child, (void __user *)data);
797 break;
798
799 case PTRACE_SETCRUNCHREGS:
800 ret = ptrace_setcrunchregs(child, (void __user *)data);
801 break;
802#endif
803
768 default: 804 default:
769 ret = ptrace_request(child, request, addr, data); 805 ret = ptrace_request(child, request, addr, data);
770 break; 806 break;
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 1ce05ec086c6..83a8d3c95eb3 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -132,6 +132,37 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
132 return ret; 132 return ret;
133} 133}
134 134
135#ifdef CONFIG_CRUNCH
136static 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
149static int restore_crunch_context(struct crunch_sigframe *frame)
150{
151 char kbuf[sizeof(*frame) + 8];
152 struct crunch_sigframe *kframe;
153
154 /* the crunch context must be 64 bit aligned */
155 kframe = (struct crunch_sigframe *)((unsigned long)(kbuf + 8) & ~7);
156 if (__copy_from_user(kframe, frame, sizeof(*frame)))
157 return -1;
158 if (kframe->magic != CRUNCH_MAGIC ||
159 kframe->size != CRUNCH_STORAGE_SIZE)
160 return -1;
161 crunch_task_restore(current_thread_info(), &kframe->storage);
162 return 0;
163}
164#endif
165
135#ifdef CONFIG_IWMMXT 166#ifdef CONFIG_IWMMXT
136 167
137static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame) 168static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame)
@@ -214,6 +245,10 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
214 err |= !valid_user_regs(regs); 245 err |= !valid_user_regs(regs);
215 246
216 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; 247 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace;
248#ifdef CONFIG_CRUNCH
249 if (err == 0)
250 err |= restore_crunch_context(&aux->crunch);
251#endif
217#ifdef CONFIG_IWMMXT 252#ifdef CONFIG_IWMMXT
218 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 253 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT))
219 err |= restore_iwmmxt_context(&aux->iwmmxt); 254 err |= restore_iwmmxt_context(&aux->iwmmxt);
@@ -333,6 +368,10 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
333 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); 368 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set));
334 369
335 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; 370 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace;
371#ifdef CONFIG_CRUNCH
372 if (err == 0)
373 err |= preserve_crunch_context(&aux->crunch);
374#endif
336#ifdef CONFIG_IWMMXT 375#ifdef CONFIG_IWMMXT
337 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 376 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT))
338 err |= preserve_iwmmxt_context(&aux->iwmmxt); 377 err |= preserve_iwmmxt_context(&aux->iwmmxt);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 2b254e88595c..2df9688a7028 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -80,6 +80,10 @@ SECTIONS
80 *(.exit.text) 80 *(.exit.text)
81 *(.exit.data) 81 *(.exit.data)
82 *(.exitcall.exit) 82 *(.exitcall.exit)
83#ifndef CONFIG_MMU
84 *(.fixup)
85 *(__ex_table)
86#endif
83 } 87 }
84 88
85 .text : { /* Real text segment */ 89 .text : { /* Real text segment */
@@ -87,7 +91,9 @@ SECTIONS
87 *(.text) 91 *(.text)
88 SCHED_TEXT 92 SCHED_TEXT
89 LOCK_TEXT 93 LOCK_TEXT
94#ifdef CONFIG_MMU
90 *(.fixup) 95 *(.fixup)
96#endif
91 *(.gnu.warning) 97 *(.gnu.warning)
92 *(.rodata) 98 *(.rodata)
93 *(.rodata.*) 99 *(.rodata.*)
@@ -142,7 +148,9 @@ SECTIONS
142 */ 148 */
143 . = ALIGN(32); 149 . = ALIGN(32);
144 __start___ex_table = .; 150 __start___ex_table = .;
151#ifdef CONFIG_MMU
145 *(__ex_table) 152 *(__ex_table)
153#endif
146 __stop___ex_table = .; 154 __stop___ex_table = .;
147 155
148 /* 156 /*
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 7b726b627ea5..30351cd4560d 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -6,28 +6,31 @@
6 6
7lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ 7lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
8 csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ 8 csumpartialcopy.o csumpartialcopyuser.o clearbit.o \
9 copy_page.o delay.o findbit.o memchr.o memcpy.o \ 9 delay.o findbit.o memchr.o memcpy.o \
10 memmove.o memset.o memzero.o setbit.o \ 10 memmove.o memset.o memzero.o setbit.o \
11 strncpy_from_user.o strnlen_user.o \ 11 strncpy_from_user.o strnlen_user.o \
12 strchr.o strrchr.o \ 12 strchr.o strrchr.o \
13 testchangebit.o testclearbit.o testsetbit.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 \ 14 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
16 ucmpdi2.o lib1funcs.o div64.o sha1.o \ 15 ucmpdi2.o lib1funcs.o div64.o sha1.o \
17 io-readsb.o io-writesb.o io-readsl.o io-writesl.o 16 io-readsb.o io-writesb.o io-readsl.o io-writesl.o
18 17
18mmu-y := clear_user.o copy_page.o getuser.o putuser.o
19
19# the code in uaccess.S is not preemption safe and 20# the code in uaccess.S is not preemption safe and
20# probably faster on ARMv3 only 21# probably faster on ARMv3 only
21ifeq ($(CONFIG_PREEMPT),y) 22ifeq ($(CONFIG_PREEMPT),y)
22 lib-y += copy_from_user.o copy_to_user.o 23 mmu-y += copy_from_user.o copy_to_user.o
23else 24else
24ifneq ($(CONFIG_CPU_32v3),y) 25ifneq ($(CONFIG_CPU_32v3),y)
25 lib-y += copy_from_user.o copy_to_user.o 26 mmu-y += copy_from_user.o copy_to_user.o
26else 27else
27 lib-y += uaccess.o 28 mmu-y += uaccess.o
28endif 29endif
29endif 30endif
30 31
32lib-$(CONFIG_MMU) += $(mmu-y)
33
31ifeq ($(CONFIG_CPU_32v3),y) 34ifeq ($(CONFIG_CPU_32v3),y)
32 lib-y += io-readsw-armv3.o io-writesw-armv3.o 35 lib-y += io-readsw-armv3.o io-writesw-armv3.o
33else 36else
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S
index 058b80d72aa1..91f993f2e9db 100644
--- a/arch/arm/lib/backtrace.S
+++ b/arch/arm/lib/backtrace.S
@@ -97,16 +97,13 @@ ENTRY(c_backtrace)
97 b 1007f 97 b 1007f
98 98
99/* 99/*
100 * Fixup for LDMDB 100 * Fixup for LDMDB. Note that this must not be in the fixup section.
101 */ 101 */
102 .section .fixup,"ax"
103 .align 0
1041007: ldr r0, =.Lbad 1021007: ldr r0, =.Lbad
105 mov r1, frame 103 mov r1, frame
106 bl printk 104 bl printk
107 ldmfd sp!, {r4 - r8, pc} 105 ldmfd sp!, {r4 - r8, pc}
108 .ltorg 106 .ltorg
109 .previous
110 107
111 .section __ex_table,"a" 108 .section __ex_table,"a"
112 .align 3 109 .align 3
diff --git a/arch/arm/lib/clear_user.S b/arch/arm/lib/clear_user.S
index ea435ae2e4a5..ecb28dcdaf7b 100644
--- a/arch/arm/lib/clear_user.S
+++ b/arch/arm/lib/clear_user.S
@@ -12,13 +12,13 @@
12 12
13 .text 13 .text
14 14
15/* Prototype: int __arch_clear_user(void *addr, size_t sz) 15/* Prototype: int __clear_user(void *addr, size_t sz)
16 * Purpose : clear some user memory 16 * Purpose : clear some user memory
17 * Params : addr - user memory address to clear 17 * Params : addr - user memory address to clear
18 * : sz - number of bytes to clear 18 * : sz - number of bytes to clear
19 * Returns : number of bytes NOT cleared 19 * Returns : number of bytes NOT cleared
20 */ 20 */
21ENTRY(__arch_clear_user) 21ENTRY(__clear_user)
22 stmfd sp!, {r1, lr} 22 stmfd sp!, {r1, lr}
23 mov r2, #0 23 mov r2, #0
24 cmp r1, #4 24 cmp r1, #4
diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S
index 7497393a0e81..6b7363ce749c 100644
--- a/arch/arm/lib/copy_from_user.S
+++ b/arch/arm/lib/copy_from_user.S
@@ -16,7 +16,7 @@
16/* 16/*
17 * Prototype: 17 * Prototype:
18 * 18 *
19 * size_t __arch_copy_from_user(void *to, const void *from, size_t n) 19 * size_t __copy_from_user(void *to, const void *from, size_t n)
20 * 20 *
21 * Purpose: 21 * Purpose:
22 * 22 *
@@ -83,7 +83,7 @@
83 83
84 .text 84 .text
85 85
86ENTRY(__arch_copy_from_user) 86ENTRY(__copy_from_user)
87 87
88#include "copy_template.S" 88#include "copy_template.S"
89 89
diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S
index 4a6d8ea14022..5224d94688d9 100644
--- a/arch/arm/lib/copy_to_user.S
+++ b/arch/arm/lib/copy_to_user.S
@@ -16,7 +16,7 @@
16/* 16/*
17 * Prototype: 17 * Prototype:
18 * 18 *
19 * size_t __arch_copy_to_user(void *to, const void *from, size_t n) 19 * size_t __copy_to_user(void *to, const void *from, size_t n)
20 * 20 *
21 * Purpose: 21 * Purpose:
22 * 22 *
@@ -86,7 +86,7 @@
86 86
87 .text 87 .text
88 88
89ENTRY(__arch_copy_to_user) 89ENTRY(__copy_to_user)
90 90
91#include "copy_template.S" 91#include "copy_template.S"
92 92
diff --git a/arch/arm/lib/strncpy_from_user.S b/arch/arm/lib/strncpy_from_user.S
index 35649f04fcac..36e3741a3772 100644
--- a/arch/arm/lib/strncpy_from_user.S
+++ b/arch/arm/lib/strncpy_from_user.S
@@ -20,7 +20,7 @@
20 * returns the number of characters copied (strlen of copied string), 20 * returns the number of characters copied (strlen of copied string),
21 * -EFAULT on exception, or "len" if we fill the whole buffer 21 * -EFAULT on exception, or "len" if we fill the whole buffer
22 */ 22 */
23ENTRY(__arch_strncpy_from_user) 23ENTRY(__strncpy_from_user)
24 mov ip, r1 24 mov ip, r1
251: subs r2, r2, #1 251: subs r2, r2, #1
26USER( ldrplbt r3, [r1], #1) 26USER( ldrplbt r3, [r1], #1)
diff --git a/arch/arm/lib/strnlen_user.S b/arch/arm/lib/strnlen_user.S
index 3668a15991ef..18d8fa4f925a 100644
--- a/arch/arm/lib/strnlen_user.S
+++ b/arch/arm/lib/strnlen_user.S
@@ -14,13 +14,13 @@
14 .text 14 .text
15 .align 5 15 .align 5
16 16
17/* Prototype: unsigned long __arch_strnlen_user(const char *str, long n) 17/* Prototype: unsigned long __strnlen_user(const char *str, long n)
18 * Purpose : get length of a string in user memory 18 * Purpose : get length of a string in user memory
19 * Params : str - address of string in user memory 19 * Params : str - address of string in user memory
20 * Returns : length of string *including terminator* 20 * Returns : length of string *including terminator*
21 * or zero on exception, or n + 1 if too long 21 * or zero on exception, or n + 1 if too long
22 */ 22 */
23ENTRY(__arch_strnlen_user) 23ENTRY(__strnlen_user)
24 mov r2, r0 24 mov r2, r0
251: 251:
26USER( ldrbt r3, [r0], #1) 26USER( ldrbt r3, [r0], #1)
diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S
index 1f1545d737be..b48bd6d5fd83 100644
--- a/arch/arm/lib/uaccess.S
+++ b/arch/arm/lib/uaccess.S
@@ -19,7 +19,7 @@
19 19
20#define PAGE_SHIFT 12 20#define PAGE_SHIFT 12
21 21
22/* Prototype: int __arch_copy_to_user(void *to, const char *from, size_t n) 22/* Prototype: int __copy_to_user(void *to, const char *from, size_t n)
23 * Purpose : copy a block to user memory from kernel memory 23 * Purpose : copy a block to user memory from kernel memory
24 * Params : to - user memory 24 * Params : to - user memory
25 * : from - kernel memory 25 * : from - kernel memory
@@ -39,7 +39,7 @@ USER( strgtbt r3, [r0], #1) @ May fault
39 sub r2, r2, ip 39 sub r2, r2, ip
40 b .Lc2u_dest_aligned 40 b .Lc2u_dest_aligned
41 41
42ENTRY(__arch_copy_to_user) 42ENTRY(__copy_to_user)
43 stmfd sp!, {r2, r4 - r7, lr} 43 stmfd sp!, {r2, r4 - r7, lr}
44 cmp r2, #4 44 cmp r2, #4
45 blt .Lc2u_not_enough 45 blt .Lc2u_not_enough
@@ -283,7 +283,7 @@ USER( strgtbt r3, [r0], #1) @ May fault
2839001: ldmfd sp!, {r0, r4 - r7, pc} 2839001: ldmfd sp!, {r0, r4 - r7, pc}
284 .previous 284 .previous
285 285
286/* Prototype: unsigned long __arch_copy_from_user(void *to,const void *from,unsigned long n); 286/* Prototype: unsigned long __copy_from_user(void *to,const void *from,unsigned long n);
287 * Purpose : copy a block from user memory to kernel memory 287 * Purpose : copy a block from user memory to kernel memory
288 * Params : to - kernel memory 288 * Params : to - kernel memory
289 * : from - user memory 289 * : from - user memory
@@ -302,7 +302,7 @@ USER( ldrgtbt r3, [r1], #1) @ May fault
302 sub r2, r2, ip 302 sub r2, r2, ip
303 b .Lcfu_dest_aligned 303 b .Lcfu_dest_aligned
304 304
305ENTRY(__arch_copy_from_user) 305ENTRY(__copy_from_user)
306 stmfd sp!, {r0, r2, r4 - r7, lr} 306 stmfd sp!, {r0, r2, r4 - r7, lr}
307 cmp r2, #4 307 cmp r2, #4
308 blt .Lcfu_not_enough 308 blt .Lcfu_not_enough
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index cec5a21ca4e3..e15e4c54a253 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -2,8 +2,19 @@ if ARCH_EP93XX
2 2
3menu "Cirrus EP93xx Implementation Options" 3menu "Cirrus EP93xx Implementation Options"
4 4
5config CRUNCH
6 bool "Support for MaverickCrunch"
7 help
8 Enable kernel support for MaverickCrunch.
9
5comment "EP93xx Platforms" 10comment "EP93xx Platforms"
6 11
12config 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
7config MACH_GESBC9312 18config MACH_GESBC9312
8 bool "Support Glomation GESBC-9312-sx" 19 bool "Support Glomation GESBC-9312-sx"
9 help 20 help
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index 05a48a21038e..dfa7e2e8a18b 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -6,5 +6,6 @@ obj-m :=
6obj-n := 6obj-n :=
7obj- := 7obj- :=
8 8
9obj-$(CONFIG_MACH_EDB9315) += edb9315.o
9obj-$(CONFIG_MACH_GESBC9312) += gesbc9312.o 10obj-$(CONFIG_MACH_GESBC9312) += gesbc9312.o
10obj-$(CONFIG_MACH_TS72XX) += ts72xx.o 11obj-$(CONFIG_MACH_TS72XX) += ts72xx.o
diff --git a/arch/arm/mach-ep93xx/edb9315.c b/arch/arm/mach-ep93xx/edb9315.c
new file mode 100644
index 000000000000..ef7482faad81
--- /dev/null
+++ b/arch/arm/mach-ep93xx/edb9315.c
@@ -0,0 +1,62 @@
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
27static struct physmap_flash_data edb9315_flash_data = {
28 .width = 4,
29};
30
31static struct resource edb9315_flash_resource = {
32 .start = 0x60000000,
33 .end = 0x61ffffff,
34 .flags = IORESOURCE_MEM,
35};
36
37static 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
47static void __init edb9315_init_machine(void)
48{
49 ep93xx_init_devices();
50 platform_device_register(&edb9315_flash);
51}
52
53MACHINE_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,
62MACHINE_END
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index 47cc6c8b7c79..2c28d66d260e 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -30,7 +30,7 @@ static struct physmap_flash_data gesbc9312_flash_data = {
30 30
31static struct resource gesbc9312_flash_resource = { 31static struct resource gesbc9312_flash_resource = {
32 .start = 0x60000000, 32 .start = 0x60000000,
33 .end = 0x60800000, 33 .end = 0x607fffff,
34 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
35}; 35};
36 36
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index 6e5a56cd5ae8..0b3b875b1875 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -118,7 +118,7 @@ static struct physmap_flash_data ts72xx_flash_data = {
118 118
119static struct resource ts72xx_flash_resource = { 119static struct resource ts72xx_flash_resource = {
120 .start = TS72XX_NOR_PHYS_BASE, 120 .start = TS72XX_NOR_PHYS_BASE,
121 .end = TS72XX_NOR_PHYS_BASE + 0x01000000, 121 .end = TS72XX_NOR_PHYS_BASE + 0x00ffffff,
122 .flags = IORESOURCE_MEM, 122 .flags = IORESOURCE_MEM,
123}; 123};
124 124
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
index dc5e489c70bc..357351fbb1e2 100644
--- a/arch/arm/mach-ixp23xx/espresso.c
+++ b/arch/arm/mach-ixp23xx/espresso.c
@@ -59,7 +59,7 @@ static struct physmap_flash_data espresso_flash_data = {
59 59
60static struct resource espresso_flash_resource = { 60static struct resource espresso_flash_resource = {
61 .start = 0x90000000, 61 .start = 0x90000000,
62 .end = 0x92000000, 62 .end = 0x91ffffff,
63 .flags = IORESOURCE_MEM, 63 .flags = IORESOURCE_MEM,
64}; 64};
65 65
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
index 535b334ee045..e0886871cc77 100644
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -304,7 +304,7 @@ static struct physmap_flash_data ixdp2351_flash_data = {
304 304
305static struct resource ixdp2351_flash_resource = { 305static struct resource ixdp2351_flash_resource = {
306 .start = 0x90000000, 306 .start = 0x90000000,
307 .end = 0x94000000, 307 .end = 0x93ffffff,
308 .flags = IORESOURCE_MEM, 308 .flags = IORESOURCE_MEM,
309}; 309};
310 310
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
index b9f5d13fcfe1..92ad18f41251 100644
--- a/arch/arm/mach-ixp23xx/roadrunner.c
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -143,7 +143,7 @@ static struct physmap_flash_data roadrunner_flash_data = {
143 143
144static struct resource roadrunner_flash_resource = { 144static struct resource roadrunner_flash_resource = {
145 .start = 0x90000000, 145 .start = 0x90000000,
146 .end = 0x94000000, 146 .end = 0x93ffffff,
147 .flags = IORESOURCE_MEM, 147 .flags = IORESOURCE_MEM,
148}; 148};
149 149
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 539b596005fc..d9635ff4b10c 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -88,8 +88,8 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
88 88
89 if (type == IRQT_PROBE) { 89 if (type == IRQT_PROBE) {
90 /* Don't mess with enabled GPIOs using preconfigured edges or 90 /* Don't mess with enabled GPIOs using preconfigured edges or
91 GPIOs set to alternate function during probe */ 91 GPIOs set to alternate function or to output during probe */
92 if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx]) & 92 if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx] | GPDR(gpio)) &
93 GPIO_bit(gpio)) 93 GPIO_bit(gpio))
94 return 0; 94 return 0;
95 if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2))) 95 if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2)))
diff --git a/arch/arm/mach-s3c2410/s3c244x.c b/arch/arm/mach-s3c2410/s3c244x.c
index 838bc525e836..9a2258270de9 100644
--- a/arch/arm/mach-s3c2410/s3c244x.c
+++ b/arch/arm/mach-s3c2410/s3c244x.c
@@ -69,6 +69,7 @@ void __init s3c244x_map_io(struct map_desc *mach_desc, int size)
69 69
70 s3c_device_i2c.name = "s3c2440-i2c"; 70 s3c_device_i2c.name = "s3c2440-i2c";
71 s3c_device_nand.name = "s3c2440-nand"; 71 s3c_device_nand.name = "s3c2440-nand";
72 s3c_device_usbgadget.name = "s3c2440-usbgadget";
72} 73}
73 74
74void __init s3c244x_init_clocks(int xtal) 75void __init s3c244x_init_clocks(int xtal)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index ecf5e232a6fc..c4bca753165b 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -15,8 +15,8 @@ config CPU_ARM610
15 select CPU_32v3 15 select CPU_32v3
16 select CPU_CACHE_V3 16 select CPU_CACHE_V3
17 select CPU_CACHE_VIVT 17 select CPU_CACHE_VIVT
18 select CPU_COPY_V3 18 select CPU_COPY_V3 if MMU
19 select CPU_TLB_V3 19 select CPU_TLB_V3 if MMU
20 help 20 help
21 The ARM610 is the successor to the ARM3 processor 21 The ARM610 is the successor to the ARM3 processor
22 and was produced by VLSI Technology Inc. 22 and was produced by VLSI Technology Inc.
@@ -31,8 +31,8 @@ config CPU_ARM710
31 select CPU_32v3 31 select CPU_32v3
32 select CPU_CACHE_V3 32 select CPU_CACHE_V3
33 select CPU_CACHE_VIVT 33 select CPU_CACHE_VIVT
34 select CPU_COPY_V3 34 select CPU_COPY_V3 if MMU
35 select CPU_TLB_V3 35 select CPU_TLB_V3 if MMU
36 help 36 help
37 A 32-bit RISC microprocessor based on the ARM7 processor core 37 A 32-bit RISC microprocessor based on the ARM7 processor core
38 designed by Advanced RISC Machines Ltd. The ARM710 is the 38 designed by Advanced RISC Machines Ltd. The ARM710 is the
@@ -50,8 +50,8 @@ config CPU_ARM720T
50 select CPU_ABRT_LV4T 50 select CPU_ABRT_LV4T
51 select CPU_CACHE_V4 51 select CPU_CACHE_V4
52 select CPU_CACHE_VIVT 52 select CPU_CACHE_VIVT
53 select CPU_COPY_V4WT 53 select CPU_COPY_V4WT if MMU
54 select CPU_TLB_V4WT 54 select CPU_TLB_V4WT if MMU
55 help 55 help
56 A 32-bit RISC processor with 8kByte Cache, Write Buffer and 56 A 32-bit RISC processor with 8kByte Cache, Write Buffer and
57 MMU built around an ARM7TDMI core. 57 MMU built around an ARM7TDMI core.
@@ -68,8 +68,8 @@ config CPU_ARM920T
68 select CPU_ABRT_EV4T 68 select CPU_ABRT_EV4T
69 select CPU_CACHE_V4WT 69 select CPU_CACHE_V4WT
70 select CPU_CACHE_VIVT 70 select CPU_CACHE_VIVT
71 select CPU_COPY_V4WB 71 select CPU_COPY_V4WB if MMU
72 select CPU_TLB_V4WBI 72 select CPU_TLB_V4WBI if MMU
73 help 73 help
74 The ARM920T is licensed to be produced by numerous vendors, 74 The ARM920T is licensed to be produced by numerous vendors,
75 and is used in the Maverick EP9312 and the Samsung S3C2410. 75 and is used in the Maverick EP9312 and the Samsung S3C2410.
@@ -89,8 +89,8 @@ config CPU_ARM922T
89 select CPU_ABRT_EV4T 89 select CPU_ABRT_EV4T
90 select CPU_CACHE_V4WT 90 select CPU_CACHE_V4WT
91 select CPU_CACHE_VIVT 91 select CPU_CACHE_VIVT
92 select CPU_COPY_V4WB 92 select CPU_COPY_V4WB if MMU
93 select CPU_TLB_V4WBI 93 select CPU_TLB_V4WBI if MMU
94 help 94 help
95 The ARM922T is a version of the ARM920T, but with smaller 95 The ARM922T is a version of the ARM920T, but with smaller
96 instruction and data caches. It is used in Altera's 96 instruction and data caches. It is used in Altera's
@@ -108,8 +108,8 @@ config CPU_ARM925T
108 select CPU_ABRT_EV4T 108 select CPU_ABRT_EV4T
109 select CPU_CACHE_V4WT 109 select CPU_CACHE_V4WT
110 select CPU_CACHE_VIVT 110 select CPU_CACHE_VIVT
111 select CPU_COPY_V4WB 111 select CPU_COPY_V4WB if MMU
112 select CPU_TLB_V4WBI 112 select CPU_TLB_V4WBI if MMU
113 help 113 help
114 The ARM925T is a mix between the ARM920T and ARM926T, but with 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 115 different instruction and data caches. It is used in TI's OMAP
@@ -126,8 +126,8 @@ config CPU_ARM926T
126 select CPU_32v5 126 select CPU_32v5
127 select CPU_ABRT_EV5TJ 127 select CPU_ABRT_EV5TJ
128 select CPU_CACHE_VIVT 128 select CPU_CACHE_VIVT
129 select CPU_COPY_V4WB 129 select CPU_COPY_V4WB if MMU
130 select CPU_TLB_V4WBI 130 select CPU_TLB_V4WBI if MMU
131 help 131 help
132 This is a variant of the ARM920. It has slightly different 132 This is a variant of the ARM920. It has slightly different
133 instruction sequences for cache and TLB operations. Curiously, 133 instruction sequences for cache and TLB operations. Curiously,
@@ -144,8 +144,8 @@ config CPU_ARM1020
144 select CPU_ABRT_EV4T 144 select CPU_ABRT_EV4T
145 select CPU_CACHE_V4WT 145 select CPU_CACHE_V4WT
146 select CPU_CACHE_VIVT 146 select CPU_CACHE_VIVT
147 select CPU_COPY_V4WB 147 select CPU_COPY_V4WB if MMU
148 select CPU_TLB_V4WBI 148 select CPU_TLB_V4WBI if MMU
149 help 149 help
150 The ARM1020 is the 32K cached version of the ARM10 processor, 150 The ARM1020 is the 32K cached version of the ARM10 processor,
151 with an addition of a floating-point unit. 151 with an addition of a floating-point unit.
@@ -161,8 +161,8 @@ config CPU_ARM1020E
161 select CPU_ABRT_EV4T 161 select CPU_ABRT_EV4T
162 select CPU_CACHE_V4WT 162 select CPU_CACHE_V4WT
163 select CPU_CACHE_VIVT 163 select CPU_CACHE_VIVT
164 select CPU_COPY_V4WB 164 select CPU_COPY_V4WB if MMU
165 select CPU_TLB_V4WBI 165 select CPU_TLB_V4WBI if MMU
166 depends on n 166 depends on n
167 167
168# ARM1022E 168# ARM1022E
@@ -172,8 +172,8 @@ config CPU_ARM1022
172 select CPU_32v5 172 select CPU_32v5
173 select CPU_ABRT_EV4T 173 select CPU_ABRT_EV4T
174 select CPU_CACHE_VIVT 174 select CPU_CACHE_VIVT
175 select CPU_COPY_V4WB # can probably do better 175 select CPU_COPY_V4WB if MMU # can probably do better
176 select CPU_TLB_V4WBI 176 select CPU_TLB_V4WBI if MMU
177 help 177 help
178 The ARM1022E is an implementation of the ARMv5TE architecture 178 The ARM1022E is an implementation of the ARMv5TE architecture
179 based upon the ARM10 integer core with a 16KiB L1 Harvard cache, 179 based upon the ARM10 integer core with a 16KiB L1 Harvard cache,
@@ -189,8 +189,8 @@ config CPU_ARM1026
189 select CPU_32v5 189 select CPU_32v5
190 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10 190 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10
191 select CPU_CACHE_VIVT 191 select CPU_CACHE_VIVT
192 select CPU_COPY_V4WB # can probably do better 192 select CPU_COPY_V4WB if MMU # can probably do better
193 select CPU_TLB_V4WBI 193 select CPU_TLB_V4WBI if MMU
194 help 194 help
195 The ARM1026EJ-S is an implementation of the ARMv5TEJ architecture 195 The ARM1026EJ-S is an implementation of the ARMv5TEJ architecture
196 based upon the ARM10 integer core. 196 based upon the ARM10 integer core.
@@ -207,8 +207,8 @@ config CPU_SA110
207 select CPU_ABRT_EV4 207 select CPU_ABRT_EV4
208 select CPU_CACHE_V4WB 208 select CPU_CACHE_V4WB
209 select CPU_CACHE_VIVT 209 select CPU_CACHE_VIVT
210 select CPU_COPY_V4WB 210 select CPU_COPY_V4WB if MMU
211 select CPU_TLB_V4WB 211 select CPU_TLB_V4WB if MMU
212 help 212 help
213 The Intel StrongARM(R) SA-110 is a 32-bit microprocessor and 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. 214 is available at five speeds ranging from 100 MHz to 233 MHz.
@@ -227,7 +227,7 @@ config CPU_SA1100
227 select CPU_ABRT_EV4 227 select CPU_ABRT_EV4
228 select CPU_CACHE_V4WB 228 select CPU_CACHE_V4WB
229 select CPU_CACHE_VIVT 229 select CPU_CACHE_VIVT
230 select CPU_TLB_V4WB 230 select CPU_TLB_V4WB if MMU
231 231
232# XScale 232# XScale
233config CPU_XSCALE 233config CPU_XSCALE
@@ -237,7 +237,7 @@ config CPU_XSCALE
237 select CPU_32v5 237 select CPU_32v5
238 select CPU_ABRT_EV5T 238 select CPU_ABRT_EV5T
239 select CPU_CACHE_VIVT 239 select CPU_CACHE_VIVT
240 select CPU_TLB_V4WBI 240 select CPU_TLB_V4WBI if MMU
241 241
242# XScale Core Version 3 242# XScale Core Version 3
243config CPU_XSC3 243config CPU_XSC3
@@ -247,7 +247,7 @@ config CPU_XSC3
247 select CPU_32v5 247 select CPU_32v5
248 select CPU_ABRT_EV5T 248 select CPU_ABRT_EV5T
249 select CPU_CACHE_VIVT 249 select CPU_CACHE_VIVT
250 select CPU_TLB_V4WBI 250 select CPU_TLB_V4WBI if MMU
251 select IO_36 251 select IO_36
252 252
253# ARMv6 253# ARMv6
@@ -258,8 +258,8 @@ config CPU_V6
258 select CPU_ABRT_EV6 258 select CPU_ABRT_EV6
259 select CPU_CACHE_V6 259 select CPU_CACHE_V6
260 select CPU_CACHE_VIPT 260 select CPU_CACHE_VIPT
261 select CPU_COPY_V6 261 select CPU_COPY_V6 if MMU
262 select CPU_TLB_V6 262 select CPU_TLB_V6 if MMU
263 263
264# ARMv6k 264# ARMv6k
265config CPU_32v6K 265config CPU_32v6K
@@ -277,17 +277,17 @@ config CPU_32v6K
277# This defines the compiler instruction set which depends on the machine type. 277# This defines the compiler instruction set which depends on the machine type.
278config CPU_32v3 278config CPU_32v3
279 bool 279 bool
280 select TLS_REG_EMUL if SMP 280 select TLS_REG_EMUL if SMP || !MMU
281 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 281 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
282 282
283config CPU_32v4 283config CPU_32v4
284 bool 284 bool
285 select TLS_REG_EMUL if SMP 285 select TLS_REG_EMUL if SMP || !MMU
286 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 286 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
287 287
288config CPU_32v5 288config CPU_32v5
289 bool 289 bool
290 select TLS_REG_EMUL if SMP 290 select TLS_REG_EMUL if SMP || !MMU
291 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 291 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
292 292
293config CPU_32v6 293config CPU_32v6
@@ -334,6 +334,7 @@ config CPU_CACHE_VIVT
334config CPU_CACHE_VIPT 334config CPU_CACHE_VIPT
335 bool 335 bool
336 336
337if MMU
337# The copy-page model 338# The copy-page model
338config CPU_COPY_V3 339config CPU_COPY_V3
339 bool 340 bool
@@ -372,6 +373,8 @@ config CPU_TLB_V4WBI
372config CPU_TLB_V6 373config CPU_TLB_V6
373 bool 374 bool
374 375
376endif
377
375# 378#
376# CPU supports 36-bit I/O 379# CPU supports 36-bit I/O
377# 380#
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 07a538505784..21a2770226ee 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -2,10 +2,16 @@
2# Makefile for the linux arm-specific parts of the memory manager. 2# Makefile for the linux arm-specific parts of the memory manager.
3# 3#
4 4
5obj-y := consistent.o extable.o fault-armv.o \ 5obj-y := consistent.o extable.o fault.o init.o \
6 fault.o flush.o init.o ioremap.o mmap.o \ 6 iomap.o
7
8obj-$(CONFIG_MMU) += fault-armv.o flush.o ioremap.o mmap.o \
7 mm-armv.o 9 mm-armv.o
8 10
11ifneq ($(CONFIG_MMU),y)
12obj-y += nommu.o
13endif
14
9obj-$(CONFIG_MODULES) += proc-syms.o 15obj-$(CONFIG_MODULES) += proc-syms.o
10 16
11obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 9ea1f87a7079..989fd681c822 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -26,8 +26,6 @@
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#define TABLE_SIZE (2 * PTRS_PER_PTE * sizeof(pte_t))
30
31DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 29DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
32 30
33extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 31extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
new file mode 100644
index 000000000000..62066f3020c8
--- /dev/null
+++ b/arch/arm/mm/iomap.c
@@ -0,0 +1,55 @@
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
14void __iomem *ioport_map(unsigned long port, unsigned int nr)
15{
16 return __io(port);
17}
18EXPORT_SYMBOL(ioport_map);
19
20void ioport_unmap(void __iomem *addr)
21{
22}
23EXPORT_SYMBOL(ioport_unmap);
24#endif
25
26#ifdef CONFIG_PCI
27void __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}
46EXPORT_SYMBOL(pci_iomap);
47
48void 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}
54EXPORT_SYMBOL(pci_iounmap);
55#endif
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index c1f7180c7bed..7691cfdba567 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -176,50 +176,3 @@ void __iounmap(void __iomem *addr)
176 vunmap((void *)(PAGE_MASK & (unsigned long)addr)); 176 vunmap((void *)(PAGE_MASK & (unsigned long)addr));
177} 177}
178EXPORT_SYMBOL(__iounmap); 178EXPORT_SYMBOL(__iounmap);
179
180#ifdef __io
181void __iomem *ioport_map(unsigned long port, unsigned int nr)
182{
183 return __io(port);
184}
185EXPORT_SYMBOL(ioport_map);
186
187void ioport_unmap(void __iomem *addr)
188{
189}
190EXPORT_SYMBOL(ioport_unmap);
191#endif
192
193#ifdef CONFIG_PCI
194#include <linux/pci.h>
195#include <linux/ioport.h>
196
197void __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}
216EXPORT_SYMBOL(pci_iomap);
217
218void 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}
224EXPORT_SYMBOL(pci_iounmap);
225#endif
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
new file mode 100644
index 000000000000..1464ed817b5d
--- /dev/null
+++ b/arch/arm/mm/nommu.c
@@ -0,0 +1,39 @@
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
14void flush_dcache_page(struct page *page)
15{
16 __cpuc_flush_dcache_page(page_address(page));
17}
18EXPORT_SYMBOL(flush_dcache_page);
19
20void __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}
27EXPORT_SYMBOL(__ioremap_pfn);
28
29void __iomem *__ioremap(unsigned long phys_addr, size_t size,
30 unsigned long flags)
31{
32 return (void __iomem *)phys_addr;
33}
34EXPORT_SYMBOL(__ioremap);
35
36void __iounmap(void __iomem *addr)
37{
38}
39EXPORT_SYMBOL(__iounmap);
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index 959588884fa5..b9abbafca812 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2000 ARM Limited 4 * Copyright (C) 2000 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 * hacked for non-paged-MM by Hyok S. Choi, 2003.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 * it under the terms of the GNU General Public License as published by
@@ -101,7 +102,9 @@ ENTRY(cpu_arm1020_reset)
101 mov ip, #0 102 mov ip, #0
102 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 103 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
103 mcr p15, 0, ip, c7, c10, 4 @ drain WB 104 mcr p15, 0, ip, c7, c10, 4 @ drain WB
105#ifdef CONFIG_MMU
104 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 106 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
107#endif
105 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 108 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
106 bic ip, ip, #0x000f @ ............wcam 109 bic ip, ip, #0x000f @ ............wcam
107 bic ip, ip, #0x1100 @ ...i...s........ 110 bic ip, ip, #0x1100 @ ...i...s........
@@ -359,6 +362,7 @@ ENTRY(cpu_arm1020_dcache_clean_area)
359 */ 362 */
360 .align 5 363 .align 5
361ENTRY(cpu_arm1020_switch_mm) 364ENTRY(cpu_arm1020_switch_mm)
365#ifdef CONFIG_MMU
362#ifndef CONFIG_CPU_DCACHE_DISABLE 366#ifndef CONFIG_CPU_DCACHE_DISABLE
363 mcr p15, 0, r3, c7, c10, 4 367 mcr p15, 0, r3, c7, c10, 4
364 mov r1, #0xF @ 16 segments 368 mov r1, #0xF @ 16 segments
@@ -383,6 +387,7 @@ ENTRY(cpu_arm1020_switch_mm)
383 mcr p15, 0, r1, c7, c10, 4 @ drain WB 387 mcr p15, 0, r1, c7, c10, 4 @ drain WB
384 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 388 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
385 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 389 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
390#endif /* CONFIG_MMU */
386 mov pc, lr 391 mov pc, lr
387 392
388/* 393/*
@@ -392,6 +397,7 @@ ENTRY(cpu_arm1020_switch_mm)
392 */ 397 */
393 .align 5 398 .align 5
394ENTRY(cpu_arm1020_set_pte) 399ENTRY(cpu_arm1020_set_pte)
400#ifdef CONFIG_MMU
395 str r1, [r0], #-2048 @ linux version 401 str r1, [r0], #-2048 @ linux version
396 402
397 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 403 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -421,6 +427,7 @@ ENTRY(cpu_arm1020_set_pte)
421 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 427 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
422#endif 428#endif
423 mcr p15, 0, r0, c7, c10, 4 @ drain WB 429 mcr p15, 0, r0, c7, c10, 4 @ drain WB
430#endif /* CONFIG_MMU */
424 mov pc, lr 431 mov pc, lr
425 432
426 __INIT 433 __INIT
@@ -430,7 +437,9 @@ __arm1020_setup:
430 mov r0, #0 437 mov r0, #0
431 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 438 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 439 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
440#ifdef CONFIG_MMU
433 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 441 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
442#endif
434 mrc p15, 0, r0, c1, c0 @ get control register v4 443 mrc p15, 0, r0, c1, c0 @ get control register v4
435 ldr r5, arm1020_cr1_clear 444 ldr r5, arm1020_cr1_clear
436 bic r0, r0, r5 445 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index be6d081ff2b7..bcd5ee022e00 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2000 ARM Limited 4 * Copyright (C) 2000 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 * hacked for non-paged-MM by Hyok S. Choi, 2003.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 * it under the terms of the GNU General Public License as published by
@@ -101,7 +102,9 @@ ENTRY(cpu_arm1020e_reset)
101 mov ip, #0 102 mov ip, #0
102 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 103 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
103 mcr p15, 0, ip, c7, c10, 4 @ drain WB 104 mcr p15, 0, ip, c7, c10, 4 @ drain WB
105#ifdef CONFIG_MMU
104 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 106 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
107#endif
105 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 108 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
106 bic ip, ip, #0x000f @ ............wcam 109 bic ip, ip, #0x000f @ ............wcam
107 bic ip, ip, #0x1100 @ ...i...s........ 110 bic ip, ip, #0x1100 @ ...i...s........
@@ -344,6 +347,7 @@ ENTRY(cpu_arm1020e_dcache_clean_area)
344 */ 347 */
345 .align 5 348 .align 5
346ENTRY(cpu_arm1020e_switch_mm) 349ENTRY(cpu_arm1020e_switch_mm)
350#ifdef CONFIG_MMU
347#ifndef CONFIG_CPU_DCACHE_DISABLE 351#ifndef CONFIG_CPU_DCACHE_DISABLE
348 mcr p15, 0, r3, c7, c10, 4 352 mcr p15, 0, r3, c7, c10, 4
349 mov r1, #0xF @ 16 segments 353 mov r1, #0xF @ 16 segments
@@ -367,6 +371,7 @@ ENTRY(cpu_arm1020e_switch_mm)
367 mcr p15, 0, r1, c7, c10, 4 @ drain WB 371 mcr p15, 0, r1, c7, c10, 4 @ drain WB
368 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 372 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
369 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 373 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
374#endif
370 mov pc, lr 375 mov pc, lr
371 376
372/* 377/*
@@ -376,6 +381,7 @@ ENTRY(cpu_arm1020e_switch_mm)
376 */ 381 */
377 .align 5 382 .align 5
378ENTRY(cpu_arm1020e_set_pte) 383ENTRY(cpu_arm1020e_set_pte)
384#ifdef CONFIG_MMU
379 str r1, [r0], #-2048 @ linux version 385 str r1, [r0], #-2048 @ linux version
380 386
381 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 387 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -403,6 +409,7 @@ ENTRY(cpu_arm1020e_set_pte)
403#ifndef CONFIG_CPU_DCACHE_DISABLE 409#ifndef CONFIG_CPU_DCACHE_DISABLE
404 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 410 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
405#endif 411#endif
412#endif /* CONFIG_MMU */
406 mov pc, lr 413 mov pc, lr
407 414
408 __INIT 415 __INIT
@@ -412,7 +419,9 @@ __arm1020e_setup:
412 mov r0, #0 419 mov r0, #0
413 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 420 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 421 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
422#ifdef CONFIG_MMU
415 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 423 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
424#endif
416 mrc p15, 0, r0, c1, c0 @ get control register v4 425 mrc p15, 0, r0, c1, c0 @ get control register v4
417 ldr r5, arm1020e_cr1_clear 426 ldr r5, arm1020e_cr1_clear
418 bic r0, r0, r5 427 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index f778545d57a2..b0ccff4fadd2 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2000 ARM Limited 4 * Copyright (C) 2000 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 * hacked for non-paged-MM by Hyok S. Choi, 2003.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 * it under the terms of the GNU General Public License as published by
@@ -90,7 +91,9 @@ ENTRY(cpu_arm1022_reset)
90 mov ip, #0 91 mov ip, #0
91 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 92 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
92 mcr p15, 0, ip, c7, c10, 4 @ drain WB 93 mcr p15, 0, ip, c7, c10, 4 @ drain WB
94#ifdef CONFIG_MMU
93 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 95 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
96#endif
94 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 97 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
95 bic ip, ip, #0x000f @ ............wcam 98 bic ip, ip, #0x000f @ ............wcam
96 bic ip, ip, #0x1100 @ ...i...s........ 99 bic ip, ip, #0x1100 @ ...i...s........
@@ -333,6 +336,7 @@ ENTRY(cpu_arm1022_dcache_clean_area)
333 */ 336 */
334 .align 5 337 .align 5
335ENTRY(cpu_arm1022_switch_mm) 338ENTRY(cpu_arm1022_switch_mm)
339#ifdef CONFIG_MMU
336#ifndef CONFIG_CPU_DCACHE_DISABLE 340#ifndef CONFIG_CPU_DCACHE_DISABLE
337 mov r1, #(CACHE_DSEGMENTS - 1) << 5 @ 16 segments 341 mov r1, #(CACHE_DSEGMENTS - 1) << 5 @ 16 segments
3381: orr r3, r1, #(CACHE_DENTRIES - 1) << 26 @ 64 entries 3421: orr r3, r1, #(CACHE_DENTRIES - 1) << 26 @ 64 entries
@@ -349,6 +353,7 @@ ENTRY(cpu_arm1022_switch_mm)
349 mcr p15, 0, r1, c7, c10, 4 @ drain WB 353 mcr p15, 0, r1, c7, c10, 4 @ drain WB
350 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 354 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
351 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 355 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
356#endif
352 mov pc, lr 357 mov pc, lr
353 358
354/* 359/*
@@ -358,6 +363,7 @@ ENTRY(cpu_arm1022_switch_mm)
358 */ 363 */
359 .align 5 364 .align 5
360ENTRY(cpu_arm1022_set_pte) 365ENTRY(cpu_arm1022_set_pte)
366#ifdef CONFIG_MMU
361 str r1, [r0], #-2048 @ linux version 367 str r1, [r0], #-2048 @ linux version
362 368
363 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 369 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -385,6 +391,7 @@ ENTRY(cpu_arm1022_set_pte)
385#ifndef CONFIG_CPU_DCACHE_DISABLE 391#ifndef CONFIG_CPU_DCACHE_DISABLE
386 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 392 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
387#endif 393#endif
394#endif /* CONFIG_MMU */
388 mov pc, lr 395 mov pc, lr
389 396
390 __INIT 397 __INIT
@@ -394,7 +401,9 @@ __arm1022_setup:
394 mov r0, #0 401 mov r0, #0
395 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 402 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 403 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
404#ifdef CONFIG_MMU
397 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 405 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
406#endif
398 mrc p15, 0, r0, c1, c0 @ get control register v4 407 mrc p15, 0, r0, c1, c0 @ get control register v4
399 ldr r5, arm1022_cr1_clear 408 ldr r5, arm1022_cr1_clear
400 bic r0, r0, r5 409 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 148c111fde73..abe850c9a641 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2000 ARM Limited 4 * Copyright (C) 2000 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 * hacked for non-paged-MM by Hyok S. Choi, 2003.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 * it under the terms of the GNU General Public License as published by
@@ -90,7 +91,9 @@ ENTRY(cpu_arm1026_reset)
90 mov ip, #0 91 mov ip, #0
91 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 92 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
92 mcr p15, 0, ip, c7, c10, 4 @ drain WB 93 mcr p15, 0, ip, c7, c10, 4 @ drain WB
94#ifdef CONFIG_MMU
93 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 95 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
96#endif
94 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 97 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
95 bic ip, ip, #0x000f @ ............wcam 98 bic ip, ip, #0x000f @ ............wcam
96 bic ip, ip, #0x1100 @ ...i...s........ 99 bic ip, ip, #0x1100 @ ...i...s........
@@ -327,6 +330,7 @@ ENTRY(cpu_arm1026_dcache_clean_area)
327 */ 330 */
328 .align 5 331 .align 5
329ENTRY(cpu_arm1026_switch_mm) 332ENTRY(cpu_arm1026_switch_mm)
333#ifdef CONFIG_MMU
330 mov r1, #0 334 mov r1, #0
331#ifndef CONFIG_CPU_DCACHE_DISABLE 335#ifndef CONFIG_CPU_DCACHE_DISABLE
3321: mrc p15, 0, r15, c7, c14, 3 @ test, clean, invalidate 3361: mrc p15, 0, r15, c7, c14, 3 @ test, clean, invalidate
@@ -338,6 +342,7 @@ ENTRY(cpu_arm1026_switch_mm)
338 mcr p15, 0, r1, c7, c10, 4 @ drain WB 342 mcr p15, 0, r1, c7, c10, 4 @ drain WB
339 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 343 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
340 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs 344 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
345#endif
341 mov pc, lr 346 mov pc, lr
342 347
343/* 348/*
@@ -347,6 +352,7 @@ ENTRY(cpu_arm1026_switch_mm)
347 */ 352 */
348 .align 5 353 .align 5
349ENTRY(cpu_arm1026_set_pte) 354ENTRY(cpu_arm1026_set_pte)
355#ifdef CONFIG_MMU
350 str r1, [r0], #-2048 @ linux version 356 str r1, [r0], #-2048 @ linux version
351 357
352 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 358 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -374,6 +380,7 @@ ENTRY(cpu_arm1026_set_pte)
374#ifndef CONFIG_CPU_DCACHE_DISABLE 380#ifndef CONFIG_CPU_DCACHE_DISABLE
375 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 381 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
376#endif 382#endif
383#endif /* CONFIG_MMU */
377 mov pc, lr 384 mov pc, lr
378 385
379 386
@@ -384,8 +391,10 @@ __arm1026_setup:
384 mov r0, #0 391 mov r0, #0
385 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 392 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 393 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
394#ifdef CONFIG_MMU
387 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 395 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
388 mcr p15, 0, r4, c2, c0 @ load page table pointer 396 mcr p15, 0, r4, c2, c0 @ load page table pointer
397#endif
389#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 398#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
390 mov r0, #4 @ explicitly disable writeback 399 mov r0, #4 @ explicitly disable writeback
391 mcr p15, 7, r0, c15, c0, 0 400 mcr p15, 7, r0, c15, c0, 0
diff --git a/arch/arm/mm/proc-arm6_7.S b/arch/arm/mm/proc-arm6_7.S
index 540359b475d0..7a705edfa4b2 100644
--- a/arch/arm/mm/proc-arm6_7.S
+++ b/arch/arm/mm/proc-arm6_7.S
@@ -2,6 +2,7 @@
2 * linux/arch/arm/mm/proc-arm6,7.S 2 * linux/arch/arm/mm/proc-arm6,7.S
3 * 3 *
4 * Copyright (C) 1997-2000 Russell King 4 * Copyright (C) 1997-2000 Russell King
5 * hacked for non-paged-MM by Hyok S. Choi, 2003.
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -199,10 +200,12 @@ ENTRY(cpu_arm7_do_idle)
199 */ 200 */
200ENTRY(cpu_arm6_switch_mm) 201ENTRY(cpu_arm6_switch_mm)
201ENTRY(cpu_arm7_switch_mm) 202ENTRY(cpu_arm7_switch_mm)
203#ifdef CONFIG_MMU
202 mov r1, #0 204 mov r1, #0
203 mcr p15, 0, r1, c7, c0, 0 @ flush cache 205 mcr p15, 0, r1, c7, c0, 0 @ flush cache
204 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr 206 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
205 mcr p15, 0, r1, c5, c0, 0 @ flush TLBs 207 mcr p15, 0, r1, c5, c0, 0 @ flush TLBs
208#endif
206 mov pc, lr 209 mov pc, lr
207 210
208/* 211/*
@@ -214,6 +217,7 @@ ENTRY(cpu_arm7_switch_mm)
214 .align 5 217 .align 5
215ENTRY(cpu_arm6_set_pte) 218ENTRY(cpu_arm6_set_pte)
216ENTRY(cpu_arm7_set_pte) 219ENTRY(cpu_arm7_set_pte)
220#ifdef CONFIG_MMU
217 str r1, [r0], #-2048 @ linux version 221 str r1, [r0], #-2048 @ linux version
218 222
219 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 223 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -232,6 +236,7 @@ ENTRY(cpu_arm7_set_pte)
232 movne r2, #0 236 movne r2, #0
233 237
234 str r2, [r0] @ hardware version 238 str r2, [r0] @ hardware version
239#endif /* CONFIG_MMU */
235 mov pc, lr 240 mov pc, lr
236 241
237/* 242/*
@@ -243,7 +248,9 @@ ENTRY(cpu_arm6_reset)
243ENTRY(cpu_arm7_reset) 248ENTRY(cpu_arm7_reset)
244 mov r1, #0 249 mov r1, #0
245 mcr p15, 0, r1, c7, c0, 0 @ flush cache 250 mcr p15, 0, r1, c7, c0, 0 @ flush cache
251#ifdef CONFIG_MMU
246 mcr p15, 0, r1, c5, c0, 0 @ flush TLB 252 mcr p15, 0, r1, c5, c0, 0 @ flush TLB
253#endif
247 mov r1, #0x30 254 mov r1, #0x30
248 mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc 255 mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc
249 mov pc, r0 256 mov pc, r0
@@ -253,19 +260,27 @@ ENTRY(cpu_arm7_reset)
253 .type __arm6_setup, #function 260 .type __arm6_setup, #function
254__arm6_setup: mov r0, #0 261__arm6_setup: mov r0, #0
255 mcr p15, 0, r0, c7, c0 @ flush caches on v3 262 mcr p15, 0, r0, c7, c0 @ flush caches on v3
263#ifdef CONFIG_MMU
256 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3 264 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3
257 mov r0, #0x3d @ . ..RS BLDP WCAM 265 mov r0, #0x3d @ . ..RS BLDP WCAM
258 orr r0, r0, #0x100 @ . ..01 0011 1101 266 orr r0, r0, #0x100 @ . ..01 0011 1101
267#else
268 mov r0, #0x3c @ . ..RS BLDP WCA.
269#endif
259 mov pc, lr 270 mov pc, lr
260 .size __arm6_setup, . - __arm6_setup 271 .size __arm6_setup, . - __arm6_setup
261 272
262 .type __arm7_setup, #function 273 .type __arm7_setup, #function
263__arm7_setup: mov r0, #0 274__arm7_setup: mov r0, #0
264 mcr p15, 0, r0, c7, c0 @ flush caches on v3 275 mcr p15, 0, r0, c7, c0 @ flush caches on v3
276#ifdef CONFIG_MMU
265 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3 277 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3
266 mcr p15, 0, r0, c3, c0 @ load domain access register 278 mcr p15, 0, r0, c3, c0 @ load domain access register
267 mov r0, #0x7d @ . ..RS BLDP WCAM 279 mov r0, #0x7d @ . ..RS BLDP WCAM
268 orr r0, r0, #0x100 @ . ..01 0111 1101 280 orr r0, r0, #0x100 @ . ..01 0111 1101
281#else
282 mov r0, #0x7c @ . ..RS BLDP WCA.
283#endif
269 mov pc, lr 284 mov pc, lr
270 .size __arm7_setup, . - __arm7_setup 285 .size __arm7_setup, . - __arm7_setup
271 286
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index 26f00ee2ad9a..86102467d37f 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -4,6 +4,7 @@
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) 4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 * Rob Scott (rscott@mtrob.fdns.net) 5 * Rob Scott (rscott@mtrob.fdns.net)
6 * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd. 6 * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd.
7 * hacked for non-paged-MM by Hyok S. Choi, 2004.
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 10 * it under the terms of the GNU General Public License as published by
@@ -29,6 +30,7 @@
29 * out of 'proc-arm6,7.S' per RMK discussion 30 * out of 'proc-arm6,7.S' per RMK discussion
30 * 07-25-2000 SJH Added idle function. 31 * 07-25-2000 SJH Added idle function.
31 * 08-25-2000 DBS Updated for integration of ARM Ltd version. 32 * 08-25-2000 DBS Updated for integration of ARM Ltd version.
33 * 04-20-2004 HSC modified for non-paged memory management mode.
32 */ 34 */
33#include <linux/linkage.h> 35#include <linux/linkage.h>
34#include <linux/init.h> 36#include <linux/init.h>
@@ -75,10 +77,12 @@ ENTRY(cpu_arm720_do_idle)
75 * the new. 77 * the new.
76 */ 78 */
77ENTRY(cpu_arm720_switch_mm) 79ENTRY(cpu_arm720_switch_mm)
80#ifdef CONFIG_MMU
78 mov r1, #0 81 mov r1, #0
79 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache 82 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
80 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr 83 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
81 mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4) 84 mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
85#endif
82 mov pc, lr 86 mov pc, lr
83 87
84/* 88/*
@@ -89,6 +93,7 @@ ENTRY(cpu_arm720_switch_mm)
89 */ 93 */
90 .align 5 94 .align 5
91ENTRY(cpu_arm720_set_pte) 95ENTRY(cpu_arm720_set_pte)
96#ifdef CONFIG_MMU
92 str r1, [r0], #-2048 @ linux version 97 str r1, [r0], #-2048 @ linux version
93 98
94 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 99 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -107,6 +112,7 @@ ENTRY(cpu_arm720_set_pte)
107 movne r2, #0 112 movne r2, #0
108 113
109 str r2, [r0] @ hardware version 114 str r2, [r0] @ hardware version
115#endif
110 mov pc, lr 116 mov pc, lr
111 117
112/* 118/*
@@ -117,7 +123,9 @@ ENTRY(cpu_arm720_set_pte)
117ENTRY(cpu_arm720_reset) 123ENTRY(cpu_arm720_reset)
118 mov ip, #0 124 mov ip, #0
119 mcr p15, 0, ip, c7, c7, 0 @ invalidate cache 125 mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
126#ifdef CONFIG_MMU
120 mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4) 127 mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
128#endif
121 mrc p15, 0, ip, c1, c0, 0 @ get ctrl register 129 mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
122 bic ip, ip, #0x000f @ ............wcam 130 bic ip, ip, #0x000f @ ............wcam
123 bic ip, ip, #0x2100 @ ..v....s........ 131 bic ip, ip, #0x2100 @ ..v....s........
@@ -130,7 +138,9 @@ ENTRY(cpu_arm720_reset)
130__arm710_setup: 138__arm710_setup:
131 mov r0, #0 139 mov r0, #0
132 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches 140 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
141#ifdef CONFIG_MMU
133 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) 142 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
143#endif
134 mrc p15, 0, r0, c1, c0 @ get control register 144 mrc p15, 0, r0, c1, c0 @ get control register
135 ldr r5, arm710_cr1_clear 145 ldr r5, arm710_cr1_clear
136 bic r0, r0, r5 146 bic r0, r0, r5
@@ -156,7 +166,9 @@ arm710_cr1_set:
156__arm720_setup: 166__arm720_setup:
157 mov r0, #0 167 mov r0, #0
158 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches 168 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
169#ifdef CONFIG_MMU
159 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) 170 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
171#endif
160 mrc p15, 0, r0, c1, c0 @ get control register 172 mrc p15, 0, r0, c1, c0 @ get control register
161 ldr r5, arm720_cr1_clear 173 ldr r5, arm720_cr1_clear
162 bic r0, r0, r5 174 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index a17f79e0199c..31dc839ba07c 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 1999,2000 ARM Limited 4 * Copyright (C) 1999,2000 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 * hacked for non-paged-MM by Hyok S. Choi, 2003.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 * it under the terms of the GNU General Public License as published by
@@ -97,7 +98,9 @@ ENTRY(cpu_arm920_reset)
97 mov ip, #0 98 mov ip, #0
98 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 99 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
99 mcr p15, 0, ip, c7, c10, 4 @ drain WB 100 mcr p15, 0, ip, c7, c10, 4 @ drain WB
101#ifdef CONFIG_MMU
100 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 102 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
103#endif
101 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 104 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
102 bic ip, ip, #0x000f @ ............wcam 105 bic ip, ip, #0x000f @ ............wcam
103 bic ip, ip, #0x1100 @ ...i...s........ 106 bic ip, ip, #0x1100 @ ...i...s........
@@ -317,6 +320,7 @@ ENTRY(cpu_arm920_dcache_clean_area)
317 */ 320 */
318 .align 5 321 .align 5
319ENTRY(cpu_arm920_switch_mm) 322ENTRY(cpu_arm920_switch_mm)
323#ifdef CONFIG_MMU
320 mov ip, #0 324 mov ip, #0
321#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 325#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
322 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache 326 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
@@ -337,6 +341,7 @@ ENTRY(cpu_arm920_switch_mm)
337 mcr p15, 0, ip, c7, c10, 4 @ drain WB 341 mcr p15, 0, ip, c7, c10, 4 @ drain WB
338 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 342 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
339 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 343 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
344#endif
340 mov pc, lr 345 mov pc, lr
341 346
342/* 347/*
@@ -346,6 +351,7 @@ ENTRY(cpu_arm920_switch_mm)
346 */ 351 */
347 .align 5 352 .align 5
348ENTRY(cpu_arm920_set_pte) 353ENTRY(cpu_arm920_set_pte)
354#ifdef CONFIG_MMU
349 str r1, [r0], #-2048 @ linux version 355 str r1, [r0], #-2048 @ linux version
350 356
351 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 357 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -372,6 +378,7 @@ ENTRY(cpu_arm920_set_pte)
372 mov r0, r0 378 mov r0, r0
373 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 379 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
374 mcr p15, 0, r0, c7, c10, 4 @ drain WB 380 mcr p15, 0, r0, c7, c10, 4 @ drain WB
381#endif /* CONFIG_MMU */
375 mov pc, lr 382 mov pc, lr
376 383
377 __INIT 384 __INIT
@@ -381,7 +388,9 @@ __arm920_setup:
381 mov r0, #0 388 mov r0, #0
382 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 389 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 390 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
391#ifdef CONFIG_MMU
384 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 392 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
393#endif
385 mrc p15, 0, r0, c1, c0 @ get control register v4 394 mrc p15, 0, r0, c1, c0 @ get control register v4
386 ldr r5, arm920_cr1_clear 395 ldr r5, arm920_cr1_clear
387 bic r0, r0, r5 396 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index bbde4a024a48..9e57c34f5c09 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -4,6 +4,7 @@
4 * Copyright (C) 1999,2000 ARM Limited 4 * Copyright (C) 1999,2000 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 * Copyright (C) 2001 Altera Corporation 6 * Copyright (C) 2001 Altera Corporation
7 * hacked for non-paged-MM by Hyok S. Choi, 2003.
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 10 * it under the terms of the GNU General Public License as published by
@@ -99,7 +100,9 @@ ENTRY(cpu_arm922_reset)
99 mov ip, #0 100 mov ip, #0
100 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 101 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
101 mcr p15, 0, ip, c7, c10, 4 @ drain WB 102 mcr p15, 0, ip, c7, c10, 4 @ drain WB
103#ifdef CONFIG_MMU
102 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 104 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
105#endif
103 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 106 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
104 bic ip, ip, #0x000f @ ............wcam 107 bic ip, ip, #0x000f @ ............wcam
105 bic ip, ip, #0x1100 @ ...i...s........ 108 bic ip, ip, #0x1100 @ ...i...s........
@@ -321,6 +324,7 @@ ENTRY(cpu_arm922_dcache_clean_area)
321 */ 324 */
322 .align 5 325 .align 5
323ENTRY(cpu_arm922_switch_mm) 326ENTRY(cpu_arm922_switch_mm)
327#ifdef CONFIG_MMU
324 mov ip, #0 328 mov ip, #0
325#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 329#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
326 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache 330 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
@@ -341,6 +345,7 @@ ENTRY(cpu_arm922_switch_mm)
341 mcr p15, 0, ip, c7, c10, 4 @ drain WB 345 mcr p15, 0, ip, c7, c10, 4 @ drain WB
342 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 346 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
343 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 347 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
348#endif
344 mov pc, lr 349 mov pc, lr
345 350
346/* 351/*
@@ -350,6 +355,7 @@ ENTRY(cpu_arm922_switch_mm)
350 */ 355 */
351 .align 5 356 .align 5
352ENTRY(cpu_arm922_set_pte) 357ENTRY(cpu_arm922_set_pte)
358#ifdef CONFIG_MMU
353 str r1, [r0], #-2048 @ linux version 359 str r1, [r0], #-2048 @ linux version
354 360
355 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 361 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -376,6 +382,7 @@ ENTRY(cpu_arm922_set_pte)
376 mov r0, r0 382 mov r0, r0
377 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 383 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
378 mcr p15, 0, r0, c7, c10, 4 @ drain WB 384 mcr p15, 0, r0, c7, c10, 4 @ drain WB
385#endif /* CONFIG_MMU */
379 mov pc, lr 386 mov pc, lr
380 387
381 __INIT 388 __INIT
@@ -385,7 +392,9 @@ __arm922_setup:
385 mov r0, #0 392 mov r0, #0
386 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 393 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 394 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
395#ifdef CONFIG_MMU
388 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 396 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
397#endif
389 mrc p15, 0, r0, c1, c0 @ get control register v4 398 mrc p15, 0, r0, c1, c0 @ get control register v4
390 ldr r5, arm922_cr1_clear 399 ldr r5, arm922_cr1_clear
391 bic r0, r0, r5 400 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 224ce226a01b..8d47c9f3f931 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -9,6 +9,8 @@
9 * Update for Linux-2.6 and cache flush improvements 9 * Update for Linux-2.6 and cache flush improvements
10 * Copyright (C) 2004 Nokia Corporation by Tony Lindgren <tony@atomide.com> 10 * Copyright (C) 2004 Nokia Corporation by Tony Lindgren <tony@atomide.com>
11 * 11 *
12 * hacked for non-paged-MM by Hyok S. Choi, 2004.
13 *
12 * This program is free software; you can redistribute it and/or modify 14 * 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 15 * 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 16 * the Free Software Foundation; either version 2 of the License, or
@@ -122,7 +124,9 @@ ENTRY(cpu_arm925_reset)
122 mov ip, #0 124 mov ip, #0
123 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 125 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
124 mcr p15, 0, ip, c7, c10, 4 @ drain WB 126 mcr p15, 0, ip, c7, c10, 4 @ drain WB
127#ifdef CONFIG_MMU
125 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 128 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
129#endif
126 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 130 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
127 bic ip, ip, #0x000f @ ............wcam 131 bic ip, ip, #0x000f @ ............wcam
128 bic ip, ip, #0x1100 @ ...i...s........ 132 bic ip, ip, #0x1100 @ ...i...s........
@@ -369,6 +373,7 @@ ENTRY(cpu_arm925_dcache_clean_area)
369 */ 373 */
370 .align 5 374 .align 5
371ENTRY(cpu_arm925_switch_mm) 375ENTRY(cpu_arm925_switch_mm)
376#ifdef CONFIG_MMU
372 mov ip, #0 377 mov ip, #0
373#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 378#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
374 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache 379 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
@@ -383,6 +388,7 @@ ENTRY(cpu_arm925_switch_mm)
383 mcr p15, 0, ip, c7, c10, 4 @ drain WB 388 mcr p15, 0, ip, c7, c10, 4 @ drain WB
384 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 389 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
385 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 390 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
391#endif
386 mov pc, lr 392 mov pc, lr
387 393
388/* 394/*
@@ -392,6 +398,7 @@ ENTRY(cpu_arm925_switch_mm)
392 */ 398 */
393 .align 5 399 .align 5
394ENTRY(cpu_arm925_set_pte) 400ENTRY(cpu_arm925_set_pte)
401#ifdef CONFIG_MMU
395 str r1, [r0], #-2048 @ linux version 402 str r1, [r0], #-2048 @ linux version
396 403
397 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 404 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -420,6 +427,7 @@ ENTRY(cpu_arm925_set_pte)
420 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 427 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
421#endif 428#endif
422 mcr p15, 0, r0, c7, c10, 4 @ drain WB 429 mcr p15, 0, r0, c7, c10, 4 @ drain WB
430#endif /* CONFIG_MMU */
423 mov pc, lr 431 mov pc, lr
424 432
425 __INIT 433 __INIT
@@ -438,7 +446,9 @@ __arm925_setup:
438 mov r0, #0 446 mov r0, #0
439 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 447 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 448 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
449#ifdef CONFIG_MMU
441 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 450 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
451#endif
442 452
443#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 453#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
444 mov r0, #4 @ disable write-back on caches explicitly 454 mov r0, #4 @ disable write-back on caches explicitly
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 4e2a087cf388..cb4d8f33d2a3 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 1999-2001 ARM Limited 4 * Copyright (C) 1999-2001 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
6 * hacked for non-paged-MM by Hyok S. Choi, 2003.
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 * it under the terms of the GNU General Public License as published by
@@ -85,7 +86,9 @@ ENTRY(cpu_arm926_reset)
85 mov ip, #0 86 mov ip, #0
86 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 87 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
87 mcr p15, 0, ip, c7, c10, 4 @ drain WB 88 mcr p15, 0, ip, c7, c10, 4 @ drain WB
89#ifdef CONFIG_MMU
88 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 90 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
91#endif
89 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 92 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
90 bic ip, ip, #0x000f @ ............wcam 93 bic ip, ip, #0x000f @ ............wcam
91 bic ip, ip, #0x1100 @ ...i...s........ 94 bic ip, ip, #0x1100 @ ...i...s........
@@ -329,6 +332,7 @@ ENTRY(cpu_arm926_dcache_clean_area)
329 */ 332 */
330 .align 5 333 .align 5
331ENTRY(cpu_arm926_switch_mm) 334ENTRY(cpu_arm926_switch_mm)
335#ifdef CONFIG_MMU
332 mov ip, #0 336 mov ip, #0
333#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 337#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
334 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache 338 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
@@ -341,6 +345,7 @@ ENTRY(cpu_arm926_switch_mm)
341 mcr p15, 0, ip, c7, c10, 4 @ drain WB 345 mcr p15, 0, ip, c7, c10, 4 @ drain WB
342 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 346 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
343 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 347 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
348#endif
344 mov pc, lr 349 mov pc, lr
345 350
346/* 351/*
@@ -350,6 +355,7 @@ ENTRY(cpu_arm926_switch_mm)
350 */ 355 */
351 .align 5 356 .align 5
352ENTRY(cpu_arm926_set_pte) 357ENTRY(cpu_arm926_set_pte)
358#ifdef CONFIG_MMU
353 str r1, [r0], #-2048 @ linux version 359 str r1, [r0], #-2048 @ linux version
354 360
355 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 361 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -378,6 +384,7 @@ ENTRY(cpu_arm926_set_pte)
378 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 384 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
379#endif 385#endif
380 mcr p15, 0, r0, c7, c10, 4 @ drain WB 386 mcr p15, 0, r0, c7, c10, 4 @ drain WB
387#endif
381 mov pc, lr 388 mov pc, lr
382 389
383 __INIT 390 __INIT
@@ -387,7 +394,9 @@ __arm926_setup:
387 mov r0, #0 394 mov r0, #0
388 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 395 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 396 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
397#ifdef CONFIG_MMU
390 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 398 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
399#endif
391 400
392 401
393#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 402#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index a2dd5ae1077d..5a760a2c629c 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -2,6 +2,7 @@
2 * linux/arch/arm/mm/proc-sa110.S 2 * linux/arch/arm/mm/proc-sa110.S
3 * 3 *
4 * Copyright (C) 1997-2002 Russell King 4 * Copyright (C) 1997-2002 Russell King
5 * hacked for non-paged-MM by Hyok S. Choi, 2003.
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -67,7 +68,9 @@ ENTRY(cpu_sa110_reset)
67 mov ip, #0 68 mov ip, #0
68 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 69 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
69 mcr p15, 0, ip, c7, c10, 4 @ drain WB 70 mcr p15, 0, ip, c7, c10, 4 @ drain WB
71#ifdef CONFIG_MMU
70 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 72 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
73#endif
71 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 74 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
72 bic ip, ip, #0x000f @ ............wcam 75 bic ip, ip, #0x000f @ ............wcam
73 bic ip, ip, #0x1100 @ ...i...s........ 76 bic ip, ip, #0x1100 @ ...i...s........
@@ -130,11 +133,15 @@ ENTRY(cpu_sa110_dcache_clean_area)
130 */ 133 */
131 .align 5 134 .align 5
132ENTRY(cpu_sa110_switch_mm) 135ENTRY(cpu_sa110_switch_mm)
136#ifdef CONFIG_MMU
133 str lr, [sp, #-4]! 137 str lr, [sp, #-4]!
134 bl v4wb_flush_kern_cache_all @ clears IP 138 bl v4wb_flush_kern_cache_all @ clears IP
135 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 139 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
136 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 140 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
137 ldr pc, [sp], #4 141 ldr pc, [sp], #4
142#else
143 mov pc, lr
144#endif
138 145
139/* 146/*
140 * cpu_sa110_set_pte(ptep, pte) 147 * cpu_sa110_set_pte(ptep, pte)
@@ -143,6 +150,7 @@ ENTRY(cpu_sa110_switch_mm)
143 */ 150 */
144 .align 5 151 .align 5
145ENTRY(cpu_sa110_set_pte) 152ENTRY(cpu_sa110_set_pte)
153#ifdef CONFIG_MMU
146 str r1, [r0], #-2048 @ linux version 154 str r1, [r0], #-2048 @ linux version
147 155
148 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 156 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -164,6 +172,7 @@ ENTRY(cpu_sa110_set_pte)
164 mov r0, r0 172 mov r0, r0
165 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 173 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
166 mcr p15, 0, r0, c7, c10, 4 @ drain WB 174 mcr p15, 0, r0, c7, c10, 4 @ drain WB
175#endif
167 mov pc, lr 176 mov pc, lr
168 177
169 __INIT 178 __INIT
@@ -173,7 +182,9 @@ __sa110_setup:
173 mov r10, #0 182 mov r10, #0
174 mcr p15, 0, r10, c7, c7 @ invalidate I,D caches on v4 183 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 184 mcr p15, 0, r10, c7, c10, 4 @ drain write buffer on v4
185#ifdef CONFIG_MMU
176 mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4 186 mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4
187#endif
177 mrc p15, 0, r0, c1, c0 @ get control register v4 188 mrc p15, 0, r0, c1, c0 @ get control register v4
178 ldr r5, sa110_cr1_clear 189 ldr r5, sa110_cr1_clear
179 bic r0, r0, r5 190 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index 777ad99c1439..0a2107ad4c32 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -2,6 +2,7 @@
2 * linux/arch/arm/mm/proc-sa1100.S 2 * linux/arch/arm/mm/proc-sa1100.S
3 * 3 *
4 * Copyright (C) 1997-2002 Russell King 4 * Copyright (C) 1997-2002 Russell King
5 * hacked for non-paged-MM by Hyok S. Choi, 2003.
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -77,7 +78,9 @@ ENTRY(cpu_sa1100_reset)
77 mov ip, #0 78 mov ip, #0
78 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches 79 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
79 mcr p15, 0, ip, c7, c10, 4 @ drain WB 80 mcr p15, 0, ip, c7, c10, 4 @ drain WB
81#ifdef CONFIG_MMU
80 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 82 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
83#endif
81 mrc p15, 0, ip, c1, c0, 0 @ ctrl register 84 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
82 bic ip, ip, #0x000f @ ............wcam 85 bic ip, ip, #0x000f @ ............wcam
83 bic ip, ip, #0x1100 @ ...i...s........ 86 bic ip, ip, #0x1100 @ ...i...s........
@@ -142,12 +145,16 @@ ENTRY(cpu_sa1100_dcache_clean_area)
142 */ 145 */
143 .align 5 146 .align 5
144ENTRY(cpu_sa1100_switch_mm) 147ENTRY(cpu_sa1100_switch_mm)
148#ifdef CONFIG_MMU
145 str lr, [sp, #-4]! 149 str lr, [sp, #-4]!
146 bl v4wb_flush_kern_cache_all @ clears IP 150 bl v4wb_flush_kern_cache_all @ clears IP
147 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB 151 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB
148 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 152 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
149 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs 153 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
150 ldr pc, [sp], #4 154 ldr pc, [sp], #4
155#else
156 mov pc, lr
157#endif
151 158
152/* 159/*
153 * cpu_sa1100_set_pte(ptep, pte) 160 * cpu_sa1100_set_pte(ptep, pte)
@@ -156,6 +163,7 @@ ENTRY(cpu_sa1100_switch_mm)
156 */ 163 */
157 .align 5 164 .align 5
158ENTRY(cpu_sa1100_set_pte) 165ENTRY(cpu_sa1100_set_pte)
166#ifdef CONFIG_MMU
159 str r1, [r0], #-2048 @ linux version 167 str r1, [r0], #-2048 @ linux version
160 168
161 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY 169 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
@@ -177,6 +185,7 @@ ENTRY(cpu_sa1100_set_pte)
177 mov r0, r0 185 mov r0, r0
178 mcr p15, 0, r0, c7, c10, 1 @ clean D entry 186 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
179 mcr p15, 0, r0, c7, c10, 4 @ drain WB 187 mcr p15, 0, r0, c7, c10, 4 @ drain WB
188#endif
180 mov pc, lr 189 mov pc, lr
181 190
182 __INIT 191 __INIT
@@ -186,7 +195,9 @@ __sa1100_setup:
186 mov r0, #0 195 mov r0, #0
187 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 196 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 197 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
198#ifdef CONFIG_MMU
189 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 199 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
200#endif
190 mrc p15, 0, r0, c1, c0 @ get control register v4 201 mrc p15, 0, r0, c1, c0 @ get control register v4
191 ldr r5, sa1100_cr1_clear 202 ldr r5, sa1100_cr1_clear
192 bic r0, r0, r5 203 bic r0, r0, r5
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 09b1a41a6de8..ca13d4d05f65 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -2,6 +2,7 @@
2 * linux/arch/arm/mm/proc-v6.S 2 * linux/arch/arm/mm/proc-v6.S
3 * 3 *
4 * Copyright (C) 2001 Deep Blue Solutions Ltd. 4 * Copyright (C) 2001 Deep Blue Solutions Ltd.
5 * Modified by Catalin Marinas for noMMU support
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -88,6 +89,7 @@ ENTRY(cpu_v6_dcache_clean_area)
88 * - we are not using split page tables 89 * - we are not using split page tables
89 */ 90 */
90ENTRY(cpu_v6_switch_mm) 91ENTRY(cpu_v6_switch_mm)
92#ifdef CONFIG_MMU
91 mov r2, #0 93 mov r2, #0
92 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id 94 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id
93#ifdef CONFIG_SMP 95#ifdef CONFIG_SMP
@@ -97,6 +99,7 @@ ENTRY(cpu_v6_switch_mm)
97 mcr p15, 0, r2, c7, c10, 4 @ drain write buffer 99 mcr p15, 0, r2, c7, c10, 4 @ drain write buffer
98 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 100 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
99 mcr p15, 0, r1, c13, c0, 1 @ set context ID 101 mcr p15, 0, r1, c13, c0, 1 @ set context ID
102#endif
100 mov pc, lr 103 mov pc, lr
101 104
102/* 105/*
@@ -119,6 +122,7 @@ ENTRY(cpu_v6_switch_mm)
119 * 1111 0 1 1 r/w r/w 122 * 1111 0 1 1 r/w r/w
120 */ 123 */
121ENTRY(cpu_v6_set_pte) 124ENTRY(cpu_v6_set_pte)
125#ifdef CONFIG_MMU
122 str r1, [r0], #-2048 @ linux version 126 str r1, [r0], #-2048 @ linux version
123 127
124 bic r2, r1, #0x000003f0 128 bic r2, r1, #0x000003f0
@@ -145,6 +149,7 @@ ENTRY(cpu_v6_set_pte)
145 149
146 str r2, [r0] 150 str r2, [r0]
147 mcr p15, 0, r0, c7, c10, 1 @ flush_pte 151 mcr p15, 0, r0, c7, c10, 1 @ flush_pte
152#endif
148 mov pc, lr 153 mov pc, lr
149 154
150 155
@@ -194,12 +199,14 @@ __v6_setup:
194 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache 199 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
195 mcr p15, 0, r0, c7, c15, 0 @ clean+invalidate cache 200 mcr p15, 0, r0, c7, c15, 0 @ clean+invalidate cache
196 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 201 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
202#ifdef CONFIG_MMU
197 mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs 203 mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs
198 mcr p15, 0, r0, c2, c0, 2 @ TTB control register 204 mcr p15, 0, r0, c2, c0, 2 @ TTB control register
199#ifdef CONFIG_SMP 205#ifdef CONFIG_SMP
200 orr r4, r4, #TTB_RGN_WBWA|TTB_S @ mark PTWs shared, outer cacheable 206 orr r4, r4, #TTB_RGN_WBWA|TTB_S @ mark PTWs shared, outer cacheable
201#endif 207#endif
202 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 208 mcr p15, 0, r4, c2, c0, 1 @ load TTB1
209#endif /* CONFIG_MMU */
203#ifdef CONFIG_VFP 210#ifdef CONFIG_VFP
204 mrc p15, 0, r0, c1, c0, 2 211 mrc p15, 0, r0, c1, c0, 2
205 orr r0, r0, #(0xf << 20) 212 orr r0, r0, #(0xf << 20)
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
index c703bc7b0880..9eec9435318e 100644
--- a/arch/i386/kernel/irq.c
+++ b/arch/i386/kernel/irq.c
@@ -60,6 +60,12 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs)
60 u32 *isp; 60 u32 *isp;
61#endif 61#endif
62 62
63 if (unlikely((unsigned)irq >= NR_IRQS)) {
64 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
65 __FUNCTION__, irq);
66 BUG();
67 }
68
63 irq_enter(); 69 irq_enter();
64#ifdef CONFIG_DEBUG_STACKOVERFLOW 70#ifdef CONFIG_DEBUG_STACKOVERFLOW
65 /* Debugging check for stack overflow: is there less than 1KB free? */ 71 /* Debugging check for stack overflow: is there less than 1KB free? */
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index 766bf4955432..9d1cffb57cde 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -114,7 +114,7 @@ CONFIG_IA64_CYCLONE=y
114CONFIG_IOSAPIC=y 114CONFIG_IOSAPIC=y
115CONFIG_FORCE_MAX_ZONEORDER=17 115CONFIG_FORCE_MAX_ZONEORDER=17
116CONFIG_SMP=y 116CONFIG_SMP=y
117CONFIG_NR_CPUS=4 117CONFIG_NR_CPUS=16
118CONFIG_HOTPLUG_CPU=y 118CONFIG_HOTPLUG_CPU=y
119CONFIG_PERMIT_BSP_REMOVE=y 119CONFIG_PERMIT_BSP_REMOVE=y
120CONFIG_FORCE_CPEI_RETARGET=y 120CONFIG_FORCE_CPEI_RETARGET=y
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 303a9afcf2a1..8a1208419138 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -998,7 +998,7 @@ palinfo_init(void)
998 } 998 }
999 999
1000 /* Register for future delivery via notify registration */ 1000 /* Register for future delivery via notify registration */
1001 register_cpu_notifier(&palinfo_cpu_notifier); 1001 register_hotcpu_notifier(&palinfo_cpu_notifier);
1002 1002
1003 return 0; 1003 return 0;
1004} 1004}
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 93577abae36d..3bfccf354343 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -458,7 +458,7 @@ void __init sn_setup(char **cmdline_p)
458 * support here so we don't have to listen to failed keyboard probe 458 * support here so we don't have to listen to failed keyboard probe
459 * messages. 459 * messages.
460 */ 460 */
461 if (version <= 0x0209 && acpi_kbd_controller_present) { 461 if (is_shub1() && version <= 0x0209 && acpi_kbd_controller_present) {
462 printk(KERN_INFO "Disabling legacy keyboard support as prom " 462 printk(KERN_INFO "Disabling legacy keyboard support as prom "
463 "is too old and doesn't provide FADT\n"); 463 "is too old and doesn't provide FADT\n");
464 acpi_kbd_controller_present = 0; 464 acpi_kbd_controller_present = 0;
@@ -577,7 +577,8 @@ void __init sn_cpu_init(void)
577 int i; 577 int i;
578 static int wars_have_been_checked; 578 static int wars_have_been_checked;
579 579
580 if (smp_processor_id() == 0 && IS_MEDUSA()) { 580 cpuid = smp_processor_id();
581 if (cpuid == 0 && IS_MEDUSA()) {
581 if (ia64_sn_is_fake_prom()) 582 if (ia64_sn_is_fake_prom())
582 sn_prom_type = 2; 583 sn_prom_type = 2;
583 else 584 else
@@ -597,6 +598,12 @@ void __init sn_cpu_init(void)
597 sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2; 598 sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2;
598 599
599 /* 600 /*
601 * Don't check status. The SAL call is not supported on all PROMs
602 * but a failure is harmless.
603 */
604 (void) ia64_sn_set_cpu_number(cpuid);
605
606 /*
600 * The boot cpu makes this call again after platform initialization is 607 * The boot cpu makes this call again after platform initialization is
601 * complete. 608 * complete.
602 */ 609 */
@@ -607,7 +614,6 @@ void __init sn_cpu_init(void)
607 if (ia64_sn_get_prom_feature_set(i, &sn_prom_features[i]) != 0) 614 if (ia64_sn_get_prom_feature_set(i, &sn_prom_features[i]) != 0)
608 break; 615 break;
609 616
610 cpuid = smp_processor_id();
611 cpuphyid = get_sapicid(); 617 cpuphyid = get_sapicid();
612 618
613 if (ia64_sn_get_sapic_info(cpuphyid, &nasid, &subnode, &slice)) 619 if (ia64_sn_get_sapic_info(cpuphyid, &nasid, &subnode, &slice))
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 20de72791b97..e4aa839d0189 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -595,7 +595,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
595 595
596 /* sanity check prom rev */ 596 /* sanity check prom rev */
597 597
598 if (sn_sal_rev() < 0x0406) { 598 if (is_shub1() && sn_sal_rev() < 0x0406) {
599 printk 599 printk
600 (KERN_ERR "%s: SGI prom rev 4.06 or greater required " 600 (KERN_ERR "%s: SGI prom rev 4.06 or greater required "
601 "for tioca support\n", __FUNCTION__); 601 "for tioca support\n", __FUNCTION__);
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 8b6e723eb82b..e767f2ddae72 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -540,6 +540,59 @@ config RAM32BIT
540 540
541endchoice 541endchoice
542 542
543comment "ROM configuration"
544
545config 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
553config 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
562config 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
571config 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
580config 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
588config 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
543choice 596choice
544 prompt "Kernel executes from" 597 prompt "Kernel executes from"
545 ---help--- 598 ---help---
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 6a2f0c693254..59ced831b792 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -3,63 +3,13 @@
3 * 3 *
4 * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com> 4 * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com>
5 * 5 *
6 * This ends up looking compilcated, because of the number of 6 * This linker script is equiped to build either ROM loaded or RAM
7 * address variations for ram and rom/flash layouts. The real 7 * run kernels.
8 * work of the linker script is all at the end, and reasonably
9 * strait forward.
10 */ 8 */
11 9
12#include <linux/config.h> 10#include <linux/config.h>
13#include <asm-generic/vmlinux.lds.h> 11#include <asm-generic/vmlinux.lds.h>
14 12
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) 13#if defined(CONFIG_RAMKERNEL)
64#define RAM_START CONFIG_KERNELBASE 14#define RAM_START CONFIG_KERNELBASE
65#define RAM_LENGTH (CONFIG_RAMBASE + CONFIG_RAMSIZE - CONFIG_KERNELBASE) 15#define RAM_LENGTH (CONFIG_RAMBASE + CONFIG_RAMSIZE - CONFIG_KERNELBASE)
@@ -71,6 +21,10 @@
71#if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL) 21#if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL)
72#define RAM_START CONFIG_RAMBASE 22#define RAM_START CONFIG_RAMBASE
73#define RAM_LENGTH CONFIG_RAMSIZE 23#define RAM_LENGTH CONFIG_RAMSIZE
24#define ROMVEC_START CONFIG_ROMVEC
25#define ROMVEC_LENGTH CONFIG_ROMVECSIZE
26#define ROM_START CONFIG_ROMSTART
27#define ROM_LENGTH CONFIG_ROMSIZE
74#define TEXT rom 28#define TEXT rom
75#define DATA ram 29#define DATA ram
76#define INIT ram 30#define INIT ram
@@ -90,7 +44,6 @@ MEMORY {
90#ifdef ROM_START 44#ifdef ROM_START
91 romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH 45 romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH
92 rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH 46 rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH
93 erom : ORIGIN = ROM_END, LENGTH = 0
94#endif 47#endif
95} 48}
96 49
@@ -167,13 +120,6 @@ SECTIONS {
167 _etext = . ; 120 _etext = . ;
168 } > TEXT 121 } > TEXT
169 122
170#ifdef ROM_END
171 . = ROM_END ;
172 .erom : {
173 __rom_end = . ;
174 } > erom
175#endif
176
177 .data DATA_ADDR : { 123 .data DATA_ADDR : {
178 . = ALIGN(4); 124 . = ALIGN(4);
179 _sdata = . ; 125 _sdata = . ;
diff --git a/arch/m68knommu/platform/68328/Makefile b/arch/m68knommu/platform/68328/Makefile
index 1b3b719e4479..5e5435552d56 100644
--- a/arch/m68knommu/platform/68328/Makefile
+++ b/arch/m68knommu/platform/68328/Makefile
@@ -8,6 +8,7 @@ head-$(CONFIG_DRAGEN2) = head-de2.o
8 8
9obj-y += entry.o ints.o timers.o 9obj-y += entry.o ints.o timers.o
10obj-$(CONFIG_M68328) += config.o 10obj-$(CONFIG_M68328) += config.o
11obj-$(CONFIG_ROM) += romvec.o
11 12
12extra-y := head.o 13extra-y := head.o
13extra-$(CONFIG_M68328) += bootlogo.rh head.o 14extra-$(CONFIG_M68328) += bootlogo.rh head.o
diff --git a/arch/m68knommu/platform/68328/ints.c b/arch/m68knommu/platform/68328/ints.c
index 7437217813d2..2dda7339aae5 100644
--- a/arch/m68knommu/platform/68328/ints.c
+++ b/arch/m68knommu/platform/68328/ints.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/irqnode.h>
21#include <asm/traps.h> 22#include <asm/traps.h>
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/machdep.h> 24#include <asm/machdep.h>
@@ -82,25 +83,6 @@ unsigned int local_irq_count[NR_CPUS];
82/* irq node variables for the 32 (potential) on chip sources */ 83/* irq node variables for the 32 (potential) on chip sources */
83static irq_node_t int_irq_list[NR_IRQS]; 84static irq_node_t int_irq_list[NR_IRQS];
84 85
85#if !defined(CONFIG_DRAGEN2)
86asm (".global _start, __ramend/n/t"
87 ".section .romvec/n"
88 "e_vectors:\n\t"
89 ".long __ramend-4, _start, buserr, trap, trap, trap, trap, trap\n\t"
90 ".long trap, trap, trap, 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\n\t"
93 ".long trap, trap, trap, trap\n\t"
94 /*.long inthandler, inthandler, inthandler, inthandler
95 .long inthandler4, inthandler, inthandler, inthandler */
96 /* TRAP #0-15 */
97 ".long system_call, trap, trap, trap, trap, trap, trap, trap\n\t"
98 ".long trap, trap, trap, trap, trap, trap, trap, trap\n\t"
99 ".long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n\t"
100 ".text\n"
101 "ignore: rte");
102#endif
103
104/* 86/*
105 * This function should be called during kernel startup to initialize 87 * This function should be called during kernel startup to initialize
106 * the IRQ handling routines. 88 * the IRQ handling routines.
diff --git a/arch/m68knommu/platform/68328/romvec.S b/arch/m68knommu/platform/68328/romvec.S
new file mode 100644
index 000000000000..3e7fe1e14913
--- /dev/null
+++ b/arch/m68knommu/platform/68328/romvec.S
@@ -0,0 +1,37 @@
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
22e_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
diff --git a/arch/m68knommu/platform/68360/config.c b/arch/m68knommu/platform/68360/config.c
index 3db244625f0f..69c670dfd62b 100644
--- a/arch/m68knommu/platform/68360/config.c
+++ b/arch/m68knommu/platform/68360/config.c
@@ -141,13 +141,13 @@ int BSP_set_clock_mmss (unsigned long nowtime)
141void BSP_reset (void) 141void BSP_reset (void)
142{ 142{
143 local_irq_disable(); 143 local_irq_disable();
144 asm volatile (" 144 asm volatile (
145 moveal #_start, %a0; 145 "moveal #_start, %a0;\n"
146 moveb #0, 0xFFFFF300; 146 "moveb #0, 0xFFFFF300;\n"
147 moveal 0(%a0), %sp; 147 "moveal 0(%a0), %sp;\n"
148 moveal 4(%a0), %a0; 148 "moveal 4(%a0), %a0;\n"
149 jmp (%a0); 149 "jmp (%a0);\n"
150 "); 150 );
151} 151}
152 152
153unsigned char *scc1_hwaddr; 153unsigned char *scc1_hwaddr;
diff --git a/arch/m68knommu/platform/68360/ints.c b/arch/m68knommu/platform/68360/ints.c
index ba184db1651b..0245fc4a4781 100644
--- a/arch/m68knommu/platform/68360/ints.c
+++ b/arch/m68knommu/platform/68360/ints.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/irqnode.h>
23#include <asm/traps.h> 24#include <asm/traps.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/machdep.h> 26#include <asm/machdep.h>
diff --git a/arch/m68knommu/platform/68EZ328/config.c b/arch/m68knommu/platform/68EZ328/config.c
index d8d56e5de310..15a14a67c2bf 100644
--- a/arch/m68knommu/platform/68EZ328/config.c
+++ b/arch/m68knommu/platform/68EZ328/config.c
@@ -42,13 +42,13 @@ void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int
42void m68ez328_reset(void) 42void m68ez328_reset(void)
43{ 43{
44 local_irq_disable(); 44 local_irq_disable();
45 asm volatile (" 45 asm volatile (
46 moveal #0x10c00000, %a0; 46 "moveal #0x10c00000, %a0;\n"
47 moveb #0, 0xFFFFF300; 47 "moveb #0, 0xFFFFF300;\n"
48 moveal 0(%a0), %sp; 48 "moveal 0(%a0), %sp;\n"
49 moveal 4(%a0), %a0; 49 "moveal 4(%a0), %a0;\n"
50 jmp (%a0); 50 "jmp (%a0);\n"
51 "); 51 );
52} 52}
53 53
54/***************************************************************************/ 54/***************************************************************************/
diff --git a/arch/m68knommu/platform/68VZ328/config.c b/arch/m68knommu/platform/68VZ328/config.c
index d926524cdf82..4058de5c8fa2 100644
--- a/arch/m68knommu/platform/68VZ328/config.c
+++ b/arch/m68knommu/platform/68VZ328/config.c
@@ -141,13 +141,13 @@ static void init_hardware(char *command, int size)
141static void m68vz328_reset(void) 141static void m68vz328_reset(void)
142{ 142{
143 local_irq_disable(); 143 local_irq_disable();
144 asm volatile (" 144 asm volatile (
145 moveal #0x10c00000, %a0; 145 "moveal #0x10c00000, %a0;\n\t"
146 moveb #0, 0xFFFFF300; 146 "moveb #0, 0xFFFFF300;\n\t"
147 moveal 0(%a0), %sp; 147 "moveal 0(%a0), %sp;\n\t"
148 moveal 4(%a0), %a0; 148 "moveal 4(%a0), %a0;\n\t"
149 jmp (%a0); 149 "jmp (%a0);\n"
150 "); 150 );
151} 151}
152 152
153unsigned char *cs8900a_hwaddr; 153unsigned char *cs8900a_hwaddr;
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index 498b042e1837..c7a27eddca6d 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -119,7 +119,14 @@ int pmac_backlight_set_legacy_brightness(int brightness)
119 down(&pmac_backlight->sem); 119 down(&pmac_backlight->sem);
120 props = pmac_backlight->props; 120 props = pmac_backlight->props;
121 props->brightness = brightness * 121 props->brightness = brightness *
122 props->max_brightness / OLD_BACKLIGHT_MAX; 122 (props->max_brightness + 1) /
123 (OLD_BACKLIGHT_MAX + 1);
124
125 if (props->brightness > props->max_brightness)
126 props->brightness = props->max_brightness;
127 else if (props->brightness < 0)
128 props->brightness = 0;
129
123 props->update_status(pmac_backlight); 130 props->update_status(pmac_backlight);
124 up(&pmac_backlight->sem); 131 up(&pmac_backlight->sem);
125 132
@@ -140,8 +147,11 @@ int pmac_backlight_get_legacy_brightness()
140 147
141 down(&pmac_backlight->sem); 148 down(&pmac_backlight->sem);
142 props = pmac_backlight->props; 149 props = pmac_backlight->props;
150
143 result = props->brightness * 151 result = props->brightness *
144 OLD_BACKLIGHT_MAX / props->max_brightness; 152 (OLD_BACKLIGHT_MAX + 1) /
153 (props->max_brightness + 1);
154
145 up(&pmac_backlight->sem); 155 up(&pmac_backlight->sem);
146 } 156 }
147 mutex_unlock(&pmac_backlight_mutex); 157 mutex_unlock(&pmac_backlight_mutex);
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index 3be0a7e4bf08..bfa82f52a5cc 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -118,6 +118,12 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
118 /* high bit used in ret_from_ code */ 118 /* high bit used in ret_from_ code */
119 unsigned irq = ~regs->orig_rax; 119 unsigned irq = ~regs->orig_rax;
120 120
121 if (unlikely(irq >= NR_IRQS)) {
122 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
123 __FUNCTION__, irq);
124 BUG();
125 }
126
121 exit_idle(); 127 exit_idle();
122 irq_enter(); 128 irq_enter();
123#ifdef CONFIG_DEBUG_STACKOVERFLOW 129#ifdef CONFIG_DEBUG_STACKOVERFLOW
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 399489c93132..0ef9cf2bc45e 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -607,11 +607,13 @@ void set_nmi_callback(nmi_callback_t callback)
607 vmalloc_sync_all(); 607 vmalloc_sync_all();
608 rcu_assign_pointer(nmi_callback, callback); 608 rcu_assign_pointer(nmi_callback, callback);
609} 609}
610EXPORT_SYMBOL_GPL(set_nmi_callback);
610 611
611void unset_nmi_callback(void) 612void unset_nmi_callback(void)
612{ 613{
613 nmi_callback = dummy_nmi_callback; 614 nmi_callback = dummy_nmi_callback;
614} 615}
616EXPORT_SYMBOL_GPL(unset_nmi_callback);
615 617
616#ifdef CONFIG_SYSCTL 618#ifdef CONFIG_SYSCTL
617 619
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 3c74ea729fc7..18dd026f470d 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -210,7 +210,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec,
210{ 210{
211 struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */ 211 struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */
212 struct address_space *mapping = file->f_mapping; 212 struct address_space *mapping = file->f_mapping;
213 struct address_space_operations *aops = mapping->a_ops; 213 const struct address_space_operations *aops = mapping->a_ops;
214 pgoff_t index; 214 pgoff_t index;
215 unsigned offset, bv_offs; 215 unsigned offset, bv_offs;
216 int len, ret; 216 int len, ret;
@@ -784,7 +784,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
784 784
785 error = -EINVAL; 785 error = -EINVAL;
786 if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) { 786 if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) {
787 struct address_space_operations *aops = mapping->a_ops; 787 const struct address_space_operations *aops = mapping->a_ops;
788 /* 788 /*
789 * If we can't read - sorry. If we only can't write - well, 789 * If we can't read - sorry. If we only can't write - well,
790 * it's going to be read-only. 790 * it's going to be read-only.
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 940bfd7951e5..0378da04cfa2 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -191,7 +191,7 @@ static int ramdisk_set_page_dirty(struct page *page)
191 return 0; 191 return 0;
192} 192}
193 193
194static struct address_space_operations ramdisk_aops = { 194static const struct address_space_operations ramdisk_aops = {
195 .readpage = ramdisk_readpage, 195 .readpage = ramdisk_readpage,
196 .prepare_write = ramdisk_prepare_write, 196 .prepare_write = ramdisk_prepare_write,
197 .commit_write = ramdisk_commit_write, 197 .commit_write = ramdisk_commit_write,
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 83ed6ae466a5..ad26f4b997c5 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -3738,11 +3738,8 @@ static int ipmi_init_msghandler(void)
3738 proc_ipmi_root->owner = THIS_MODULE; 3738 proc_ipmi_root->owner = THIS_MODULE;
3739#endif /* CONFIG_PROC_FS */ 3739#endif /* CONFIG_PROC_FS */
3740 3740
3741 init_timer(&ipmi_timer); 3741 setup_timer(&ipmi_timer, ipmi_timeout, 0);
3742 ipmi_timer.data = 0; 3742 mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
3743 ipmi_timer.function = ipmi_timeout;
3744 ipmi_timer.expires = jiffies + IPMI_TIMEOUT_JIFFIES;
3745 add_timer(&ipmi_timer);
3746 3743
3747 atomic_notifier_chain_register(&panic_notifier_list, &panic_block); 3744 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
3748 3745
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 101c14b9b26d..bd4f2248b758 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -55,23 +55,6 @@
55#include <linux/mutex.h> 55#include <linux/mutex.h>
56#include <linux/kthread.h> 56#include <linux/kthread.h>
57#include <asm/irq.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
65static 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> 58#include <linux/interrupt.h>
76#include <linux/rcupdate.h> 59#include <linux/rcupdate.h>
77#include <linux/ipmi_smi.h> 60#include <linux/ipmi_smi.h>
@@ -243,8 +226,6 @@ static int register_xaction_notifier(struct notifier_block * nb)
243 return atomic_notifier_chain_register(&xaction_notifier_list, nb); 226 return atomic_notifier_chain_register(&xaction_notifier_list, nb);
244} 227}
245 228
246static void si_restart_short_timer(struct smi_info *smi_info);
247
248static void deliver_recv_msg(struct smi_info *smi_info, 229static void deliver_recv_msg(struct smi_info *smi_info,
249 struct ipmi_smi_msg *msg) 230 struct ipmi_smi_msg *msg)
250{ 231{
@@ -768,7 +749,6 @@ static void sender(void *send_info,
768 && (smi_info->curr_msg == NULL)) 749 && (smi_info->curr_msg == NULL))
769 { 750 {
770 start_next_msg(smi_info); 751 start_next_msg(smi_info);
771 si_restart_short_timer(smi_info);
772 } 752 }
773 spin_unlock_irqrestore(&(smi_info->si_lock), flags); 753 spin_unlock_irqrestore(&(smi_info->si_lock), flags);
774} 754}
@@ -833,37 +813,6 @@ static void request_events(void *send_info)
833 813
834static int initialized = 0; 814static int initialized = 0;
835 815
836/* Must be called with interrupts off and with the si_lock held. */
837static void si_restart_short_timer(struct smi_info *smi_info)
838{
839#if defined(CONFIG_HIGH_RES_TIMERS)
840 unsigned long flags;
841 unsigned long jiffies_now;
842 unsigned long seq;
843
844 if (del_timer(&(smi_info->si_timer))) {
845 /* If we don't delete the timer, then it will go off
846 immediately, anyway. So we only process if we
847 actually delete the timer. */
848
849 do {
850 seq = read_seqbegin_irqsave(&xtime_lock, flags);
851 jiffies_now = jiffies;
852 smi_info->si_timer.expires = jiffies_now;
853 smi_info->si_timer.arch_cycle_expires
854 = get_arch_cycles(jiffies_now);
855 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
856
857 add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
858
859 add_timer(&(smi_info->si_timer));
860 spin_lock_irqsave(&smi_info->count_lock, flags);
861 smi_info->timeout_restarts++;
862 spin_unlock_irqrestore(&smi_info->count_lock, flags);
863 }
864#endif
865}
866
867static void smi_timeout(unsigned long data) 816static void smi_timeout(unsigned long data)
868{ 817{
869 struct smi_info *smi_info = (struct smi_info *) data; 818 struct smi_info *smi_info = (struct smi_info *) data;
@@ -904,31 +853,15 @@ static void smi_timeout(unsigned long data)
904 /* If the state machine asks for a short delay, then shorten 853 /* If the state machine asks for a short delay, then shorten
905 the timer timeout. */ 854 the timer timeout. */
906 if (smi_result == SI_SM_CALL_WITH_DELAY) { 855 if (smi_result == SI_SM_CALL_WITH_DELAY) {
907#if defined(CONFIG_HIGH_RES_TIMERS)
908 unsigned long seq;
909#endif
910 spin_lock_irqsave(&smi_info->count_lock, flags); 856 spin_lock_irqsave(&smi_info->count_lock, flags);
911 smi_info->short_timeouts++; 857 smi_info->short_timeouts++;
912 spin_unlock_irqrestore(&smi_info->count_lock, flags); 858 spin_unlock_irqrestore(&smi_info->count_lock, flags);
913#if defined(CONFIG_HIGH_RES_TIMERS)
914 do {
915 seq = read_seqbegin_irqsave(&xtime_lock, flags);
916 smi_info->si_timer.expires = jiffies;
917 smi_info->si_timer.arch_cycle_expires
918 = get_arch_cycles(smi_info->si_timer.expires);
919 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
920 add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
921#else
922 smi_info->si_timer.expires = jiffies + 1; 859 smi_info->si_timer.expires = jiffies + 1;
923#endif
924 } else { 860 } else {
925 spin_lock_irqsave(&smi_info->count_lock, flags); 861 spin_lock_irqsave(&smi_info->count_lock, flags);
926 smi_info->long_timeouts++; 862 smi_info->long_timeouts++;
927 spin_unlock_irqrestore(&smi_info->count_lock, flags); 863 spin_unlock_irqrestore(&smi_info->count_lock, flags);
928 smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; 864 smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES;
929#if defined(CONFIG_HIGH_RES_TIMERS)
930 smi_info->si_timer.arch_cycle_expires = 0;
931#endif
932 } 865 }
933 866
934 do_add_timer: 867 do_add_timer:
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 8f8867170973..1a0a19c53605 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -949,9 +949,10 @@ static int wdog_reboot_handler(struct notifier_block *this,
949 /* Disable the WDT if we are shutting down. */ 949 /* Disable the WDT if we are shutting down. */
950 ipmi_watchdog_state = WDOG_TIMEOUT_NONE; 950 ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
951 panic_halt_ipmi_set_timeout(); 951 panic_halt_ipmi_set_timeout();
952 } else { 952 } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {
953 /* Set a long timer to let the reboot happens, but 953 /* Set a long timer to let the reboot happens, but
954 reboot if it hangs. */ 954 reboot if it hangs, but only if the watchdog
955 timer was already running. */
955 timeout = 120; 956 timeout = 120;
956 pretimeout = 0; 957 pretimeout = 0;
957 ipmi_watchdog_state = WDOG_TIMEOUT_RESET; 958 ipmi_watchdog_state = WDOG_TIMEOUT_RESET;
@@ -973,16 +974,17 @@ static int wdog_panic_handler(struct notifier_block *this,
973{ 974{
974 static int panic_event_handled = 0; 975 static int panic_event_handled = 0;
975 976
976 /* On a panic, if we have a panic timeout, make sure that the thing 977 /* On a panic, if we have a panic timeout, make sure to extend
977 reboots, even if it hangs during that panic. */ 978 the watchdog timer to a reasonable value to complete the
978 if (watchdog_user && !panic_event_handled) { 979 panic, if the watchdog timer is running. Plus the
979 /* Make sure the panic doesn't hang, and make sure we 980 pretimeout is meaningless at panic time. */
980 do this only once. */ 981 if (watchdog_user && !panic_event_handled &&
982 ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {
983 /* Make sure we do this only once. */
981 panic_event_handled = 1; 984 panic_event_handled = 1;
982 985
983 timeout = 255; 986 timeout = 255;
984 pretimeout = 0; 987 pretimeout = 0;
985 ipmi_watchdog_state = WDOG_TIMEOUT_RESET;
986 panic_halt_ipmi_set_timeout(); 988 panic_halt_ipmi_set_timeout();
987 } 989 }
988 990
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index ef20c1fc9c4c..216c79256de3 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -42,13 +42,12 @@
42#include <linux/devfs_fs_kernel.h> 42#include <linux/devfs_fs_kernel.h>
43#include <linux/device.h> 43#include <linux/device.h>
44#include <linux/wait.h> 44#include <linux/wait.h>
45#include <linux/eisa.h>
45 46
46#include <asm/io.h> 47#include <asm/io.h>
47#include <asm/uaccess.h> 48#include <asm/uaccess.h>
48 49
49#ifdef CONFIG_PCI
50#include <linux/pci.h> 50#include <linux/pci.h>
51#endif
52 51
53/*****************************************************************************/ 52/*****************************************************************************/
54 53
@@ -137,6 +136,10 @@ static stlconf_t stli_brdconf[] = {
137 136
138static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); 137static int stli_nrbrds = ARRAY_SIZE(stli_brdconf);
139 138
139/* stli_lock must NOT be taken holding brd_lock */
140static spinlock_t stli_lock; /* TTY logic lock */
141static spinlock_t brd_lock; /* Board logic lock */
142
140/* 143/*
141 * There is some experimental EISA board detection code in this driver. 144 * There is some experimental EISA board detection code in this driver.
142 * By default it is disabled, but for those that want to try it out, 145 * By default it is disabled, but for those that want to try it out,
@@ -173,14 +176,6 @@ static char *stli_serialname = "ttyE";
173 176
174static struct tty_driver *stli_serial; 177static struct tty_driver *stli_serial;
175 178
176/*
177 * We will need to allocate a temporary write buffer for chars that
178 * come direct from user space. The problem is that a copy from user
179 * space might cause a page fault (typically on a system that is
180 * swapping!). All ports will share one buffer - since if the system
181 * is already swapping a shared buffer won't make things any worse.
182 */
183static char *stli_tmpwritebuf;
184 179
185#define STLI_TXBUFSIZE 4096 180#define STLI_TXBUFSIZE 4096
186 181
@@ -419,7 +414,7 @@ static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs);
419#endif 414#endif
420 415
421static struct pci_device_id istallion_pci_tbl[] = { 416static struct pci_device_id istallion_pci_tbl[] = {
422 { PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 417 { PCI_DEVICE(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA), },
423 { 0 } 418 { 0 }
424}; 419};
425MODULE_DEVICE_TABLE(pci, istallion_pci_tbl); 420MODULE_DEVICE_TABLE(pci, istallion_pci_tbl);
@@ -682,7 +677,7 @@ static int stli_startbrd(stlibrd_t *brdp);
682static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp); 677static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp);
683static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp); 678static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp);
684static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg); 679static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg);
685static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp); 680static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp);
686static void stli_poll(unsigned long arg); 681static void stli_poll(unsigned long arg);
687static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp); 682static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp);
688static int stli_initopen(stlibrd_t *brdp, stliport_t *portp); 683static int stli_initopen(stlibrd_t *brdp, stliport_t *portp);
@@ -693,7 +688,8 @@ static void stli_dohangup(void *arg);
693static int stli_setport(stliport_t *portp); 688static int stli_setport(stliport_t *portp);
694static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); 689static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);
695static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); 690static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);
696static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp); 691static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);
692static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp);
697static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp); 693static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp);
698static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); 694static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts);
699static long stli_mktiocm(unsigned long sigvalue); 695static long stli_mktiocm(unsigned long sigvalue);
@@ -799,18 +795,8 @@ static struct class *istallion_class;
799 795
800static int __init istallion_module_init(void) 796static int __init istallion_module_init(void)
801{ 797{
802 unsigned long flags;
803
804#ifdef DEBUG
805 printk("init_module()\n");
806#endif
807
808 save_flags(flags);
809 cli();
810 stli_init(); 798 stli_init();
811 restore_flags(flags); 799 return 0;
812
813 return(0);
814} 800}
815 801
816/*****************************************************************************/ 802/*****************************************************************************/
@@ -819,33 +805,24 @@ static void __exit istallion_module_exit(void)
819{ 805{
820 stlibrd_t *brdp; 806 stlibrd_t *brdp;
821 stliport_t *portp; 807 stliport_t *portp;
822 unsigned long flags;
823 int i, j; 808 int i, j;
824 809
825#ifdef DEBUG
826 printk("cleanup_module()\n");
827#endif
828
829 printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, 810 printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle,
830 stli_drvversion); 811 stli_drvversion);
831 812
832 save_flags(flags); 813 /*
833 cli(); 814 * Free up all allocated resources used by the ports. This includes
834 815 * memory and interrupts.
835/* 816 */
836 * Free up all allocated resources used by the ports. This includes
837 * memory and interrupts.
838 */
839 if (stli_timeron) { 817 if (stli_timeron) {
840 stli_timeron = 0; 818 stli_timeron = 0;
841 del_timer(&stli_timerlist); 819 del_timer_sync(&stli_timerlist);
842 } 820 }
843 821
844 i = tty_unregister_driver(stli_serial); 822 i = tty_unregister_driver(stli_serial);
845 if (i) { 823 if (i) {
846 printk("STALLION: failed to un-register tty driver, " 824 printk("STALLION: failed to un-register tty driver, "
847 "errno=%d\n", -i); 825 "errno=%d\n", -i);
848 restore_flags(flags);
849 return; 826 return;
850 } 827 }
851 put_tty_driver(stli_serial); 828 put_tty_driver(stli_serial);
@@ -859,16 +836,15 @@ static void __exit istallion_module_exit(void)
859 printk("STALLION: failed to un-register serial memory device, " 836 printk("STALLION: failed to un-register serial memory device, "
860 "errno=%d\n", -i); 837 "errno=%d\n", -i);
861 838
862 kfree(stli_tmpwritebuf);
863 kfree(stli_txcookbuf); 839 kfree(stli_txcookbuf);
864 840
865 for (i = 0; (i < stli_nrbrds); i++) { 841 for (i = 0; (i < stli_nrbrds); i++) {
866 if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL) 842 if ((brdp = stli_brds[i]) == NULL)
867 continue; 843 continue;
868 for (j = 0; (j < STL_MAXPORTS); j++) { 844 for (j = 0; (j < STL_MAXPORTS); j++) {
869 portp = brdp->ports[j]; 845 portp = brdp->ports[j];
870 if (portp != (stliport_t *) NULL) { 846 if (portp != NULL) {
871 if (portp->tty != (struct tty_struct *) NULL) 847 if (portp->tty != NULL)
872 tty_hangup(portp->tty); 848 tty_hangup(portp->tty);
873 kfree(portp); 849 kfree(portp);
874 } 850 }
@@ -878,10 +854,8 @@ static void __exit istallion_module_exit(void)
878 if (brdp->iosize > 0) 854 if (brdp->iosize > 0)
879 release_region(brdp->iobase, brdp->iosize); 855 release_region(brdp->iobase, brdp->iosize);
880 kfree(brdp); 856 kfree(brdp);
881 stli_brds[i] = (stlibrd_t *) NULL; 857 stli_brds[i] = NULL;
882 } 858 }
883
884 restore_flags(flags);
885} 859}
886 860
887module_init(istallion_module_init); 861module_init(istallion_module_init);
@@ -895,19 +869,15 @@ module_exit(istallion_module_exit);
895 869
896static void stli_argbrds(void) 870static void stli_argbrds(void)
897{ 871{
898 stlconf_t conf; 872 stlconf_t conf;
899 stlibrd_t *brdp; 873 stlibrd_t *brdp;
900 int i; 874 int i;
901
902#ifdef DEBUG
903 printk("stli_argbrds()\n");
904#endif
905 875
906 for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { 876 for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) {
907 memset(&conf, 0, sizeof(conf)); 877 memset(&conf, 0, sizeof(conf));
908 if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) 878 if (stli_parsebrd(&conf, stli_brdsp[i]) == 0)
909 continue; 879 continue;
910 if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 880 if ((brdp = stli_allocbrd()) == NULL)
911 continue; 881 continue;
912 stli_nrbrds = i + 1; 882 stli_nrbrds = i + 1;
913 brdp->brdnr = i; 883 brdp->brdnr = i;
@@ -926,9 +896,9 @@ static void stli_argbrds(void)
926 896
927static unsigned long stli_atol(char *str) 897static unsigned long stli_atol(char *str)
928{ 898{
929 unsigned long val; 899 unsigned long val;
930 int base, c; 900 int base, c;
931 char *sp; 901 char *sp;
932 902
933 val = 0; 903 val = 0;
934 sp = str; 904 sp = str;
@@ -962,15 +932,11 @@ static unsigned long stli_atol(char *str)
962 932
963static int stli_parsebrd(stlconf_t *confp, char **argp) 933static int stli_parsebrd(stlconf_t *confp, char **argp)
964{ 934{
965 char *sp; 935 char *sp;
966 int i; 936 int i;
967
968#ifdef DEBUG
969 printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);
970#endif
971 937
972 if ((argp[0] == (char *) NULL) || (*argp[0] == 0)) 938 if (argp[0] == NULL || *argp[0] == 0)
973 return(0); 939 return 0;
974 940
975 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) 941 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
976 *sp = TOLOWER(*sp); 942 *sp = TOLOWER(*sp);
@@ -985,9 +951,9 @@ static int stli_parsebrd(stlconf_t *confp, char **argp)
985 } 951 }
986 952
987 confp->brdtype = stli_brdstr[i].type; 953 confp->brdtype = stli_brdstr[i].type;
988 if ((argp[1] != (char *) NULL) && (*argp[1] != 0)) 954 if (argp[1] != NULL && *argp[1] != 0)
989 confp->ioaddr1 = stli_atol(argp[1]); 955 confp->ioaddr1 = stli_atol(argp[1]);
990 if ((argp[2] != (char *) NULL) && (*argp[2] != 0)) 956 if (argp[2] != NULL && *argp[2] != 0)
991 confp->memaddr = stli_atol(argp[2]); 957 confp->memaddr = stli_atol(argp[2]);
992 return(1); 958 return(1);
993} 959}
@@ -998,34 +964,29 @@ static int stli_parsebrd(stlconf_t *confp, char **argp)
998 964
999static int stli_open(struct tty_struct *tty, struct file *filp) 965static int stli_open(struct tty_struct *tty, struct file *filp)
1000{ 966{
1001 stlibrd_t *brdp; 967 stlibrd_t *brdp;
1002 stliport_t *portp; 968 stliport_t *portp;
1003 unsigned int minordev; 969 unsigned int minordev;
1004 int brdnr, portnr, rc; 970 int brdnr, portnr, rc;
1005
1006#ifdef DEBUG
1007 printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty,
1008 (int) filp, tty->name);
1009#endif
1010 971
1011 minordev = tty->index; 972 minordev = tty->index;
1012 brdnr = MINOR2BRD(minordev); 973 brdnr = MINOR2BRD(minordev);
1013 if (brdnr >= stli_nrbrds) 974 if (brdnr >= stli_nrbrds)
1014 return(-ENODEV); 975 return -ENODEV;
1015 brdp = stli_brds[brdnr]; 976 brdp = stli_brds[brdnr];
1016 if (brdp == (stlibrd_t *) NULL) 977 if (brdp == NULL)
1017 return(-ENODEV); 978 return -ENODEV;
1018 if ((brdp->state & BST_STARTED) == 0) 979 if ((brdp->state & BST_STARTED) == 0)
1019 return(-ENODEV); 980 return -ENODEV;
1020 portnr = MINOR2PORT(minordev); 981 portnr = MINOR2PORT(minordev);
1021 if ((portnr < 0) || (portnr > brdp->nrports)) 982 if ((portnr < 0) || (portnr > brdp->nrports))
1022 return(-ENODEV); 983 return -ENODEV;
1023 984
1024 portp = brdp->ports[portnr]; 985 portp = brdp->ports[portnr];
1025 if (portp == (stliport_t *) NULL) 986 if (portp == NULL)
1026 return(-ENODEV); 987 return -ENODEV;
1027 if (portp->devnr < 1) 988 if (portp->devnr < 1)
1028 return(-ENODEV); 989 return -ENODEV;
1029 990
1030 991
1031/* 992/*
@@ -1037,8 +998,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
1037 if (portp->flags & ASYNC_CLOSING) { 998 if (portp->flags & ASYNC_CLOSING) {
1038 interruptible_sleep_on(&portp->close_wait); 999 interruptible_sleep_on(&portp->close_wait);
1039 if (portp->flags & ASYNC_HUP_NOTIFY) 1000 if (portp->flags & ASYNC_HUP_NOTIFY)
1040 return(-EAGAIN); 1001 return -EAGAIN;
1041 return(-ERESTARTSYS); 1002 return -ERESTARTSYS;
1042 } 1003 }
1043 1004
1044/* 1005/*
@@ -1054,7 +1015,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
1054 wait_event_interruptible(portp->raw_wait, 1015 wait_event_interruptible(portp->raw_wait,
1055 !test_bit(ST_INITIALIZING, &portp->state)); 1016 !test_bit(ST_INITIALIZING, &portp->state));
1056 if (signal_pending(current)) 1017 if (signal_pending(current))
1057 return(-ERESTARTSYS); 1018 return -ERESTARTSYS;
1058 1019
1059 if ((portp->flags & ASYNC_INITIALIZED) == 0) { 1020 if ((portp->flags & ASYNC_INITIALIZED) == 0) {
1060 set_bit(ST_INITIALIZING, &portp->state); 1021 set_bit(ST_INITIALIZING, &portp->state);
@@ -1065,7 +1026,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
1065 clear_bit(ST_INITIALIZING, &portp->state); 1026 clear_bit(ST_INITIALIZING, &portp->state);
1066 wake_up_interruptible(&portp->raw_wait); 1027 wake_up_interruptible(&portp->raw_wait);
1067 if (rc < 0) 1028 if (rc < 0)
1068 return(rc); 1029 return rc;
1069 } 1030 }
1070 1031
1071/* 1032/*
@@ -1077,8 +1038,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
1077 if (portp->flags & ASYNC_CLOSING) { 1038 if (portp->flags & ASYNC_CLOSING) {
1078 interruptible_sleep_on(&portp->close_wait); 1039 interruptible_sleep_on(&portp->close_wait);
1079 if (portp->flags & ASYNC_HUP_NOTIFY) 1040 if (portp->flags & ASYNC_HUP_NOTIFY)
1080 return(-EAGAIN); 1041 return -EAGAIN;
1081 return(-ERESTARTSYS); 1042 return -ERESTARTSYS;
1082 } 1043 }
1083 1044
1084/* 1045/*
@@ -1088,38 +1049,33 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
1088 */ 1049 */
1089 if (!(filp->f_flags & O_NONBLOCK)) { 1050 if (!(filp->f_flags & O_NONBLOCK)) {
1090 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) 1051 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0)
1091 return(rc); 1052 return rc;
1092 } 1053 }
1093 portp->flags |= ASYNC_NORMAL_ACTIVE; 1054 portp->flags |= ASYNC_NORMAL_ACTIVE;
1094 return(0); 1055 return 0;
1095} 1056}
1096 1057
1097/*****************************************************************************/ 1058/*****************************************************************************/
1098 1059
1099static void stli_close(struct tty_struct *tty, struct file *filp) 1060static void stli_close(struct tty_struct *tty, struct file *filp)
1100{ 1061{
1101 stlibrd_t *brdp; 1062 stlibrd_t *brdp;
1102 stliport_t *portp; 1063 stliport_t *portp;
1103 unsigned long flags; 1064 unsigned long flags;
1104
1105#ifdef DEBUG
1106 printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp);
1107#endif
1108 1065
1109 portp = tty->driver_data; 1066 portp = tty->driver_data;
1110 if (portp == (stliport_t *) NULL) 1067 if (portp == NULL)
1111 return; 1068 return;
1112 1069
1113 save_flags(flags); 1070 spin_lock_irqsave(&stli_lock, flags);
1114 cli();
1115 if (tty_hung_up_p(filp)) { 1071 if (tty_hung_up_p(filp)) {
1116 restore_flags(flags); 1072 spin_unlock_irqrestore(&stli_lock, flags);
1117 return; 1073 return;
1118 } 1074 }
1119 if ((tty->count == 1) && (portp->refcount != 1)) 1075 if ((tty->count == 1) && (portp->refcount != 1))
1120 portp->refcount = 1; 1076 portp->refcount = 1;
1121 if (portp->refcount-- > 1) { 1077 if (portp->refcount-- > 1) {
1122 restore_flags(flags); 1078 spin_unlock_irqrestore(&stli_lock, flags);
1123 return; 1079 return;
1124 } 1080 }
1125 1081
@@ -1134,6 +1090,8 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
1134 if (tty == stli_txcooktty) 1090 if (tty == stli_txcooktty)
1135 stli_flushchars(tty); 1091 stli_flushchars(tty);
1136 tty->closing = 1; 1092 tty->closing = 1;
1093 spin_unlock_irqrestore(&stli_lock, flags);
1094
1137 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1095 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)
1138 tty_wait_until_sent(tty, portp->closing_wait); 1096 tty_wait_until_sent(tty, portp->closing_wait);
1139 1097
@@ -1157,7 +1115,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
1157 stli_flushbuffer(tty); 1115 stli_flushbuffer(tty);
1158 1116
1159 tty->closing = 0; 1117 tty->closing = 0;
1160 portp->tty = (struct tty_struct *) NULL; 1118 portp->tty = NULL;
1161 1119
1162 if (portp->openwaitcnt) { 1120 if (portp->openwaitcnt) {
1163 if (portp->close_delay) 1121 if (portp->close_delay)
@@ -1167,7 +1125,6 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
1167 1125
1168 portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1126 portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1169 wake_up_interruptible(&portp->close_wait); 1127 wake_up_interruptible(&portp->close_wait);
1170 restore_flags(flags);
1171} 1128}
1172 1129
1173/*****************************************************************************/ 1130/*****************************************************************************/
@@ -1182,45 +1139,41 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
1182 1139
1183static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) 1140static int stli_initopen(stlibrd_t *brdp, stliport_t *portp)
1184{ 1141{
1185 struct tty_struct *tty; 1142 struct tty_struct *tty;
1186 asynotify_t nt; 1143 asynotify_t nt;
1187 asyport_t aport; 1144 asyport_t aport;
1188 int rc; 1145 int rc;
1189
1190#ifdef DEBUG
1191 printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp);
1192#endif
1193 1146
1194 if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0) 1147 if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0)
1195 return(rc); 1148 return rc;
1196 1149
1197 memset(&nt, 0, sizeof(asynotify_t)); 1150 memset(&nt, 0, sizeof(asynotify_t));
1198 nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK); 1151 nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK);
1199 nt.signal = SG_DCD; 1152 nt.signal = SG_DCD;
1200 if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt, 1153 if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt,
1201 sizeof(asynotify_t), 0)) < 0) 1154 sizeof(asynotify_t), 0)) < 0)
1202 return(rc); 1155 return rc;
1203 1156
1204 tty = portp->tty; 1157 tty = portp->tty;
1205 if (tty == (struct tty_struct *) NULL) 1158 if (tty == NULL)
1206 return(-ENODEV); 1159 return -ENODEV;
1207 stli_mkasyport(portp, &aport, tty->termios); 1160 stli_mkasyport(portp, &aport, tty->termios);
1208 if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, 1161 if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport,
1209 sizeof(asyport_t), 0)) < 0) 1162 sizeof(asyport_t), 0)) < 0)
1210 return(rc); 1163 return rc;
1211 1164
1212 set_bit(ST_GETSIGS, &portp->state); 1165 set_bit(ST_GETSIGS, &portp->state);
1213 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, 1166 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig,
1214 sizeof(asysigs_t), 1)) < 0) 1167 sizeof(asysigs_t), 1)) < 0)
1215 return(rc); 1168 return rc;
1216 if (test_and_clear_bit(ST_GETSIGS, &portp->state)) 1169 if (test_and_clear_bit(ST_GETSIGS, &portp->state))
1217 portp->sigs = stli_mktiocm(portp->asig.sigvalue); 1170 portp->sigs = stli_mktiocm(portp->asig.sigvalue);
1218 stli_mkasysigs(&portp->asig, 1, 1); 1171 stli_mkasysigs(&portp->asig, 1, 1);
1219 if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, 1172 if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig,
1220 sizeof(asysigs_t), 0)) < 0) 1173 sizeof(asysigs_t), 0)) < 0)
1221 return(rc); 1174 return rc;
1222 1175
1223 return(0); 1176 return 0;
1224} 1177}
1225 1178
1226/*****************************************************************************/ 1179/*****************************************************************************/
@@ -1234,22 +1187,15 @@ static int stli_initopen(stlibrd_t *brdp, stliport_t *portp)
1234 1187
1235static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) 1188static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait)
1236{ 1189{
1237 volatile cdkhdr_t *hdrp; 1190 cdkhdr_t __iomem *hdrp;
1238 volatile cdkctrl_t *cp; 1191 cdkctrl_t __iomem *cp;
1239 volatile unsigned char *bits; 1192 unsigned char __iomem *bits;
1240 unsigned long flags; 1193 unsigned long flags;
1241 int rc; 1194 int rc;
1242
1243#ifdef DEBUG
1244 printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n",
1245 (int) brdp, (int) portp, (int) arg, wait);
1246#endif
1247 1195
1248/* 1196/*
1249 * Send a message to the slave to open this port. 1197 * Send a message to the slave to open this port.
1250 */ 1198 */
1251 save_flags(flags);
1252 cli();
1253 1199
1254/* 1200/*
1255 * Slave is already closing this port. This can happen if a hangup 1201 * Slave is already closing this port. This can happen if a hangup
@@ -1260,7 +1206,6 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
1260 wait_event_interruptible(portp->raw_wait, 1206 wait_event_interruptible(portp->raw_wait,
1261 !test_bit(ST_CLOSING, &portp->state)); 1207 !test_bit(ST_CLOSING, &portp->state));
1262 if (signal_pending(current)) { 1208 if (signal_pending(current)) {
1263 restore_flags(flags);
1264 return -ERESTARTSYS; 1209 return -ERESTARTSYS;
1265 } 1210 }
1266 1211
@@ -1269,19 +1214,20 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
1269 * memory. Once the message is in set the service bits to say that 1214 * memory. Once the message is in set the service bits to say that
1270 * this port wants service. 1215 * this port wants service.
1271 */ 1216 */
1217 spin_lock_irqsave(&brd_lock, flags);
1272 EBRDENABLE(brdp); 1218 EBRDENABLE(brdp);
1273 cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 1219 cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;
1274 cp->openarg = arg; 1220 writel(arg, &cp->openarg);
1275 cp->open = 1; 1221 writeb(1, &cp->open);
1276 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1222 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
1277 bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1223 bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +
1278 portp->portidx; 1224 portp->portidx;
1279 *bits |= portp->portbit; 1225 writeb(readb(bits) | portp->portbit, bits);
1280 EBRDDISABLE(brdp); 1226 EBRDDISABLE(brdp);
1281 1227
1282 if (wait == 0) { 1228 if (wait == 0) {
1283 restore_flags(flags); 1229 spin_unlock_irqrestore(&brd_lock, flags);
1284 return(0); 1230 return 0;
1285 } 1231 }
1286 1232
1287/* 1233/*
@@ -1290,15 +1236,16 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
1290 */ 1236 */
1291 rc = 0; 1237 rc = 0;
1292 set_bit(ST_OPENING, &portp->state); 1238 set_bit(ST_OPENING, &portp->state);
1239 spin_unlock_irqrestore(&brd_lock, flags);
1240
1293 wait_event_interruptible(portp->raw_wait, 1241 wait_event_interruptible(portp->raw_wait,
1294 !test_bit(ST_OPENING, &portp->state)); 1242 !test_bit(ST_OPENING, &portp->state));
1295 if (signal_pending(current)) 1243 if (signal_pending(current))
1296 rc = -ERESTARTSYS; 1244 rc = -ERESTARTSYS;
1297 restore_flags(flags);
1298 1245
1299 if ((rc == 0) && (portp->rc != 0)) 1246 if ((rc == 0) && (portp->rc != 0))
1300 rc = -EIO; 1247 rc = -EIO;
1301 return(rc); 1248 return rc;
1302} 1249}
1303 1250
1304/*****************************************************************************/ 1251/*****************************************************************************/
@@ -1311,19 +1258,11 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
1311 1258
1312static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) 1259static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait)
1313{ 1260{
1314 volatile cdkhdr_t *hdrp; 1261 cdkhdr_t __iomem *hdrp;
1315 volatile cdkctrl_t *cp; 1262 cdkctrl_t __iomem *cp;
1316 volatile unsigned char *bits; 1263 unsigned char __iomem *bits;
1317 unsigned long flags; 1264 unsigned long flags;
1318 int rc; 1265 int rc;
1319
1320#ifdef DEBUG
1321 printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n",
1322 (int) brdp, (int) portp, (int) arg, wait);
1323#endif
1324
1325 save_flags(flags);
1326 cli();
1327 1266
1328/* 1267/*
1329 * Slave is already closing this port. This can happen if a hangup 1268 * Slave is already closing this port. This can happen if a hangup
@@ -1333,7 +1272,6 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
1333 wait_event_interruptible(portp->raw_wait, 1272 wait_event_interruptible(portp->raw_wait,
1334 !test_bit(ST_CLOSING, &portp->state)); 1273 !test_bit(ST_CLOSING, &portp->state));
1335 if (signal_pending(current)) { 1274 if (signal_pending(current)) {
1336 restore_flags(flags);
1337 return -ERESTARTSYS; 1275 return -ERESTARTSYS;
1338 } 1276 }
1339 } 1277 }
@@ -1341,21 +1279,22 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
1341/* 1279/*
1342 * Write the close command into shared memory. 1280 * Write the close command into shared memory.
1343 */ 1281 */
1282 spin_lock_irqsave(&brd_lock, flags);
1344 EBRDENABLE(brdp); 1283 EBRDENABLE(brdp);
1345 cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 1284 cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;
1346 cp->closearg = arg; 1285 writel(arg, &cp->closearg);
1347 cp->close = 1; 1286 writeb(1, &cp->close);
1348 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1287 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
1349 bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1288 bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +
1350 portp->portidx; 1289 portp->portidx;
1351 *bits |= portp->portbit; 1290 writeb(readb(bits) |portp->portbit, bits);
1352 EBRDDISABLE(brdp); 1291 EBRDDISABLE(brdp);
1353 1292
1354 set_bit(ST_CLOSING, &portp->state); 1293 set_bit(ST_CLOSING, &portp->state);
1355 if (wait == 0) { 1294 spin_unlock_irqrestore(&brd_lock, flags);
1356 restore_flags(flags); 1295
1357 return(0); 1296 if (wait == 0)
1358 } 1297 return 0;
1359 1298
1360/* 1299/*
1361 * Slave is in action, so now we must wait for the open acknowledgment 1300 * Slave is in action, so now we must wait for the open acknowledgment
@@ -1366,11 +1305,10 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
1366 !test_bit(ST_CLOSING, &portp->state)); 1305 !test_bit(ST_CLOSING, &portp->state));
1367 if (signal_pending(current)) 1306 if (signal_pending(current))
1368 rc = -ERESTARTSYS; 1307 rc = -ERESTARTSYS;
1369 restore_flags(flags);
1370 1308
1371 if ((rc == 0) && (portp->rc != 0)) 1309 if ((rc == 0) && (portp->rc != 0))
1372 rc = -EIO; 1310 rc = -EIO;
1373 return(rc); 1311 return rc;
1374} 1312}
1375 1313
1376/*****************************************************************************/ 1314/*****************************************************************************/
@@ -1384,36 +1322,21 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
1384 1322
1385static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) 1323static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback)
1386{ 1324{
1387 unsigned long flags;
1388
1389#ifdef DEBUG
1390 printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"
1391 "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,
1392 (int) arg, size, copyback);
1393#endif
1394
1395 save_flags(flags);
1396 cli();
1397 wait_event_interruptible(portp->raw_wait, 1325 wait_event_interruptible(portp->raw_wait,
1398 !test_bit(ST_CMDING, &portp->state)); 1326 !test_bit(ST_CMDING, &portp->state));
1399 if (signal_pending(current)) { 1327 if (signal_pending(current))
1400 restore_flags(flags);
1401 return -ERESTARTSYS; 1328 return -ERESTARTSYS;
1402 }
1403 1329
1404 stli_sendcmd(brdp, portp, cmd, arg, size, copyback); 1330 stli_sendcmd(brdp, portp, cmd, arg, size, copyback);
1405 1331
1406 wait_event_interruptible(portp->raw_wait, 1332 wait_event_interruptible(portp->raw_wait,
1407 !test_bit(ST_CMDING, &portp->state)); 1333 !test_bit(ST_CMDING, &portp->state));
1408 if (signal_pending(current)) { 1334 if (signal_pending(current))
1409 restore_flags(flags);
1410 return -ERESTARTSYS; 1335 return -ERESTARTSYS;
1411 }
1412 restore_flags(flags);
1413 1336
1414 if (portp->rc != 0) 1337 if (portp->rc != 0)
1415 return(-EIO); 1338 return -EIO;
1416 return(0); 1339 return 0;
1417} 1340}
1418 1341
1419/*****************************************************************************/ 1342/*****************************************************************************/
@@ -1425,22 +1348,18 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v
1425 1348
1426static int stli_setport(stliport_t *portp) 1349static int stli_setport(stliport_t *portp)
1427{ 1350{
1428 stlibrd_t *brdp; 1351 stlibrd_t *brdp;
1429 asyport_t aport; 1352 asyport_t aport;
1430
1431#ifdef DEBUG
1432 printk("stli_setport(portp=%x)\n", (int) portp);
1433#endif
1434 1353
1435 if (portp == (stliport_t *) NULL) 1354 if (portp == NULL)
1436 return(-ENODEV); 1355 return -ENODEV;
1437 if (portp->tty == (struct tty_struct *) NULL) 1356 if (portp->tty == NULL)
1438 return(-ENODEV); 1357 return -ENODEV;
1439 if ((portp->brdnr < 0) && (portp->brdnr >= stli_nrbrds)) 1358 if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds)
1440 return(-ENODEV); 1359 return -ENODEV;
1441 brdp = stli_brds[portp->brdnr]; 1360 brdp = stli_brds[portp->brdnr];
1442 if (brdp == (stlibrd_t *) NULL) 1361 if (brdp == NULL)
1443 return(-ENODEV); 1362 return -ENODEV;
1444 1363
1445 stli_mkasyport(portp, &aport, portp->tty->termios); 1364 stli_mkasyport(portp, &aport, portp->tty->termios);
1446 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); 1365 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0));
@@ -1455,13 +1374,8 @@ static int stli_setport(stliport_t *portp)
1455 1374
1456static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp) 1375static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp)
1457{ 1376{
1458 unsigned long flags; 1377 unsigned long flags;
1459 int rc, doclocal; 1378 int rc, doclocal;
1460
1461#ifdef DEBUG
1462 printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n",
1463 (int) brdp, (int) portp, (int) filp);
1464#endif
1465 1379
1466 rc = 0; 1380 rc = 0;
1467 doclocal = 0; 1381 doclocal = 0;
@@ -1469,11 +1383,11 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil
1469 if (portp->tty->termios->c_cflag & CLOCAL) 1383 if (portp->tty->termios->c_cflag & CLOCAL)
1470 doclocal++; 1384 doclocal++;
1471 1385
1472 save_flags(flags); 1386 spin_lock_irqsave(&stli_lock, flags);
1473 cli();
1474 portp->openwaitcnt++; 1387 portp->openwaitcnt++;
1475 if (! tty_hung_up_p(filp)) 1388 if (! tty_hung_up_p(filp))
1476 portp->refcount--; 1389 portp->refcount--;
1390 spin_unlock_irqrestore(&stli_lock, flags);
1477 1391
1478 for (;;) { 1392 for (;;) {
1479 stli_mkasysigs(&portp->asig, 1, 1); 1393 stli_mkasysigs(&portp->asig, 1, 1);
@@ -1499,12 +1413,13 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil
1499 interruptible_sleep_on(&portp->open_wait); 1413 interruptible_sleep_on(&portp->open_wait);
1500 } 1414 }
1501 1415
1416 spin_lock_irqsave(&stli_lock, flags);
1502 if (! tty_hung_up_p(filp)) 1417 if (! tty_hung_up_p(filp))
1503 portp->refcount++; 1418 portp->refcount++;
1504 portp->openwaitcnt--; 1419 portp->openwaitcnt--;
1505 restore_flags(flags); 1420 spin_unlock_irqrestore(&stli_lock, flags);
1506 1421
1507 return(rc); 1422 return rc;
1508} 1423}
1509 1424
1510/*****************************************************************************/ 1425/*****************************************************************************/
@@ -1517,46 +1432,38 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil
1517 1432
1518static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count) 1433static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count)
1519{ 1434{
1520 volatile cdkasy_t *ap; 1435 cdkasy_t __iomem *ap;
1521 volatile cdkhdr_t *hdrp; 1436 cdkhdr_t __iomem *hdrp;
1522 volatile unsigned char *bits; 1437 unsigned char __iomem *bits;
1523 unsigned char *shbuf, *chbuf; 1438 unsigned char __iomem *shbuf;
1524 stliport_t *portp; 1439 unsigned char *chbuf;
1525 stlibrd_t *brdp; 1440 stliport_t *portp;
1526 unsigned int len, stlen, head, tail, size; 1441 stlibrd_t *brdp;
1527 unsigned long flags; 1442 unsigned int len, stlen, head, tail, size;
1528 1443 unsigned long flags;
1529#ifdef DEBUG
1530 printk("stli_write(tty=%x,buf=%x,count=%d)\n",
1531 (int) tty, (int) buf, count);
1532#endif
1533 1444
1534 if ((tty == (struct tty_struct *) NULL) ||
1535 (stli_tmpwritebuf == (char *) NULL))
1536 return(0);
1537 if (tty == stli_txcooktty) 1445 if (tty == stli_txcooktty)
1538 stli_flushchars(tty); 1446 stli_flushchars(tty);
1539 portp = tty->driver_data; 1447 portp = tty->driver_data;
1540 if (portp == (stliport_t *) NULL) 1448 if (portp == NULL)
1541 return(0); 1449 return 0;
1542 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1450 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
1543 return(0); 1451 return 0;
1544 brdp = stli_brds[portp->brdnr]; 1452 brdp = stli_brds[portp->brdnr];
1545 if (brdp == (stlibrd_t *) NULL) 1453 if (brdp == NULL)
1546 return(0); 1454 return 0;
1547 chbuf = (unsigned char *) buf; 1455 chbuf = (unsigned char *) buf;
1548 1456
1549/* 1457/*
1550 * All data is now local, shove as much as possible into shared memory. 1458 * All data is now local, shove as much as possible into shared memory.
1551 */ 1459 */
1552 save_flags(flags); 1460 spin_lock_irqsave(&brd_lock, flags);
1553 cli();
1554 EBRDENABLE(brdp); 1461 EBRDENABLE(brdp);
1555 ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1462 ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);
1556 head = (unsigned int) ap->txq.head; 1463 head = (unsigned int) readw(&ap->txq.head);
1557 tail = (unsigned int) ap->txq.tail; 1464 tail = (unsigned int) readw(&ap->txq.tail);
1558 if (tail != ((unsigned int) ap->txq.tail)) 1465 if (tail != ((unsigned int) readw(&ap->txq.tail)))
1559 tail = (unsigned int) ap->txq.tail; 1466 tail = (unsigned int) readw(&ap->txq.tail);
1560 size = portp->txsize; 1467 size = portp->txsize;
1561 if (head >= tail) { 1468 if (head >= tail) {
1562 len = size - (head - tail) - 1; 1469 len = size - (head - tail) - 1;
@@ -1568,11 +1475,11 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun
1568 1475
1569 len = MIN(len, count); 1476 len = MIN(len, count);
1570 count = 0; 1477 count = 0;
1571 shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset); 1478 shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset);
1572 1479
1573 while (len > 0) { 1480 while (len > 0) {
1574 stlen = MIN(len, stlen); 1481 stlen = MIN(len, stlen);
1575 memcpy((shbuf + head), chbuf, stlen); 1482 memcpy_toio(shbuf + head, chbuf, stlen);
1576 chbuf += stlen; 1483 chbuf += stlen;
1577 len -= stlen; 1484 len -= stlen;
1578 count += stlen; 1485 count += stlen;
@@ -1583,20 +1490,19 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun
1583 } 1490 }
1584 } 1491 }
1585 1492
1586 ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1493 ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);
1587 ap->txq.head = head; 1494 writew(head, &ap->txq.head);
1588 if (test_bit(ST_TXBUSY, &portp->state)) { 1495 if (test_bit(ST_TXBUSY, &portp->state)) {
1589 if (ap->changed.data & DT_TXEMPTY) 1496 if (readl(&ap->changed.data) & DT_TXEMPTY)
1590 ap->changed.data &= ~DT_TXEMPTY; 1497 writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data);
1591 } 1498 }
1592 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1499 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
1593 bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1500 bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +
1594 portp->portidx; 1501 portp->portidx;
1595 *bits |= portp->portbit; 1502 writeb(readb(bits) | portp->portbit, bits);
1596 set_bit(ST_TXBUSY, &portp->state); 1503 set_bit(ST_TXBUSY, &portp->state);
1597 EBRDDISABLE(brdp); 1504 EBRDDISABLE(brdp);
1598 1505 spin_unlock_irqrestore(&brd_lock, flags);
1599 restore_flags(flags);
1600 1506
1601 return(count); 1507 return(count);
1602} 1508}
@@ -1613,14 +1519,8 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun
1613 1519
1614static void stli_putchar(struct tty_struct *tty, unsigned char ch) 1520static void stli_putchar(struct tty_struct *tty, unsigned char ch)
1615{ 1521{
1616#ifdef DEBUG
1617 printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch);
1618#endif
1619
1620 if (tty == (struct tty_struct *) NULL)
1621 return;
1622 if (tty != stli_txcooktty) { 1522 if (tty != stli_txcooktty) {
1623 if (stli_txcooktty != (struct tty_struct *) NULL) 1523 if (stli_txcooktty != NULL)
1624 stli_flushchars(stli_txcooktty); 1524 stli_flushchars(stli_txcooktty);
1625 stli_txcooktty = tty; 1525 stli_txcooktty = tty;
1626 } 1526 }
@@ -1640,29 +1540,26 @@ static void stli_putchar(struct tty_struct *tty, unsigned char ch)
1640 1540
1641static void stli_flushchars(struct tty_struct *tty) 1541static void stli_flushchars(struct tty_struct *tty)
1642{ 1542{
1643 volatile cdkhdr_t *hdrp; 1543 cdkhdr_t __iomem *hdrp;
1644 volatile unsigned char *bits; 1544 unsigned char __iomem *bits;
1645 volatile cdkasy_t *ap; 1545 cdkasy_t __iomem *ap;
1646 struct tty_struct *cooktty; 1546 struct tty_struct *cooktty;
1647 stliport_t *portp; 1547 stliport_t *portp;
1648 stlibrd_t *brdp; 1548 stlibrd_t *brdp;
1649 unsigned int len, stlen, head, tail, size, count, cooksize; 1549 unsigned int len, stlen, head, tail, size, count, cooksize;
1650 unsigned char *buf, *shbuf; 1550 unsigned char *buf;
1651 unsigned long flags; 1551 unsigned char __iomem *shbuf;
1652 1552 unsigned long flags;
1653#ifdef DEBUG
1654 printk("stli_flushchars(tty=%x)\n", (int) tty);
1655#endif
1656 1553
1657 cooksize = stli_txcooksize; 1554 cooksize = stli_txcooksize;
1658 cooktty = stli_txcooktty; 1555 cooktty = stli_txcooktty;
1659 stli_txcooksize = 0; 1556 stli_txcooksize = 0;
1660 stli_txcookrealsize = 0; 1557 stli_txcookrealsize = 0;
1661 stli_txcooktty = (struct tty_struct *) NULL; 1558 stli_txcooktty = NULL;
1662 1559
1663 if (tty == (struct tty_struct *) NULL) 1560 if (tty == NULL)
1664 return; 1561 return;
1665 if (cooktty == (struct tty_struct *) NULL) 1562 if (cooktty == NULL)
1666 return; 1563 return;
1667 if (tty != cooktty) 1564 if (tty != cooktty)
1668 tty = cooktty; 1565 tty = cooktty;
@@ -1670,23 +1567,22 @@ static void stli_flushchars(struct tty_struct *tty)
1670 return; 1567 return;
1671 1568
1672 portp = tty->driver_data; 1569 portp = tty->driver_data;
1673 if (portp == (stliport_t *) NULL) 1570 if (portp == NULL)
1674 return; 1571 return;
1675 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1572 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
1676 return; 1573 return;
1677 brdp = stli_brds[portp->brdnr]; 1574 brdp = stli_brds[portp->brdnr];
1678 if (brdp == (stlibrd_t *) NULL) 1575 if (brdp == NULL)
1679 return; 1576 return;
1680 1577
1681 save_flags(flags); 1578 spin_lock_irqsave(&brd_lock, flags);
1682 cli();
1683 EBRDENABLE(brdp); 1579 EBRDENABLE(brdp);
1684 1580
1685 ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1581 ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);
1686 head = (unsigned int) ap->txq.head; 1582 head = (unsigned int) readw(&ap->txq.head);
1687 tail = (unsigned int) ap->txq.tail; 1583 tail = (unsigned int) readw(&ap->txq.tail);
1688 if (tail != ((unsigned int) ap->txq.tail)) 1584 if (tail != ((unsigned int) readw(&ap->txq.tail)))
1689 tail = (unsigned int) ap->txq.tail; 1585 tail = (unsigned int) readw(&ap->txq.tail);
1690 size = portp->txsize; 1586 size = portp->txsize;
1691 if (head >= tail) { 1587 if (head >= tail) {
1692 len = size - (head - tail) - 1; 1588 len = size - (head - tail) - 1;
@@ -1703,7 +1599,7 @@ static void stli_flushchars(struct tty_struct *tty)
1703 1599
1704 while (len > 0) { 1600 while (len > 0) {
1705 stlen = MIN(len, stlen); 1601 stlen = MIN(len, stlen);
1706 memcpy((shbuf + head), buf, stlen); 1602 memcpy_toio(shbuf + head, buf, stlen);
1707 buf += stlen; 1603 buf += stlen;
1708 len -= stlen; 1604 len -= stlen;
1709 count += stlen; 1605 count += stlen;
@@ -1714,73 +1610,66 @@ static void stli_flushchars(struct tty_struct *tty)
1714 } 1610 }
1715 } 1611 }
1716 1612
1717 ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 1613 ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);
1718 ap->txq.head = head; 1614 writew(head, &ap->txq.head);
1719 1615
1720 if (test_bit(ST_TXBUSY, &portp->state)) { 1616 if (test_bit(ST_TXBUSY, &portp->state)) {
1721 if (ap->changed.data & DT_TXEMPTY) 1617 if (readl(&ap->changed.data) & DT_TXEMPTY)
1722 ap->changed.data &= ~DT_TXEMPTY; 1618 writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data);
1723 } 1619 }
1724 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 1620 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
1725 bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 1621 bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +
1726 portp->portidx; 1622 portp->portidx;
1727 *bits |= portp->portbit; 1623 writeb(readb(bits) | portp->portbit, bits);
1728 set_bit(ST_TXBUSY, &portp->state); 1624 set_bit(ST_TXBUSY, &portp->state);
1729 1625
1730 EBRDDISABLE(brdp); 1626 EBRDDISABLE(brdp);
1731 restore_flags(flags); 1627 spin_unlock_irqrestore(&brd_lock, flags);
1732} 1628}
1733 1629
1734/*****************************************************************************/ 1630/*****************************************************************************/
1735 1631
1736static int stli_writeroom(struct tty_struct *tty) 1632static int stli_writeroom(struct tty_struct *tty)
1737{ 1633{
1738 volatile cdkasyrq_t *rp; 1634 cdkasyrq_t __iomem *rp;
1739 stliport_t *portp; 1635 stliport_t *portp;
1740 stlibrd_t *brdp; 1636 stlibrd_t *brdp;
1741 unsigned int head, tail, len; 1637 unsigned int head, tail, len;
1742 unsigned long flags; 1638 unsigned long flags;
1743
1744#ifdef DEBUG
1745 printk("stli_writeroom(tty=%x)\n", (int) tty);
1746#endif
1747 1639
1748 if (tty == (struct tty_struct *) NULL)
1749 return(0);
1750 if (tty == stli_txcooktty) { 1640 if (tty == stli_txcooktty) {
1751 if (stli_txcookrealsize != 0) { 1641 if (stli_txcookrealsize != 0) {
1752 len = stli_txcookrealsize - stli_txcooksize; 1642 len = stli_txcookrealsize - stli_txcooksize;
1753 return(len); 1643 return len;
1754 } 1644 }
1755 } 1645 }
1756 1646
1757 portp = tty->driver_data; 1647 portp = tty->driver_data;
1758 if (portp == (stliport_t *) NULL) 1648 if (portp == NULL)
1759 return(0); 1649 return 0;
1760 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1650 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
1761 return(0); 1651 return 0;
1762 brdp = stli_brds[portp->brdnr]; 1652 brdp = stli_brds[portp->brdnr];
1763 if (brdp == (stlibrd_t *) NULL) 1653 if (brdp == NULL)
1764 return(0); 1654 return 0;
1765 1655
1766 save_flags(flags); 1656 spin_lock_irqsave(&brd_lock, flags);
1767 cli();
1768 EBRDENABLE(brdp); 1657 EBRDENABLE(brdp);
1769 rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; 1658 rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq;
1770 head = (unsigned int) rp->head; 1659 head = (unsigned int) readw(&rp->head);
1771 tail = (unsigned int) rp->tail; 1660 tail = (unsigned int) readw(&rp->tail);
1772 if (tail != ((unsigned int) rp->tail)) 1661 if (tail != ((unsigned int) readw(&rp->tail)))
1773 tail = (unsigned int) rp->tail; 1662 tail = (unsigned int) readw(&rp->tail);
1774 len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head); 1663 len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head);
1775 len--; 1664 len--;
1776 EBRDDISABLE(brdp); 1665 EBRDDISABLE(brdp);
1777 restore_flags(flags); 1666 spin_unlock_irqrestore(&brd_lock, flags);
1778 1667
1779 if (tty == stli_txcooktty) { 1668 if (tty == stli_txcooktty) {
1780 stli_txcookrealsize = len; 1669 stli_txcookrealsize = len;
1781 len -= stli_txcooksize; 1670 len -= stli_txcooksize;
1782 } 1671 }
1783 return(len); 1672 return len;
1784} 1673}
1785 1674
1786/*****************************************************************************/ 1675/*****************************************************************************/
@@ -1795,44 +1684,37 @@ static int stli_writeroom(struct tty_struct *tty)
1795 1684
1796static int stli_charsinbuffer(struct tty_struct *tty) 1685static int stli_charsinbuffer(struct tty_struct *tty)
1797{ 1686{
1798 volatile cdkasyrq_t *rp; 1687 cdkasyrq_t __iomem *rp;
1799 stliport_t *portp; 1688 stliport_t *portp;
1800 stlibrd_t *brdp; 1689 stlibrd_t *brdp;
1801 unsigned int head, tail, len; 1690 unsigned int head, tail, len;
1802 unsigned long flags; 1691 unsigned long flags;
1803
1804#ifdef DEBUG
1805 printk("stli_charsinbuffer(tty=%x)\n", (int) tty);
1806#endif
1807 1692
1808 if (tty == (struct tty_struct *) NULL)
1809 return(0);
1810 if (tty == stli_txcooktty) 1693 if (tty == stli_txcooktty)
1811 stli_flushchars(tty); 1694 stli_flushchars(tty);
1812 portp = tty->driver_data; 1695 portp = tty->driver_data;
1813 if (portp == (stliport_t *) NULL) 1696 if (portp == NULL)
1814 return(0); 1697 return 0;
1815 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1698 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
1816 return(0); 1699 return 0;
1817 brdp = stli_brds[portp->brdnr]; 1700 brdp = stli_brds[portp->brdnr];
1818 if (brdp == (stlibrd_t *) NULL) 1701 if (brdp == NULL)
1819 return(0); 1702 return 0;
1820 1703
1821 save_flags(flags); 1704 spin_lock_irqsave(&brd_lock, flags);
1822 cli();
1823 EBRDENABLE(brdp); 1705 EBRDENABLE(brdp);
1824 rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; 1706 rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq;
1825 head = (unsigned int) rp->head; 1707 head = (unsigned int) readw(&rp->head);
1826 tail = (unsigned int) rp->tail; 1708 tail = (unsigned int) readw(&rp->tail);
1827 if (tail != ((unsigned int) rp->tail)) 1709 if (tail != ((unsigned int) readw(&rp->tail)))
1828 tail = (unsigned int) rp->tail; 1710 tail = (unsigned int) readw(&rp->tail);
1829 len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head)); 1711 len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head));
1830 if ((len == 0) && test_bit(ST_TXBUSY, &portp->state)) 1712 if ((len == 0) && test_bit(ST_TXBUSY, &portp->state))
1831 len = 1; 1713 len = 1;
1832 EBRDDISABLE(brdp); 1714 EBRDDISABLE(brdp);
1833 restore_flags(flags); 1715 spin_unlock_irqrestore(&brd_lock, flags);
1834 1716
1835 return(len); 1717 return len;
1836} 1718}
1837 1719
1838/*****************************************************************************/ 1720/*****************************************************************************/
@@ -1843,12 +1725,8 @@ static int stli_charsinbuffer(struct tty_struct *tty)
1843 1725
1844static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) 1726static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp)
1845{ 1727{
1846 struct serial_struct sio; 1728 struct serial_struct sio;
1847 stlibrd_t *brdp; 1729 stlibrd_t *brdp;
1848
1849#ifdef DEBUG
1850 printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);
1851#endif
1852 1730
1853 memset(&sio, 0, sizeof(struct serial_struct)); 1731 memset(&sio, 0, sizeof(struct serial_struct));
1854 sio.type = PORT_UNKNOWN; 1732 sio.type = PORT_UNKNOWN;
@@ -1863,7 +1741,7 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp)
1863 sio.hub6 = 0; 1741 sio.hub6 = 0;
1864 1742
1865 brdp = stli_brds[portp->brdnr]; 1743 brdp = stli_brds[portp->brdnr];
1866 if (brdp != (stlibrd_t *) NULL) 1744 if (brdp != NULL)
1867 sio.port = brdp->iobase; 1745 sio.port = brdp->iobase;
1868 1746
1869 return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? 1747 return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ?
@@ -1880,12 +1758,8 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp)
1880 1758
1881static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) 1759static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp)
1882{ 1760{
1883 struct serial_struct sio; 1761 struct serial_struct sio;
1884 int rc; 1762 int rc;
1885
1886#ifdef DEBUG
1887 printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp);
1888#endif
1889 1763
1890 if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) 1764 if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))
1891 return -EFAULT; 1765 return -EFAULT;
@@ -1894,7 +1768,7 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp)
1894 (sio.close_delay != portp->close_delay) || 1768 (sio.close_delay != portp->close_delay) ||
1895 ((sio.flags & ~ASYNC_USR_MASK) != 1769 ((sio.flags & ~ASYNC_USR_MASK) !=
1896 (portp->flags & ~ASYNC_USR_MASK))) 1770 (portp->flags & ~ASYNC_USR_MASK)))
1897 return(-EPERM); 1771 return -EPERM;
1898 } 1772 }
1899 1773
1900 portp->flags = (portp->flags & ~ASYNC_USR_MASK) | 1774 portp->flags = (portp->flags & ~ASYNC_USR_MASK) |
@@ -1905,8 +1779,8 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp)
1905 portp->custom_divisor = sio.custom_divisor; 1779 portp->custom_divisor = sio.custom_divisor;
1906 1780
1907 if ((rc = stli_setport(portp)) < 0) 1781 if ((rc = stli_setport(portp)) < 0)
1908 return(rc); 1782 return rc;
1909 return(0); 1783 return 0;
1910} 1784}
1911 1785
1912/*****************************************************************************/ 1786/*****************************************************************************/
@@ -1917,19 +1791,19 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file)
1917 stlibrd_t *brdp; 1791 stlibrd_t *brdp;
1918 int rc; 1792 int rc;
1919 1793
1920 if (portp == (stliport_t *) NULL) 1794 if (portp == NULL)
1921 return(-ENODEV); 1795 return -ENODEV;
1922 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1796 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
1923 return(0); 1797 return 0;
1924 brdp = stli_brds[portp->brdnr]; 1798 brdp = stli_brds[portp->brdnr];
1925 if (brdp == (stlibrd_t *) NULL) 1799 if (brdp == NULL)
1926 return(0); 1800 return 0;
1927 if (tty->flags & (1 << TTY_IO_ERROR)) 1801 if (tty->flags & (1 << TTY_IO_ERROR))
1928 return(-EIO); 1802 return -EIO;
1929 1803
1930 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, 1804 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS,
1931 &portp->asig, sizeof(asysigs_t), 1)) < 0) 1805 &portp->asig, sizeof(asysigs_t), 1)) < 0)
1932 return(rc); 1806 return rc;
1933 1807
1934 return stli_mktiocm(portp->asig.sigvalue); 1808 return stli_mktiocm(portp->asig.sigvalue);
1935} 1809}
@@ -1941,15 +1815,15 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file,
1941 stlibrd_t *brdp; 1815 stlibrd_t *brdp;
1942 int rts = -1, dtr = -1; 1816 int rts = -1, dtr = -1;
1943 1817
1944 if (portp == (stliport_t *) NULL) 1818 if (portp == NULL)
1945 return(-ENODEV); 1819 return -ENODEV;
1946 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1820 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
1947 return(0); 1821 return 0;
1948 brdp = stli_brds[portp->brdnr]; 1822 brdp = stli_brds[portp->brdnr];
1949 if (brdp == (stlibrd_t *) NULL) 1823 if (brdp == NULL)
1950 return(0); 1824 return 0;
1951 if (tty->flags & (1 << TTY_IO_ERROR)) 1825 if (tty->flags & (1 << TTY_IO_ERROR))
1952 return(-EIO); 1826 return -EIO;
1953 1827
1954 if (set & TIOCM_RTS) 1828 if (set & TIOCM_RTS)
1955 rts = 1; 1829 rts = 1;
@@ -1968,32 +1842,25 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file,
1968 1842
1969static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) 1843static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
1970{ 1844{
1971 stliport_t *portp; 1845 stliport_t *portp;
1972 stlibrd_t *brdp; 1846 stlibrd_t *brdp;
1973 unsigned int ival; 1847 unsigned int ival;
1974 int rc; 1848 int rc;
1975 void __user *argp = (void __user *)arg; 1849 void __user *argp = (void __user *)arg;
1976 1850
1977#ifdef DEBUG
1978 printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n",
1979 (int) tty, (int) file, cmd, (int) arg);
1980#endif
1981
1982 if (tty == (struct tty_struct *) NULL)
1983 return(-ENODEV);
1984 portp = tty->driver_data; 1851 portp = tty->driver_data;
1985 if (portp == (stliport_t *) NULL) 1852 if (portp == NULL)
1986 return(-ENODEV); 1853 return -ENODEV;
1987 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1854 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
1988 return(0); 1855 return 0;
1989 brdp = stli_brds[portp->brdnr]; 1856 brdp = stli_brds[portp->brdnr];
1990 if (brdp == (stlibrd_t *) NULL) 1857 if (brdp == NULL)
1991 return(0); 1858 return 0;
1992 1859
1993 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 1860 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1994 (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { 1861 (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) {
1995 if (tty->flags & (1 << TTY_IO_ERROR)) 1862 if (tty->flags & (1 << TTY_IO_ERROR))
1996 return(-EIO); 1863 return -EIO;
1997 } 1864 }
1998 1865
1999 rc = 0; 1866 rc = 0;
@@ -2040,7 +1907,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
2040 break; 1907 break;
2041 } 1908 }
2042 1909
2043 return(rc); 1910 return rc;
2044} 1911}
2045 1912
2046/*****************************************************************************/ 1913/*****************************************************************************/
@@ -2052,24 +1919,20 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
2052 1919
2053static void stli_settermios(struct tty_struct *tty, struct termios *old) 1920static void stli_settermios(struct tty_struct *tty, struct termios *old)
2054{ 1921{
2055 stliport_t *portp; 1922 stliport_t *portp;
2056 stlibrd_t *brdp; 1923 stlibrd_t *brdp;
2057 struct termios *tiosp; 1924 struct termios *tiosp;
2058 asyport_t aport; 1925 asyport_t aport;
2059
2060#ifdef DEBUG
2061 printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old);
2062#endif
2063 1926
2064 if (tty == (struct tty_struct *) NULL) 1927 if (tty == NULL)
2065 return; 1928 return;
2066 portp = tty->driver_data; 1929 portp = tty->driver_data;
2067 if (portp == (stliport_t *) NULL) 1930 if (portp == NULL)
2068 return; 1931 return;
2069 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 1932 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
2070 return; 1933 return;
2071 brdp = stli_brds[portp->brdnr]; 1934 brdp = stli_brds[portp->brdnr];
2072 if (brdp == (stlibrd_t *) NULL) 1935 if (brdp == NULL)
2073 return; 1936 return;
2074 1937
2075 tiosp = tty->termios; 1938 tiosp = tty->termios;
@@ -2102,18 +1965,9 @@ static void stli_settermios(struct tty_struct *tty, struct termios *old)
2102 1965
2103static void stli_throttle(struct tty_struct *tty) 1966static void stli_throttle(struct tty_struct *tty)
2104{ 1967{
2105 stliport_t *portp; 1968 stliport_t *portp = tty->driver_data;
2106 1969 if (portp == NULL)
2107#ifdef DEBUG
2108 printk("stli_throttle(tty=%x)\n", (int) tty);
2109#endif
2110
2111 if (tty == (struct tty_struct *) NULL)
2112 return; 1970 return;
2113 portp = tty->driver_data;
2114 if (portp == (stliport_t *) NULL)
2115 return;
2116
2117 set_bit(ST_RXSTOP, &portp->state); 1971 set_bit(ST_RXSTOP, &portp->state);
2118} 1972}
2119 1973
@@ -2127,88 +1981,30 @@ static void stli_throttle(struct tty_struct *tty)
2127 1981
2128static void stli_unthrottle(struct tty_struct *tty) 1982static void stli_unthrottle(struct tty_struct *tty)
2129{ 1983{
2130 stliport_t *portp; 1984 stliport_t *portp = tty->driver_data;
2131 1985 if (portp == NULL)
2132#ifdef DEBUG
2133 printk("stli_unthrottle(tty=%x)\n", (int) tty);
2134#endif
2135
2136 if (tty == (struct tty_struct *) NULL)
2137 return;
2138 portp = tty->driver_data;
2139 if (portp == (stliport_t *) NULL)
2140 return; 1986 return;
2141
2142 clear_bit(ST_RXSTOP, &portp->state); 1987 clear_bit(ST_RXSTOP, &portp->state);
2143} 1988}
2144 1989
2145/*****************************************************************************/ 1990/*****************************************************************************/
2146 1991
2147/* 1992/*
2148 * Stop the transmitter. Basically to do this we will just turn TX 1993 * Stop the transmitter.
2149 * interrupts off.
2150 */ 1994 */
2151 1995
2152static void stli_stop(struct tty_struct *tty) 1996static void stli_stop(struct tty_struct *tty)
2153{ 1997{
2154 stlibrd_t *brdp;
2155 stliport_t *portp;
2156 asyctrl_t actrl;
2157
2158#ifdef DEBUG
2159 printk("stli_stop(tty=%x)\n", (int) tty);
2160#endif
2161
2162 if (tty == (struct tty_struct *) NULL)
2163 return;
2164 portp = tty->driver_data;
2165 if (portp == (stliport_t *) NULL)
2166 return;
2167 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
2168 return;
2169 brdp = stli_brds[portp->brdnr];
2170 if (brdp == (stlibrd_t *) NULL)
2171 return;
2172
2173 memset(&actrl, 0, sizeof(asyctrl_t));
2174 actrl.txctrl = CT_STOPFLOW;
2175#if 0
2176 stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0);
2177#endif
2178} 1998}
2179 1999
2180/*****************************************************************************/ 2000/*****************************************************************************/
2181 2001
2182/* 2002/*
2183 * Start the transmitter again. Just turn TX interrupts back on. 2003 * Start the transmitter again.
2184 */ 2004 */
2185 2005
2186static void stli_start(struct tty_struct *tty) 2006static void stli_start(struct tty_struct *tty)
2187{ 2007{
2188 stliport_t *portp;
2189 stlibrd_t *brdp;
2190 asyctrl_t actrl;
2191
2192#ifdef DEBUG
2193 printk("stli_start(tty=%x)\n", (int) tty);
2194#endif
2195
2196 if (tty == (struct tty_struct *) NULL)
2197 return;
2198 portp = tty->driver_data;
2199 if (portp == (stliport_t *) NULL)
2200 return;
2201 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))
2202 return;
2203 brdp = stli_brds[portp->brdnr];
2204 if (brdp == (stlibrd_t *) NULL)
2205 return;
2206
2207 memset(&actrl, 0, sizeof(asyctrl_t));
2208 actrl.txctrl = CT_STARTFLOW;
2209#if 0
2210 stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0);
2211#endif
2212} 2008}
2213 2009
2214/*****************************************************************************/ 2010/*****************************************************************************/
@@ -2224,22 +2020,9 @@ static void stli_start(struct tty_struct *tty)
2224 2020
2225static void stli_dohangup(void *arg) 2021static void stli_dohangup(void *arg)
2226{ 2022{
2227 stliport_t *portp; 2023 stliport_t *portp = (stliport_t *) arg;
2228 2024 if (portp->tty != NULL) {
2229#ifdef DEBUG 2025 tty_hangup(portp->tty);
2230 printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg);
2231#endif
2232
2233 /*
2234 * FIXME: There's a module removal race here: tty_hangup
2235 * calls schedule_work which will call into this
2236 * driver later.
2237 */
2238 portp = (stliport_t *) arg;
2239 if (portp != (stliport_t *) NULL) {
2240 if (portp->tty != (struct tty_struct *) NULL) {
2241 tty_hangup(portp->tty);
2242 }
2243 } 2026 }
2244} 2027}
2245 2028
@@ -2254,31 +2037,25 @@ static void stli_dohangup(void *arg)
2254 2037
2255static void stli_hangup(struct tty_struct *tty) 2038static void stli_hangup(struct tty_struct *tty)
2256{ 2039{
2257 stliport_t *portp; 2040 stliport_t *portp;
2258 stlibrd_t *brdp; 2041 stlibrd_t *brdp;
2259 unsigned long flags; 2042 unsigned long flags;
2260
2261#ifdef DEBUG
2262 printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty);
2263#endif
2264 2043
2265 if (tty == (struct tty_struct *) NULL)
2266 return;
2267 portp = tty->driver_data; 2044 portp = tty->driver_data;
2268 if (portp == (stliport_t *) NULL) 2045 if (portp == NULL)
2269 return; 2046 return;
2270 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2047 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
2271 return; 2048 return;
2272 brdp = stli_brds[portp->brdnr]; 2049 brdp = stli_brds[portp->brdnr];
2273 if (brdp == (stlibrd_t *) NULL) 2050 if (brdp == NULL)
2274 return; 2051 return;
2275 2052
2276 portp->flags &= ~ASYNC_INITIALIZED; 2053 portp->flags &= ~ASYNC_INITIALIZED;
2277 2054
2278 save_flags(flags); 2055 if (!test_bit(ST_CLOSING, &portp->state))
2279 cli();
2280 if (! test_bit(ST_CLOSING, &portp->state))
2281 stli_rawclose(brdp, portp, 0, 0); 2056 stli_rawclose(brdp, portp, 0, 0);
2057
2058 spin_lock_irqsave(&stli_lock, flags);
2282 if (tty->termios->c_cflag & HUPCL) { 2059 if (tty->termios->c_cflag & HUPCL) {
2283 stli_mkasysigs(&portp->asig, 0, 0); 2060 stli_mkasysigs(&portp->asig, 0, 0);
2284 if (test_bit(ST_CMDING, &portp->state)) { 2061 if (test_bit(ST_CMDING, &portp->state)) {
@@ -2290,14 +2067,15 @@ static void stli_hangup(struct tty_struct *tty)
2290 &portp->asig, sizeof(asysigs_t), 0); 2067 &portp->asig, sizeof(asysigs_t), 0);
2291 } 2068 }
2292 } 2069 }
2293 restore_flags(flags);
2294 2070
2295 clear_bit(ST_TXBUSY, &portp->state); 2071 clear_bit(ST_TXBUSY, &portp->state);
2296 clear_bit(ST_RXSTOP, &portp->state); 2072 clear_bit(ST_RXSTOP, &portp->state);
2297 set_bit(TTY_IO_ERROR, &tty->flags); 2073 set_bit(TTY_IO_ERROR, &tty->flags);
2298 portp->tty = (struct tty_struct *) NULL; 2074 portp->tty = NULL;
2299 portp->flags &= ~ASYNC_NORMAL_ACTIVE; 2075 portp->flags &= ~ASYNC_NORMAL_ACTIVE;
2300 portp->refcount = 0; 2076 portp->refcount = 0;
2077 spin_unlock_irqrestore(&stli_lock, flags);
2078
2301 wake_up_interruptible(&portp->open_wait); 2079 wake_up_interruptible(&portp->open_wait);
2302} 2080}
2303 2081
@@ -2312,29 +2090,22 @@ static void stli_hangup(struct tty_struct *tty)
2312 2090
2313static void stli_flushbuffer(struct tty_struct *tty) 2091static void stli_flushbuffer(struct tty_struct *tty)
2314{ 2092{
2315 stliport_t *portp; 2093 stliport_t *portp;
2316 stlibrd_t *brdp; 2094 stlibrd_t *brdp;
2317 unsigned long ftype, flags; 2095 unsigned long ftype, flags;
2318
2319#ifdef DEBUG
2320 printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty);
2321#endif
2322 2096
2323 if (tty == (struct tty_struct *) NULL)
2324 return;
2325 portp = tty->driver_data; 2097 portp = tty->driver_data;
2326 if (portp == (stliport_t *) NULL) 2098 if (portp == NULL)
2327 return; 2099 return;
2328 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2100 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
2329 return; 2101 return;
2330 brdp = stli_brds[portp->brdnr]; 2102 brdp = stli_brds[portp->brdnr];
2331 if (brdp == (stlibrd_t *) NULL) 2103 if (brdp == NULL)
2332 return; 2104 return;
2333 2105
2334 save_flags(flags); 2106 spin_lock_irqsave(&brd_lock, flags);
2335 cli();
2336 if (tty == stli_txcooktty) { 2107 if (tty == stli_txcooktty) {
2337 stli_txcooktty = (struct tty_struct *) NULL; 2108 stli_txcooktty = NULL;
2338 stli_txcooksize = 0; 2109 stli_txcooksize = 0;
2339 stli_txcookrealsize = 0; 2110 stli_txcookrealsize = 0;
2340 } 2111 }
@@ -2346,15 +2117,10 @@ static void stli_flushbuffer(struct tty_struct *tty)
2346 ftype |= FLUSHRX; 2117 ftype |= FLUSHRX;
2347 clear_bit(ST_DOFLUSHRX, &portp->state); 2118 clear_bit(ST_DOFLUSHRX, &portp->state);
2348 } 2119 }
2349 stli_sendcmd(brdp, portp, A_FLUSH, &ftype, 2120 __stli_sendcmd(brdp, portp, A_FLUSH, &ftype, sizeof(u32), 0);
2350 sizeof(unsigned long), 0);
2351 } 2121 }
2352 restore_flags(flags); 2122 spin_unlock_irqrestore(&brd_lock, flags);
2353 2123 tty_wakeup(tty);
2354 wake_up_interruptible(&tty->write_wait);
2355 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
2356 tty->ldisc.write_wakeup)
2357 (tty->ldisc.write_wakeup)(tty);
2358} 2124}
2359 2125
2360/*****************************************************************************/ 2126/*****************************************************************************/
@@ -2364,55 +2130,31 @@ static void stli_breakctl(struct tty_struct *tty, int state)
2364 stlibrd_t *brdp; 2130 stlibrd_t *brdp;
2365 stliport_t *portp; 2131 stliport_t *portp;
2366 long arg; 2132 long arg;
2367 /* long savestate, savetime; */
2368 2133
2369#ifdef DEBUG
2370 printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state);
2371#endif
2372
2373 if (tty == (struct tty_struct *) NULL)
2374 return;
2375 portp = tty->driver_data; 2134 portp = tty->driver_data;
2376 if (portp == (stliport_t *) NULL) 2135 if (portp == NULL)
2377 return; 2136 return;
2378 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2137 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
2379 return; 2138 return;
2380 brdp = stli_brds[portp->brdnr]; 2139 brdp = stli_brds[portp->brdnr];
2381 if (brdp == (stlibrd_t *) NULL) 2140 if (brdp == NULL)
2382 return; 2141 return;
2383 2142
2384/*
2385 * Due to a bug in the tty send_break() code we need to preserve
2386 * the current process state and timeout...
2387 savetime = current->timeout;
2388 savestate = current->state;
2389 */
2390
2391 arg = (state == -1) ? BREAKON : BREAKOFF; 2143 arg = (state == -1) ? BREAKON : BREAKOFF;
2392 stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0); 2144 stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0);
2393
2394/*
2395 *
2396 current->timeout = savetime;
2397 current->state = savestate;
2398 */
2399} 2145}
2400 2146
2401/*****************************************************************************/ 2147/*****************************************************************************/
2402 2148
2403static void stli_waituntilsent(struct tty_struct *tty, int timeout) 2149static void stli_waituntilsent(struct tty_struct *tty, int timeout)
2404{ 2150{
2405 stliport_t *portp; 2151 stliport_t *portp;
2406 unsigned long tend; 2152 unsigned long tend;
2407 2153
2408#ifdef DEBUG 2154 if (tty == NULL)
2409 printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout);
2410#endif
2411
2412 if (tty == (struct tty_struct *) NULL)
2413 return; 2155 return;
2414 portp = tty->driver_data; 2156 portp = tty->driver_data;
2415 if (portp == (stliport_t *) NULL) 2157 if (portp == NULL)
2416 return; 2158 return;
2417 2159
2418 if (timeout == 0) 2160 if (timeout == 0)
@@ -2436,19 +2178,13 @@ static void stli_sendxchar(struct tty_struct *tty, char ch)
2436 stliport_t *portp; 2178 stliport_t *portp;
2437 asyctrl_t actrl; 2179 asyctrl_t actrl;
2438 2180
2439#ifdef DEBUG
2440 printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch);
2441#endif
2442
2443 if (tty == (struct tty_struct *) NULL)
2444 return;
2445 portp = tty->driver_data; 2181 portp = tty->driver_data;
2446 if (portp == (stliport_t *) NULL) 2182 if (portp == NULL)
2447 return; 2183 return;
2448 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) 2184 if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)
2449 return; 2185 return;
2450 brdp = stli_brds[portp->brdnr]; 2186 brdp = stli_brds[portp->brdnr];
2451 if (brdp == (stlibrd_t *) NULL) 2187 if (brdp == NULL)
2452 return; 2188 return;
2453 2189
2454 memset(&actrl, 0, sizeof(asyctrl_t)); 2190 memset(&actrl, 0, sizeof(asyctrl_t));
@@ -2460,7 +2196,6 @@ static void stli_sendxchar(struct tty_struct *tty, char ch)
2460 actrl.txctrl = CT_SENDCHR; 2196 actrl.txctrl = CT_SENDCHR;
2461 actrl.tximdch = ch; 2197 actrl.tximdch = ch;
2462 } 2198 }
2463
2464 stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); 2199 stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0);
2465} 2200}
2466 2201
@@ -2476,17 +2211,17 @@ static void stli_sendxchar(struct tty_struct *tty, char ch)
2476 2211
2477static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos) 2212static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos)
2478{ 2213{
2479 char *sp, *uart; 2214 char *sp, *uart;
2480 int rc, cnt; 2215 int rc, cnt;
2481 2216
2482 rc = stli_portcmdstats(portp); 2217 rc = stli_portcmdstats(portp);
2483 2218
2484 uart = "UNKNOWN"; 2219 uart = "UNKNOWN";
2485 if (brdp->state & BST_STARTED) { 2220 if (brdp->state & BST_STARTED) {
2486 switch (stli_comstats.hwid) { 2221 switch (stli_comstats.hwid) {
2487 case 0: uart = "2681"; break; 2222 case 0: uart = "2681"; break;
2488 case 1: uart = "SC26198"; break; 2223 case 1: uart = "SC26198"; break;
2489 default: uart = "CD1400"; break; 2224 default:uart = "CD1400"; break;
2490 } 2225 }
2491 } 2226 }
2492 2227
@@ -2537,17 +2272,11 @@ static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *p
2537 2272
2538static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) 2273static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data)
2539{ 2274{
2540 stlibrd_t *brdp; 2275 stlibrd_t *brdp;
2541 stliport_t *portp; 2276 stliport_t *portp;
2542 int brdnr, portnr, totalport; 2277 int brdnr, portnr, totalport;
2543 int curoff, maxoff; 2278 int curoff, maxoff;
2544 char *pos; 2279 char *pos;
2545
2546#ifdef DEBUG
2547 printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x,"
2548 "data=%x\n", (int) page, (int) start, (int) off, count,
2549 (int) eof, (int) data);
2550#endif
2551 2280
2552 pos = page; 2281 pos = page;
2553 totalport = 0; 2282 totalport = 0;
@@ -2568,7 +2297,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo
2568 */ 2297 */
2569 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { 2298 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) {
2570 brdp = stli_brds[brdnr]; 2299 brdp = stli_brds[brdnr];
2571 if (brdp == (stlibrd_t *) NULL) 2300 if (brdp == NULL)
2572 continue; 2301 continue;
2573 if (brdp->state == 0) 2302 if (brdp->state == 0)
2574 continue; 2303 continue;
@@ -2583,7 +2312,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo
2583 for (portnr = 0; (portnr < brdp->nrports); portnr++, 2312 for (portnr = 0; (portnr < brdp->nrports); portnr++,
2584 totalport++) { 2313 totalport++) {
2585 portp = brdp->ports[portnr]; 2314 portp = brdp->ports[portnr];
2586 if (portp == (stliport_t *) NULL) 2315 if (portp == NULL)
2587 continue; 2316 continue;
2588 if (off >= (curoff += MAXLINE)) 2317 if (off >= (curoff += MAXLINE))
2589 continue; 2318 continue;
@@ -2610,49 +2339,54 @@ stli_readdone:
2610 * a poll routine that does not have user context. Therefore you cannot 2339 * 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 2340 * 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. 2341 * process. This routine does not sleep, so can be called from anywhere.
2342 *
2343 * The caller must hold the brd_lock (see also stli_sendcmd the usual
2344 * entry point)
2613 */ 2345 */
2614 2346
2615static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) 2347static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback)
2616{ 2348{
2617 volatile cdkhdr_t *hdrp; 2349 cdkhdr_t __iomem *hdrp;
2618 volatile cdkctrl_t *cp; 2350 cdkctrl_t __iomem *cp;
2619 volatile unsigned char *bits; 2351 unsigned char __iomem *bits;
2620 unsigned long flags; 2352 unsigned long flags;
2621 2353
2622#ifdef DEBUG 2354 spin_lock_irqsave(&brd_lock, flags);
2623 printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"
2624 "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,
2625 (int) arg, size, copyback);
2626#endif
2627
2628 save_flags(flags);
2629 cli();
2630 2355
2631 if (test_bit(ST_CMDING, &portp->state)) { 2356 if (test_bit(ST_CMDING, &portp->state)) {
2632 printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", 2357 printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n",
2633 (int) cmd); 2358 (int) cmd);
2634 restore_flags(flags); 2359 spin_unlock_irqrestore(&brd_lock, flags);
2635 return; 2360 return;
2636 } 2361 }
2637 2362
2638 EBRDENABLE(brdp); 2363 EBRDENABLE(brdp);
2639 cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; 2364 cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;
2640 if (size > 0) { 2365 if (size > 0) {
2641 memcpy((void *) &(cp->args[0]), arg, size); 2366 memcpy_toio((void __iomem *) &(cp->args[0]), arg, size);
2642 if (copyback) { 2367 if (copyback) {
2643 portp->argp = arg; 2368 portp->argp = arg;
2644 portp->argsize = size; 2369 portp->argsize = size;
2645 } 2370 }
2646 } 2371 }
2647 cp->status = 0; 2372 writel(0, &cp->status);
2648 cp->cmd = cmd; 2373 writel(cmd, &cp->cmd);
2649 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2374 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
2650 bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + 2375 bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +
2651 portp->portidx; 2376 portp->portidx;
2652 *bits |= portp->portbit; 2377 writeb(readb(bits) | portp->portbit, bits);
2653 set_bit(ST_CMDING, &portp->state); 2378 set_bit(ST_CMDING, &portp->state);
2654 EBRDDISABLE(brdp); 2379 EBRDDISABLE(brdp);
2655 restore_flags(flags); 2380 spin_unlock_irqrestore(&brd_lock, flags);
2381}
2382
2383static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback)
2384{
2385 unsigned long flags;
2386
2387 spin_lock_irqsave(&brd_lock, flags);
2388 __stli_sendcmd(brdp, portp, cmd, arg, size, copyback);
2389 spin_unlock_irqrestore(&brd_lock, flags);
2656} 2390}
2657 2391
2658/*****************************************************************************/ 2392/*****************************************************************************/
@@ -2667,28 +2401,23 @@ static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd,
2667 2401
2668static void stli_read(stlibrd_t *brdp, stliport_t *portp) 2402static void stli_read(stlibrd_t *brdp, stliport_t *portp)
2669{ 2403{
2670 volatile cdkasyrq_t *rp; 2404 cdkasyrq_t __iomem *rp;
2671 volatile char *shbuf; 2405 char __iomem *shbuf;
2672 struct tty_struct *tty; 2406 struct tty_struct *tty;
2673 unsigned int head, tail, size; 2407 unsigned int head, tail, size;
2674 unsigned int len, stlen; 2408 unsigned int len, stlen;
2675
2676#ifdef DEBUG
2677 printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n",
2678 (int) brdp, (int) portp);
2679#endif
2680 2409
2681 if (test_bit(ST_RXSTOP, &portp->state)) 2410 if (test_bit(ST_RXSTOP, &portp->state))
2682 return; 2411 return;
2683 tty = portp->tty; 2412 tty = portp->tty;
2684 if (tty == (struct tty_struct *) NULL) 2413 if (tty == NULL)
2685 return; 2414 return;
2686 2415
2687 rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; 2416 rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq;
2688 head = (unsigned int) rp->head; 2417 head = (unsigned int) readw(&rp->head);
2689 if (head != ((unsigned int) rp->head)) 2418 if (head != ((unsigned int) readw(&rp->head)))
2690 head = (unsigned int) rp->head; 2419 head = (unsigned int) readw(&rp->head);
2691 tail = (unsigned int) rp->tail; 2420 tail = (unsigned int) readw(&rp->tail);
2692 size = portp->rxsize; 2421 size = portp->rxsize;
2693 if (head >= tail) { 2422 if (head >= tail) {
2694 len = head - tail; 2423 len = head - tail;
@@ -2699,12 +2428,15 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp)
2699 } 2428 }
2700 2429
2701 len = tty_buffer_request_room(tty, len); 2430 len = tty_buffer_request_room(tty, len);
2702 /* FIXME : iomap ? */ 2431
2703 shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset); 2432 shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->rxoffset);
2704 2433
2705 while (len > 0) { 2434 while (len > 0) {
2435 unsigned char *cptr;
2436
2706 stlen = MIN(len, stlen); 2437 stlen = MIN(len, stlen);
2707 tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen); 2438 tty_prepare_flip_string(tty, &cptr, stlen);
2439 memcpy_fromio(cptr, shbuf + tail, stlen);
2708 len -= stlen; 2440 len -= stlen;
2709 tail += stlen; 2441 tail += stlen;
2710 if (tail >= size) { 2442 if (tail >= size) {
@@ -2712,8 +2444,8 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp)
2712 stlen = head; 2444 stlen = head;
2713 } 2445 }
2714 } 2446 }
2715 rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; 2447 rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq;
2716 rp->tail = tail; 2448 writew(tail, &rp->tail);
2717 2449
2718 if (head != tail) 2450 if (head != tail)
2719 set_bit(ST_RXING, &portp->state); 2451 set_bit(ST_RXING, &portp->state);
@@ -2729,9 +2461,9 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp)
2729 * difficult to deal with them here. 2461 * difficult to deal with them here.
2730 */ 2462 */
2731 2463
2732static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) 2464static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp)
2733{ 2465{
2734 int cmd; 2466 int cmd;
2735 2467
2736 if (test_bit(ST_DOSIGS, &portp->state)) { 2468 if (test_bit(ST_DOSIGS, &portp->state)) {
2737 if (test_bit(ST_DOFLUSHTX, &portp->state) && 2469 if (test_bit(ST_DOFLUSHTX, &portp->state) &&
@@ -2746,10 +2478,10 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp)
2746 clear_bit(ST_DOFLUSHTX, &portp->state); 2478 clear_bit(ST_DOFLUSHTX, &portp->state);
2747 clear_bit(ST_DOFLUSHRX, &portp->state); 2479 clear_bit(ST_DOFLUSHRX, &portp->state);
2748 clear_bit(ST_DOSIGS, &portp->state); 2480 clear_bit(ST_DOSIGS, &portp->state);
2749 memcpy((void *) &(cp->args[0]), (void *) &portp->asig, 2481 memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &portp->asig,
2750 sizeof(asysigs_t)); 2482 sizeof(asysigs_t));
2751 cp->status = 0; 2483 writel(0, &cp->status);
2752 cp->cmd = cmd; 2484 writel(cmd, &cp->cmd);
2753 set_bit(ST_CMDING, &portp->state); 2485 set_bit(ST_CMDING, &portp->state);
2754 } else if (test_bit(ST_DOFLUSHTX, &portp->state) || 2486 } else if (test_bit(ST_DOFLUSHTX, &portp->state) ||
2755 test_bit(ST_DOFLUSHRX, &portp->state)) { 2487 test_bit(ST_DOFLUSHRX, &portp->state)) {
@@ -2757,9 +2489,9 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp)
2757 cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0); 2489 cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0);
2758 clear_bit(ST_DOFLUSHTX, &portp->state); 2490 clear_bit(ST_DOFLUSHTX, &portp->state);
2759 clear_bit(ST_DOFLUSHRX, &portp->state); 2491 clear_bit(ST_DOFLUSHRX, &portp->state);
2760 memcpy((void *) &(cp->args[0]), (void *) &cmd, sizeof(int)); 2492 memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &cmd, sizeof(int));
2761 cp->status = 0; 2493 writel(0, &cp->status);
2762 cp->cmd = A_FLUSH; 2494 writel(A_FLUSH, &cp->cmd);
2763 set_bit(ST_CMDING, &portp->state); 2495 set_bit(ST_CMDING, &portp->state);
2764 } 2496 }
2765} 2497}
@@ -2779,30 +2511,25 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp)
2779 2511
2780static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) 2512static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
2781{ 2513{
2782 volatile cdkasy_t *ap; 2514 cdkasy_t __iomem *ap;
2783 volatile cdkctrl_t *cp; 2515 cdkctrl_t __iomem *cp;
2784 struct tty_struct *tty; 2516 struct tty_struct *tty;
2785 asynotify_t nt; 2517 asynotify_t nt;
2786 unsigned long oldsigs; 2518 unsigned long oldsigs;
2787 int rc, donerx; 2519 int rc, donerx;
2788 2520
2789#ifdef DEBUG 2521 ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);
2790 printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n",
2791 (int) brdp, channr);
2792#endif
2793
2794 ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);
2795 cp = &ap->ctrl; 2522 cp = &ap->ctrl;
2796 2523
2797/* 2524/*
2798 * Check if we are waiting for an open completion message. 2525 * Check if we are waiting for an open completion message.
2799 */ 2526 */
2800 if (test_bit(ST_OPENING, &portp->state)) { 2527 if (test_bit(ST_OPENING, &portp->state)) {
2801 rc = (int) cp->openarg; 2528 rc = readl(&cp->openarg);
2802 if ((cp->open == 0) && (rc != 0)) { 2529 if (readb(&cp->open) == 0 && rc != 0) {
2803 if (rc > 0) 2530 if (rc > 0)
2804 rc--; 2531 rc--;
2805 cp->openarg = 0; 2532 writel(0, &cp->openarg);
2806 portp->rc = rc; 2533 portp->rc = rc;
2807 clear_bit(ST_OPENING, &portp->state); 2534 clear_bit(ST_OPENING, &portp->state);
2808 wake_up_interruptible(&portp->raw_wait); 2535 wake_up_interruptible(&portp->raw_wait);
@@ -2813,11 +2540,11 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
2813 * Check if we are waiting for a close completion message. 2540 * Check if we are waiting for a close completion message.
2814 */ 2541 */
2815 if (test_bit(ST_CLOSING, &portp->state)) { 2542 if (test_bit(ST_CLOSING, &portp->state)) {
2816 rc = (int) cp->closearg; 2543 rc = (int) readl(&cp->closearg);
2817 if ((cp->close == 0) && (rc != 0)) { 2544 if (readb(&cp->close) == 0 && rc != 0) {
2818 if (rc > 0) 2545 if (rc > 0)
2819 rc--; 2546 rc--;
2820 cp->closearg = 0; 2547 writel(0, &cp->closearg);
2821 portp->rc = rc; 2548 portp->rc = rc;
2822 clear_bit(ST_CLOSING, &portp->state); 2549 clear_bit(ST_CLOSING, &portp->state);
2823 wake_up_interruptible(&portp->raw_wait); 2550 wake_up_interruptible(&portp->raw_wait);
@@ -2829,16 +2556,16 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
2829 * need to copy out the command results associated with this command. 2556 * need to copy out the command results associated with this command.
2830 */ 2557 */
2831 if (test_bit(ST_CMDING, &portp->state)) { 2558 if (test_bit(ST_CMDING, &portp->state)) {
2832 rc = cp->status; 2559 rc = readl(&cp->status);
2833 if ((cp->cmd == 0) && (rc != 0)) { 2560 if (readl(&cp->cmd) == 0 && rc != 0) {
2834 if (rc > 0) 2561 if (rc > 0)
2835 rc--; 2562 rc--;
2836 if (portp->argp != (void *) NULL) { 2563 if (portp->argp != NULL) {
2837 memcpy(portp->argp, (void *) &(cp->args[0]), 2564 memcpy_fromio(portp->argp, (void __iomem *) &(cp->args[0]),
2838 portp->argsize); 2565 portp->argsize);
2839 portp->argp = (void *) NULL; 2566 portp->argp = NULL;
2840 } 2567 }
2841 cp->status = 0; 2568 writel(0, &cp->status);
2842 portp->rc = rc; 2569 portp->rc = rc;
2843 clear_bit(ST_CMDING, &portp->state); 2570 clear_bit(ST_CMDING, &portp->state);
2844 stli_dodelaycmd(portp, cp); 2571 stli_dodelaycmd(portp, cp);
@@ -2877,18 +2604,15 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
2877 if (nt.data & DT_TXEMPTY) 2604 if (nt.data & DT_TXEMPTY)
2878 clear_bit(ST_TXBUSY, &portp->state); 2605 clear_bit(ST_TXBUSY, &portp->state);
2879 if (nt.data & (DT_TXEMPTY | DT_TXLOW)) { 2606 if (nt.data & (DT_TXEMPTY | DT_TXLOW)) {
2880 if (tty != (struct tty_struct *) NULL) { 2607 if (tty != NULL) {
2881 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 2608 tty_wakeup(tty);
2882 tty->ldisc.write_wakeup) { 2609 EBRDENABLE(brdp);
2883 (tty->ldisc.write_wakeup)(tty);
2884 EBRDENABLE(brdp);
2885 }
2886 wake_up_interruptible(&tty->write_wait); 2610 wake_up_interruptible(&tty->write_wait);
2887 } 2611 }
2888 } 2612 }
2889 2613
2890 if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { 2614 if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) {
2891 if (tty != (struct tty_struct *) NULL) { 2615 if (tty != NULL) {
2892 tty_insert_flip_char(tty, 0, TTY_BREAK); 2616 tty_insert_flip_char(tty, 0, TTY_BREAK);
2893 if (portp->flags & ASYNC_SAK) { 2617 if (portp->flags & ASYNC_SAK) {
2894 do_SAK(tty); 2618 do_SAK(tty);
@@ -2932,14 +2656,14 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
2932 * at the cdk header structure. 2656 * at the cdk header structure.
2933 */ 2657 */
2934 2658
2935static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) 2659static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp)
2936{ 2660{
2937 stliport_t *portp; 2661 stliport_t *portp;
2938 unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; 2662 unsigned char hostbits[(STL_MAXCHANS / 8) + 1];
2939 unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; 2663 unsigned char slavebits[(STL_MAXCHANS / 8) + 1];
2940 unsigned char *slavep; 2664 unsigned char __iomem *slavep;
2941 int bitpos, bitat, bitsize; 2665 int bitpos, bitat, bitsize;
2942 int channr, nrdevs, slavebitchange; 2666 int channr, nrdevs, slavebitchange;
2943 2667
2944 bitsize = brdp->bitsize; 2668 bitsize = brdp->bitsize;
2945 nrdevs = brdp->nrdevs; 2669 nrdevs = brdp->nrdevs;
@@ -2951,7 +2675,7 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp)
2951 * 8 service bits at a time in the inner loop, so we can bypass 2675 * 8 service bits at a time in the inner loop, so we can bypass
2952 * the lot if none of them want service. 2676 * the lot if none of them want service.
2953 */ 2677 */
2954 memcpy(&hostbits[0], (((unsigned char *) hdrp) + brdp->hostoffset), 2678 memcpy_fromio(&hostbits[0], (((unsigned char __iomem *) hdrp) + brdp->hostoffset),
2955 bitsize); 2679 bitsize);
2956 2680
2957 memset(&slavebits[0], 0, bitsize); 2681 memset(&slavebits[0], 0, bitsize);
@@ -2978,11 +2702,11 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp)
2978 * service may initiate more slave requests. 2702 * service may initiate more slave requests.
2979 */ 2703 */
2980 if (slavebitchange) { 2704 if (slavebitchange) {
2981 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2705 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
2982 slavep = ((unsigned char *) hdrp) + brdp->slaveoffset; 2706 slavep = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset;
2983 for (bitpos = 0; (bitpos < bitsize); bitpos++) { 2707 for (bitpos = 0; (bitpos < bitsize); bitpos++) {
2984 if (slavebits[bitpos]) 2708 if (readb(slavebits + bitpos))
2985 slavep[bitpos] &= ~slavebits[bitpos]; 2709 writeb(readb(slavep + bitpos) & ~slavebits[bitpos], slavebits + bitpos);
2986 } 2710 }
2987 } 2711 }
2988} 2712}
@@ -3000,9 +2724,9 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp)
3000 2724
3001static void stli_poll(unsigned long arg) 2725static void stli_poll(unsigned long arg)
3002{ 2726{
3003 volatile cdkhdr_t *hdrp; 2727 cdkhdr_t __iomem *hdrp;
3004 stlibrd_t *brdp; 2728 stlibrd_t *brdp;
3005 int brdnr; 2729 int brdnr;
3006 2730
3007 stli_timerlist.expires = STLI_TIMEOUT; 2731 stli_timerlist.expires = STLI_TIMEOUT;
3008 add_timer(&stli_timerlist); 2732 add_timer(&stli_timerlist);
@@ -3012,16 +2736,18 @@ static void stli_poll(unsigned long arg)
3012 */ 2736 */
3013 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { 2737 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) {
3014 brdp = stli_brds[brdnr]; 2738 brdp = stli_brds[brdnr];
3015 if (brdp == (stlibrd_t *) NULL) 2739 if (brdp == NULL)
3016 continue; 2740 continue;
3017 if ((brdp->state & BST_STARTED) == 0) 2741 if ((brdp->state & BST_STARTED) == 0)
3018 continue; 2742 continue;
3019 2743
2744 spin_lock(&brd_lock);
3020 EBRDENABLE(brdp); 2745 EBRDENABLE(brdp);
3021 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 2746 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
3022 if (hdrp->hostreq) 2747 if (readb(&hdrp->hostreq))
3023 stli_brdpoll(brdp, hdrp); 2748 stli_brdpoll(brdp, hdrp);
3024 EBRDDISABLE(brdp); 2749 EBRDDISABLE(brdp);
2750 spin_unlock(&brd_lock);
3025 } 2751 }
3026} 2752}
3027 2753
@@ -3034,11 +2760,6 @@ static void stli_poll(unsigned long arg)
3034 2760
3035static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) 2761static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp)
3036{ 2762{
3037#ifdef DEBUG
3038 printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n",
3039 (int) portp, (int) pp, (int) tiosp);
3040#endif
3041
3042 memset(pp, 0, sizeof(asyport_t)); 2763 memset(pp, 0, sizeof(asyport_t));
3043 2764
3044/* 2765/*
@@ -3157,11 +2878,6 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio
3157 2878
3158static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) 2879static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts)
3159{ 2880{
3160#ifdef DEBUG
3161 printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n",
3162 (int) sp, dtr, rts);
3163#endif
3164
3165 memset(sp, 0, sizeof(asysigs_t)); 2881 memset(sp, 0, sizeof(asysigs_t));
3166 if (dtr >= 0) { 2882 if (dtr >= 0) {
3167 sp->signal |= SG_DTR; 2883 sp->signal |= SG_DTR;
@@ -3182,13 +2898,7 @@ static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts)
3182 2898
3183static long stli_mktiocm(unsigned long sigvalue) 2899static long stli_mktiocm(unsigned long sigvalue)
3184{ 2900{
3185 long tiocm; 2901 long tiocm = 0;
3186
3187#ifdef DEBUG
3188 printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue);
3189#endif
3190
3191 tiocm = 0;
3192 tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0); 2902 tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0);
3193 tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); 2903 tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0);
3194 tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); 2904 tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0);
@@ -3210,10 +2920,6 @@ static int stli_initports(stlibrd_t *brdp)
3210 stliport_t *portp; 2920 stliport_t *portp;
3211 int i, panelnr, panelport; 2921 int i, panelnr, panelport;
3212 2922
3213#ifdef DEBUG
3214 printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp);
3215#endif
3216
3217 for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { 2923 for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {
3218 portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); 2924 portp = kzalloc(sizeof(stliport_t), GFP_KERNEL);
3219 if (!portp) { 2925 if (!portp) {
@@ -3240,7 +2946,7 @@ static int stli_initports(stlibrd_t *brdp)
3240 brdp->ports[i] = portp; 2946 brdp->ports[i] = portp;
3241 } 2947 }
3242 2948
3243 return(0); 2949 return 0;
3244} 2950}
3245 2951
3246/*****************************************************************************/ 2952/*****************************************************************************/
@@ -3253,10 +2959,6 @@ static void stli_ecpinit(stlibrd_t *brdp)
3253{ 2959{
3254 unsigned long memconf; 2960 unsigned long memconf;
3255 2961
3256#ifdef DEBUG
3257 printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp);
3258#endif
3259
3260 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); 2962 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR));
3261 udelay(10); 2963 udelay(10);
3262 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); 2964 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));
@@ -3270,9 +2972,6 @@ static void stli_ecpinit(stlibrd_t *brdp)
3270 2972
3271static void stli_ecpenable(stlibrd_t *brdp) 2973static void stli_ecpenable(stlibrd_t *brdp)
3272{ 2974{
3273#ifdef DEBUG
3274 printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp);
3275#endif
3276 outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); 2975 outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR));
3277} 2976}
3278 2977
@@ -3280,9 +2979,6 @@ static void stli_ecpenable(stlibrd_t *brdp)
3280 2979
3281static void stli_ecpdisable(stlibrd_t *brdp) 2980static void stli_ecpdisable(stlibrd_t *brdp)
3282{ 2981{
3283#ifdef DEBUG
3284 printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp);
3285#endif
3286 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); 2982 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));
3287} 2983}
3288 2984
@@ -3290,13 +2986,8 @@ static void stli_ecpdisable(stlibrd_t *brdp)
3290 2986
3291static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 2987static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3292{ 2988{
3293 void *ptr; 2989 void *ptr;
3294 unsigned char val; 2990 unsigned char val;
3295
3296#ifdef DEBUG
3297 printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
3298 (int) offset);
3299#endif
3300 2991
3301 if (offset > brdp->memsize) { 2992 if (offset > brdp->memsize) {
3302 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 2993 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
@@ -3316,10 +3007,6 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3316 3007
3317static void stli_ecpreset(stlibrd_t *brdp) 3008static void stli_ecpreset(stlibrd_t *brdp)
3318{ 3009{
3319#ifdef DEBUG
3320 printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp);
3321#endif
3322
3323 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); 3010 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR));
3324 udelay(10); 3011 udelay(10);
3325 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); 3012 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));
@@ -3330,9 +3017,6 @@ static void stli_ecpreset(stlibrd_t *brdp)
3330 3017
3331static void stli_ecpintr(stlibrd_t *brdp) 3018static void stli_ecpintr(stlibrd_t *brdp)
3332{ 3019{
3333#ifdef DEBUG
3334 printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp);
3335#endif
3336 outb(0x1, brdp->iobase); 3020 outb(0x1, brdp->iobase);
3337} 3021}
3338 3022
@@ -3346,10 +3030,6 @@ static void stli_ecpeiinit(stlibrd_t *brdp)
3346{ 3030{
3347 unsigned long memconf; 3031 unsigned long memconf;
3348 3032
3349#ifdef DEBUG
3350 printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp);
3351#endif
3352
3353 outb(0x1, (brdp->iobase + ECP_EIBRDENAB)); 3033 outb(0x1, (brdp->iobase + ECP_EIBRDENAB));
3354 outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR)); 3034 outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR));
3355 udelay(10); 3035 udelay(10);
@@ -3383,11 +3063,6 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line
3383 void *ptr; 3063 void *ptr;
3384 unsigned char val; 3064 unsigned char val;
3385 3065
3386#ifdef DEBUG
3387 printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n",
3388 (int) brdp, (int) offset, line);
3389#endif
3390
3391 if (offset > brdp->memsize) { 3066 if (offset > brdp->memsize) {
3392 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3067 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
3393 "range at line=%d(%d), brd=%d\n", 3068 "range at line=%d(%d), brd=%d\n",
@@ -3437,8 +3112,8 @@ static void stli_ecpmcdisable(stlibrd_t *brdp)
3437 3112
3438static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3113static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3439{ 3114{
3440 void *ptr; 3115 void *ptr;
3441 unsigned char val; 3116 unsigned char val;
3442 3117
3443 if (offset > brdp->memsize) { 3118 if (offset > brdp->memsize) {
3444 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3119 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
@@ -3472,10 +3147,6 @@ static void stli_ecpmcreset(stlibrd_t *brdp)
3472 3147
3473static void stli_ecppciinit(stlibrd_t *brdp) 3148static void stli_ecppciinit(stlibrd_t *brdp)
3474{ 3149{
3475#ifdef DEBUG
3476 printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp);
3477#endif
3478
3479 outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR)); 3150 outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR));
3480 udelay(10); 3151 udelay(10);
3481 outb(0, (brdp->iobase + ECP_PCICONFR)); 3152 outb(0, (brdp->iobase + ECP_PCICONFR));
@@ -3489,11 +3160,6 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin
3489 void *ptr; 3160 void *ptr;
3490 unsigned char val; 3161 unsigned char val;
3491 3162
3492#ifdef DEBUG
3493 printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n",
3494 (int) brdp, (int) offset, line);
3495#endif
3496
3497 if (offset > brdp->memsize) { 3163 if (offset > brdp->memsize) {
3498 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3164 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
3499 "range at line=%d(%d), board=%d\n", 3165 "range at line=%d(%d), board=%d\n",
@@ -3528,10 +3194,6 @@ static void stli_onbinit(stlibrd_t *brdp)
3528{ 3194{
3529 unsigned long memconf; 3195 unsigned long memconf;
3530 3196
3531#ifdef DEBUG
3532 printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp);
3533#endif
3534
3535 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); 3197 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR));
3536 udelay(10); 3198 udelay(10);
3537 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); 3199 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR));
@@ -3547,9 +3209,6 @@ static void stli_onbinit(stlibrd_t *brdp)
3547 3209
3548static void stli_onbenable(stlibrd_t *brdp) 3210static void stli_onbenable(stlibrd_t *brdp)
3549{ 3211{
3550#ifdef DEBUG
3551 printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp);
3552#endif
3553 outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR)); 3212 outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR));
3554} 3213}
3555 3214
@@ -3557,9 +3216,6 @@ static void stli_onbenable(stlibrd_t *brdp)
3557 3216
3558static void stli_onbdisable(stlibrd_t *brdp) 3217static void stli_onbdisable(stlibrd_t *brdp)
3559{ 3218{
3560#ifdef DEBUG
3561 printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp);
3562#endif
3563 outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR)); 3219 outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR));
3564} 3220}
3565 3221
@@ -3569,11 +3225,6 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3569{ 3225{
3570 void *ptr; 3226 void *ptr;
3571 3227
3572#ifdef DEBUG
3573 printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
3574 (int) offset);
3575#endif
3576
3577 if (offset > brdp->memsize) { 3228 if (offset > brdp->memsize) {
3578 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3229 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
3579 "range at line=%d(%d), brd=%d\n", 3230 "range at line=%d(%d), brd=%d\n",
@@ -3589,11 +3240,6 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3589 3240
3590static void stli_onbreset(stlibrd_t *brdp) 3241static void stli_onbreset(stlibrd_t *brdp)
3591{ 3242{
3592
3593#ifdef DEBUG
3594 printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp);
3595#endif
3596
3597 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); 3243 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR));
3598 udelay(10); 3244 udelay(10);
3599 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); 3245 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR));
@@ -3610,10 +3256,6 @@ static void stli_onbeinit(stlibrd_t *brdp)
3610{ 3256{
3611 unsigned long memconf; 3257 unsigned long memconf;
3612 3258
3613#ifdef DEBUG
3614 printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp);
3615#endif
3616
3617 outb(0x1, (brdp->iobase + ONB_EIBRDENAB)); 3259 outb(0x1, (brdp->iobase + ONB_EIBRDENAB));
3618 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); 3260 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR));
3619 udelay(10); 3261 udelay(10);
@@ -3632,9 +3274,6 @@ static void stli_onbeinit(stlibrd_t *brdp)
3632 3274
3633static void stli_onbeenable(stlibrd_t *brdp) 3275static void stli_onbeenable(stlibrd_t *brdp)
3634{ 3276{
3635#ifdef DEBUG
3636 printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp);
3637#endif
3638 outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); 3277 outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR));
3639} 3278}
3640 3279
@@ -3642,9 +3281,6 @@ static void stli_onbeenable(stlibrd_t *brdp)
3642 3281
3643static void stli_onbedisable(stlibrd_t *brdp) 3282static void stli_onbedisable(stlibrd_t *brdp)
3644{ 3283{
3645#ifdef DEBUG
3646 printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp);
3647#endif
3648 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); 3284 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR));
3649} 3285}
3650 3286
@@ -3652,13 +3288,8 @@ static void stli_onbedisable(stlibrd_t *brdp)
3652 3288
3653static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3289static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3654{ 3290{
3655 void *ptr; 3291 void *ptr;
3656 unsigned char val; 3292 unsigned char val;
3657
3658#ifdef DEBUG
3659 printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n",
3660 (int) brdp, (int) offset, line);
3661#endif
3662 3293
3663 if (offset > brdp->memsize) { 3294 if (offset > brdp->memsize) {
3664 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3295 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
@@ -3681,11 +3312,6 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3681 3312
3682static void stli_onbereset(stlibrd_t *brdp) 3313static void stli_onbereset(stlibrd_t *brdp)
3683{ 3314{
3684
3685#ifdef DEBUG
3686 printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp);
3687#endif
3688
3689 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); 3315 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR));
3690 udelay(10); 3316 udelay(10);
3691 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); 3317 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR));
@@ -3700,11 +3326,6 @@ static void stli_onbereset(stlibrd_t *brdp)
3700 3326
3701static void stli_bbyinit(stlibrd_t *brdp) 3327static void stli_bbyinit(stlibrd_t *brdp)
3702{ 3328{
3703
3704#ifdef DEBUG
3705 printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp);
3706#endif
3707
3708 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); 3329 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR));
3709 udelay(10); 3330 udelay(10);
3710 outb(0, (brdp->iobase + BBY_ATCONFR)); 3331 outb(0, (brdp->iobase + BBY_ATCONFR));
@@ -3717,24 +3338,13 @@ static void stli_bbyinit(stlibrd_t *brdp)
3717 3338
3718static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3339static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3719{ 3340{
3720 void *ptr; 3341 void *ptr;
3721 unsigned char val; 3342 unsigned char val;
3722 3343
3723#ifdef DEBUG 3344 BUG_ON(offset > brdp->memsize);
3724 printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
3725 (int) offset);
3726#endif
3727 3345
3728 if (offset > brdp->memsize) { 3346 ptr = brdp->membase + (offset % BBY_PAGESIZE);
3729 printk(KERN_ERR "STALLION: shared memory pointer=%x out of " 3347 val = (unsigned char) (offset / BBY_PAGESIZE);
3730 "range at line=%d(%d), brd=%d\n",
3731 (int) offset, line, __LINE__, brdp->brdnr);
3732 ptr = NULL;
3733 val = 0;
3734 } else {
3735 ptr = brdp->membase + (offset % BBY_PAGESIZE);
3736 val = (unsigned char) (offset / BBY_PAGESIZE);
3737 }
3738 outb(val, (brdp->iobase + BBY_ATCONFR)); 3348 outb(val, (brdp->iobase + BBY_ATCONFR));
3739 return(ptr); 3349 return(ptr);
3740} 3350}
@@ -3743,11 +3353,6 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3743 3353
3744static void stli_bbyreset(stlibrd_t *brdp) 3354static void stli_bbyreset(stlibrd_t *brdp)
3745{ 3355{
3746
3747#ifdef DEBUG
3748 printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp);
3749#endif
3750
3751 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); 3356 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR));
3752 udelay(10); 3357 udelay(10);
3753 outb(0, (brdp->iobase + BBY_ATCONFR)); 3358 outb(0, (brdp->iobase + BBY_ATCONFR));
@@ -3762,11 +3367,6 @@ static void stli_bbyreset(stlibrd_t *brdp)
3762 3367
3763static void stli_stalinit(stlibrd_t *brdp) 3368static void stli_stalinit(stlibrd_t *brdp)
3764{ 3369{
3765
3766#ifdef DEBUG
3767 printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp);
3768#endif
3769
3770 outb(0x1, brdp->iobase); 3370 outb(0x1, brdp->iobase);
3771 mdelay(1000); 3371 mdelay(1000);
3772} 3372}
@@ -3775,36 +3375,18 @@ static void stli_stalinit(stlibrd_t *brdp)
3775 3375
3776static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) 3376static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
3777{ 3377{
3778 void *ptr; 3378 BUG_ON(offset > brdp->memsize);
3779 3379 return brdp->membase + (offset % STAL_PAGESIZE);
3780#ifdef DEBUG
3781 printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
3782 (int) offset);
3783#endif
3784
3785 if (offset > brdp->memsize) {
3786 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
3787 "range at line=%d(%d), brd=%d\n",
3788 (int) offset, line, __LINE__, brdp->brdnr);
3789 ptr = NULL;
3790 } else {
3791 ptr = brdp->membase + (offset % STAL_PAGESIZE);
3792 }
3793 return(ptr);
3794} 3380}
3795 3381
3796/*****************************************************************************/ 3382/*****************************************************************************/
3797 3383
3798static void stli_stalreset(stlibrd_t *brdp) 3384static void stli_stalreset(stlibrd_t *brdp)
3799{ 3385{
3800 volatile unsigned long *vecp; 3386 u32 __iomem *vecp;
3801
3802#ifdef DEBUG
3803 printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp);
3804#endif
3805 3387
3806 vecp = (volatile unsigned long *) (brdp->membase + 0x30); 3388 vecp = (u32 __iomem *) (brdp->membase + 0x30);
3807 *vecp = 0xffff0000; 3389 writel(0xffff0000, vecp);
3808 outb(0, brdp->iobase); 3390 outb(0, brdp->iobase);
3809 mdelay(1000); 3391 mdelay(1000);
3810} 3392}
@@ -3818,15 +3400,11 @@ static void stli_stalreset(stlibrd_t *brdp)
3818 3400
3819static int stli_initecp(stlibrd_t *brdp) 3401static int stli_initecp(stlibrd_t *brdp)
3820{ 3402{
3821 cdkecpsig_t sig; 3403 cdkecpsig_t sig;
3822 cdkecpsig_t *sigsp; 3404 cdkecpsig_t __iomem *sigsp;
3823 unsigned int status, nxtid; 3405 unsigned int status, nxtid;
3824 char *name; 3406 char *name;
3825 int panelnr, nrports; 3407 int panelnr, nrports;
3826
3827#ifdef DEBUG
3828 printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp);
3829#endif
3830 3408
3831 if (!request_region(brdp->iobase, brdp->iosize, "istallion")) 3409 if (!request_region(brdp->iobase, brdp->iosize, "istallion"))
3832 return -EIO; 3410 return -EIO;
@@ -3834,7 +3412,7 @@ static int stli_initecp(stlibrd_t *brdp)
3834 if ((brdp->iobase == 0) || (brdp->memaddr == 0)) 3412 if ((brdp->iobase == 0) || (brdp->memaddr == 0))
3835 { 3413 {
3836 release_region(brdp->iobase, brdp->iosize); 3414 release_region(brdp->iobase, brdp->iosize);
3837 return(-ENODEV); 3415 return -ENODEV;
3838 } 3416 }
3839 3417
3840 brdp->iosize = ECP_IOSIZE; 3418 brdp->iosize = ECP_IOSIZE;
@@ -3903,7 +3481,7 @@ static int stli_initecp(stlibrd_t *brdp)
3903 3481
3904 default: 3482 default:
3905 release_region(brdp->iobase, brdp->iosize); 3483 release_region(brdp->iobase, brdp->iosize);
3906 return(-EINVAL); 3484 return -EINVAL;
3907 } 3485 }
3908 3486
3909/* 3487/*
@@ -3915,10 +3493,10 @@ static int stli_initecp(stlibrd_t *brdp)
3915 EBRDINIT(brdp); 3493 EBRDINIT(brdp);
3916 3494
3917 brdp->membase = ioremap(brdp->memaddr, brdp->memsize); 3495 brdp->membase = ioremap(brdp->memaddr, brdp->memsize);
3918 if (brdp->membase == (void *) NULL) 3496 if (brdp->membase == NULL)
3919 { 3497 {
3920 release_region(brdp->iobase, brdp->iosize); 3498 release_region(brdp->iobase, brdp->iosize);
3921 return(-ENOMEM); 3499 return -ENOMEM;
3922 } 3500 }
3923 3501
3924/* 3502/*
@@ -3927,23 +3505,14 @@ static int stli_initecp(stlibrd_t *brdp)
3927 * this is, and what it is connected to it. 3505 * this is, and what it is connected to it.
3928 */ 3506 */
3929 EBRDENABLE(brdp); 3507 EBRDENABLE(brdp);
3930 sigsp = (cdkecpsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); 3508 sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR);
3931 memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); 3509 memcpy(&sig, sigsp, sizeof(cdkecpsig_t));
3932 EBRDDISABLE(brdp); 3510 EBRDDISABLE(brdp);
3933 3511
3934#if 0 3512 if (sig.magic != cpu_to_le32(ECP_MAGIC))
3935 printk("%s(%d): sig-> magic=%x rom=%x panel=%x,%x,%x,%x,%x,%x,%x,%x\n",
3936 __FILE__, __LINE__, (int) sig.magic, sig.romver, sig.panelid[0],
3937 (int) sig.panelid[1], (int) sig.panelid[2],
3938 (int) sig.panelid[3], (int) sig.panelid[4],
3939 (int) sig.panelid[5], (int) sig.panelid[6],
3940 (int) sig.panelid[7]);
3941#endif
3942
3943 if (sig.magic != ECP_MAGIC)
3944 { 3513 {
3945 release_region(brdp->iobase, brdp->iosize); 3514 release_region(brdp->iobase, brdp->iosize);
3946 return(-ENODEV); 3515 return -ENODEV;
3947 } 3516 }
3948 3517
3949/* 3518/*
@@ -3967,7 +3536,7 @@ static int stli_initecp(stlibrd_t *brdp)
3967 3536
3968 3537
3969 brdp->state |= BST_FOUND; 3538 brdp->state |= BST_FOUND;
3970 return(0); 3539 return 0;
3971} 3540}
3972 3541
3973/*****************************************************************************/ 3542/*****************************************************************************/
@@ -3979,20 +3548,16 @@ static int stli_initecp(stlibrd_t *brdp)
3979 3548
3980static int stli_initonb(stlibrd_t *brdp) 3549static int stli_initonb(stlibrd_t *brdp)
3981{ 3550{
3982 cdkonbsig_t sig; 3551 cdkonbsig_t sig;
3983 cdkonbsig_t *sigsp; 3552 cdkonbsig_t __iomem *sigsp;
3984 char *name; 3553 char *name;
3985 int i; 3554 int i;
3986
3987#ifdef DEBUG
3988 printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp);
3989#endif
3990 3555
3991/* 3556/*
3992 * Do a basic sanity check on the IO and memory addresses. 3557 * Do a basic sanity check on the IO and memory addresses.
3993 */ 3558 */
3994 if ((brdp->iobase == 0) || (brdp->memaddr == 0)) 3559 if (brdp->iobase == 0 || brdp->memaddr == 0)
3995 return(-ENODEV); 3560 return -ENODEV;
3996 3561
3997 brdp->iosize = ONB_IOSIZE; 3562 brdp->iosize = ONB_IOSIZE;
3998 3563
@@ -4010,7 +3575,6 @@ static int stli_initonb(stlibrd_t *brdp)
4010 case BRD_ONBOARD2: 3575 case BRD_ONBOARD2:
4011 case BRD_ONBOARD2_32: 3576 case BRD_ONBOARD2_32:
4012 case BRD_ONBOARDRS: 3577 case BRD_ONBOARDRS:
4013 brdp->membase = (void *) brdp->memaddr;
4014 brdp->memsize = ONB_MEMSIZE; 3578 brdp->memsize = ONB_MEMSIZE;
4015 brdp->pagesize = ONB_ATPAGESIZE; 3579 brdp->pagesize = ONB_ATPAGESIZE;
4016 brdp->init = stli_onbinit; 3580 brdp->init = stli_onbinit;
@@ -4028,7 +3592,6 @@ static int stli_initonb(stlibrd_t *brdp)
4028 break; 3592 break;
4029 3593
4030 case BRD_ONBOARDE: 3594 case BRD_ONBOARDE:
4031 brdp->membase = (void *) brdp->memaddr;
4032 brdp->memsize = ONB_EIMEMSIZE; 3595 brdp->memsize = ONB_EIMEMSIZE;
4033 brdp->pagesize = ONB_EIPAGESIZE; 3596 brdp->pagesize = ONB_EIPAGESIZE;
4034 brdp->init = stli_onbeinit; 3597 brdp->init = stli_onbeinit;
@@ -4044,7 +3607,6 @@ static int stli_initonb(stlibrd_t *brdp)
4044 case BRD_BRUMBY4: 3607 case BRD_BRUMBY4:
4045 case BRD_BRUMBY8: 3608 case BRD_BRUMBY8:
4046 case BRD_BRUMBY16: 3609 case BRD_BRUMBY16:
4047 brdp->membase = (void *) brdp->memaddr;
4048 brdp->memsize = BBY_MEMSIZE; 3610 brdp->memsize = BBY_MEMSIZE;
4049 brdp->pagesize = BBY_PAGESIZE; 3611 brdp->pagesize = BBY_PAGESIZE;
4050 brdp->init = stli_bbyinit; 3612 brdp->init = stli_bbyinit;
@@ -4058,7 +3620,6 @@ static int stli_initonb(stlibrd_t *brdp)
4058 break; 3620 break;
4059 3621
4060 case BRD_STALLION: 3622 case BRD_STALLION:
4061 brdp->membase = (void *) brdp->memaddr;
4062 brdp->memsize = STAL_MEMSIZE; 3623 brdp->memsize = STAL_MEMSIZE;
4063 brdp->pagesize = STAL_PAGESIZE; 3624 brdp->pagesize = STAL_PAGESIZE;
4064 brdp->init = stli_stalinit; 3625 brdp->init = stli_stalinit;
@@ -4073,7 +3634,7 @@ static int stli_initonb(stlibrd_t *brdp)
4073 3634
4074 default: 3635 default:
4075 release_region(brdp->iobase, brdp->iosize); 3636 release_region(brdp->iobase, brdp->iosize);
4076 return(-EINVAL); 3637 return -EINVAL;
4077 } 3638 }
4078 3639
4079/* 3640/*
@@ -4085,10 +3646,10 @@ static int stli_initonb(stlibrd_t *brdp)
4085 EBRDINIT(brdp); 3646 EBRDINIT(brdp);
4086 3647
4087 brdp->membase = ioremap(brdp->memaddr, brdp->memsize); 3648 brdp->membase = ioremap(brdp->memaddr, brdp->memsize);
4088 if (brdp->membase == (void *) NULL) 3649 if (brdp->membase == NULL)
4089 { 3650 {
4090 release_region(brdp->iobase, brdp->iosize); 3651 release_region(brdp->iobase, brdp->iosize);
4091 return(-ENOMEM); 3652 return -ENOMEM;
4092 } 3653 }
4093 3654
4094/* 3655/*
@@ -4097,21 +3658,17 @@ static int stli_initonb(stlibrd_t *brdp)
4097 * this is, and how many ports. 3658 * this is, and how many ports.
4098 */ 3659 */
4099 EBRDENABLE(brdp); 3660 EBRDENABLE(brdp);
4100 sigsp = (cdkonbsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); 3661 sigsp = (cdkonbsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR);
4101 memcpy(&sig, sigsp, sizeof(cdkonbsig_t)); 3662 memcpy_fromio(&sig, sigsp, sizeof(cdkonbsig_t));
4102 EBRDDISABLE(brdp); 3663 EBRDDISABLE(brdp);
4103 3664
4104#if 0 3665 if (sig.magic0 != cpu_to_le16(ONB_MAGIC0) ||
4105 printk("%s(%d): sig-> magic=%x:%x:%x:%x romver=%x amask=%x:%x:%x\n", 3666 sig.magic1 != cpu_to_le16(ONB_MAGIC1) ||
4106 __FILE__, __LINE__, sig.magic0, sig.magic1, sig.magic2, 3667 sig.magic2 != cpu_to_le16(ONB_MAGIC2) ||
4107 sig.magic3, sig.romver, sig.amask0, sig.amask1, sig.amask2); 3668 sig.magic3 != cpu_to_le16(ONB_MAGIC3))
4108#endif
4109
4110 if ((sig.magic0 != ONB_MAGIC0) || (sig.magic1 != ONB_MAGIC1) ||
4111 (sig.magic2 != ONB_MAGIC2) || (sig.magic3 != ONB_MAGIC3))
4112 { 3669 {
4113 release_region(brdp->iobase, brdp->iosize); 3670 release_region(brdp->iobase, brdp->iosize);
4114 return(-ENODEV); 3671 return -ENODEV;
4115 } 3672 }
4116 3673
4117/* 3674/*
@@ -4132,7 +3689,7 @@ static int stli_initonb(stlibrd_t *brdp)
4132 3689
4133 3690
4134 brdp->state |= BST_FOUND; 3691 brdp->state |= BST_FOUND;
4135 return(0); 3692 return 0;
4136} 3693}
4137 3694
4138/*****************************************************************************/ 3695/*****************************************************************************/
@@ -4145,31 +3702,25 @@ static int stli_initonb(stlibrd_t *brdp)
4145 3702
4146static int stli_startbrd(stlibrd_t *brdp) 3703static int stli_startbrd(stlibrd_t *brdp)
4147{ 3704{
4148 volatile cdkhdr_t *hdrp; 3705 cdkhdr_t __iomem *hdrp;
4149 volatile cdkmem_t *memp; 3706 cdkmem_t __iomem *memp;
4150 volatile cdkasy_t *ap; 3707 cdkasy_t __iomem *ap;
4151 unsigned long flags; 3708 unsigned long flags;
4152 stliport_t *portp; 3709 stliport_t *portp;
4153 int portnr, nrdevs, i, rc; 3710 int portnr, nrdevs, i, rc = 0;
4154 3711 u32 memoff;
4155#ifdef DEBUG 3712
4156 printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp); 3713 spin_lock_irqsave(&brd_lock, flags);
4157#endif
4158
4159 rc = 0;
4160
4161 save_flags(flags);
4162 cli();
4163 EBRDENABLE(brdp); 3714 EBRDENABLE(brdp);
4164 hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); 3715 hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);
4165 nrdevs = hdrp->nrdevs; 3716 nrdevs = hdrp->nrdevs;
4166 3717
4167#if 0 3718#if 0
4168 printk("%s(%d): CDK version %d.%d.%d --> " 3719 printk("%s(%d): CDK version %d.%d.%d --> "
4169 "nrdevs=%d memp=%x hostp=%x slavep=%x\n", 3720 "nrdevs=%d memp=%x hostp=%x slavep=%x\n",
4170 __FILE__, __LINE__, hdrp->ver_release, hdrp->ver_modification, 3721 __FILE__, __LINE__, readb(&hdrp->ver_release), readb(&hdrp->ver_modification),
4171 hdrp->ver_fix, nrdevs, (int) hdrp->memp, (int) hdrp->hostp, 3722 readb(&hdrp->ver_fix), nrdevs, (int) readl(&hdrp->memp), readl(&hdrp->hostp),
4172 (int) hdrp->slavep); 3723 readl(&hdrp->slavep));
4173#endif 3724#endif
4174 3725
4175 if (nrdevs < (brdp->nrports + 1)) { 3726 if (nrdevs < (brdp->nrports + 1)) {
@@ -4181,14 +3732,14 @@ static int stli_startbrd(stlibrd_t *brdp)
4181 brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; 3732 brdp->hostoffset = hdrp->hostp - CDK_CDKADDR;
4182 brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; 3733 brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR;
4183 brdp->bitsize = (nrdevs + 7) / 8; 3734 brdp->bitsize = (nrdevs + 7) / 8;
4184 memp = (volatile cdkmem_t *) hdrp->memp; 3735 memoff = readl(&hdrp->memp);
4185 if (((unsigned long) memp) > brdp->memsize) { 3736 if (memoff > brdp->memsize) {
4186 printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); 3737 printk(KERN_ERR "STALLION: corrupted shared memory region?\n");
4187 rc = -EIO; 3738 rc = -EIO;
4188 goto stli_donestartup; 3739 goto stli_donestartup;
4189 } 3740 }
4190 memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, (unsigned long) memp); 3741 memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff);
4191 if (memp->dtype != TYP_ASYNCTRL) { 3742 if (readw(&memp->dtype) != TYP_ASYNCTRL) {
4192 printk(KERN_ERR "STALLION: no slave control device found\n"); 3743 printk(KERN_ERR "STALLION: no slave control device found\n");
4193 goto stli_donestartup; 3744 goto stli_donestartup;
4194 } 3745 }
@@ -4200,19 +3751,19 @@ static int stli_startbrd(stlibrd_t *brdp)
4200 * change pages while reading memory map. 3751 * change pages while reading memory map.
4201 */ 3752 */
4202 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) { 3753 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) {
4203 if (memp->dtype != TYP_ASYNC) 3754 if (readw(&memp->dtype) != TYP_ASYNC)
4204 break; 3755 break;
4205 portp = brdp->ports[portnr]; 3756 portp = brdp->ports[portnr];
4206 if (portp == (stliport_t *) NULL) 3757 if (portp == NULL)
4207 break; 3758 break;
4208 portp->devnr = i; 3759 portp->devnr = i;
4209 portp->addr = memp->offset; 3760 portp->addr = readl(&memp->offset);
4210 portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs)); 3761 portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs));
4211 portp->portidx = (unsigned char) (i / 8); 3762 portp->portidx = (unsigned char) (i / 8);
4212 portp->portbit = (unsigned char) (0x1 << (i % 8)); 3763 portp->portbit = (unsigned char) (0x1 << (i % 8));
4213 } 3764 }
4214 3765
4215 hdrp->slavereq = 0xff; 3766 writeb(0xff, &hdrp->slavereq);
4216 3767
4217/* 3768/*
4218 * For each port setup a local copy of the RX and TX buffer offsets 3769 * For each port setup a local copy of the RX and TX buffer offsets
@@ -4221,22 +3772,22 @@ static int stli_startbrd(stlibrd_t *brdp)
4221 */ 3772 */
4222 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) { 3773 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) {
4223 portp = brdp->ports[portnr]; 3774 portp = brdp->ports[portnr];
4224 if (portp == (stliport_t *) NULL) 3775 if (portp == NULL)
4225 break; 3776 break;
4226 if (portp->addr == 0) 3777 if (portp->addr == 0)
4227 break; 3778 break;
4228 ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); 3779 ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);
4229 if (ap != (volatile cdkasy_t *) NULL) { 3780 if (ap != NULL) {
4230 portp->rxsize = ap->rxq.size; 3781 portp->rxsize = readw(&ap->rxq.size);
4231 portp->txsize = ap->txq.size; 3782 portp->txsize = readw(&ap->txq.size);
4232 portp->rxoffset = ap->rxq.offset; 3783 portp->rxoffset = readl(&ap->rxq.offset);
4233 portp->txoffset = ap->txq.offset; 3784 portp->txoffset = readl(&ap->txq.offset);
4234 } 3785 }
4235 } 3786 }
4236 3787
4237stli_donestartup: 3788stli_donestartup:
4238 EBRDDISABLE(brdp); 3789 EBRDDISABLE(brdp);
4239 restore_flags(flags); 3790 spin_unlock_irqrestore(&brd_lock, flags);
4240 3791
4241 if (rc == 0) 3792 if (rc == 0)
4242 brdp->state |= BST_STARTED; 3793 brdp->state |= BST_STARTED;
@@ -4247,7 +3798,7 @@ stli_donestartup:
4247 add_timer(&stli_timerlist); 3798 add_timer(&stli_timerlist);
4248 } 3799 }
4249 3800
4250 return(rc); 3801 return rc;
4251} 3802}
4252 3803
4253/*****************************************************************************/ 3804/*****************************************************************************/
@@ -4258,10 +3809,6 @@ stli_donestartup:
4258 3809
4259static int __init stli_brdinit(stlibrd_t *brdp) 3810static int __init stli_brdinit(stlibrd_t *brdp)
4260{ 3811{
4261#ifdef DEBUG
4262 printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp);
4263#endif
4264
4265 stli_brds[brdp->brdnr] = brdp; 3812 stli_brds[brdp->brdnr] = brdp;
4266 3813
4267 switch (brdp->brdtype) { 3814 switch (brdp->brdtype) {
@@ -4289,11 +3836,11 @@ static int __init stli_brdinit(stlibrd_t *brdp)
4289 case BRD_ECHPCI: 3836 case BRD_ECHPCI:
4290 printk(KERN_ERR "STALLION: %s board type not supported in " 3837 printk(KERN_ERR "STALLION: %s board type not supported in "
4291 "this driver\n", stli_brdnames[brdp->brdtype]); 3838 "this driver\n", stli_brdnames[brdp->brdtype]);
4292 return(ENODEV); 3839 return -ENODEV;
4293 default: 3840 default:
4294 printk(KERN_ERR "STALLION: board=%d is unknown board " 3841 printk(KERN_ERR "STALLION: board=%d is unknown board "
4295 "type=%d\n", brdp->brdnr, brdp->brdtype); 3842 "type=%d\n", brdp->brdnr, brdp->brdtype);
4296 return(ENODEV); 3843 return -ENODEV;
4297 } 3844 }
4298 3845
4299 if ((brdp->state & BST_FOUND) == 0) { 3846 if ((brdp->state & BST_FOUND) == 0) {
@@ -4301,7 +3848,7 @@ static int __init stli_brdinit(stlibrd_t *brdp)
4301 "io=%x mem=%x\n", 3848 "io=%x mem=%x\n",
4302 stli_brdnames[brdp->brdtype], brdp->brdnr, 3849 stli_brdnames[brdp->brdtype], brdp->brdnr,
4303 brdp->iobase, (int) brdp->memaddr); 3850 brdp->iobase, (int) brdp->memaddr);
4304 return(ENODEV); 3851 return -ENODEV;
4305 } 3852 }
4306 3853
4307 stli_initports(brdp); 3854 stli_initports(brdp);
@@ -4309,7 +3856,7 @@ static int __init stli_brdinit(stlibrd_t *brdp)
4309 "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], 3856 "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype],
4310 brdp->brdnr, brdp->iobase, (int) brdp->memaddr, 3857 brdp->brdnr, brdp->iobase, (int) brdp->memaddr,
4311 brdp->nrpanels, brdp->nrports); 3858 brdp->nrpanels, brdp->nrports);
4312 return(0); 3859 return 0;
4313} 3860}
4314 3861
4315/*****************************************************************************/ 3862/*****************************************************************************/
@@ -4321,14 +3868,10 @@ static int __init stli_brdinit(stlibrd_t *brdp)
4321 3868
4322static int stli_eisamemprobe(stlibrd_t *brdp) 3869static int stli_eisamemprobe(stlibrd_t *brdp)
4323{ 3870{
4324 cdkecpsig_t ecpsig, *ecpsigp; 3871 cdkecpsig_t ecpsig, __iomem *ecpsigp;
4325 cdkonbsig_t onbsig, *onbsigp; 3872 cdkonbsig_t onbsig, __iomem *onbsigp;
4326 int i, foundit; 3873 int i, foundit;
4327 3874
4328#ifdef DEBUG
4329 printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp);
4330#endif
4331
4332/* 3875/*
4333 * First up we reset the board, to get it into a known state. There 3876 * First up we reset the board, to get it into a known state. There
4334 * is only 2 board types here we need to worry about. Don;t use the 3877 * is only 2 board types here we need to worry about. Don;t use the
@@ -4352,7 +3895,7 @@ static int stli_eisamemprobe(stlibrd_t *brdp)
4352 mdelay(1); 3895 mdelay(1);
4353 stli_onbeenable(brdp); 3896 stli_onbeenable(brdp);
4354 } else { 3897 } else {
4355 return(-ENODEV); 3898 return -ENODEV;
4356 } 3899 }
4357 3900
4358 foundit = 0; 3901 foundit = 0;
@@ -4364,25 +3907,24 @@ static int stli_eisamemprobe(stlibrd_t *brdp)
4364 */ 3907 */
4365 for (i = 0; (i < stli_eisamempsize); i++) { 3908 for (i = 0; (i < stli_eisamempsize); i++) {
4366 brdp->memaddr = stli_eisamemprobeaddrs[i]; 3909 brdp->memaddr = stli_eisamemprobeaddrs[i];
4367 brdp->membase = (void *) brdp->memaddr;
4368 brdp->membase = ioremap(brdp->memaddr, brdp->memsize); 3910 brdp->membase = ioremap(brdp->memaddr, brdp->memsize);
4369 if (brdp->membase == (void *) NULL) 3911 if (brdp->membase == NULL)
4370 continue; 3912 continue;
4371 3913
4372 if (brdp->brdtype == BRD_ECPE) { 3914 if (brdp->brdtype == BRD_ECPE) {
4373 ecpsigp = (cdkecpsig_t *) stli_ecpeigetmemptr(brdp, 3915 ecpsigp = (cdkecpsig_t __iomem *) stli_ecpeigetmemptr(brdp,
4374 CDK_SIGADDR, __LINE__); 3916 CDK_SIGADDR, __LINE__);
4375 memcpy(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); 3917 memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t));
4376 if (ecpsig.magic == ECP_MAGIC) 3918 if (ecpsig.magic == cpu_to_le32(ECP_MAGIC))
4377 foundit = 1; 3919 foundit = 1;
4378 } else { 3920 } else {
4379 onbsigp = (cdkonbsig_t *) stli_onbegetmemptr(brdp, 3921 onbsigp = (cdkonbsig_t __iomem *) stli_onbegetmemptr(brdp,
4380 CDK_SIGADDR, __LINE__); 3922 CDK_SIGADDR, __LINE__);
4381 memcpy(&onbsig, onbsigp, sizeof(cdkonbsig_t)); 3923 memcpy_fromio(&onbsig, onbsigp, sizeof(cdkonbsig_t));
4382 if ((onbsig.magic0 == ONB_MAGIC0) && 3924 if ((onbsig.magic0 == cpu_to_le16(ONB_MAGIC0)) &&
4383 (onbsig.magic1 == ONB_MAGIC1) && 3925 (onbsig.magic1 == cpu_to_le16(ONB_MAGIC1)) &&
4384 (onbsig.magic2 == ONB_MAGIC2) && 3926 (onbsig.magic2 == cpu_to_le16(ONB_MAGIC2)) &&
4385 (onbsig.magic3 == ONB_MAGIC3)) 3927 (onbsig.magic3 == cpu_to_le16(ONB_MAGIC3)))
4386 foundit = 1; 3928 foundit = 1;
4387 } 3929 }
4388 3930
@@ -4406,9 +3948,9 @@ static int stli_eisamemprobe(stlibrd_t *brdp)
4406 printk(KERN_ERR "STALLION: failed to probe shared memory " 3948 printk(KERN_ERR "STALLION: failed to probe shared memory "
4407 "region for %s in EISA slot=%d\n", 3949 "region for %s in EISA slot=%d\n",
4408 stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); 3950 stli_brdnames[brdp->brdtype], (brdp->iobase >> 12));
4409 return(-ENODEV); 3951 return -ENODEV;
4410 } 3952 }
4411 return(0); 3953 return 0;
4412} 3954}
4413 3955
4414static int stli_getbrdnr(void) 3956static int stli_getbrdnr(void)
@@ -4439,22 +3981,16 @@ static int stli_getbrdnr(void)
4439 3981
4440static int stli_findeisabrds(void) 3982static int stli_findeisabrds(void)
4441{ 3983{
4442 stlibrd_t *brdp; 3984 stlibrd_t *brdp;
4443 unsigned int iobase, eid; 3985 unsigned int iobase, eid;
4444 int i; 3986 int i;
4445
4446#ifdef DEBUG
4447 printk(KERN_DEBUG "stli_findeisabrds()\n");
4448#endif
4449 3987
4450/* 3988/*
4451 * Firstly check if this is an EISA system. Do this by probing for 3989 * Firstly check if this is an EISA system. If this is not an EISA system then
4452 * the system board EISA ID. If this is not an EISA system then
4453 * don't bother going any further! 3990 * don't bother going any further!
4454 */ 3991 */
4455 outb(0xff, 0xc80); 3992 if (EISA_bus)
4456 if (inb(0xc80) == 0xff) 3993 return 0;
4457 return(0);
4458 3994
4459/* 3995/*
4460 * Looks like an EISA system, so go searching for EISA boards. 3996 * Looks like an EISA system, so go searching for EISA boards.
@@ -4472,7 +4008,7 @@ static int stli_findeisabrds(void)
4472 */ 4008 */
4473 for (i = 0; (i < STL_MAXBRDS); i++) { 4009 for (i = 0; (i < STL_MAXBRDS); i++) {
4474 brdp = stli_brds[i]; 4010 brdp = stli_brds[i];
4475 if (brdp == (stlibrd_t *) NULL) 4011 if (brdp == NULL)
4476 continue; 4012 continue;
4477 if (brdp->iobase == iobase) 4013 if (brdp->iobase == iobase)
4478 break; 4014 break;
@@ -4484,10 +4020,10 @@ static int stli_findeisabrds(void)
4484 * We have found a Stallion board and it is not configured already. 4020 * We have found a Stallion board and it is not configured already.
4485 * Allocate a board structure and initialize it. 4021 * Allocate a board structure and initialize it.
4486 */ 4022 */
4487 if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 4023 if ((brdp = stli_allocbrd()) == NULL)
4488 return(-ENOMEM); 4024 return -ENOMEM;
4489 if ((brdp->brdnr = stli_getbrdnr()) < 0) 4025 if ((brdp->brdnr = stli_getbrdnr()) < 0)
4490 return(-ENOMEM); 4026 return -ENOMEM;
4491 eid = inb(iobase + 0xc82); 4027 eid = inb(iobase + 0xc82);
4492 if (eid == ECP_EISAID) 4028 if (eid == ECP_EISAID)
4493 brdp->brdtype = BRD_ECPE; 4029 brdp->brdtype = BRD_ECPE;
@@ -4502,7 +4038,7 @@ static int stli_findeisabrds(void)
4502 stli_brdinit(brdp); 4038 stli_brdinit(brdp);
4503 } 4039 }
4504 4040
4505 return(0); 4041 return 0;
4506} 4042}
4507 4043
4508/*****************************************************************************/ 4044/*****************************************************************************/
@@ -4523,32 +4059,18 @@ static int stli_findeisabrds(void)
4523 4059
4524static int stli_initpcibrd(int brdtype, struct pci_dev *devp) 4060static int stli_initpcibrd(int brdtype, struct pci_dev *devp)
4525{ 4061{
4526 stlibrd_t *brdp; 4062 stlibrd_t *brdp;
4527
4528#ifdef DEBUG
4529 printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n",
4530 brdtype, dev->bus->number, dev->devfn);
4531#endif
4532 4063
4533 if (pci_enable_device(devp)) 4064 if (pci_enable_device(devp))
4534 return(-EIO); 4065 return -EIO;
4535 if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 4066 if ((brdp = stli_allocbrd()) == NULL)
4536 return(-ENOMEM); 4067 return -ENOMEM;
4537 if ((brdp->brdnr = stli_getbrdnr()) < 0) { 4068 if ((brdp->brdnr = stli_getbrdnr()) < 0) {
4538 printk(KERN_INFO "STALLION: too many boards found, " 4069 printk(KERN_INFO "STALLION: too many boards found, "
4539 "maximum supported %d\n", STL_MAXBRDS); 4070 "maximum supported %d\n", STL_MAXBRDS);
4540 return(0); 4071 return 0;
4541 } 4072 }
4542 brdp->brdtype = brdtype; 4073 brdp->brdtype = brdtype;
4543
4544#ifdef DEBUG
4545 printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__,
4546 pci_resource_start(devp, 0),
4547 pci_resource_start(devp, 1),
4548 pci_resource_start(devp, 2),
4549 pci_resource_start(devp, 3));
4550#endif
4551
4552/* 4074/*
4553 * We have all resources from the board, so lets setup the actual 4075 * We have all resources from the board, so lets setup the actual
4554 * board structure now. 4076 * board structure now.
@@ -4557,7 +4079,7 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp)
4557 brdp->memaddr = pci_resource_start(devp, 2); 4079 brdp->memaddr = pci_resource_start(devp, 2);
4558 stli_brdinit(brdp); 4080 stli_brdinit(brdp);
4559 4081
4560 return(0); 4082 return 0;
4561} 4083}
4562 4084
4563/*****************************************************************************/ 4085/*****************************************************************************/
@@ -4569,20 +4091,12 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp)
4569 4091
4570static int stli_findpcibrds(void) 4092static int stli_findpcibrds(void)
4571{ 4093{
4572 struct pci_dev *dev = NULL; 4094 struct pci_dev *dev = NULL;
4573 int rc;
4574
4575#ifdef DEBUG
4576 printk("stli_findpcibrds()\n");
4577#endif
4578 4095
4579 while ((dev = pci_find_device(PCI_VENDOR_ID_STALLION, 4096 while ((dev = pci_get_device(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, dev))) {
4580 PCI_DEVICE_ID_ECRA, dev))) { 4097 stli_initpcibrd(BRD_ECPPCI, dev);
4581 if ((rc = stli_initpcibrd(BRD_ECPPCI, dev)))
4582 return(rc);
4583 } 4098 }
4584 4099 return 0;
4585 return(0);
4586} 4100}
4587 4101
4588#endif 4102#endif
@@ -4595,17 +4109,16 @@ static int stli_findpcibrds(void)
4595 4109
4596static stlibrd_t *stli_allocbrd(void) 4110static stlibrd_t *stli_allocbrd(void)
4597{ 4111{
4598 stlibrd_t *brdp; 4112 stlibrd_t *brdp;
4599 4113
4600 brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); 4114 brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL);
4601 if (!brdp) { 4115 if (!brdp) {
4602 printk(KERN_ERR "STALLION: failed to allocate memory " 4116 printk(KERN_ERR "STALLION: failed to allocate memory "
4603 "(size=%d)\n", sizeof(stlibrd_t)); 4117 "(size=%Zd)\n", sizeof(stlibrd_t));
4604 return NULL; 4118 return NULL;
4605 } 4119 }
4606
4607 brdp->magic = STLI_BOARDMAGIC; 4120 brdp->magic = STLI_BOARDMAGIC;
4608 return(brdp); 4121 return brdp;
4609} 4122}
4610 4123
4611/*****************************************************************************/ 4124/*****************************************************************************/
@@ -4617,13 +4130,9 @@ static stlibrd_t *stli_allocbrd(void)
4617 4130
4618static int stli_initbrds(void) 4131static int stli_initbrds(void)
4619{ 4132{
4620 stlibrd_t *brdp, *nxtbrdp; 4133 stlibrd_t *brdp, *nxtbrdp;
4621 stlconf_t *confp; 4134 stlconf_t *confp;
4622 int i, j; 4135 int i, j;
4623
4624#ifdef DEBUG
4625 printk(KERN_DEBUG "stli_initbrds()\n");
4626#endif
4627 4136
4628 if (stli_nrbrds > STL_MAXBRDS) { 4137 if (stli_nrbrds > STL_MAXBRDS) {
4629 printk(KERN_INFO "STALLION: too many boards in configuration " 4138 printk(KERN_INFO "STALLION: too many boards in configuration "
@@ -4638,11 +4147,9 @@ static int stli_initbrds(void)
4638 */ 4147 */
4639 for (i = 0; (i < stli_nrbrds); i++) { 4148 for (i = 0; (i < stli_nrbrds); i++) {
4640 confp = &stli_brdconf[i]; 4149 confp = &stli_brdconf[i];
4641#ifdef MODULE
4642 stli_parsebrd(confp, stli_brdsp[i]); 4150 stli_parsebrd(confp, stli_brdsp[i]);
4643#endif 4151 if ((brdp = stli_allocbrd()) == NULL)
4644 if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) 4152 return -ENOMEM;
4645 return(-ENOMEM);
4646 brdp->brdnr = i; 4153 brdp->brdnr = i;
4647 brdp->brdtype = confp->brdtype; 4154 brdp->brdtype = confp->brdtype;
4648 brdp->iobase = confp->ioaddr1; 4155 brdp->iobase = confp->ioaddr1;
@@ -4654,9 +4161,7 @@ static int stli_initbrds(void)
4654 * Static configuration table done, so now use dynamic methods to 4161 * Static configuration table done, so now use dynamic methods to
4655 * see if any more boards should be configured. 4162 * see if any more boards should be configured.
4656 */ 4163 */
4657#ifdef MODULE
4658 stli_argbrds(); 4164 stli_argbrds();
4659#endif
4660 if (STLI_EISAPROBE) 4165 if (STLI_EISAPROBE)
4661 stli_findeisabrds(); 4166 stli_findeisabrds();
4662#ifdef CONFIG_PCI 4167#ifdef CONFIG_PCI
@@ -4672,11 +4177,11 @@ static int stli_initbrds(void)
4672 if (stli_nrbrds > 1) { 4177 if (stli_nrbrds > 1) {
4673 for (i = 0; (i < stli_nrbrds); i++) { 4178 for (i = 0; (i < stli_nrbrds); i++) {
4674 brdp = stli_brds[i]; 4179 brdp = stli_brds[i];
4675 if (brdp == (stlibrd_t *) NULL) 4180 if (brdp == NULL)
4676 continue; 4181 continue;
4677 for (j = i + 1; (j < stli_nrbrds); j++) { 4182 for (j = i + 1; (j < stli_nrbrds); j++) {
4678 nxtbrdp = stli_brds[j]; 4183 nxtbrdp = stli_brds[j];
4679 if (nxtbrdp == (stlibrd_t *) NULL) 4184 if (nxtbrdp == NULL)
4680 continue; 4185 continue;
4681 if ((brdp->membase >= nxtbrdp->membase) && 4186 if ((brdp->membase >= nxtbrdp->membase) &&
4682 (brdp->membase <= (nxtbrdp->membase + 4187 (brdp->membase <= (nxtbrdp->membase +
@@ -4691,7 +4196,7 @@ static int stli_initbrds(void)
4691 if (stli_shared == 0) { 4196 if (stli_shared == 0) {
4692 for (i = 0; (i < stli_nrbrds); i++) { 4197 for (i = 0; (i < stli_nrbrds); i++) {
4693 brdp = stli_brds[i]; 4198 brdp = stli_brds[i];
4694 if (brdp == (stlibrd_t *) NULL) 4199 if (brdp == NULL)
4695 continue; 4200 continue;
4696 if (brdp->state & BST_FOUND) { 4201 if (brdp->state & BST_FOUND) {
4697 EBRDENABLE(brdp); 4202 EBRDENABLE(brdp);
@@ -4701,7 +4206,7 @@ static int stli_initbrds(void)
4701 } 4206 }
4702 } 4207 }
4703 4208
4704 return(0); 4209 return 0;
4705} 4210}
4706 4211
4707/*****************************************************************************/ 4212/*****************************************************************************/
@@ -4714,48 +4219,55 @@ static int stli_initbrds(void)
4714 4219
4715static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) 4220static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp)
4716{ 4221{
4717 unsigned long flags; 4222 unsigned long flags;
4718 void *memptr; 4223 void *memptr;
4719 stlibrd_t *brdp; 4224 stlibrd_t *brdp;
4720 int brdnr, size, n; 4225 int brdnr, size, n;
4721 4226 void *p;
4722#ifdef DEBUG 4227 loff_t off = *offp;
4723 printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n",
4724 (int) fp, (int) buf, count, (int) offp);
4725#endif
4726 4228
4727 brdnr = iminor(fp->f_dentry->d_inode); 4229 brdnr = iminor(fp->f_dentry->d_inode);
4728 if (brdnr >= stli_nrbrds) 4230 if (brdnr >= stli_nrbrds)
4729 return(-ENODEV); 4231 return -ENODEV;
4730 brdp = stli_brds[brdnr]; 4232 brdp = stli_brds[brdnr];
4731 if (brdp == (stlibrd_t *) NULL) 4233 if (brdp == NULL)
4732 return(-ENODEV); 4234 return -ENODEV;
4733 if (brdp->state == 0) 4235 if (brdp->state == 0)
4734 return(-ENODEV); 4236 return -ENODEV;
4735 if (fp->f_pos >= brdp->memsize) 4237 if (off >= brdp->memsize || off + count < off)
4736 return(0); 4238 return 0;
4737 4239
4738 size = MIN(count, (brdp->memsize - fp->f_pos)); 4240 size = MIN(count, (brdp->memsize - off));
4241
4242 /*
4243 * Copy the data a page at a time
4244 */
4245
4246 p = (void *)__get_free_page(GFP_KERNEL);
4247 if(p == NULL)
4248 return -ENOMEM;
4739 4249
4740 save_flags(flags);
4741 cli();
4742 EBRDENABLE(brdp);
4743 while (size > 0) { 4250 while (size > 0) {
4744 memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); 4251 spin_lock_irqsave(&brd_lock, flags);
4745 n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); 4252 EBRDENABLE(brdp);
4746 if (copy_to_user(buf, memptr, n)) { 4253 memptr = (void *) EBRDGETMEMPTR(brdp, off);
4254 n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
4255 n = MIN(n, PAGE_SIZE);
4256 memcpy_fromio(p, memptr, n);
4257 EBRDDISABLE(brdp);
4258 spin_unlock_irqrestore(&brd_lock, flags);
4259 if (copy_to_user(buf, p, n)) {
4747 count = -EFAULT; 4260 count = -EFAULT;
4748 goto out; 4261 goto out;
4749 } 4262 }
4750 fp->f_pos += n; 4263 off += n;
4751 buf += n; 4264 buf += n;
4752 size -= n; 4265 size -= n;
4753 } 4266 }
4754out: 4267out:
4755 EBRDDISABLE(brdp); 4268 *offp = off;
4756 restore_flags(flags); 4269 free_page((unsigned long)p);
4757 4270 return count;
4758 return(count);
4759} 4271}
4760 4272
4761/*****************************************************************************/ 4273/*****************************************************************************/
@@ -4764,54 +4276,65 @@ out:
4764 * Code to handle an "staliomem" write operation. This device is the 4276 * Code to handle an "staliomem" write operation. This device is the
4765 * contents of the board shared memory. It is used for down loading 4277 * contents of the board shared memory. It is used for down loading
4766 * the slave image (and debugging :-) 4278 * the slave image (and debugging :-)
4279 *
4280 * FIXME: copy under lock
4767 */ 4281 */
4768 4282
4769static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) 4283static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp)
4770{ 4284{
4771 unsigned long flags; 4285 unsigned long flags;
4772 void *memptr; 4286 void *memptr;
4773 stlibrd_t *brdp; 4287 stlibrd_t *brdp;
4774 char __user *chbuf; 4288 char __user *chbuf;
4775 int brdnr, size, n; 4289 int brdnr, size, n;
4776 4290 void *p;
4777#ifdef DEBUG 4291 loff_t off = *offp;
4778 printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n",
4779 (int) fp, (int) buf, count, (int) offp);
4780#endif
4781 4292
4782 brdnr = iminor(fp->f_dentry->d_inode); 4293 brdnr = iminor(fp->f_dentry->d_inode);
4294
4783 if (brdnr >= stli_nrbrds) 4295 if (brdnr >= stli_nrbrds)
4784 return(-ENODEV); 4296 return -ENODEV;
4785 brdp = stli_brds[brdnr]; 4297 brdp = stli_brds[brdnr];
4786 if (brdp == (stlibrd_t *) NULL) 4298 if (brdp == NULL)
4787 return(-ENODEV); 4299 return -ENODEV;
4788 if (brdp->state == 0) 4300 if (brdp->state == 0)
4789 return(-ENODEV); 4301 return -ENODEV;
4790 if (fp->f_pos >= brdp->memsize) 4302 if (off >= brdp->memsize || off + count < off)
4791 return(0); 4303 return 0;
4792 4304
4793 chbuf = (char __user *) buf; 4305 chbuf = (char __user *) buf;
4794 size = MIN(count, (brdp->memsize - fp->f_pos)); 4306 size = MIN(count, (brdp->memsize - off));
4307
4308 /*
4309 * Copy the data a page at a time
4310 */
4311
4312 p = (void *)__get_free_page(GFP_KERNEL);
4313 if(p == NULL)
4314 return -ENOMEM;
4795 4315
4796 save_flags(flags);
4797 cli();
4798 EBRDENABLE(brdp);
4799 while (size > 0) { 4316 while (size > 0) {
4800 memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); 4317 n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));
4801 n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); 4318 n = MIN(n, PAGE_SIZE);
4802 if (copy_from_user(memptr, chbuf, n)) { 4319 if (copy_from_user(p, chbuf, n)) {
4803 count = -EFAULT; 4320 if (count == 0)
4321 count = -EFAULT;
4804 goto out; 4322 goto out;
4805 } 4323 }
4806 fp->f_pos += n; 4324 spin_lock_irqsave(&brd_lock, flags);
4325 EBRDENABLE(brdp);
4326 memptr = (void *) EBRDGETMEMPTR(brdp, off);
4327 memcpy_toio(memptr, p, n);
4328 EBRDDISABLE(brdp);
4329 spin_unlock_irqrestore(&brd_lock, flags);
4330 off += n;
4807 chbuf += n; 4331 chbuf += n;
4808 size -= n; 4332 size -= n;
4809 } 4333 }
4810out: 4334out:
4811 EBRDDISABLE(brdp); 4335 free_page((unsigned long) p);
4812 restore_flags(flags); 4336 *offp = off;
4813 4337 return count;
4814 return(count);
4815} 4338}
4816 4339
4817/*****************************************************************************/ 4340/*****************************************************************************/
@@ -4822,16 +4345,16 @@ out:
4822 4345
4823static int stli_getbrdstats(combrd_t __user *bp) 4346static int stli_getbrdstats(combrd_t __user *bp)
4824{ 4347{
4825 stlibrd_t *brdp; 4348 stlibrd_t *brdp;
4826 int i; 4349 int i;
4827 4350
4828 if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) 4351 if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t)))
4829 return -EFAULT; 4352 return -EFAULT;
4830 if (stli_brdstats.brd >= STL_MAXBRDS) 4353 if (stli_brdstats.brd >= STL_MAXBRDS)
4831 return(-ENODEV); 4354 return -ENODEV;
4832 brdp = stli_brds[stli_brdstats.brd]; 4355 brdp = stli_brds[stli_brdstats.brd];
4833 if (brdp == (stlibrd_t *) NULL) 4356 if (brdp == NULL)
4834 return(-ENODEV); 4357 return -ENODEV;
4835 4358
4836 memset(&stli_brdstats, 0, sizeof(combrd_t)); 4359 memset(&stli_brdstats, 0, sizeof(combrd_t));
4837 stli_brdstats.brd = brdp->brdnr; 4360 stli_brdstats.brd = brdp->brdnr;
@@ -4850,7 +4373,7 @@ static int stli_getbrdstats(combrd_t __user *bp)
4850 4373
4851 if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t))) 4374 if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t)))
4852 return -EFAULT; 4375 return -EFAULT;
4853 return(0); 4376 return 0;
4854} 4377}
4855 4378
4856/*****************************************************************************/ 4379/*****************************************************************************/
@@ -4861,19 +4384,19 @@ static int stli_getbrdstats(combrd_t __user *bp)
4861 4384
4862static stliport_t *stli_getport(int brdnr, int panelnr, int portnr) 4385static stliport_t *stli_getport(int brdnr, int panelnr, int portnr)
4863{ 4386{
4864 stlibrd_t *brdp; 4387 stlibrd_t *brdp;
4865 int i; 4388 int i;
4866 4389
4867 if ((brdnr < 0) || (brdnr >= STL_MAXBRDS)) 4390 if (brdnr < 0 || brdnr >= STL_MAXBRDS)
4868 return((stliport_t *) NULL); 4391 return NULL;
4869 brdp = stli_brds[brdnr]; 4392 brdp = stli_brds[brdnr];
4870 if (brdp == (stlibrd_t *) NULL) 4393 if (brdp == NULL)
4871 return((stliport_t *) NULL); 4394 return NULL;
4872 for (i = 0; (i < panelnr); i++) 4395 for (i = 0; (i < panelnr); i++)
4873 portnr += brdp->panels[i]; 4396 portnr += brdp->panels[i];
4874 if ((portnr < 0) || (portnr >= brdp->nrports)) 4397 if ((portnr < 0) || (portnr >= brdp->nrports))
4875 return((stliport_t *) NULL); 4398 return NULL;
4876 return(brdp->ports[portnr]); 4399 return brdp->ports[portnr];
4877} 4400}
4878 4401
4879/*****************************************************************************/ 4402/*****************************************************************************/
@@ -4892,16 +4415,16 @@ static int stli_portcmdstats(stliport_t *portp)
4892 4415
4893 memset(&stli_comstats, 0, sizeof(comstats_t)); 4416 memset(&stli_comstats, 0, sizeof(comstats_t));
4894 4417
4895 if (portp == (stliport_t *) NULL) 4418 if (portp == NULL)
4896 return(-ENODEV); 4419 return -ENODEV;
4897 brdp = stli_brds[portp->brdnr]; 4420 brdp = stli_brds[portp->brdnr];
4898 if (brdp == (stlibrd_t *) NULL) 4421 if (brdp == NULL)
4899 return(-ENODEV); 4422 return -ENODEV;
4900 4423
4901 if (brdp->state & BST_STARTED) { 4424 if (brdp->state & BST_STARTED) {
4902 if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, 4425 if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS,
4903 &stli_cdkstats, sizeof(asystats_t), 1)) < 0) 4426 &stli_cdkstats, sizeof(asystats_t), 1)) < 0)
4904 return(rc); 4427 return rc;
4905 } else { 4428 } else {
4906 memset(&stli_cdkstats, 0, sizeof(asystats_t)); 4429 memset(&stli_cdkstats, 0, sizeof(asystats_t));
4907 } 4430 }
@@ -4912,13 +4435,12 @@ static int stli_portcmdstats(stliport_t *portp)
4912 stli_comstats.state = portp->state; 4435 stli_comstats.state = portp->state;
4913 stli_comstats.flags = portp->flags; 4436 stli_comstats.flags = portp->flags;
4914 4437
4915 save_flags(flags); 4438 spin_lock_irqsave(&brd_lock, flags);
4916 cli(); 4439 if (portp->tty != NULL) {
4917 if (portp->tty != (struct tty_struct *) NULL) {
4918 if (portp->tty->driver_data == portp) { 4440 if (portp->tty->driver_data == portp) {
4919 stli_comstats.ttystate = portp->tty->flags; 4441 stli_comstats.ttystate = portp->tty->flags;
4920 stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/; 4442 stli_comstats.rxbuffered = -1;
4921 if (portp->tty->termios != (struct termios *) NULL) { 4443 if (portp->tty->termios != NULL) {
4922 stli_comstats.cflags = portp->tty->termios->c_cflag; 4444 stli_comstats.cflags = portp->tty->termios->c_cflag;
4923 stli_comstats.iflags = portp->tty->termios->c_iflag; 4445 stli_comstats.iflags = portp->tty->termios->c_iflag;
4924 stli_comstats.oflags = portp->tty->termios->c_oflag; 4446 stli_comstats.oflags = portp->tty->termios->c_oflag;
@@ -4926,7 +4448,7 @@ static int stli_portcmdstats(stliport_t *portp)
4926 } 4448 }
4927 } 4449 }
4928 } 4450 }
4929 restore_flags(flags); 4451 spin_unlock_irqrestore(&brd_lock, flags);
4930 4452
4931 stli_comstats.txtotal = stli_cdkstats.txchars; 4453 stli_comstats.txtotal = stli_cdkstats.txchars;
4932 stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover; 4454 stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover;
@@ -4948,7 +4470,7 @@ static int stli_portcmdstats(stliport_t *portp)
4948 stli_comstats.hwid = stli_cdkstats.hwid; 4470 stli_comstats.hwid = stli_cdkstats.hwid;
4949 stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); 4471 stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals);
4950 4472
4951 return(0); 4473 return 0;
4952} 4474}
4953 4475
4954/*****************************************************************************/ 4476/*****************************************************************************/
@@ -4961,8 +4483,8 @@ static int stli_portcmdstats(stliport_t *portp)
4961 4483
4962static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) 4484static int stli_getportstats(stliport_t *portp, comstats_t __user *cp)
4963{ 4485{
4964 stlibrd_t *brdp; 4486 stlibrd_t *brdp;
4965 int rc; 4487 int rc;
4966 4488
4967 if (!portp) { 4489 if (!portp) {
4968 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) 4490 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))
@@ -4992,8 +4514,8 @@ static int stli_getportstats(stliport_t *portp, comstats_t __user *cp)
4992 4514
4993static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) 4515static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp)
4994{ 4516{
4995 stlibrd_t *brdp; 4517 stlibrd_t *brdp;
4996 int rc; 4518 int rc;
4997 4519
4998 if (!portp) { 4520 if (!portp) {
4999 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) 4521 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))
@@ -5031,7 +4553,7 @@ static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp)
5031 4553
5032static int stli_getportstruct(stliport_t __user *arg) 4554static int stli_getportstruct(stliport_t __user *arg)
5033{ 4555{
5034 stliport_t *portp; 4556 stliport_t *portp;
5035 4557
5036 if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) 4558 if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t)))
5037 return -EFAULT; 4559 return -EFAULT;
@@ -5052,7 +4574,7 @@ static int stli_getportstruct(stliport_t __user *arg)
5052 4574
5053static int stli_getbrdstruct(stlibrd_t __user *arg) 4575static int stli_getbrdstruct(stlibrd_t __user *arg)
5054{ 4576{
5055 stlibrd_t *brdp; 4577 stlibrd_t *brdp;
5056 4578
5057 if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) 4579 if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t)))
5058 return -EFAULT; 4580 return -EFAULT;
@@ -5076,15 +4598,10 @@ static int stli_getbrdstruct(stlibrd_t __user *arg)
5076 4598
5077static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) 4599static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg)
5078{ 4600{
5079 stlibrd_t *brdp; 4601 stlibrd_t *brdp;
5080 int brdnr, rc, done; 4602 int brdnr, rc, done;
5081 void __user *argp = (void __user *)arg; 4603 void __user *argp = (void __user *)arg;
5082 4604
5083#ifdef DEBUG
5084 printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n",
5085 (int) ip, (int) fp, cmd, (int) arg);
5086#endif
5087
5088/* 4605/*
5089 * First up handle the board independent ioctls. 4606 * First up handle the board independent ioctls.
5090 */ 4607 */
@@ -5115,7 +4632,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
5115 } 4632 }
5116 4633
5117 if (done) 4634 if (done)
5118 return(rc); 4635 return rc;
5119 4636
5120/* 4637/*
5121 * Now handle the board specific ioctls. These all depend on the 4638 * Now handle the board specific ioctls. These all depend on the
@@ -5123,12 +4640,12 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
5123 */ 4640 */
5124 brdnr = iminor(ip); 4641 brdnr = iminor(ip);
5125 if (brdnr >= STL_MAXBRDS) 4642 if (brdnr >= STL_MAXBRDS)
5126 return(-ENODEV); 4643 return -ENODEV;
5127 brdp = stli_brds[brdnr]; 4644 brdp = stli_brds[brdnr];
5128 if (!brdp) 4645 if (!brdp)
5129 return(-ENODEV); 4646 return -ENODEV;
5130 if (brdp->state == 0) 4647 if (brdp->state == 0)
5131 return(-ENODEV); 4648 return -ENODEV;
5132 4649
5133 switch (cmd) { 4650 switch (cmd) {
5134 case STL_BINTR: 4651 case STL_BINTR:
@@ -5152,8 +4669,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
5152 rc = -ENOIOCTLCMD; 4669 rc = -ENOIOCTLCMD;
5153 break; 4670 break;
5154 } 4671 }
5155 4672 return rc;
5156 return(rc);
5157} 4673}
5158 4674
5159static struct tty_operations stli_ops = { 4675static struct tty_operations stli_ops = {
@@ -5187,6 +4703,9 @@ int __init stli_init(void)
5187 int i; 4703 int i;
5188 printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); 4704 printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion);
5189 4705
4706 spin_lock_init(&stli_lock);
4707 spin_lock_init(&brd_lock);
4708
5190 stli_initbrds(); 4709 stli_initbrds();
5191 4710
5192 stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); 4711 stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
@@ -5196,10 +4715,6 @@ int __init stli_init(void)
5196/* 4715/*
5197 * Allocate a temporary write buffer. 4716 * Allocate a temporary write buffer.
5198 */ 4717 */
5199 stli_tmpwritebuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);
5200 if (!stli_tmpwritebuf)
5201 printk(KERN_ERR "STALLION: failed to allocate memory "
5202 "(size=%d)\n", STLI_TXBUFSIZE);
5203 stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); 4718 stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);
5204 if (!stli_txcookbuf) 4719 if (!stli_txcookbuf)
5205 printk(KERN_ERR "STALLION: failed to allocate memory " 4720 printk(KERN_ERR "STALLION: failed to allocate memory "
@@ -5243,7 +4758,7 @@ int __init stli_init(void)
5243 printk(KERN_ERR "STALLION: failed to register serial driver\n"); 4758 printk(KERN_ERR "STALLION: failed to register serial driver\n");
5244 return -EBUSY; 4759 return -EBUSY;
5245 } 4760 }
5246 return(0); 4761 return 0;
5247} 4762}
5248 4763
5249/*****************************************************************************/ 4764/*****************************************************************************/
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 645d9d713aec..72cfd09091e0 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -996,7 +996,6 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
996 996
997 info->session = current->signal->session; 997 info->session = current->signal->session;
998 info->pgrp = process_group(current); 998 info->pgrp = process_group(current);
999 clear_bit(TTY_DONT_FLIP, &tty->flags);
1000 999
1001 /* 1000 /*
1002 status = mxser_get_msr(info->base, 0, info->port); 1001 status = mxser_get_msr(info->base, 0, info->port);
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index b9371d5bf790..603b9ade5eb0 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1132,7 +1132,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt)
1132 * buffer, and once to drain the space from the (physical) beginning of 1132 * buffer, and once to drain the space from the (physical) beginning of
1133 * the buffer to head pointer. 1133 * the buffer to head pointer.
1134 * 1134 *
1135 * Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set 1135 * Called under the tty->atomic_read_lock sem
1136 * 1136 *
1137 */ 1137 */
1138 1138
@@ -1271,7 +1271,6 @@ do_it_again:
1271 } 1271 }
1272 1272
1273 add_wait_queue(&tty->read_wait, &wait); 1273 add_wait_queue(&tty->read_wait, &wait);
1274 set_bit(TTY_DONT_FLIP, &tty->flags);
1275 while (nr) { 1274 while (nr) {
1276 /* First test for status change. */ 1275 /* First test for status change. */
1277 if (tty->packet && tty->link->ctrl_status) { 1276 if (tty->packet && tty->link->ctrl_status) {
@@ -1315,9 +1314,7 @@ do_it_again:
1315 break; 1314 break;
1316 } 1315 }
1317 n_tty_set_room(tty); 1316 n_tty_set_room(tty);
1318 clear_bit(TTY_DONT_FLIP, &tty->flags);
1319 timeout = schedule_timeout(timeout); 1317 timeout = schedule_timeout(timeout);
1320 set_bit(TTY_DONT_FLIP, &tty->flags);
1321 continue; 1318 continue;
1322 } 1319 }
1323 __set_current_state(TASK_RUNNING); 1320 __set_current_state(TASK_RUNNING);
@@ -1394,7 +1391,6 @@ do_it_again:
1394 if (time) 1391 if (time)
1395 timeout = time; 1392 timeout = time;
1396 } 1393 }
1397 clear_bit(TTY_DONT_FLIP, &tty->flags);
1398 mutex_unlock(&tty->atomic_read_lock); 1394 mutex_unlock(&tty->atomic_read_lock);
1399 remove_wait_queue(&tty->read_wait, &wait); 1395 remove_wait_queue(&tty->read_wait, &wait);
1400 1396
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 9b5a2c0e7008..0c17f61549b4 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -101,7 +101,7 @@ static void pty_unthrottle(struct tty_struct * tty)
101 * 101 *
102 * FIXME: Our pty_write method is called with our ldisc lock held but 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 103 * not our partners. We can't just take the other one blindly without
104 * risking deadlocks. There is also the small matter of TTY_DONT_FLIP 104 * risking deadlocks.
105 */ 105 */
106static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count) 106static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count)
107{ 107{
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index bf361a5ba70d..00b4a2187164 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -3029,6 +3029,9 @@ static int __init stl_init(void)
3029 int i; 3029 int i;
3030 printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); 3030 printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion);
3031 3031
3032 spin_lock_init(&stallion_lock);
3033 spin_lock_init(&brd_lock);
3034
3032 stl_initbrds(); 3035 stl_initbrds();
3033 3036
3034 stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); 3037 stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index bd74e82d8a72..8d19f7281f0b 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -267,7 +267,6 @@ static struct tty_buffer *tty_buffer_alloc(size_t size)
267 p->used = 0; 267 p->used = 0;
268 p->size = size; 268 p->size = size;
269 p->next = NULL; 269 p->next = NULL;
270 p->active = 0;
271 p->commit = 0; 270 p->commit = 0;
272 p->read = 0; 271 p->read = 0;
273 p->char_buf_ptr = (char *)(p->data); 272 p->char_buf_ptr = (char *)(p->data);
@@ -327,10 +326,9 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
327 /* OPTIMISATION: We could keep a per tty "zero" sized buffer to 326 /* OPTIMISATION: We could keep a per tty "zero" sized buffer to
328 remove this conditional if its worth it. This would be invisible 327 remove this conditional if its worth it. This would be invisible
329 to the callers */ 328 to the callers */
330 if ((b = tty->buf.tail) != NULL) { 329 if ((b = tty->buf.tail) != NULL)
331 left = b->size - b->used; 330 left = b->size - b->used;
332 b->active = 1; 331 else
333 } else
334 left = 0; 332 left = 0;
335 333
336 if (left < size) { 334 if (left < size) {
@@ -338,12 +336,10 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
338 if ((n = tty_buffer_find(tty, size)) != NULL) { 336 if ((n = tty_buffer_find(tty, size)) != NULL) {
339 if (b != NULL) { 337 if (b != NULL) {
340 b->next = n; 338 b->next = n;
341 b->active = 0;
342 b->commit = b->used; 339 b->commit = b->used;
343 } else 340 } else
344 tty->buf.head = n; 341 tty->buf.head = n;
345 tty->buf.tail = n; 342 tty->buf.tail = n;
346 n->active = 1;
347 } else 343 } else
348 size = left; 344 size = left;
349 } 345 }
@@ -404,10 +400,8 @@ void tty_schedule_flip(struct tty_struct *tty)
404{ 400{
405 unsigned long flags; 401 unsigned long flags;
406 spin_lock_irqsave(&tty->buf.lock, flags); 402 spin_lock_irqsave(&tty->buf.lock, flags);
407 if (tty->buf.tail != NULL) { 403 if (tty->buf.tail != NULL)
408 tty->buf.tail->active = 0;
409 tty->buf.tail->commit = tty->buf.tail->used; 404 tty->buf.tail->commit = tty->buf.tail->used;
410 }
411 spin_unlock_irqrestore(&tty->buf.lock, flags); 405 spin_unlock_irqrestore(&tty->buf.lock, flags);
412 schedule_delayed_work(&tty->buf.work, 1); 406 schedule_delayed_work(&tty->buf.work, 1);
413} 407}
@@ -784,11 +778,8 @@ restart:
784 } 778 }
785 779
786 clear_bit(TTY_LDISC, &tty->flags); 780 clear_bit(TTY_LDISC, &tty->flags);
787 clear_bit(TTY_DONT_FLIP, &tty->flags); 781 if (o_tty)
788 if (o_tty) {
789 clear_bit(TTY_LDISC, &o_tty->flags); 782 clear_bit(TTY_LDISC, &o_tty->flags);
790 clear_bit(TTY_DONT_FLIP, &o_tty->flags);
791 }
792 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 783 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
793 784
794 /* 785 /*
@@ -1955,7 +1946,6 @@ static void release_dev(struct file * filp)
1955 * race with the set_ldisc code path. 1946 * race with the set_ldisc code path.
1956 */ 1947 */
1957 clear_bit(TTY_LDISC, &tty->flags); 1948 clear_bit(TTY_LDISC, &tty->flags);
1958 clear_bit(TTY_DONT_FLIP, &tty->flags);
1959 cancel_delayed_work(&tty->buf.work); 1949 cancel_delayed_work(&tty->buf.work);
1960 1950
1961 /* 1951 /*
@@ -2775,8 +2765,7 @@ static void flush_to_ldisc(void *private_)
2775 struct tty_struct *tty = (struct tty_struct *) private_; 2765 struct tty_struct *tty = (struct tty_struct *) private_;
2776 unsigned long flags; 2766 unsigned long flags;
2777 struct tty_ldisc *disc; 2767 struct tty_ldisc *disc;
2778 struct tty_buffer *tbuf; 2768 struct tty_buffer *tbuf, *head;
2779 int count;
2780 char *char_buf; 2769 char *char_buf;
2781 unsigned char *flag_buf; 2770 unsigned char *flag_buf;
2782 2771
@@ -2784,32 +2773,37 @@ static void flush_to_ldisc(void *private_)
2784 if (disc == NULL) /* !TTY_LDISC */ 2773 if (disc == NULL) /* !TTY_LDISC */
2785 return; 2774 return;
2786 2775
2787 if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
2788 /*
2789 * Do it after the next timer tick:
2790 */
2791 schedule_delayed_work(&tty->buf.work, 1);
2792 goto out;
2793 }
2794 spin_lock_irqsave(&tty->buf.lock, flags); 2776 spin_lock_irqsave(&tty->buf.lock, flags);
2795 while((tbuf = tty->buf.head) != NULL) { 2777 head = tty->buf.head;
2796 while ((count = tbuf->commit - tbuf->read) != 0) { 2778 if (head != NULL) {
2797 char_buf = tbuf->char_buf_ptr + tbuf->read; 2779 tty->buf.head = NULL;
2798 flag_buf = tbuf->flag_buf_ptr + tbuf->read; 2780 for (;;) {
2799 tbuf->read += count; 2781 int count = head->commit - head->read;
2782 if (!count) {
2783 if (head->next == NULL)
2784 break;
2785 tbuf = head;
2786 head = head->next;
2787 tty_buffer_free(tty, tbuf);
2788 continue;
2789 }
2790 if (!tty->receive_room) {
2791 schedule_delayed_work(&tty->buf.work, 1);
2792 break;
2793 }
2794 if (count > tty->receive_room)
2795 count = tty->receive_room;
2796 char_buf = head->char_buf_ptr + head->read;
2797 flag_buf = head->flag_buf_ptr + head->read;
2798 head->read += count;
2800 spin_unlock_irqrestore(&tty->buf.lock, flags); 2799 spin_unlock_irqrestore(&tty->buf.lock, flags);
2801 disc->receive_buf(tty, char_buf, flag_buf, count); 2800 disc->receive_buf(tty, char_buf, flag_buf, count);
2802 spin_lock_irqsave(&tty->buf.lock, flags); 2801 spin_lock_irqsave(&tty->buf.lock, flags);
2803 } 2802 }
2804 if (tbuf->active) 2803 tty->buf.head = head;
2805 break;
2806 tty->buf.head = tbuf->next;
2807 if (tty->buf.head == NULL)
2808 tty->buf.tail = NULL;
2809 tty_buffer_free(tty, tbuf);
2810 } 2804 }
2811 spin_unlock_irqrestore(&tty->buf.lock, flags); 2805 spin_unlock_irqrestore(&tty->buf.lock, flags);
2812out: 2806
2813 tty_ldisc_deref(disc); 2807 tty_ldisc_deref(disc);
2814} 2808}
2815 2809
@@ -2902,10 +2896,8 @@ void tty_flip_buffer_push(struct tty_struct *tty)
2902{ 2896{
2903 unsigned long flags; 2897 unsigned long flags;
2904 spin_lock_irqsave(&tty->buf.lock, flags); 2898 spin_lock_irqsave(&tty->buf.lock, flags);
2905 if (tty->buf.tail != NULL) { 2899 if (tty->buf.tail != NULL)
2906 tty->buf.tail->active = 0;
2907 tty->buf.tail->commit = tty->buf.tail->used; 2900 tty->buf.tail->commit = tty->buf.tail->used;
2908 }
2909 spin_unlock_irqrestore(&tty->buf.lock, flags); 2901 spin_unlock_irqrestore(&tty->buf.lock, flags);
2910 2902
2911 if (tty->low_latency) 2903 if (tty->low_latency)
diff --git a/drivers/char/watchdog/at91_wdt.c b/drivers/char/watchdog/at91_wdt.c
index ac83bc4b019a..00080655533d 100644
--- a/drivers/char/watchdog/at91_wdt.c
+++ b/drivers/char/watchdog/at91_wdt.c
@@ -17,14 +17,15 @@
17#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/moduleparam.h> 19#include <linux/moduleparam.h>
20#include <linux/platform_device.h>
20#include <linux/types.h> 21#include <linux/types.h>
21#include <linux/watchdog.h> 22#include <linux/watchdog.h>
22#include <asm/bitops.h> 23#include <asm/bitops.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24 25
25 26
26#define WDT_DEFAULT_TIME 5 /* 5 seconds */ 27#define WDT_DEFAULT_TIME 5 /* seconds */
27#define WDT_MAX_TIME 256 /* 256 seconds */ 28#define WDT_MAX_TIME 256 /* seconds */
28 29
29static int wdt_time = WDT_DEFAULT_TIME; 30static int wdt_time = WDT_DEFAULT_TIME;
30static int nowayout = WATCHDOG_NOWAYOUT; 31static int nowayout = WATCHDOG_NOWAYOUT;
@@ -32,8 +33,10 @@ static int nowayout = WATCHDOG_NOWAYOUT;
32module_param(wdt_time, int, 0); 33module_param(wdt_time, int, 0);
33MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")"); 34MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
34 35
36#ifdef CONFIG_WATCHDOG_NOWAYOUT
35module_param(nowayout, int, 0); 37module_param(nowayout, int, 0);
36MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 38MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
39#endif
37 40
38 41
39static unsigned long at91wdt_busy; 42static unsigned long at91wdt_busy;
@@ -138,7 +141,7 @@ static int at91_wdt_ioctl(struct inode *inode, struct file *file,
138 case WDIOC_SETTIMEOUT: 141 case WDIOC_SETTIMEOUT:
139 if (get_user(new_value, p)) 142 if (get_user(new_value, p))
140 return -EFAULT; 143 return -EFAULT;
141 144
142 if (at91_wdt_settimeout(new_value)) 145 if (at91_wdt_settimeout(new_value))
143 return -EINVAL; 146 return -EINVAL;
144 147
@@ -196,27 +199,84 @@ static struct miscdevice at91wdt_miscdev = {
196 .fops = &at91wdt_fops, 199 .fops = &at91wdt_fops,
197}; 200};
198 201
199static int __init at91_wdt_init(void) 202static int __init at91wdt_probe(struct platform_device *pdev)
200{ 203{
201 int res; 204 int res;
202 205
203 /* Check that the heartbeat value is within range; if not reset to the default */ 206 if (at91wdt_miscdev.dev)
204 if (at91_wdt_settimeout(wdt_time)) { 207 return -EBUSY;
205 at91_wdt_settimeout(WDT_DEFAULT_TIME); 208 at91wdt_miscdev.dev = &pdev->dev;
206 printk(KERN_INFO "at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time);
207 }
208 209
209 res = misc_register(&at91wdt_miscdev); 210 res = misc_register(&at91wdt_miscdev);
210 if (res) 211 if (res)
211 return res; 212 return res;
212 213
213 printk("AT91 Watchdog Timer enabled (%d seconds, nowayout=%d)\n", wdt_time, nowayout); 214 printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
214 return 0; 215 return 0;
215} 216}
216 217
218static int __exit at91wdt_remove(struct platform_device *pdev)
219{
220 int res;
221
222 res = misc_deregister(&at91wdt_miscdev);
223 if (!res)
224 at91wdt_miscdev.dev = NULL;
225
226 return res;
227}
228
229static void at91wdt_shutdown(struct platform_device *pdev)
230{
231 at91_wdt_stop();
232}
233
234#ifdef CONFIG_PM
235
236static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message)
237{
238 at91_wdt_stop();
239 return 0;
240}
241
242static int at91wdt_resume(struct platform_device *pdev)
243{
244 if (at91wdt_busy)
245 at91_wdt_start();
246 return 0;
247}
248
249#else
250#define at91wdt_suspend NULL
251#define at91wdt_resume NULL
252#endif
253
254static struct platform_driver at91wdt_driver = {
255 .probe = at91wdt_probe,
256 .remove = __exit_p(at91wdt_remove),
257 .shutdown = at91wdt_shutdown,
258 .suspend = at91wdt_suspend,
259 .resume = at91wdt_resume,
260 .driver = {
261 .name = "at91_wdt",
262 .owner = THIS_MODULE,
263 },
264};
265
266static int __init at91_wdt_init(void)
267{
268 /* Check that the heartbeat value is within range; if not reset to the default */
269 if (at91_wdt_settimeout(wdt_time)) {
270 at91_wdt_settimeout(WDT_DEFAULT_TIME);
271 pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time);
272 }
273
274 return platform_driver_register(&at91wdt_driver);
275}
276
217static void __exit at91_wdt_exit(void) 277static void __exit at91_wdt_exit(void)
218{ 278{
219 misc_deregister(&at91wdt_miscdev); 279 platform_driver_unregister(&at91wdt_driver);
220} 280}
221 281
222module_init(at91_wdt_init); 282module_init(at91_wdt_init);
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c
index fa2ba9ebe42a..bfbdbbf3c2f2 100644
--- a/drivers/char/watchdog/i8xx_tco.c
+++ b/drivers/char/watchdog/i8xx_tco.c
@@ -205,6 +205,23 @@ static int tco_timer_set_heartbeat (int t)
205 return 0; 205 return 0;
206} 206}
207 207
208static int tco_timer_get_timeleft (int *time_left)
209{
210 unsigned char val;
211
212 spin_lock(&tco_lock);
213
214 /* read the TCO Timer */
215 val = inb (TCO1_RLD);
216 val &= 0x3f;
217
218 spin_unlock(&tco_lock);
219
220 *time_left = (int)((val * 6) / 10);
221
222 return 0;
223}
224
208/* 225/*
209 * /dev/watchdog handling 226 * /dev/watchdog handling
210 */ 227 */
@@ -272,6 +289,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
272{ 289{
273 int new_options, retval = -EINVAL; 290 int new_options, retval = -EINVAL;
274 int new_heartbeat; 291 int new_heartbeat;
292 int time_left;
275 void __user *argp = (void __user *)arg; 293 void __user *argp = (void __user *)arg;
276 int __user *p = argp; 294 int __user *p = argp;
277 static struct watchdog_info ident = { 295 static struct watchdog_info ident = {
@@ -320,7 +338,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
320 return -EFAULT; 338 return -EFAULT;
321 339
322 if (tco_timer_set_heartbeat(new_heartbeat)) 340 if (tco_timer_set_heartbeat(new_heartbeat))
323 return -EINVAL; 341 return -EINVAL;
324 342
325 tco_timer_keepalive (); 343 tco_timer_keepalive ();
326 /* Fall */ 344 /* Fall */
@@ -329,6 +347,14 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
329 case WDIOC_GETTIMEOUT: 347 case WDIOC_GETTIMEOUT:
330 return put_user(heartbeat, p); 348 return put_user(heartbeat, p);
331 349
350 case WDIOC_GETTIMELEFT:
351 {
352 if (tco_timer_get_timeleft(&time_left))
353 return -EINVAL;
354
355 return put_user(time_left, p);
356 }
357
332 default: 358 default:
333 return -ENOIOCTLCMD; 359 return -ENOIOCTLCMD;
334 } 360 }
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c
index 2451edbefece..1f40ecefbf72 100644
--- a/drivers/char/watchdog/pcwd_pci.c
+++ b/drivers/char/watchdog/pcwd_pci.c
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23/* 23/*
24 * A bells and whistles driver is available from: 24 * A bells and whistles driver is available from:
25 * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/ 25 * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/
26 * 26 *
27 * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ 27 * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/
@@ -390,6 +390,24 @@ static int pcipcwd_get_temperature(int *temperature)
390 return 0; 390 return 0;
391} 391}
392 392
393static int pcipcwd_get_timeleft(int *time_left)
394{
395 int msb;
396 int lsb;
397
398 /* Read the time that's left before rebooting */
399 /* Note: if the board is not yet armed then we will read 0xFFFF */
400 send_command(CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb);
401
402 *time_left = (msb << 8) + lsb;
403
404 if (debug >= VERBOSE)
405 printk(KERN_DEBUG PFX "Time left before next reboot: %d\n",
406 *time_left);
407
408 return 0;
409}
410
393/* 411/*
394 * /dev/watchdog handling 412 * /dev/watchdog handling
395 */ 413 */
@@ -512,6 +530,16 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
512 case WDIOC_GETTIMEOUT: 530 case WDIOC_GETTIMEOUT:
513 return put_user(heartbeat, p); 531 return put_user(heartbeat, p);
514 532
533 case WDIOC_GETTIMELEFT:
534 {
535 int time_left;
536
537 if (pcipcwd_get_timeleft(&time_left))
538 return -EFAULT;
539
540 return put_user(time_left, p);
541 }
542
515 default: 543 default:
516 return -ENOIOCTLCMD; 544 return -ENOIOCTLCMD;
517 } 545 }
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c
index 3fdfda9324fa..0d072bed501d 100644
--- a/drivers/char/watchdog/pcwd_usb.c
+++ b/drivers/char/watchdog/pcwd_usb.c
@@ -317,6 +317,19 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp
317 return 0; 317 return 0;
318} 318}
319 319
320static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd, int *time_left)
321{
322 unsigned char msb, lsb;
323
324 /* Read the time that's left before rebooting */
325 /* Note: if the board is not yet armed then we will read 0xFFFF */
326 usb_pcwd_send_command(usb_pcwd, CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb);
327
328 *time_left = (msb << 8) + lsb;
329
330 return 0;
331}
332
320/* 333/*
321 * /dev/watchdog handling 334 * /dev/watchdog handling
322 */ 335 */
@@ -422,6 +435,16 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
422 case WDIOC_GETTIMEOUT: 435 case WDIOC_GETTIMEOUT:
423 return put_user(heartbeat, p); 436 return put_user(heartbeat, p);
424 437
438 case WDIOC_GETTIMELEFT:
439 {
440 int time_left;
441
442 if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
443 return -EFAULT;
444
445 return put_user(time_left, p);
446 }
447
425 default: 448 default:
426 return -ENOIOCTLCMD; 449 return -ENOIOCTLCMD;
427 } 450 }
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 935cb2583770..26ceab1e90bb 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -505,7 +505,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
505 } 505 }
506 } 506 }
507 507
508 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) 508 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
509 try_to_flush_leftover_data(drive); 509 try_to_flush_leftover_data(drive);
510 510
511 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) 511 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 97a49e77a8f1..32117f0ec5c0 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -597,6 +597,10 @@ u8 eighty_ninty_three (ide_drive_t *drive)
597{ 597{
598 if(HWIF(drive)->udma_four == 0) 598 if(HWIF(drive)->udma_four == 0)
599 return 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;
600 if (!(drive->id->hw_config & 0x6000)) 604 if (!(drive->id->hw_config & 0x6000))
601 return 0; 605 return 0;
602#ifndef CONFIG_IDEDMA_IVB 606#ifndef CONFIG_IDEDMA_IVB
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index c743e68c33aa..ff0cdc142f17 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -22,7 +22,7 @@ struct chipset_bus_clock_list_entry {
22 u8 ultra_settings; 22 u8 ultra_settings;
23}; 23};
24 24
25static struct chipset_bus_clock_list_entry aec6xxx_33_base [] = { 25static const struct chipset_bus_clock_list_entry aec6xxx_33_base [] = {
26 { XFER_UDMA_6, 0x31, 0x07 }, 26 { XFER_UDMA_6, 0x31, 0x07 },
27 { XFER_UDMA_5, 0x31, 0x06 }, 27 { XFER_UDMA_5, 0x31, 0x06 },
28 { XFER_UDMA_4, 0x31, 0x05 }, 28 { XFER_UDMA_4, 0x31, 0x05 },
@@ -42,7 +42,7 @@ static struct chipset_bus_clock_list_entry aec6xxx_33_base [] = {
42 { 0, 0x00, 0x00 } 42 { 0, 0x00, 0x00 }
43}; 43};
44 44
45static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { 45static const struct chipset_bus_clock_list_entry aec6xxx_34_base [] = {
46 { XFER_UDMA_6, 0x41, 0x06 }, 46 { XFER_UDMA_6, 0x41, 0x06 },
47 { XFER_UDMA_5, 0x41, 0x05 }, 47 { XFER_UDMA_5, 0x41, 0x05 },
48 { XFER_UDMA_4, 0x41, 0x04 }, 48 { XFER_UDMA_4, 0x41, 0x04 },
@@ -425,12 +425,12 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
425 return d->init_setup(dev, d); 425 return d->init_setup(dev, d);
426} 426}
427 427
428static struct pci_device_id aec62xx_pci_tbl[] = { 428static const 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 }, 429 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF), 0 },
430 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, 430 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860), 1 },
431 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 }, 431 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R), 2 },
432 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3 }, 432 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865), 3 },
433 { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, 433 { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R), 4 },
434 { 0, }, 434 { 0, },
435}; 435};
436MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl); 436MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl);
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 3d9c7afc8695..92b7b1549b16 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -190,14 +190,6 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count)
190#endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ 190#endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */
191 191
192/* 192/*
193 * Registers and masks for easy access by drive index:
194 */
195#if 0
196static u8 prefetch_regs[4] = {CNTRL, CNTRL, ARTTIM23, ARTTIM23};
197static 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 193 * This routine writes the prepared setup/active/recovery counts
202 * for a drive into the cmd646 chipset registers to active them. 194 * for a drive into the cmd646 chipset registers to active them.
203 */ 195 */
@@ -606,13 +598,6 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha
606 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); 598 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
607 class_rev &= 0xff; 599 class_rev &= 0xff;
608 600
609#ifdef __i386__
610 if (dev->resource[PCI_ROM_RESOURCE].start) {
611 pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
612 printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
613 }
614#endif
615
616 switch(dev->device) { 601 switch(dev->device) {
617 case PCI_DEVICE_ID_CMD_643: 602 case PCI_DEVICE_ID_CMD_643:
618 break; 603 break;
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index acd63173199b..2c9e938dd1cd 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -338,6 +338,8 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
338 hwif->ultra_mask = 0x7f; 338 hwif->ultra_mask = 0x7f;
339 hwif->mwdma_mask = 0x07; 339 hwif->mwdma_mask = 0x07;
340 340
341 hwif->err_stops_fifo = 1;
342
341 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate; 343 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate;
342 hwif->ide_dma_lostirq = &pdcnew_ide_dma_lostirq; 344 hwif->ide_dma_lostirq = &pdcnew_ide_dma_lostirq;
343 hwif->ide_dma_timeout = &pdcnew_ide_dma_timeout; 345 hwif->ide_dma_timeout = &pdcnew_ide_dma_timeout;
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 22d17548ecdb..26bc688a1821 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -101,31 +101,6 @@ static const char *pdc_quirk_drives[] = {
101#define MC1 0x02 /* DMA"C" timing */ 101#define MC1 0x02 /* DMA"C" timing */
102#define MC0 0x01 /* DMA"C" timing */ 102#define MC0 0x01 /* DMA"C" timing */
103 103
104#if 0
105 unsigned long bibma = pci_resource_start(dev, 4);
106 u8 hi = 0, lo = 0;
107
108 u8 sc1c = inb_p((u16)bibma + 0x1c);
109 u8 sc1e = inb_p((u16)bibma + 0x1e);
110 u8 sc1f = inb_p((u16)bibma + 0x1f);
111
112 p += sprintf(p, "Host Mode : %s\n",
113 (sc1f & 0x08) ? "Tri-Stated" : "Normal");
114 p += sprintf(p, "Bus Clocking : %s\n",
115 ((sc1f & 0xC0) == 0xC0) ? "100 External" :
116 ((sc1f & 0x80) == 0x80) ? "66 External" :
117 ((sc1f & 0x40) == 0x40) ? "33 External" : "33 PCI Internal");
118 p += sprintf(p, "IO pad select : %s mA\n",
119 ((sc1c & 0x03) == 0x03) ? "10" :
120 ((sc1c & 0x02) == 0x02) ? "8" :
121 ((sc1c & 0x01) == 0x01) ? "6" :
122 ((sc1c & 0x00) == 0x00) ? "4" : "??");
123 hi = sc1e >> 4;
124 lo = sc1e & 0xf;
125 p += sprintf(p, "Status Polling Period : %d\n", hi);
126 p += sprintf(p, "Interrupt Check Status Polling Delay : %d\n", lo);
127#endif
128
129static u8 pdc202xx_ratemask (ide_drive_t *drive) 104static u8 pdc202xx_ratemask (ide_drive_t *drive)
130{ 105{
131 u8 mode; 106 u8 mode;
@@ -505,42 +480,13 @@ static void pdc202xx_reset (ide_drive_t *drive)
505 480
506 pdc202xx_reset_host(hwif); 481 pdc202xx_reset_host(hwif);
507 pdc202xx_reset_host(mate); 482 pdc202xx_reset_host(mate);
508#if 0
509 /*
510 * FIXME: Have to kick all the drives again :-/
511 * What a pain in the ACE!
512 */
513 if (hwif->present) {
514 u16 hunit = 0;
515 for (hunit = 0; hunit < MAX_DRIVES; ++hunit) {
516 ide_drive_t *hdrive = &hwif->drives[hunit];
517 if (hdrive->present) {
518 if (hwif->ide_dma_check)
519 hwif->ide_dma_check(hdrive);
520 else
521 hwif->tuneproc(hdrive, 5);
522 }
523 }
524 }
525 if (mate->present) {
526 u16 munit = 0;
527 for (munit = 0; munit < MAX_DRIVES; ++munit) {
528 ide_drive_t *mdrive = &mate->drives[munit];
529 if (mdrive->present) {
530 if (mate->ide_dma_check)
531 mate->ide_dma_check(mdrive);
532 else
533 mate->tuneproc(mdrive, 5);
534 }
535 }
536 }
537#else
538 hwif->tuneproc(drive, 5); 483 hwif->tuneproc(drive, 5);
539#endif
540} 484}
541 485
542static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name) 486static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
487 const char *name)
543{ 488{
489 /* This doesn't appear needed */
544 if (dev->resource[PCI_ROM_RESOURCE].start) { 490 if (dev->resource[PCI_ROM_RESOURCE].start) {
545 pci_write_config_dword(dev, PCI_ROM_ADDRESS, 491 pci_write_config_dword(dev, PCI_ROM_ADDRESS,
546 dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 492 dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
@@ -548,30 +494,6 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const c
548 name, dev->resource[PCI_ROM_RESOURCE].start); 494 name, dev->resource[PCI_ROM_RESOURCE].start);
549 } 495 }
550 496
551 /*
552 * software reset - this is required because the bios
553 * will set UDMA timing on if the hdd supports it. The
554 * user may want to turn udma off. A bug in the pdc20262
555 * is that it cannot handle a downgrade in timing from
556 * UDMA to DMA. Disk accesses after issuing a set
557 * feature command will result in errors. A software
558 * reset leaves the timing registers intact,
559 * but resets the drives.
560 */
561#if 0
562 if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) ||
563 (dev->device == PCI_DEVICE_ID_PROMISE_20265) ||
564 (dev->device == PCI_DEVICE_ID_PROMISE_20263) ||
565 (dev->device == PCI_DEVICE_ID_PROMISE_20262)) {
566 unsigned long high_16 = pci_resource_start(dev, 4);
567 byte udma_speed_flag = inb(high_16 + 0x001f);
568 outb(udma_speed_flag | 0x10, high_16 + 0x001f);
569 mdelay(100);
570 outb(udma_speed_flag & ~0x10, high_16 + 0x001f);
571 mdelay(2000); /* 2 seconds ?! */
572 }
573
574#endif
575 return dev->irq; 497 return dev->irq;
576} 498}
577 499
@@ -599,6 +521,8 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
599 hwif->mwdma_mask = 0x07; 521 hwif->mwdma_mask = 0x07;
600 hwif->swdma_mask = 0x07; 522 hwif->swdma_mask = 0x07;
601 523
524 hwif->err_stops_fifo = 1;
525
602 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate; 526 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate;
603 hwif->ide_dma_lostirq = &pdc202xx_ide_dma_lostirq; 527 hwif->ide_dma_lostirq = &pdc202xx_ide_dma_lostirq;
604 hwif->ide_dma_timeout = &pdc202xx_ide_dma_timeout; 528 hwif->ide_dma_timeout = &pdc202xx_ide_dma_timeout;
@@ -687,19 +611,6 @@ static int __devinit init_setup_pdc202ata4(struct pci_dev *dev,
687 "mirror fixed.\n", d->name); 611 "mirror fixed.\n", d->name);
688 } 612 }
689 } 613 }
690
691#if 0
692 if (dev->device == PCI_DEVICE_ID_PROMISE_20262)
693 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
694 (tmp & e->mask) != e->val))
695
696 if (d->enablebits[0].reg != d->enablebits[1].reg) {
697 d->enablebits[0].reg = d->enablebits[1].reg;
698 d->enablebits[0].mask = d->enablebits[1].mask;
699 d->enablebits[0].val = d->enablebits[1].val;
700 }
701#endif
702
703 return ide_setup_pci_device(dev, d); 614 return ide_setup_pci_device(dev, d);
704} 615}
705 616
@@ -714,22 +625,6 @@ static int __devinit init_setup_pdc20265(struct pci_dev *dev,
714 "attached to I2O RAID controller.\n"); 625 "attached to I2O RAID controller.\n");
715 return -ENODEV; 626 return -ENODEV;
716 } 627 }
717
718#if 0
719 {
720 u8 pri = 0, sec = 0;
721
722 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
723 (tmp & e->mask) != e->val))
724
725 if (d->enablebits[0].reg != d->enablebits[1].reg) {
726 d->enablebits[0].reg = d->enablebits[1].reg;
727 d->enablebits[0].mask = d->enablebits[1].mask;
728 d->enablebits[0].val = d->enablebits[1].val;
729 }
730 }
731#endif
732
733 return ide_setup_pci_device(dev, d); 628 return ide_setup_pci_device(dev, d);
734} 629}
735 630
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 24e21b2838c1..778b82ae964d 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -395,7 +395,6 @@ static int sc1200_resume (struct pci_dev *dev)
395{ 395{
396 ide_hwif_t *hwif = NULL; 396 ide_hwif_t *hwif = NULL;
397 397
398printk("SC1200: resume\n");
399 pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state 398 pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state
400 dev->current_state = PM_EVENT_ON; 399 dev->current_state = PM_EVENT_ON;
401 pci_enable_device(dev); 400 pci_enable_device(dev);
@@ -405,7 +404,6 @@ printk("SC1200: resume\n");
405 while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { 404 while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) {
406 unsigned int basereg, r, d, format; 405 unsigned int basereg, r, d, format;
407 sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; 406 sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data;
408printk("%s: SC1200: resume\n", hwif->name);
409 407
410 // 408 //
411 // Restore timing registers: this may be unnecessary if BIOS also does it 409 // Restore timing registers: this may be unnecessary if BIOS also does it
@@ -493,7 +491,7 @@ static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_devic
493} 491}
494 492
495static struct pci_device_id sc1200_pci_tbl[] = { 493static struct pci_device_id sc1200_pci_tbl[] = {
496 { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 494 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_IDE), 0},
497 { 0, }, 495 { 0, },
498}; 496};
499MODULE_DEVICE_TABLE(pci, sc1200_pci_tbl); 497MODULE_DEVICE_TABLE(pci, sc1200_pci_tbl);
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 0d3073f4eab4..5100b827a935 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -123,11 +123,11 @@ static u8 svwks_csb_check (struct pci_dev *dev)
123} 123}
124static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) 124static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
125{ 125{
126 u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; 126 static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
127 u8 dma_modes[] = { 0x77, 0x21, 0x20 }; 127 static const u8 dma_modes[] = { 0x77, 0x21, 0x20 };
128 u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 128 static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
129 u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 129 static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 };
130 u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; 130 static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 };
131 131
132 ide_hwif_t *hwif = HWIF(drive); 132 ide_hwif_t *hwif = HWIF(drive);
133 struct pci_dev *dev = hwif->pci_dev; 133 struct pci_dev *dev = hwif->pci_dev;
@@ -392,16 +392,6 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
392 } 392 }
393 outb_p(0x06, 0x0c00); 393 outb_p(0x06, 0x0c00);
394 dev->irq = inb_p(0x0c01); 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 { 395 } else {
406 struct pci_dev * findev = NULL; 396 struct pci_dev * findev = NULL;
407 u8 reg41 = 0; 397 u8 reg41 = 0;
@@ -452,7 +442,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
452 pci_write_config_byte(dev, 0x5A, btr); 442 pci_write_config_byte(dev, 0x5A, btr);
453 } 443 }
454 444
455 return (dev->irq) ? dev->irq : 0; 445 return dev->irq;
456} 446}
457 447
458static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif) 448static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif)
@@ -500,11 +490,6 @@ static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif)
500{ 490{
501 struct pci_dev *dev = hwif->pci_dev; 491 struct pci_dev *dev = hwif->pci_dev;
502 492
503 /* Per Specified Design by OEM, and ASIC Architect */
504 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
505 (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2))
506 return 1;
507
508 /* Server Works */ 493 /* Server Works */
509 if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) 494 if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS)
510 return ata66_svwks_svwks (hwif); 495 return ata66_svwks_svwks (hwif);
@@ -517,10 +502,14 @@ static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif)
517 if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN) 502 if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN)
518 return ata66_svwks_cobalt (hwif); 503 return ata66_svwks_cobalt (hwif);
519 504
505 /* Per Specified Design by OEM, and ASIC Architect */
506 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
507 (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2))
508 return 1;
509
520 return 0; 510 return 0;
521} 511}
522 512
523#undef CAN_SW_DMA
524static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 513static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
525{ 514{
526 u8 dma_stat = 0; 515 u8 dma_stat = 0;
@@ -537,9 +526,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
537 hwif->ultra_mask = 0x3f; 526 hwif->ultra_mask = 0x3f;
538 527
539 hwif->mwdma_mask = 0x07; 528 hwif->mwdma_mask = 0x07;
540#ifdef CAN_SW_DMA
541 hwif->swdma_mask = 0x07;
542#endif /* CAN_SW_DMA */
543 529
544 hwif->autodma = 0; 530 hwif->autodma = 0;
545 531
@@ -562,8 +548,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
562 hwif->drives[1].autodma = (dma_stat & 0x40); 548 hwif->drives[1].autodma = (dma_stat & 0x40);
563 hwif->drives[0].autotune = (!(dma_stat & 0x20)); 549 hwif->drives[0].autotune = (!(dma_stat & 0x20));
564 hwif->drives[1].autotune = (!(dma_stat & 0x40)); 550 hwif->drives[1].autotune = (!(dma_stat & 0x40));
565// hwif->drives[0].autodma = hwif->autodma;
566// hwif->drives[1].autodma = hwif->autodma;
567} 551}
568 552
569/* 553/*
@@ -593,11 +577,6 @@ static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
593 if (dev->resource[0].start == 0x01f1) 577 if (dev->resource[0].start == 0x01f1)
594 d->bootable = ON_BOARD; 578 d->bootable = ON_BOARD;
595 } 579 }
596#if 0
597 if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) &&
598 (!(PCI_FUNC(dev->devfn) & 1)))
599 d->autodma = AUTODMA;
600#endif
601 580
602 d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || 581 d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ||
603 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && 582 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
@@ -671,11 +650,11 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
671} 650}
672 651
673static struct pci_device_id svwks_pci_tbl[] = { 652static struct pci_device_id svwks_pci_tbl[] = {
674 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 653 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0},
675 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 654 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 1},
676 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 655 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2},
677 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 656 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 3},
678 { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 657 { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4},
679 { 0, }, 658 { 0, },
680}; 659};
681MODULE_DEVICE_TABLE(pci, svwks_pci_tbl); 660MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index f1ca154dd52c..72dade14c725 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -38,9 +38,6 @@
38 38
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#undef SIIMAGE_VIRTUAL_DMAPIO
42#undef SIIMAGE_LARGE_DMA
43
44/** 41/**
45 * pdev_is_sata - check if device is SATA 42 * pdev_is_sata - check if device is SATA
46 * @pdev: PCI device to check 43 * @pdev: PCI device to check
@@ -461,36 +458,6 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
461 return 0; 458 return 0;
462} 459}
463 460
464#if 0
465/**
466 * siimage_mmio_ide_dma_count - DMA bytes done
467 * @drive
468 *
469 * If we are doing VDMA the CMD680 requires a little bit
470 * of more careful handling and we have to read the counts
471 * off ourselves. For non VDMA life is normal.
472 */
473
474static int siimage_mmio_ide_dma_count (ide_drive_t *drive)
475{
476#ifdef SIIMAGE_VIRTUAL_DMAPIO
477 struct request *rq = HWGROUP(drive)->rq;
478 ide_hwif_t *hwif = HWIF(drive);
479 u32 count = (rq->nr_sectors * SECTOR_SIZE);
480 u32 rcount = 0;
481 unsigned long addr = siimage_selreg(hwif, 0x1C);
482
483 hwif->OUTL(count, addr);
484 rcount = hwif->INL(addr);
485
486 printk("\n%s: count = %d, rcount = %d, nr_sectors = %lu\n",
487 drive->name, count, rcount, rq->nr_sectors);
488
489#endif /* SIIMAGE_VIRTUAL_DMAPIO */
490 return __ide_dma_count(drive);
491}
492#endif
493
494/** 461/**
495 * siimage_mmio_ide_dma_test_irq - check we caused an IRQ 462 * siimage_mmio_ide_dma_test_irq - check we caused an IRQ
496 * @drive: drive we are testing 463 * @drive: drive we are testing
@@ -512,12 +479,10 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
512 u32 sata_error = hwif->INL(SATA_ERROR_REG); 479 u32 sata_error = hwif->INL(SATA_ERROR_REG);
513 hwif->OUTL(sata_error, SATA_ERROR_REG); 480 hwif->OUTL(sata_error, SATA_ERROR_REG);
514 watchdog = (sata_error & 0x00680000) ? 1 : 0; 481 watchdog = (sata_error & 0x00680000) ? 1 : 0;
515#if 1
516 printk(KERN_WARNING "%s: sata_error = 0x%08x, " 482 printk(KERN_WARNING "%s: sata_error = 0x%08x, "
517 "watchdog = %d, %s\n", 483 "watchdog = %d, %s\n",
518 drive->name, sata_error, watchdog, 484 drive->name, sata_error, watchdog,
519 __FUNCTION__); 485 __FUNCTION__);
520#endif
521 486
522 } else { 487 } else {
523 watchdog = (ext_stat & 0x8000) ? 1 : 0; 488 watchdog = (ext_stat & 0x8000) ? 1 : 0;
@@ -863,7 +828,7 @@ static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const ch
863 * time. 828 * time.
864 * 829 *
865 * The hardware supports buffered taskfiles and also some rather nice 830 * The hardware supports buffered taskfiles and also some rather nice
866 * extended PRD tables. Unfortunately right now we don't. 831 * extended PRD tables. For better SI3112 support use the libata driver
867 */ 832 */
868 833
869static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) 834static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
@@ -900,9 +865,6 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
900 * so we can't currently use it sanely since we want to 865 * so we can't currently use it sanely since we want to
901 * use LBA48 mode. 866 * use LBA48 mode.
902 */ 867 */
903// base += 0x10;
904// hwif->no_lba48 = 1;
905
906 hw.io_ports[IDE_DATA_OFFSET] = base; 868 hw.io_ports[IDE_DATA_OFFSET] = base;
907 hw.io_ports[IDE_ERROR_OFFSET] = base + 1; 869 hw.io_ports[IDE_ERROR_OFFSET] = base + 1;
908 hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2; 870 hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2;
@@ -936,15 +898,8 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
936 898
937 base = (unsigned long) addr; 899 base = (unsigned long) addr;
938 900
939#ifdef SIIMAGE_LARGE_DMA
940/* Watch the brackets - even Ken and Dennis get some language design wrong */
941 hwif->dma_base = base + (ch ? 0x18 : 0x10);
942 hwif->dma_base2 = base + (ch ? 0x08 : 0x00);
943 hwif->dma_prdtable = hwif->dma_base2 + 4;
944#else /* ! SIIMAGE_LARGE_DMA */
945 hwif->dma_base = base + (ch ? 0x08 : 0x00); 901 hwif->dma_base = base + (ch ? 0x08 : 0x00);
946 hwif->dma_base2 = base + (ch ? 0x18 : 0x10); 902 hwif->dma_base2 = base + (ch ? 0x18 : 0x10);
947#endif /* SIIMAGE_LARGE_DMA */
948 hwif->mmio = 2; 903 hwif->mmio = 2;
949} 904}
950 905
@@ -1052,9 +1007,16 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
1052 hwif->reset_poll = &siimage_reset_poll; 1007 hwif->reset_poll = &siimage_reset_poll;
1053 hwif->pre_reset = &siimage_pre_reset; 1008 hwif->pre_reset = &siimage_pre_reset;
1054 1009
1055 if(is_sata(hwif)) 1010 if(is_sata(hwif)) {
1011 static int first = 1;
1012
1056 hwif->busproc = &siimage_busproc; 1013 hwif->busproc = &siimage_busproc;
1057 1014
1015 if (first) {
1016 printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
1017 first = 0;
1018 }
1019 }
1058 if (!hwif->dma_base) { 1020 if (!hwif->dma_base) {
1059 hwif->drives[0].autotune = 1; 1021 hwif->drives[0].autotune = 1;
1060 hwif->drives[1].autotune = 1; 1022 hwif->drives[1].autotune = 1;
@@ -1121,10 +1083,10 @@ static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_devi
1121} 1083}
1122 1084
1123static struct pci_device_id siimage_pci_tbl[] = { 1085static struct pci_device_id siimage_pci_tbl[] = {
1124 { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 1086 { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680), 0},
1125#ifdef CONFIG_BLK_DEV_IDE_SATA 1087#ifdef CONFIG_BLK_DEV_IDE_SATA
1126 { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 1088 { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112), 1},
1127 { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 1089 { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA), 2},
1128#endif 1090#endif
1129 { 0, }, 1091 { 0, },
1130}; 1092};
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 8a5c7b286b2b..900301e43818 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -447,7 +447,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
447 printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n", 447 printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n",
448 hwif->name, rev); 448 hwif->name, rev);
449 } else { 449 } else {
450#ifdef CONFIG_BLK_DEV_IDEDMA
451 dma_state |= 0x60; 450 dma_state |= 0x60;
452 451
453 hwif->atapi_dma = 1; 452 hwif->atapi_dma = 1;
@@ -468,7 +467,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
468 467
469 if (hwif->mate) 468 if (hwif->mate)
470 hwif->serialized = hwif->mate->serialized = 1; 469 hwif->serialized = hwif->mate->serialized = 1;
471#endif /* CONFIG_BLK_DEV_IDEDMA */
472 } 470 }
473 hwif->OUTB(dma_state, hwif->dma_base + 2); 471 hwif->OUTB(dma_state, hwif->dma_base + 2);
474} 472}
@@ -489,7 +487,7 @@ static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_dev
489} 487}
490 488
491static struct pci_device_id sl82c105_pci_tbl[] = { 489static struct pci_device_id sl82c105_pci_tbl[] = {
492 { PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 490 { PCI_DEVICE(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105), 0},
493 { 0, }, 491 { 0, },
494}; 492};
495MODULE_DEVICE_TABLE(pci, sl82c105_pci_tbl); 493MODULE_DEVICE_TABLE(pci, sl82c105_pci_tbl);
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 5112c726633b..0968f6bc669a 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -72,7 +72,8 @@ static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio)
72 u16 master_data; 72 u16 master_data;
73 u8 slave_data; 73 u8 slave_data;
74 /* ISP RTC */ 74 /* ISP RTC */
75 u8 timings[][2] = { { 0, 0 }, 75 static const u8 timings[][2]= {
76 { 0, 0 },
76 { 0, 0 }, 77 { 0, 0 },
77 { 1, 0 }, 78 { 1, 0 },
78 { 2, 1 }, 79 { 2, 1 },
@@ -119,7 +120,6 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
119 pci_read_config_word(dev, 0x4a, &reg4a); 120 pci_read_config_word(dev, 0x4a, &reg4a);
120 121
121 switch(speed) { 122 switch(speed) {
122#ifdef CONFIG_BLK_DEV_IDEDMA
123 case XFER_UDMA_4: u_speed = 4 << (drive->dn * 4); break; 123 case XFER_UDMA_4: u_speed = 4 << (drive->dn * 4); break;
124 case XFER_UDMA_3: u_speed = 3 << (drive->dn * 4); break; 124 case XFER_UDMA_3: u_speed = 3 << (drive->dn * 4); break;
125 case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break; 125 case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break;
@@ -128,7 +128,6 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
128 case XFER_MW_DMA_2: 128 case XFER_MW_DMA_2:
129 case XFER_MW_DMA_1: 129 case XFER_MW_DMA_1:
130 case XFER_SW_DMA_2: break; 130 case XFER_SW_DMA_2: break;
131#endif /* CONFIG_BLK_DEV_IDEDMA */
132 case XFER_PIO_4: 131 case XFER_PIO_4:
133 case XFER_PIO_3: 132 case XFER_PIO_3:
134 case XFER_PIO_2: 133 case XFER_PIO_2:
@@ -156,7 +155,6 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
156 return (ide_config_drive_speed(drive, speed)); 155 return (ide_config_drive_speed(drive, speed));
157} 156}
158 157
159#ifdef CONFIG_BLK_DEV_IDEDMA
160static int slc90e66_config_drive_for_dma (ide_drive_t *drive) 158static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
161{ 159{
162 u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive)); 160 u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive));
@@ -194,7 +192,6 @@ fast_ata_pio:
194 /* IORDY not supported */ 192 /* IORDY not supported */
195 return 0; 193 return 0;
196} 194}
197#endif /* CONFIG_BLK_DEV_IDEDMA */
198 195
199static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) 196static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
200{ 197{
@@ -222,7 +219,6 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
222 hwif->mwdma_mask = 0x07; 219 hwif->mwdma_mask = 0x07;
223 hwif->swdma_mask = 0x07; 220 hwif->swdma_mask = 0x07;
224 221
225#ifdef CONFIG_BLK_DEV_IDEDMA
226 if (!(hwif->udma_four)) 222 if (!(hwif->udma_four))
227 /* bit[0(1)]: 0:80, 1:40 */ 223 /* bit[0(1)]: 0:80, 1:40 */
228 hwif->udma_four = (reg47 & mask) ? 0 : 1; 224 hwif->udma_four = (reg47 & mask) ? 0 : 1;
@@ -232,7 +228,6 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
232 hwif->autodma = 1; 228 hwif->autodma = 1;
233 hwif->drives[0].autodma = hwif->autodma; 229 hwif->drives[0].autodma = hwif->autodma;
234 hwif->drives[1].autodma = hwif->autodma; 230 hwif->drives[1].autodma = hwif->autodma;
235#endif /* !CONFIG_BLK_DEV_IDEDMA */
236} 231}
237 232
238static ide_pci_device_t slc90e66_chipset __devinitdata = { 233static ide_pci_device_t slc90e66_chipset __devinitdata = {
@@ -250,7 +245,7 @@ static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_dev
250} 245}
251 246
252static struct pci_device_id slc90e66_pci_tbl[] = { 247static struct pci_device_id slc90e66_pci_tbl[] = {
253 { PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 248 { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1), 0},
254 { 0, }, 249 { 0, },
255}; 250};
256MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl); 251MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl);
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 6f31f054d1bb..5080e15c6d30 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -584,7 +584,7 @@ static struct db9 __init *db9_probe(int parport, int mode)
584 goto err_out; 584 goto err_out;
585 } 585 }
586 586
587 if (db9_mode[mode].bidirectional && !(pp->modes & PARPORT_MODE_TRISTATE)) { 587 if (db9_mode->bidirectional && !(pp->modes & PARPORT_MODE_TRISTATE)) {
588 printk(KERN_ERR "db9.c: specified parport is not bidirectional\n"); 588 printk(KERN_ERR "db9.c: specified parport is not bidirectional\n");
589 err = -EINVAL; 589 err = -EINVAL;
590 goto err_put_pp; 590 goto err_put_pp;
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index ffde8f86e0fb..ce1f10e8984b 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -459,7 +459,7 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
459 } 459 }
460 460
461 input_regs(dev, regs); 461 input_regs(dev, regs);
462 input_report_key(dev, keycode, value); 462 input_event(dev, EV_KEY, keycode, value);
463 input_sync(dev); 463 input_sync(dev);
464 464
465 if (value && add_release_event) { 465 if (value && add_release_event) {
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index e4e5be111c96..ccf0faeee5c1 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -285,6 +285,15 @@ static struct key_entry keymap_fujitsu_n3510[] = {
285 { KE_END, 0 } 285 { KE_END, 0 }
286}; 286};
287 287
288static 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
288static struct key_entry keymap_wistron_ms2141[] = { 297static struct key_entry keymap_wistron_ms2141[] = {
289 { KE_KEY, 0x11, KEY_PROG1 }, 298 { KE_KEY, 0x11, KEY_PROG1 },
290 { KE_KEY, 0x12, KEY_PROG2 }, 299 { KE_KEY, 0x12, KEY_PROG2 },
@@ -326,6 +335,7 @@ static struct key_entry keymap_aopen_1559as[] = {
326 { KE_WIFI, 0x30, 0 }, 335 { KE_WIFI, 0x30, 0 },
327 { KE_KEY, 0x31, KEY_MAIL }, 336 { KE_KEY, 0x31, KEY_MAIL },
328 { KE_KEY, 0x36, KEY_WWW }, 337 { KE_KEY, 0x36, KEY_WWW },
338 { KE_END, 0 },
329}; 339};
330 340
331/* 341/*
@@ -388,6 +398,15 @@ static struct dmi_system_id dmi_ids[] = {
388 }, 398 },
389 .driver_data = keymap_aopen_1559as 399 .driver_data = keymap_aopen_1559as
390 }, 400 },
401 {
402 .callback = dmi_matched,
403 .ident = "Medion MD 9783",
404 .matches = {
405 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
406 DMI_MATCH(DMI_PRODUCT_NAME, "MD 9783"),
407 },
408 .driver_data = keymap_wistron_ms2111
409 },
391 { NULL, } 410 { NULL, }
392}; 411};
393 412
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index bccff400b198..f2fc81a9074d 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -162,6 +162,16 @@ config RTC_DRV_PCF8583
162 This driver can also be built as a module. If so, the module 162 This driver can also be built as a module. If so, the module
163 will be called rtc-pcf8583. 163 will be called rtc-pcf8583.
164 164
165config 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
165config RTC_DRV_RS5C372 175config RTC_DRV_RS5C372
166 tristate "Ricoh RS5C372A/B" 176 tristate "Ricoh RS5C372A/B"
167 depends on RTC_CLASS && I2C 177 depends on RTC_CLASS && I2C
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 900d210dd1a2..da5e38774e13 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o
19obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o 19obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
20obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o 20obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
21obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o 21obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o
22obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o
22obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o 23obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o
23obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o 24obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o
24obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o 25obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
new file mode 100644
index 000000000000..0964d1dba925
--- /dev/null
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -0,0 +1,246 @@
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
56struct rs5c348_plat_data {
57 struct rtc_device *rtc;
58 int rtc_24h;
59};
60
61static int
62rs5c348_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
97static int
98rs5c348_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
143static struct rtc_class_ops rs5c348_rtc_ops = {
144 .read_time = rs5c348_rtc_read_time,
145 .set_time = rs5c348_rtc_set_time,
146};
147
148static struct spi_driver rs5c348_driver;
149
150static 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
209static 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
220static 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
230static __init int rs5c348_init(void)
231{
232 return spi_register_driver(&rs5c348_driver);
233}
234
235static __exit void rs5c348_exit(void)
236{
237 spi_unregister_driver(&rs5c348_driver);
238}
239
240module_init(rs5c348_init);
241module_exit(rs5c348_exit);
242
243MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
244MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver");
245MODULE_LICENSE("GPL");
246MODULE_VERSION(DRV_VERSION);
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index b88a7c1158af..bff94541991c 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -131,17 +131,6 @@ static int m68328_console_baud = CONSOLE_BAUD_RATE;
131static int m68328_console_cbaud = DEFAULT_CBAUD; 131static int m68328_console_cbaud = DEFAULT_CBAUD;
132 132
133 133
134/*
135 * tmp_buf is used as a temporary buffer by serial_write. We need to
136 * lock it in case the memcpy_fromfs blocks while swapping in a page,
137 * and some other program tries to do a serial write at the same time.
138 * Since the lock will only come under contention when the system is
139 * swapping and available memory is low, it makes sense to share one
140 * buffer across all the serial ports, since it significantly saves
141 * memory if large numbers of serial ports are open.
142 */
143static unsigned char tmp_buf[SERIAL_XMIT_SIZE]; /* This is cheating */
144
145static inline int serial_paranoia_check(struct m68k_serial *info, 134static inline int serial_paranoia_check(struct m68k_serial *info,
146 char *name, const char *routine) 135 char *name, const char *routine)
147{ 136{
@@ -211,16 +200,16 @@ static void rs_stop(struct tty_struct *tty)
211 if (serial_paranoia_check(info, tty->name, "rs_stop")) 200 if (serial_paranoia_check(info, tty->name, "rs_stop"))
212 return; 201 return;
213 202
214 save_flags(flags); cli(); 203 local_irq_save(flags);
215 uart->ustcnt &= ~USTCNT_TXEN; 204 uart->ustcnt &= ~USTCNT_TXEN;
216 restore_flags(flags); 205 local_irq_restore(flags);
217} 206}
218 207
219static void rs_put_char(char ch) 208static void rs_put_char(char ch)
220{ 209{
221 int flags, loops = 0; 210 int flags, loops = 0;
222 211
223 save_flags(flags); cli(); 212 local_irq_save(flags);
224 213
225 while (!(UTX & UTX_TX_AVAIL) && (loops < 1000)) { 214 while (!(UTX & UTX_TX_AVAIL) && (loops < 1000)) {
226 loops++; 215 loops++;
@@ -229,7 +218,7 @@ static void rs_put_char(char ch)
229 218
230 UTX_TXDATA = ch; 219 UTX_TXDATA = ch;
231 udelay(5); 220 udelay(5);
232 restore_flags(flags); 221 local_irq_restore(flags);
233} 222}
234 223
235static void rs_start(struct tty_struct *tty) 224static void rs_start(struct tty_struct *tty)
@@ -241,7 +230,7 @@ static void rs_start(struct tty_struct *tty)
241 if (serial_paranoia_check(info, tty->name, "rs_start")) 230 if (serial_paranoia_check(info, tty->name, "rs_start"))
242 return; 231 return;
243 232
244 save_flags(flags); cli(); 233 local_irq_save(flags);
245 if (info->xmit_cnt && info->xmit_buf && !(uart->ustcnt & USTCNT_TXEN)) { 234 if (info->xmit_cnt && info->xmit_buf && !(uart->ustcnt & USTCNT_TXEN)) {
246#ifdef USE_INTS 235#ifdef USE_INTS
247 uart->ustcnt |= USTCNT_TXEN | USTCNT_TX_INTR_MASK; 236 uart->ustcnt |= USTCNT_TXEN | USTCNT_TX_INTR_MASK;
@@ -249,7 +238,7 @@ static void rs_start(struct tty_struct *tty)
249 uart->ustcnt |= USTCNT_TXEN; 238 uart->ustcnt |= USTCNT_TXEN;
250#endif 239#endif
251 } 240 }
252 restore_flags(flags); 241 local_irq_restore(flags);
253} 242}
254 243
255/* Drop into either the boot monitor or kadb upon receiving a break 244/* Drop into either the boot monitor or kadb upon receiving a break
@@ -327,14 +316,6 @@ static void receive_chars(struct m68k_serial *info, struct pt_regs *regs,
327 if(!tty) 316 if(!tty)
328 goto clear_and_exit; 317 goto clear_and_exit;
329 318
330 /*
331 * Make sure that we do not overflow the buffer
332 */
333 if (tty_request_buffer_room(tty, 1) == 0) {
334 tty_schedule_flip(tty);
335 return;
336 }
337
338 flag = TTY_NORMAL; 319 flag = TTY_NORMAL;
339 320
340 if(rx & URX_PARITY_ERROR) { 321 if(rx & URX_PARITY_ERROR) {
@@ -473,7 +454,7 @@ static int startup(struct m68k_serial * info)
473 return -ENOMEM; 454 return -ENOMEM;
474 } 455 }
475 456
476 save_flags(flags); cli(); 457 local_irq_save(flags);
477 458
478 /* 459 /*
479 * Clear the FIFO buffers and disable them 460 * Clear the FIFO buffers and disable them
@@ -506,7 +487,7 @@ static int startup(struct m68k_serial * info)
506 change_speed(info); 487 change_speed(info);
507 488
508 info->flags |= S_INITIALIZED; 489 info->flags |= S_INITIALIZED;
509 restore_flags(flags); 490 local_irq_restore(flags);
510 return 0; 491 return 0;
511} 492}
512 493
@@ -523,7 +504,7 @@ static void shutdown(struct m68k_serial * info)
523 if (!(info->flags & S_INITIALIZED)) 504 if (!(info->flags & S_INITIALIZED))
524 return; 505 return;
525 506
526 save_flags(flags); cli(); /* Disable interrupts */ 507 local_irq_save(flags);
527 508
528 if (info->xmit_buf) { 509 if (info->xmit_buf) {
529 free_page((unsigned long) info->xmit_buf); 510 free_page((unsigned long) info->xmit_buf);
@@ -534,7 +515,7 @@ static void shutdown(struct m68k_serial * info)
534 set_bit(TTY_IO_ERROR, &info->tty->flags); 515 set_bit(TTY_IO_ERROR, &info->tty->flags);
535 516
536 info->flags &= ~S_INITIALIZED; 517 info->flags &= ~S_INITIALIZED;
537 restore_flags(flags); 518 local_irq_restore(flags);
538} 519}
539 520
540struct { 521struct {
@@ -655,24 +636,24 @@ static void rs_fair_output(void)
655 if (info == 0) return; 636 if (info == 0) return;
656 if (info->xmit_buf == 0) return; 637 if (info->xmit_buf == 0) return;
657 638
658 save_flags(flags); cli(); 639 local_irq_save(flags);
659 left = info->xmit_cnt; 640 left = info->xmit_cnt;
660 while (left != 0) { 641 while (left != 0) {
661 c = info->xmit_buf[info->xmit_tail]; 642 c = info->xmit_buf[info->xmit_tail];
662 info->xmit_tail = (info->xmit_tail+1) & (SERIAL_XMIT_SIZE-1); 643 info->xmit_tail = (info->xmit_tail+1) & (SERIAL_XMIT_SIZE-1);
663 info->xmit_cnt--; 644 info->xmit_cnt--;
664 restore_flags(flags); 645 local_irq_restore(flags);
665 646
666 rs_put_char(c); 647 rs_put_char(c);
667 648
668 save_flags(flags); cli(); 649 local_irq_save(flags);
669 left = min(info->xmit_cnt, left-1); 650 left = min(info->xmit_cnt, left-1);
670 } 651 }
671 652
672 /* Last character is being transmitted now (hopefully). */ 653 /* Last character is being transmitted now (hopefully). */
673 udelay(5); 654 udelay(5);
674 655
675 restore_flags(flags); 656 local_irq_restore(flags);
676 return; 657 return;
677} 658}
678 659
@@ -720,11 +701,11 @@ static void rs_flush_chars(struct tty_struct *tty)
720#endif 701#endif
721 702
722 /* Enable transmitter */ 703 /* Enable transmitter */
723 save_flags(flags); cli(); 704 local_irq_save(flags);
724 705
725 if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 706 if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
726 !info->xmit_buf) { 707 !info->xmit_buf) {
727 restore_flags(flags); 708 local_irq_restore(flags);
728 return; 709 return;
729 } 710 }
730 711
@@ -749,7 +730,7 @@ static void rs_flush_chars(struct tty_struct *tty)
749 while (!(uart->utx.w & UTX_TX_AVAIL)) udelay(5); 730 while (!(uart->utx.w & UTX_TX_AVAIL)) udelay(5);
750 } 731 }
751#endif 732#endif
752 restore_flags(flags); 733 local_irq_restore(flags);
753} 734}
754 735
755extern void console_printn(const char * b, int count); 736extern void console_printn(const char * b, int count);
@@ -768,18 +749,22 @@ static int rs_write(struct tty_struct * tty,
768 if (!tty || !info->xmit_buf) 749 if (!tty || !info->xmit_buf)
769 return 0; 750 return 0;
770 751
771 save_flags(flags); 752 local_save_flags(flags);
772 while (1) { 753 while (1) {
773 cli(); 754 local_irq_disable();
774 c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, 755 c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
775 SERIAL_XMIT_SIZE - info->xmit_head)); 756 SERIAL_XMIT_SIZE - info->xmit_head));
757 local_irq_restore(flags);
758
776 if (c <= 0) 759 if (c <= 0)
777 break; 760 break;
778 761
779 memcpy(info->xmit_buf + info->xmit_head, buf, c); 762 memcpy(info->xmit_buf + info->xmit_head, buf, c);
763
764 local_irq_disable();
780 info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); 765 info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
781 info->xmit_cnt += c; 766 info->xmit_cnt += c;
782 restore_flags(flags); 767 local_irq_restore(flags);
783 buf += c; 768 buf += c;
784 count -= c; 769 count -= c;
785 total += c; 770 total += c;
@@ -787,7 +772,7 @@ static int rs_write(struct tty_struct * tty,
787 772
788 if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) { 773 if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) {
789 /* Enable transmitter */ 774 /* Enable transmitter */
790 cli(); 775 local_irq_disable();
791#ifndef USE_INTS 776#ifndef USE_INTS
792 while(info->xmit_cnt) { 777 while(info->xmit_cnt) {
793#endif 778#endif
@@ -807,9 +792,9 @@ static int rs_write(struct tty_struct * tty,
807#ifndef USE_INTS 792#ifndef USE_INTS
808 } 793 }
809#endif 794#endif
810 restore_flags(flags); 795 local_irq_restore(flags);
811 } 796 }
812 restore_flags(flags); 797
813 return total; 798 return total;
814} 799}
815 800
@@ -838,12 +823,13 @@ static int rs_chars_in_buffer(struct tty_struct *tty)
838static void rs_flush_buffer(struct tty_struct *tty) 823static void rs_flush_buffer(struct tty_struct *tty)
839{ 824{
840 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; 825 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data;
826 unsigned long flags;
841 827
842 if (serial_paranoia_check(info, tty->name, "rs_flush_buffer")) 828 if (serial_paranoia_check(info, tty->name, "rs_flush_buffer"))
843 return; 829 return;
844 cli(); 830 local_irq_save(flags);
845 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 831 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
846 sti(); 832 local_irq_restore(flags);
847 tty_wakeup(tty); 833 tty_wakeup(tty);
848} 834}
849 835
@@ -973,14 +959,15 @@ static int get_lsr_info(struct m68k_serial * info, unsigned int *value)
973 m68328_uart *uart = &uart_addr[info->line]; 959 m68328_uart *uart = &uart_addr[info->line];
974#endif 960#endif
975 unsigned char status; 961 unsigned char status;
962 unsigned long flags;
976 963
977 cli(); 964 local_irq_save(flags);
978#ifdef CONFIG_SERIAL_68328_RTS_CTS 965#ifdef CONFIG_SERIAL_68328_RTS_CTS
979 status = (uart->utx.w & UTX_CTS_STAT) ? 1 : 0; 966 status = (uart->utx.w & UTX_CTS_STAT) ? 1 : 0;
980#else 967#else
981 status = 0; 968 status = 0;
982#endif 969#endif
983 sti(); 970 local_irq_restore(flags);
984 put_user(status,value); 971 put_user(status,value);
985 return 0; 972 return 0;
986} 973}
@@ -994,14 +981,13 @@ static void send_break(struct m68k_serial * info, unsigned int duration)
994 unsigned long flags; 981 unsigned long flags;
995 if (!info->port) 982 if (!info->port)
996 return; 983 return;
997 save_flags(flags); 984 local_irq_save(flags);
998 cli();
999#ifdef USE_INTS 985#ifdef USE_INTS
1000 uart->utx.w |= UTX_SEND_BREAK; 986 uart->utx.w |= UTX_SEND_BREAK;
1001 msleep_interruptible(duration); 987 msleep_interruptible(duration);
1002 uart->utx.w &= ~UTX_SEND_BREAK; 988 uart->utx.w &= ~UTX_SEND_BREAK;
1003#endif 989#endif
1004 restore_flags(flags); 990 local_irq_restore(flags);
1005} 991}
1006 992
1007static int rs_ioctl(struct tty_struct *tty, struct file * file, 993static int rs_ioctl(struct tty_struct *tty, struct file * file,
@@ -1060,7 +1046,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
1060 (struct serial_struct *) arg); 1046 (struct serial_struct *) arg);
1061 case TIOCSERGETLSR: /* Get line status register */ 1047 case TIOCSERGETLSR: /* Get line status register */
1062 if (access_ok(VERIFY_WRITE, (void *) arg, 1048 if (access_ok(VERIFY_WRITE, (void *) arg,
1063 sizeof(unsigned int)); 1049 sizeof(unsigned int)))
1064 return get_lsr_info(info, (unsigned int *) arg); 1050 return get_lsr_info(info, (unsigned int *) arg);
1065 return -EFAULT; 1051 return -EFAULT;
1066 case TIOCSERGSTRUCT: 1052 case TIOCSERGSTRUCT:
@@ -1113,10 +1099,10 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1113 if (!info || serial_paranoia_check(info, tty->name, "rs_close")) 1099 if (!info || serial_paranoia_check(info, tty->name, "rs_close"))
1114 return; 1100 return;
1115 1101
1116 save_flags(flags); cli(); 1102 local_irq_save(flags);
1117 1103
1118 if (tty_hung_up_p(filp)) { 1104 if (tty_hung_up_p(filp)) {
1119 restore_flags(flags); 1105 local_irq_restore(flags);
1120 return; 1106 return;
1121 } 1107 }
1122 1108
@@ -1138,7 +1124,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1138 info->count = 0; 1124 info->count = 0;
1139 } 1125 }
1140 if (info->count) { 1126 if (info->count) {
1141 restore_flags(flags); 1127 local_irq_restore(flags);
1142 return; 1128 return;
1143 } 1129 }
1144 info->flags |= S_CLOSING; 1130 info->flags |= S_CLOSING;
@@ -1186,7 +1172,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1186 } 1172 }
1187 info->flags &= ~(S_NORMAL_ACTIVE|S_CLOSING); 1173 info->flags &= ~(S_NORMAL_ACTIVE|S_CLOSING);
1188 wake_up_interruptible(&info->close_wait); 1174 wake_up_interruptible(&info->close_wait);
1189 restore_flags(flags); 1175 local_irq_restore(flags);
1190} 1176}
1191 1177
1192/* 1178/*
@@ -1262,9 +1248,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1262 info->count--; 1248 info->count--;
1263 info->blocked_open++; 1249 info->blocked_open++;
1264 while (1) { 1250 while (1) {
1265 cli(); 1251 local_irq_disable();
1266 m68k_rtsdtr(info, 1); 1252 m68k_rtsdtr(info, 1);
1267 sti(); 1253 local_irq_enable();
1268 current->state = TASK_INTERRUPTIBLE; 1254 current->state = TASK_INTERRUPTIBLE;
1269 if (tty_hung_up_p(filp) || 1255 if (tty_hung_up_p(filp) ||
1270 !(info->flags & S_INITIALIZED)) { 1256 !(info->flags & S_INITIALIZED)) {
@@ -1444,7 +1430,7 @@ rs68328_init(void)
1444 return -ENOMEM; 1430 return -ENOMEM;
1445 } 1431 }
1446 1432
1447 save_flags(flags); cli(); 1433 local_irq_save(flags);
1448 1434
1449 for(i=0;i<NR_PORTS;i++) { 1435 for(i=0;i<NR_PORTS;i++) {
1450 1436
@@ -1489,7 +1475,7 @@ rs68328_init(void)
1489 serial_pm[i]->data = info; 1475 serial_pm[i]->data = info;
1490#endif 1476#endif
1491 } 1477 }
1492 restore_flags(flags); 1478 local_irq_restore(flags);
1493 return 0; 1479 return 0;
1494} 1480}
1495 1481
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 89700141f87e..5cacc5e74a92 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -2573,12 +2573,6 @@ static void flush_to_flip_buffer(struct e100_serial *info)
2573 2573
2574 DFLIP( 2574 DFLIP(
2575 if (1) { 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); 2576 DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx);
2583 DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty)); 2577 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)); 2578 DEBUG_LOG(info->line, "room %lu\n", tty->ldisc.receive_room(tty));
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 7d823705193c..f8262e6ad8d3 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -589,13 +589,6 @@ void jsm_input(struct jsm_channel *ch)
589 ld = tty_ldisc_ref(tp); 589 ld = tty_ldisc_ref(tp);
590 590
591 /* 591 /*
592 * If the DONT_FLIP flag is on, don't flush our buffer, and act
593 * like the ld doesn't have any space to put the data right now.
594 */
595 if (test_bit(TTY_DONT_FLIP, &tp->flags))
596 len = 0;
597
598 /*
599 * If we were unable to get a reference to the ld, 592 * If we were unable to get a reference to the ld,
600 * don't flush our buffer, and act like the ld doesn't 593 * don't flush our buffer, and act like the ld doesn't
601 * have any space to put the data right now. 594 * have any space to put the data right now.
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1cea4a6799fe..ed1cdf6ac8f3 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -210,6 +210,7 @@ spi_new_device(struct spi_master *master, struct spi_board_info *chip)
210 proxy->master = master; 210 proxy->master = master;
211 proxy->chip_select = chip->chip_select; 211 proxy->chip_select = chip->chip_select;
212 proxy->max_speed_hz = chip->max_speed_hz; 212 proxy->max_speed_hz = chip->max_speed_hz;
213 proxy->mode = chip->mode;
213 proxy->irq = chip->irq; 214 proxy->irq = chip->irq;
214 proxy->modalias = chip->modalias; 215 proxy->modalias = chip->modalias;
215 216
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 9432c7302275..d7f3f736a692 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -453,8 +453,7 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
453 tty = port->tty; 453 tty = port->tty;
454 454
455 /* 455 /*
456 * FIXME: must not do this in IRQ context, 456 * FIXME: must not do this in IRQ context
457 * must honour TTY_DONT_FLIP
458 */ 457 */
459 tty->ldisc.receive_buf( 458 tty->ldisc.receive_buf(
460 tty, 459 tty,
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c
index 7de66b855d4e..1755dddf1899 100644
--- a/drivers/video/aty/radeon_backlight.c
+++ b/drivers/video/aty/radeon_backlight.c
@@ -40,14 +40,14 @@ static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata,
40 40
41 mutex_unlock(&info->bl_mutex); 41 mutex_unlock(&info->bl_mutex);
42 42
43 if (pdata->negative)
44 rlevel = MAX_RADEON_LEVEL - rlevel;
45
46 if (rlevel < 0) 43 if (rlevel < 0)
47 rlevel = 0; 44 rlevel = 0;
48 else if (rlevel > MAX_RADEON_LEVEL) 45 else if (rlevel > MAX_RADEON_LEVEL)
49 rlevel = MAX_RADEON_LEVEL; 46 rlevel = MAX_RADEON_LEVEL;
50 47
48 if (pdata->negative)
49 rlevel = MAX_RADEON_LEVEL - rlevel;
50
51 return rlevel; 51 return rlevel;
52} 52}
53 53
diff --git a/fs/9p/mux.c b/fs/9p/mux.c
index 12e1baa4508d..8d45ed668837 100644
--- a/fs/9p/mux.c
+++ b/fs/9p/mux.c
@@ -932,6 +932,8 @@ v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc,
932 r.rcall || r.err); 932 r.rcall || r.err);
933 } while (!r.rcall && !r.err && err==-ERESTARTSYS && 933 } while (!r.rcall && !r.err && err==-ERESTARTSYS &&
934 m->trans->status==Connected && !m->err); 934 m->trans->status==Connected && !m->err);
935
936 err = -ERESTARTSYS;
935 } 937 }
936 sigpending = 1; 938 sigpending = 1;
937 } 939 }
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index f867b8d3e973..450b0c1b385e 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -38,7 +38,7 @@
38 */ 38 */
39 39
40extern struct file_system_type v9fs_fs_type; 40extern struct file_system_type v9fs_fs_type;
41extern struct address_space_operations v9fs_addr_operations; 41extern const struct address_space_operations v9fs_addr_operations;
42extern const struct file_operations v9fs_file_operations; 42extern const struct file_operations v9fs_file_operations;
43extern const struct file_operations v9fs_dir_operations; 43extern const struct file_operations v9fs_dir_operations;
44extern struct dentry_operations v9fs_dentry_operations; 44extern struct dentry_operations v9fs_dentry_operations;
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index efda46fb64d9..d4f0aa3c87f2 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -103,6 +103,6 @@ UnmapAndUnlock:
103 return retval; 103 return retval;
104} 104}
105 105
106struct address_space_operations v9fs_addr_operations = { 106const struct address_space_operations v9fs_addr_operations = {
107 .readpage = v9fs_vfs_readpage, 107 .readpage = v9fs_vfs_readpage,
108}; 108};
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 5c6bdf82146c..2f580a197b8d 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -300,7 +300,7 @@ clunk_fid:
300 fid = V9FS_NOFID; 300 fid = V9FS_NOFID;
301 301
302put_fid: 302put_fid:
303 if (fid >= 0) 303 if (fid != V9FS_NOFID)
304 v9fs_put_idpool(fid, &v9ses->fidpool); 304 v9fs_put_idpool(fid, &v9ses->fidpool);
305 305
306 kfree(fcall); 306 kfree(fcall);
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index a02802a30798..534f3eecc985 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -72,7 +72,7 @@ static sector_t _adfs_bmap(struct address_space *mapping, sector_t block)
72 return generic_block_bmap(mapping, block, adfs_get_block); 72 return generic_block_bmap(mapping, block, adfs_get_block);
73} 73}
74 74
75static struct address_space_operations adfs_aops = { 75static const struct address_space_operations adfs_aops = {
76 .readpage = adfs_readpage, 76 .readpage = adfs_readpage,
77 .writepage = adfs_writepage, 77 .writepage = adfs_writepage,
78 .sync_page = block_sync_page, 78 .sync_page = block_sync_page,
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index a43a876742b8..0ddd4cc0d1a0 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -195,9 +195,9 @@ extern struct inode_operations affs_symlink_inode_operations;
195extern const struct file_operations affs_file_operations; 195extern const struct file_operations affs_file_operations;
196extern const struct file_operations affs_file_operations_ofs; 196extern const struct file_operations affs_file_operations_ofs;
197extern const struct file_operations affs_dir_operations; 197extern const struct file_operations affs_dir_operations;
198extern struct address_space_operations affs_symlink_aops; 198extern const struct address_space_operations affs_symlink_aops;
199extern struct address_space_operations affs_aops; 199extern const struct address_space_operations affs_aops;
200extern struct address_space_operations affs_aops_ofs; 200extern const struct address_space_operations affs_aops_ofs;
201 201
202extern struct dentry_operations affs_dentry_operations; 202extern struct dentry_operations affs_dentry_operations;
203extern struct dentry_operations affs_dentry_operations_intl; 203extern struct dentry_operations affs_dentry_operations_intl;
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 7076262af39b..3de8590e4f6a 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -406,7 +406,7 @@ static sector_t _affs_bmap(struct address_space *mapping, sector_t block)
406{ 406{
407 return generic_block_bmap(mapping,block,affs_get_block); 407 return generic_block_bmap(mapping,block,affs_get_block);
408} 408}
409struct address_space_operations affs_aops = { 409const struct address_space_operations affs_aops = {
410 .readpage = affs_readpage, 410 .readpage = affs_readpage,
411 .writepage = affs_writepage, 411 .writepage = affs_writepage,
412 .sync_page = block_sync_page, 412 .sync_page = block_sync_page,
@@ -759,7 +759,7 @@ out:
759 goto done; 759 goto done;
760} 760}
761 761
762struct address_space_operations affs_aops_ofs = { 762const struct address_space_operations affs_aops_ofs = {
763 .readpage = affs_readpage_ofs, 763 .readpage = affs_readpage_ofs,
764 //.writepage = affs_writepage_ofs, 764 //.writepage = affs_writepage_ofs,
765 //.sync_page = affs_sync_page_ofs, 765 //.sync_page = affs_sync_page_ofs,
diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c
index 426f0f094f23..f802256a5933 100644
--- a/fs/affs/symlink.c
+++ b/fs/affs/symlink.c
@@ -66,7 +66,7 @@ fail:
66 return err; 66 return err;
67} 67}
68 68
69struct address_space_operations affs_symlink_aops = { 69const struct address_space_operations affs_symlink_aops = {
70 .readpage = affs_symlink_readpage, 70 .readpage = affs_symlink_readpage,
71}; 71};
72 72
diff --git a/fs/afs/file.c b/fs/afs/file.c
index 7bb716887e29..67d6634101fd 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -35,7 +35,7 @@ struct inode_operations afs_file_inode_operations = {
35 .getattr = afs_inode_getattr, 35 .getattr = afs_inode_getattr,
36}; 36};
37 37
38struct address_space_operations afs_fs_aops = { 38const struct address_space_operations afs_fs_aops = {
39 .readpage = afs_file_readpage, 39 .readpage = afs_file_readpage,
40 .sync_page = block_sync_page, 40 .sync_page = block_sync_page,
41 .set_page_dirty = __set_page_dirty_nobuffers, 41 .set_page_dirty = __set_page_dirty_nobuffers,
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 72febdf9a35a..e88b3b65ae49 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -69,7 +69,7 @@ extern const struct file_operations afs_dir_file_operations;
69/* 69/*
70 * file.c 70 * file.c
71 */ 71 */
72extern struct address_space_operations afs_fs_aops; 72extern const struct address_space_operations afs_fs_aops;
73extern struct inode_operations afs_file_inode_operations; 73extern struct inode_operations afs_file_inode_operations;
74 74
75#ifdef AFS_CACHING_SUPPORT 75#ifdef AFS_CACHING_SUPPORT
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 08201fab26cd..a83e889a97cd 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -73,7 +73,7 @@ static struct inode_operations befs_dir_inode_operations = {
73 .lookup = befs_lookup, 73 .lookup = befs_lookup,
74}; 74};
75 75
76static struct address_space_operations befs_aops = { 76static const struct address_space_operations befs_aops = {
77 .readpage = befs_readpage, 77 .readpage = befs_readpage,
78 .sync_page = block_sync_page, 78 .sync_page = block_sync_page,
79 .bmap = befs_bmap, 79 .bmap = befs_bmap,
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 9d791004b21c..31973bbbf057 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -50,7 +50,7 @@ static inline struct bfs_inode_info *BFS_I(struct inode *inode)
50/* file.c */ 50/* file.c */
51extern struct inode_operations bfs_file_inops; 51extern struct inode_operations bfs_file_inops;
52extern const struct file_operations bfs_file_operations; 52extern const struct file_operations bfs_file_operations;
53extern struct address_space_operations bfs_aops; 53extern const struct address_space_operations bfs_aops;
54 54
55/* dir.c */ 55/* dir.c */
56extern struct inode_operations bfs_dir_inops; 56extern struct inode_operations bfs_dir_inops;
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index d83cd74a2e4e..3d5aca28a0a0 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -153,7 +153,7 @@ static sector_t bfs_bmap(struct address_space *mapping, sector_t block)
153 return generic_block_bmap(mapping, block, bfs_get_block); 153 return generic_block_bmap(mapping, block, bfs_get_block);
154} 154}
155 155
156struct address_space_operations bfs_aops = { 156const struct address_space_operations bfs_aops = {
157 .readpage = bfs_readpage, 157 .readpage = bfs_readpage,
158 .writepage = bfs_writepage, 158 .writepage = bfs_writepage,
159 .sync_page = block_sync_page, 159 .sync_page = block_sync_page,
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 028d9fb9c2d5..7f7600e2381c 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1095,7 +1095,7 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
1095 return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); 1095 return blkdev_ioctl(file->f_mapping->host, file, cmd, arg);
1096} 1096}
1097 1097
1098struct address_space_operations def_blk_aops = { 1098const struct address_space_operations def_blk_aops = {
1099 .readpage = blkdev_readpage, 1099 .readpage = blkdev_readpage,
1100 .writepage = blkdev_writepage, 1100 .writepage = blkdev_writepage,
1101 .sync_page = block_sync_page, 1101 .sync_page = block_sync_page,
diff --git a/fs/buffer.c b/fs/buffer.c
index f23bb647db47..e9994722f4a3 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2598,7 +2598,7 @@ int nobh_truncate_page(struct address_space *mapping, loff_t from)
2598 unsigned offset = from & (PAGE_CACHE_SIZE-1); 2598 unsigned offset = from & (PAGE_CACHE_SIZE-1);
2599 unsigned to; 2599 unsigned to;
2600 struct page *page; 2600 struct page *page;
2601 struct address_space_operations *a_ops = mapping->a_ops; 2601 const struct address_space_operations *a_ops = mapping->a_ops;
2602 char *kaddr; 2602 char *kaddr;
2603 int ret = 0; 2603 int ret = 0;
2604 2604
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index a6384d83fdef..8f75c6f24701 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -32,8 +32,8 @@
32#define TRUE 1 32#define TRUE 1
33#endif 33#endif
34 34
35extern struct address_space_operations cifs_addr_ops; 35extern const struct address_space_operations cifs_addr_ops;
36extern struct address_space_operations cifs_addr_ops_smallbuf; 36extern const struct address_space_operations cifs_addr_ops_smallbuf;
37 37
38/* Functions related to super block operations */ 38/* Functions related to super block operations */
39extern struct super_operations cifs_super_ops; 39extern struct super_operations cifs_super_ops;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e9c1573f6aa7..5861eb42e626 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1942,7 +1942,7 @@ static int cifs_prepare_write(struct file *file, struct page *page,
1942 return 0; 1942 return 0;
1943} 1943}
1944 1944
1945struct address_space_operations cifs_addr_ops = { 1945const struct address_space_operations cifs_addr_ops = {
1946 .readpage = cifs_readpage, 1946 .readpage = cifs_readpage,
1947 .readpages = cifs_readpages, 1947 .readpages = cifs_readpages,
1948 .writepage = cifs_writepage, 1948 .writepage = cifs_writepage,
@@ -1959,7 +1959,7 @@ struct address_space_operations cifs_addr_ops = {
1959 * contain the header plus one complete page of data. Otherwise, we need 1959 * contain the header plus one complete page of data. Otherwise, we need
1960 * to leave cifs_readpages out of the address space operations. 1960 * to leave cifs_readpages out of the address space operations.
1961 */ 1961 */
1962struct address_space_operations cifs_addr_ops_smallbuf = { 1962const struct address_space_operations cifs_addr_ops_smallbuf = {
1963 .readpage = cifs_readpage, 1963 .readpage = cifs_readpage,
1964 .writepage = cifs_writepage, 1964 .writepage = cifs_writepage,
1965 .writepages = cifs_writepages, 1965 .writepages = cifs_writepages,
diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c
index b35e5bbd9c99..76e00a65a75b 100644
--- a/fs/coda/symlink.c
+++ b/fs/coda/symlink.c
@@ -50,6 +50,6 @@ fail:
50 return error; 50 return error;
51} 51}
52 52
53struct address_space_operations coda_symlink_aops = { 53const struct address_space_operations coda_symlink_aops = {
54 .readpage = coda_symlink_filler, 54 .readpage = coda_symlink_filler,
55}; 55};
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index c153bd9534cb..e14488ca6411 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -38,7 +38,7 @@
38 38
39extern struct super_block * configfs_sb; 39extern struct super_block * configfs_sb;
40 40
41static struct address_space_operations configfs_aops = { 41static const struct address_space_operations configfs_aops = {
42 .readpage = simple_readpage, 42 .readpage = simple_readpage,
43 .prepare_write = simple_prepare_write, 43 .prepare_write = simple_prepare_write,
44 .commit_write = simple_commit_write 44 .commit_write = simple_commit_write
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index c45d73860803..223c0431042d 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -30,7 +30,7 @@
30static struct super_operations cramfs_ops; 30static struct super_operations cramfs_ops;
31static struct inode_operations cramfs_dir_inode_operations; 31static struct inode_operations cramfs_dir_inode_operations;
32static const struct file_operations cramfs_directory_operations; 32static const struct file_operations cramfs_directory_operations;
33static struct address_space_operations cramfs_aops; 33static const struct address_space_operations cramfs_aops;
34 34
35static DEFINE_MUTEX(read_mutex); 35static DEFINE_MUTEX(read_mutex);
36 36
@@ -501,7 +501,7 @@ static int cramfs_readpage(struct file *file, struct page * page)
501 return 0; 501 return 0;
502} 502}
503 503
504static struct address_space_operations cramfs_aops = { 504static const struct address_space_operations cramfs_aops = {
505 .readpage = cramfs_readpage 505 .readpage = cramfs_readpage
506}; 506};
507 507
diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index 180607f9314d..174696f9bf14 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -21,7 +21,7 @@ static sector_t _efs_bmap(struct address_space *mapping, sector_t block)
21{ 21{
22 return generic_block_bmap(mapping,block,efs_get_block); 22 return generic_block_bmap(mapping,block,efs_get_block);
23} 23}
24static struct address_space_operations efs_aops = { 24static const struct address_space_operations efs_aops = {
25 .readpage = efs_readpage, 25 .readpage = efs_readpage,
26 .sync_page = block_sync_page, 26 .sync_page = block_sync_page,
27 .bmap = _efs_bmap 27 .bmap = _efs_bmap
diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c
index 3d9a350e3e7f..e249cf733a6b 100644
--- a/fs/efs/symlink.c
+++ b/fs/efs/symlink.c
@@ -53,6 +53,6 @@ fail:
53 return err; 53 return err;
54} 54}
55 55
56struct address_space_operations efs_symlink_aops = { 56const struct address_space_operations efs_symlink_aops = {
57 .readpage = efs_symlink_readpage 57 .readpage = efs_symlink_readpage
58}; 58};
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 9f74a62be555..e65a019fc7a5 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -162,9 +162,9 @@ extern const struct file_operations ext2_file_operations;
162extern const struct file_operations ext2_xip_file_operations; 162extern const struct file_operations ext2_xip_file_operations;
163 163
164/* inode.c */ 164/* inode.c */
165extern struct address_space_operations ext2_aops; 165extern const struct address_space_operations ext2_aops;
166extern struct address_space_operations ext2_aops_xip; 166extern const struct address_space_operations ext2_aops_xip;
167extern struct address_space_operations ext2_nobh_aops; 167extern const struct address_space_operations ext2_nobh_aops;
168 168
169/* namei.c */ 169/* namei.c */
170extern struct inode_operations ext2_dir_inode_operations; 170extern struct inode_operations ext2_dir_inode_operations;
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 04af9c45dce2..fb4d3220eb8d 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -684,7 +684,7 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
684 return mpage_writepages(mapping, wbc, ext2_get_block); 684 return mpage_writepages(mapping, wbc, ext2_get_block);
685} 685}
686 686
687struct address_space_operations ext2_aops = { 687const struct address_space_operations ext2_aops = {
688 .readpage = ext2_readpage, 688 .readpage = ext2_readpage,
689 .readpages = ext2_readpages, 689 .readpages = ext2_readpages,
690 .writepage = ext2_writepage, 690 .writepage = ext2_writepage,
@@ -697,12 +697,12 @@ struct address_space_operations ext2_aops = {
697 .migratepage = buffer_migrate_page, 697 .migratepage = buffer_migrate_page,
698}; 698};
699 699
700struct address_space_operations ext2_aops_xip = { 700const struct address_space_operations ext2_aops_xip = {
701 .bmap = ext2_bmap, 701 .bmap = ext2_bmap,
702 .get_xip_page = ext2_get_xip_page, 702 .get_xip_page = ext2_get_xip_page,
703}; 703};
704 704
705struct address_space_operations ext2_nobh_aops = { 705const struct address_space_operations ext2_nobh_aops = {
706 .readpage = ext2_readpage, 706 .readpage = ext2_readpage,
707 .readpages = ext2_readpages, 707 .readpages = ext2_readpages,
708 .writepage = ext2_nobh_writepage, 708 .writepage = ext2_nobh_writepage,
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 0321e1b9034a..f804d5e9d60c 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1698,7 +1698,7 @@ static int ext3_journalled_set_page_dirty(struct page *page)
1698 return __set_page_dirty_nobuffers(page); 1698 return __set_page_dirty_nobuffers(page);
1699} 1699}
1700 1700
1701static struct address_space_operations ext3_ordered_aops = { 1701static const struct address_space_operations ext3_ordered_aops = {
1702 .readpage = ext3_readpage, 1702 .readpage = ext3_readpage,
1703 .readpages = ext3_readpages, 1703 .readpages = ext3_readpages,
1704 .writepage = ext3_ordered_writepage, 1704 .writepage = ext3_ordered_writepage,
@@ -1712,7 +1712,7 @@ static struct address_space_operations ext3_ordered_aops = {
1712 .migratepage = buffer_migrate_page, 1712 .migratepage = buffer_migrate_page,
1713}; 1713};
1714 1714
1715static struct address_space_operations ext3_writeback_aops = { 1715static const struct address_space_operations ext3_writeback_aops = {
1716 .readpage = ext3_readpage, 1716 .readpage = ext3_readpage,
1717 .readpages = ext3_readpages, 1717 .readpages = ext3_readpages,
1718 .writepage = ext3_writeback_writepage, 1718 .writepage = ext3_writeback_writepage,
@@ -1726,7 +1726,7 @@ static struct address_space_operations ext3_writeback_aops = {
1726 .migratepage = buffer_migrate_page, 1726 .migratepage = buffer_migrate_page,
1727}; 1727};
1728 1728
1729static struct address_space_operations ext3_journalled_aops = { 1729static const struct address_space_operations ext3_journalled_aops = {
1730 .readpage = ext3_readpage, 1730 .readpage = ext3_readpage,
1731 .readpages = ext3_readpages, 1731 .readpages = ext3_readpages,
1732 .writepage = ext3_journalled_writepage, 1732 .writepage = ext3_journalled_writepage,
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 7c35d582ec10..31b7174176ba 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -196,7 +196,7 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
196 return generic_block_bmap(mapping, block, fat_get_block); 196 return generic_block_bmap(mapping, block, fat_get_block);
197} 197}
198 198
199static struct address_space_operations fat_aops = { 199static const struct address_space_operations fat_aops = {
200 .readpage = fat_readpage, 200 .readpage = fat_readpage,
201 .readpages = fat_readpages, 201 .readpages = fat_readpages,
202 .writepage = fat_writepage, 202 .writepage = fat_writepage,
diff --git a/fs/freevxfs/vxfs_immed.c b/fs/freevxfs/vxfs_immed.c
index 6f5df1700e95..4e25f3fbed86 100644
--- a/fs/freevxfs/vxfs_immed.c
+++ b/fs/freevxfs/vxfs_immed.c
@@ -56,7 +56,7 @@ struct inode_operations vxfs_immed_symlink_iops = {
56/* 56/*
57 * Adress space operations for immed files and directories. 57 * Adress space operations for immed files and directories.
58 */ 58 */
59struct address_space_operations vxfs_immed_aops = { 59const struct address_space_operations vxfs_immed_aops = {
60 .readpage = vxfs_immed_readpage, 60 .readpage = vxfs_immed_readpage,
61}; 61};
62 62
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c
index f544aae9169f..ca6a39714771 100644
--- a/fs/freevxfs/vxfs_inode.c
+++ b/fs/freevxfs/vxfs_inode.c
@@ -41,8 +41,8 @@
41#include "vxfs_extern.h" 41#include "vxfs_extern.h"
42 42
43 43
44extern struct address_space_operations vxfs_aops; 44extern const struct address_space_operations vxfs_aops;
45extern struct address_space_operations vxfs_immed_aops; 45extern const struct address_space_operations vxfs_immed_aops;
46 46
47extern struct inode_operations vxfs_immed_symlink_iops; 47extern struct inode_operations vxfs_immed_symlink_iops;
48 48
@@ -295,7 +295,7 @@ vxfs_read_inode(struct inode *ip)
295{ 295{
296 struct super_block *sbp = ip->i_sb; 296 struct super_block *sbp = ip->i_sb;
297 struct vxfs_inode_info *vip; 297 struct vxfs_inode_info *vip;
298 struct address_space_operations *aops; 298 const struct address_space_operations *aops;
299 ino_t ino = ip->i_ino; 299 ino_t ino = ip->i_ino;
300 300
301 if (!(vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist))) 301 if (!(vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist)))
diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c
index c1be118fc067..decac62efe57 100644
--- a/fs/freevxfs/vxfs_subr.c
+++ b/fs/freevxfs/vxfs_subr.c
@@ -42,7 +42,7 @@
42static int vxfs_readpage(struct file *, struct page *); 42static int vxfs_readpage(struct file *, struct page *);
43static sector_t vxfs_bmap(struct address_space *, sector_t); 43static sector_t vxfs_bmap(struct address_space *, sector_t);
44 44
45struct address_space_operations vxfs_aops = { 45const struct address_space_operations vxfs_aops = {
46 .readpage = vxfs_readpage, 46 .readpage = vxfs_readpage,
47 .bmap = vxfs_bmap, 47 .bmap = vxfs_bmap,
48 .sync_page = block_sync_page, 48 .sync_page = block_sync_page,
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 28aa81eae2cc..63614ed16336 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -770,7 +770,7 @@ static const struct file_operations fuse_direct_io_file_operations = {
770 /* no mmap and sendfile */ 770 /* no mmap and sendfile */
771}; 771};
772 772
773static struct address_space_operations fuse_file_aops = { 773static const struct address_space_operations fuse_file_aops = {
774 .readpage = fuse_readpage, 774 .readpage = fuse_readpage,
775 .prepare_write = fuse_prepare_write, 775 .prepare_write = fuse_prepare_write,
776 .commit_write = fuse_commit_write, 776 .commit_write = fuse_commit_write,
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 3ed8663a8db1..735332dfd1b8 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -182,8 +182,8 @@ extern void hfs_file_truncate(struct inode *);
182extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); 182extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
183 183
184/* inode.c */ 184/* inode.c */
185extern struct address_space_operations hfs_aops; 185extern const struct address_space_operations hfs_aops;
186extern struct address_space_operations hfs_btree_aops; 186extern const struct address_space_operations hfs_btree_aops;
187 187
188extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); 188extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int);
189extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); 189extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 2d4ced22201b..315cf44a90b2 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -114,7 +114,7 @@ static int hfs_writepages(struct address_space *mapping,
114 return mpage_writepages(mapping, wbc, hfs_get_block); 114 return mpage_writepages(mapping, wbc, hfs_get_block);
115} 115}
116 116
117struct address_space_operations hfs_btree_aops = { 117const struct address_space_operations hfs_btree_aops = {
118 .readpage = hfs_readpage, 118 .readpage = hfs_readpage,
119 .writepage = hfs_writepage, 119 .writepage = hfs_writepage,
120 .sync_page = block_sync_page, 120 .sync_page = block_sync_page,
@@ -124,7 +124,7 @@ struct address_space_operations hfs_btree_aops = {
124 .releasepage = hfs_releasepage, 124 .releasepage = hfs_releasepage,
125}; 125};
126 126
127struct address_space_operations hfs_aops = { 127const struct address_space_operations hfs_aops = {
128 .readpage = hfs_readpage, 128 .readpage = hfs_readpage,
129 .writepage = hfs_writepage, 129 .writepage = hfs_writepage,
130 .sync_page = block_sync_page, 130 .sync_page = block_sync_page,
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 7ae393637a0c..8a1ca5ef7ada 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -323,8 +323,8 @@ int hfsplus_file_extend(struct inode *);
323void hfsplus_file_truncate(struct inode *); 323void hfsplus_file_truncate(struct inode *);
324 324
325/* inode.c */ 325/* inode.c */
326extern struct address_space_operations hfsplus_aops; 326extern const struct address_space_operations hfsplus_aops;
327extern struct address_space_operations hfsplus_btree_aops; 327extern const struct address_space_operations hfsplus_btree_aops;
328 328
329void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); 329void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *);
330void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); 330void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index acf66dba3e01..924ecdef8091 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -109,7 +109,7 @@ static int hfsplus_writepages(struct address_space *mapping,
109 return mpage_writepages(mapping, wbc, hfsplus_get_block); 109 return mpage_writepages(mapping, wbc, hfsplus_get_block);
110} 110}
111 111
112struct address_space_operations hfsplus_btree_aops = { 112const struct address_space_operations hfsplus_btree_aops = {
113 .readpage = hfsplus_readpage, 113 .readpage = hfsplus_readpage,
114 .writepage = hfsplus_writepage, 114 .writepage = hfsplus_writepage,
115 .sync_page = block_sync_page, 115 .sync_page = block_sync_page,
@@ -119,7 +119,7 @@ struct address_space_operations hfsplus_btree_aops = {
119 .releasepage = hfsplus_releasepage, 119 .releasepage = hfsplus_releasepage,
120}; 120};
121 121
122struct address_space_operations hfsplus_aops = { 122const struct address_space_operations hfsplus_aops = {
123 .readpage = hfsplus_readpage, 123 .readpage = hfsplus_readpage,
124 .writepage = hfsplus_writepage, 124 .writepage = hfsplus_writepage,
125 .sync_page = block_sync_page, 125 .sync_page = block_sync_page,
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 8e0d37743e7c..b82e3d9c8790 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -54,7 +54,7 @@ static int append = 0;
54 54
55static struct inode_operations hostfs_iops; 55static struct inode_operations hostfs_iops;
56static struct inode_operations hostfs_dir_iops; 56static struct inode_operations hostfs_dir_iops;
57static struct address_space_operations hostfs_link_aops; 57static const struct address_space_operations hostfs_link_aops;
58 58
59#ifndef MODULE 59#ifndef MODULE
60static int __init hostfs_args(char *options, int *add) 60static int __init hostfs_args(char *options, int *add)
@@ -518,7 +518,7 @@ int hostfs_commit_write(struct file *file, struct page *page, unsigned from,
518 return(err); 518 return(err);
519} 519}
520 520
521static struct address_space_operations hostfs_aops = { 521static const struct address_space_operations hostfs_aops = {
522 .writepage = hostfs_writepage, 522 .writepage = hostfs_writepage,
523 .readpage = hostfs_readpage, 523 .readpage = hostfs_readpage,
524 .set_page_dirty = __set_page_dirty_nobuffers, 524 .set_page_dirty = __set_page_dirty_nobuffers,
@@ -935,7 +935,7 @@ int hostfs_link_readpage(struct file *file, struct page *page)
935 return(err); 935 return(err);
936} 936}
937 937
938static struct address_space_operations hostfs_link_aops = { 938static const struct address_space_operations hostfs_link_aops = {
939 .readpage = hostfs_link_readpage, 939 .readpage = hostfs_link_readpage,
940}; 940};
941 941
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index d3b9fffe45a1..d9eb19b7b8ae 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -99,7 +99,7 @@ static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block)
99{ 99{
100 return generic_block_bmap(mapping,block,hpfs_get_block); 100 return generic_block_bmap(mapping,block,hpfs_get_block);
101} 101}
102struct address_space_operations hpfs_aops = { 102const struct address_space_operations hpfs_aops = {
103 .readpage = hpfs_readpage, 103 .readpage = hpfs_readpage,
104 .writepage = hpfs_writepage, 104 .writepage = hpfs_writepage,
105 .sync_page = block_sync_page, 105 .sync_page = block_sync_page,
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index 29b7a3e55173..f687d54ed442 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -268,7 +268,7 @@ void hpfs_set_ea(struct inode *, struct fnode *, char *, char *, int);
268int hpfs_file_fsync(struct file *, struct dentry *, int); 268int hpfs_file_fsync(struct file *, struct dentry *, int);
269extern const struct file_operations hpfs_file_ops; 269extern const struct file_operations hpfs_file_ops;
270extern struct inode_operations hpfs_file_iops; 270extern struct inode_operations hpfs_file_iops;
271extern struct address_space_operations hpfs_aops; 271extern const struct address_space_operations hpfs_aops;
272 272
273/* inode.c */ 273/* inode.c */
274 274
@@ -304,7 +304,7 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned);
304/* namei.c */ 304/* namei.c */
305 305
306extern struct inode_operations hpfs_dir_iops; 306extern struct inode_operations hpfs_dir_iops;
307extern struct address_space_operations hpfs_symlink_aops; 307extern const struct address_space_operations hpfs_symlink_aops;
308 308
309static inline struct hpfs_inode_info *hpfs_i(struct inode *inode) 309static inline struct hpfs_inode_info *hpfs_i(struct inode *inode)
310{ 310{
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index a03abb12c610..59e7dc182a0c 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -538,7 +538,7 @@ fail:
538 return err; 538 return err;
539} 539}
540 540
541struct address_space_operations hpfs_symlink_aops = { 541const struct address_space_operations hpfs_symlink_aops = {
542 .readpage = hpfs_symlink_readpage 542 .readpage = hpfs_symlink_readpage
543}; 543};
544 544
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index e6410d8edd0e..6449cb697967 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -34,7 +34,7 @@
34#define HUGETLBFS_MAGIC 0x958458f6 34#define HUGETLBFS_MAGIC 0x958458f6
35 35
36static struct super_operations hugetlbfs_ops; 36static struct super_operations hugetlbfs_ops;
37static struct address_space_operations hugetlbfs_aops; 37static const struct address_space_operations hugetlbfs_aops;
38const struct file_operations hugetlbfs_file_operations; 38const struct file_operations hugetlbfs_file_operations;
39static struct inode_operations hugetlbfs_dir_inode_operations; 39static struct inode_operations hugetlbfs_dir_inode_operations;
40static struct inode_operations hugetlbfs_inode_operations; 40static struct inode_operations hugetlbfs_inode_operations;
@@ -547,7 +547,7 @@ static void hugetlbfs_destroy_inode(struct inode *inode)
547 kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); 547 kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode));
548} 548}
549 549
550static struct address_space_operations hugetlbfs_aops = { 550static const struct address_space_operations hugetlbfs_aops = {
551 .readpage = hugetlbfs_readpage, 551 .readpage = hugetlbfs_readpage,
552 .prepare_write = hugetlbfs_prepare_write, 552 .prepare_write = hugetlbfs_prepare_write,
553 .commit_write = hugetlbfs_commit_write, 553 .commit_write = hugetlbfs_commit_write,
diff --git a/fs/inode.c b/fs/inode.c
index 3a2446a27d2c..f42961eb983b 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -102,7 +102,7 @@ static kmem_cache_t * inode_cachep __read_mostly;
102 102
103static struct inode *alloc_inode(struct super_block *sb) 103static struct inode *alloc_inode(struct super_block *sb)
104{ 104{
105 static struct address_space_operations empty_aops; 105 static const struct address_space_operations empty_aops;
106 static struct inode_operations empty_iops; 106 static struct inode_operations empty_iops;
107 static const struct file_operations empty_fops; 107 static const struct file_operations empty_fops;
108 struct inode *inode; 108 struct inode *inode;
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 4917315db732..3a39158cca96 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -312,7 +312,7 @@ eio:
312 return err; 312 return err;
313} 313}
314 314
315struct address_space_operations zisofs_aops = { 315const struct address_space_operations zisofs_aops = {
316 .readpage = zisofs_readpage, 316 .readpage = zisofs_readpage,
317 /* No sync_page operation supported? */ 317 /* No sync_page operation supported? */
318 /* No bmap operation supported */ 318 /* No bmap operation supported */
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 3f9c8ba1fa1f..bb11c7fb4019 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1054,7 +1054,7 @@ static sector_t _isofs_bmap(struct address_space *mapping, sector_t block)
1054 return generic_block_bmap(mapping,block,isofs_get_block); 1054 return generic_block_bmap(mapping,block,isofs_get_block);
1055} 1055}
1056 1056
1057static struct address_space_operations isofs_aops = { 1057static const struct address_space_operations isofs_aops = {
1058 .readpage = isofs_readpage, 1058 .readpage = isofs_readpage,
1059 .sync_page = block_sync_page, 1059 .sync_page = block_sync_page,
1060 .bmap = _isofs_bmap 1060 .bmap = _isofs_bmap
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index b87ba066f5e7..e6308c8b5735 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -176,5 +176,5 @@ isofs_normalize_block_and_offset(struct iso_directory_record* de,
176 176
177extern struct inode_operations isofs_dir_inode_operations; 177extern struct inode_operations isofs_dir_inode_operations;
178extern const struct file_operations isofs_dir_operations; 178extern const struct file_operations isofs_dir_operations;
179extern struct address_space_operations isofs_symlink_aops; 179extern const struct address_space_operations isofs_symlink_aops;
180extern struct export_operations isofs_export_ops; 180extern struct export_operations isofs_export_ops;
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 4326cb47f8fa..f3a1db3098de 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -754,6 +754,6 @@ error:
754 return -EIO; 754 return -EIO;
755} 755}
756 756
757struct address_space_operations isofs_symlink_aops = { 757const struct address_space_operations isofs_symlink_aops = {
758 .readpage = rock_ridge_symlink_readpage 758 .readpage = rock_ridge_symlink_readpage
759}; 759};
diff --git a/fs/isofs/zisofs.h b/fs/isofs/zisofs.h
index d78485d101c2..273795709155 100644
--- a/fs/isofs/zisofs.h
+++ b/fs/isofs/zisofs.h
@@ -15,7 +15,7 @@
15 */ 15 */
16 16
17#ifdef CONFIG_ZISOFS 17#ifdef CONFIG_ZISOFS
18extern struct address_space_operations zisofs_aops; 18extern const struct address_space_operations zisofs_aops;
19extern int __init zisofs_init(void); 19extern int __init zisofs_init(void);
20extern void zisofs_cleanup(void); 20extern void zisofs_cleanup(void);
21#endif 21#endif
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index 9e46ea6da752..93068697a9bf 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -59,7 +59,7 @@ static const struct file_operations jffs_file_operations;
59static struct inode_operations jffs_file_inode_operations; 59static struct inode_operations jffs_file_inode_operations;
60static const struct file_operations jffs_dir_operations; 60static const struct file_operations jffs_dir_operations;
61static struct inode_operations jffs_dir_inode_operations; 61static struct inode_operations jffs_dir_inode_operations;
62static struct address_space_operations jffs_address_operations; 62static const struct address_space_operations jffs_address_operations;
63 63
64kmem_cache_t *node_cache = NULL; 64kmem_cache_t *node_cache = NULL;
65kmem_cache_t *fm_cache = NULL; 65kmem_cache_t *fm_cache = NULL;
@@ -1614,7 +1614,7 @@ jffs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1614} /* jffs_ioctl() */ 1614} /* jffs_ioctl() */
1615 1615
1616 1616
1617static struct address_space_operations jffs_address_operations = { 1617static const struct address_space_operations jffs_address_operations = {
1618 .readpage = jffs_readpage, 1618 .readpage = jffs_readpage,
1619 .prepare_write = jffs_prepare_write, 1619 .prepare_write = jffs_prepare_write,
1620 .commit_write = jffs_commit_write, 1620 .commit_write = jffs_commit_write,
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index bb8844f40e48..3ed6e3e120b6 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -62,7 +62,7 @@ struct inode_operations jffs2_file_inode_operations =
62 .removexattr = jffs2_removexattr 62 .removexattr = jffs2_removexattr
63}; 63};
64 64
65struct address_space_operations jffs2_file_address_operations = 65const struct address_space_operations jffs2_file_address_operations =
66{ 66{
67 .readpage = jffs2_readpage, 67 .readpage = jffs2_readpage,
68 .prepare_write =jffs2_prepare_write, 68 .prepare_write =jffs2_prepare_write,
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 6b5223565405..9f41fc01a371 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -158,7 +158,7 @@ extern struct inode_operations jffs2_dir_inode_operations;
158/* file.c */ 158/* file.c */
159extern const struct file_operations jffs2_file_operations; 159extern const struct file_operations jffs2_file_operations;
160extern struct inode_operations jffs2_file_inode_operations; 160extern struct inode_operations jffs2_file_inode_operations;
161extern struct address_space_operations jffs2_file_address_operations; 161extern const struct address_space_operations jffs2_file_address_operations;
162int jffs2_fsync(struct file *, struct dentry *, int); 162int jffs2_fsync(struct file *, struct dentry *, int);
163int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); 163int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg);
164 164
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 04eb78f1252e..43e3f566aad6 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -305,7 +305,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
305 offset, nr_segs, jfs_get_block, NULL); 305 offset, nr_segs, jfs_get_block, NULL);
306} 306}
307 307
308struct address_space_operations jfs_aops = { 308const struct address_space_operations jfs_aops = {
309 .readpage = jfs_readpage, 309 .readpage = jfs_readpage,
310 .readpages = jfs_readpages, 310 .readpages = jfs_readpages,
311 .writepage = jfs_writepage, 311 .writepage = jfs_writepage,
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index c30072674464..b5c7da6190dc 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -33,7 +33,7 @@ extern void jfs_free_zero_link(struct inode *);
33extern struct dentry *jfs_get_parent(struct dentry *dentry); 33extern struct dentry *jfs_get_parent(struct dentry *dentry);
34extern void jfs_set_inode_flags(struct inode *); 34extern void jfs_set_inode_flags(struct inode *);
35 35
36extern struct address_space_operations jfs_aops; 36extern const struct address_space_operations jfs_aops;
37extern struct inode_operations jfs_dir_inode_operations; 37extern struct inode_operations jfs_dir_inode_operations;
38extern const struct file_operations jfs_dir_operations; 38extern const struct file_operations jfs_dir_operations;
39extern struct inode_operations jfs_file_inode_operations; 39extern struct inode_operations jfs_file_inode_operations;
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 7f6e88039700..e1e0a6e6ebdf 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -577,7 +577,7 @@ static void metapage_invalidatepage(struct page *page, unsigned long offset)
577 metapage_releasepage(page, 0); 577 metapage_releasepage(page, 0);
578} 578}
579 579
580struct address_space_operations jfs_metapage_aops = { 580const struct address_space_operations jfs_metapage_aops = {
581 .readpage = metapage_readpage, 581 .readpage = metapage_readpage,
582 .writepage = metapage_writepage, 582 .writepage = metapage_writepage,
583 .sync_page = block_sync_page, 583 .sync_page = block_sync_page,
diff --git a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h
index f0b7d3282b07..d17a3290f5aa 100644
--- a/fs/jfs/jfs_metapage.h
+++ b/fs/jfs/jfs_metapage.h
@@ -139,7 +139,7 @@ static inline void metapage_homeok(struct metapage *mp)
139 put_metapage(mp); 139 put_metapage(mp);
140} 140}
141 141
142extern struct address_space_operations jfs_metapage_aops; 142extern const struct address_space_operations jfs_metapage_aops;
143 143
144/* 144/*
145 * This routines invalidate all pages for an extent. 145 * This routines invalidate all pages for an extent.
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index a6fb509b7341..9ea91c5eeb7b 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -335,7 +335,7 @@ static sector_t minix_bmap(struct address_space *mapping, sector_t block)
335{ 335{
336 return generic_block_bmap(mapping,block,minix_get_block); 336 return generic_block_bmap(mapping,block,minix_get_block);
337} 337}
338static struct address_space_operations minix_aops = { 338static const struct address_space_operations minix_aops = {
339 .readpage = minix_readpage, 339 .readpage = minix_readpage,
340 .writepage = minix_writepage, 340 .writepage = minix_writepage,
341 .sync_page = block_sync_page, 341 .sync_page = block_sync_page,
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 90d2ea28f333..6c51c1198464 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -105,7 +105,7 @@ static struct super_operations ncp_sops =
105 105
106extern struct dentry_operations ncp_root_dentry_operations; 106extern struct dentry_operations ncp_root_dentry_operations;
107#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) 107#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
108extern struct address_space_operations ncp_symlink_aops; 108extern const struct address_space_operations ncp_symlink_aops;
109extern int ncp_symlink(struct inode*, struct dentry*, const char*); 109extern int ncp_symlink(struct inode*, struct dentry*, const char*);
110#endif 110#endif
111 111
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c
index e935f1b34bc2..f76b1392a012 100644
--- a/fs/ncpfs/symlink.c
+++ b/fs/ncpfs/symlink.c
@@ -99,7 +99,7 @@ fail:
99/* 99/*
100 * symlinks can't do much... 100 * symlinks can't do much...
101 */ 101 */
102struct address_space_operations ncp_symlink_aops = { 102const struct address_space_operations ncp_symlink_aops = {
103 .readpage = ncp_symlink_readpage, 103 .readpage = ncp_symlink_readpage,
104}; 104};
105 105
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index add289138836..cc2b874ad5a4 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -315,7 +315,7 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
315 return !nfs_wb_page(page->mapping->host, page); 315 return !nfs_wb_page(page->mapping->host, page);
316} 316}
317 317
318struct address_space_operations nfs_file_aops = { 318const struct address_space_operations nfs_file_aops = {
319 .readpage = nfs_readpage, 319 .readpage = nfs_readpage,
320 .readpages = nfs_readpages, 320 .readpages = nfs_readpages,
321 .set_page_dirty = __set_page_dirty_nobuffers, 321 .set_page_dirty = __set_page_dirty_nobuffers,
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 580412d330cb..bc579bfdfbd8 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -1544,7 +1544,7 @@ err_out:
1544/** 1544/**
1545 * ntfs_aops - general address space operations for inodes and attributes 1545 * ntfs_aops - general address space operations for inodes and attributes
1546 */ 1546 */
1547struct address_space_operations ntfs_aops = { 1547const struct address_space_operations ntfs_aops = {
1548 .readpage = ntfs_readpage, /* Fill page with data. */ 1548 .readpage = ntfs_readpage, /* Fill page with data. */
1549 .sync_page = block_sync_page, /* Currently, just unplugs the 1549 .sync_page = block_sync_page, /* Currently, just unplugs the
1550 disk request queue. */ 1550 disk request queue. */
@@ -1560,7 +1560,7 @@ struct address_space_operations ntfs_aops = {
1560 * ntfs_mst_aops - general address space operations for mst protecteed inodes 1560 * ntfs_mst_aops - general address space operations for mst protecteed inodes
1561 * and attributes 1561 * and attributes
1562 */ 1562 */
1563struct address_space_operations ntfs_mst_aops = { 1563const struct address_space_operations ntfs_mst_aops = {
1564 .readpage = ntfs_readpage, /* Fill page with data. */ 1564 .readpage = ntfs_readpage, /* Fill page with data. */
1565 .sync_page = block_sync_page, /* Currently, just unplugs the 1565 .sync_page = block_sync_page, /* Currently, just unplugs the
1566 disk request queue. */ 1566 disk request queue. */
diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h
index bf7b3d7c0930..ddd3d503097c 100644
--- a/fs/ntfs/ntfs.h
+++ b/fs/ntfs/ntfs.h
@@ -57,8 +57,8 @@ extern struct kmem_cache *ntfs_attr_ctx_cache;
57extern struct kmem_cache *ntfs_index_ctx_cache; 57extern struct kmem_cache *ntfs_index_ctx_cache;
58 58
59/* The various operations structs defined throughout the driver files. */ 59/* The various operations structs defined throughout the driver files. */
60extern struct address_space_operations ntfs_aops; 60extern const struct address_space_operations ntfs_aops;
61extern struct address_space_operations ntfs_mst_aops; 61extern const struct address_space_operations ntfs_mst_aops;
62 62
63extern const struct file_operations ntfs_file_ops; 63extern const struct file_operations ntfs_file_ops;
64extern struct inode_operations ntfs_file_inode_ops; 64extern struct inode_operations ntfs_file_inode_ops;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 47152bf9a7f2..cca71317b6d6 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -666,7 +666,7 @@ out:
666 return ret; 666 return ret;
667} 667}
668 668
669struct address_space_operations ocfs2_aops = { 669const struct address_space_operations ocfs2_aops = {
670 .readpage = ocfs2_readpage, 670 .readpage = ocfs2_readpage,
671 .writepage = ocfs2_writepage, 671 .writepage = ocfs2_writepage,
672 .prepare_write = ocfs2_prepare_write, 672 .prepare_write = ocfs2_prepare_write,
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index 84c507961287..35140f6cf840 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -114,7 +114,7 @@ static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode)
114 114
115extern kmem_cache_t *ocfs2_inode_cache; 115extern kmem_cache_t *ocfs2_inode_cache;
116 116
117extern struct address_space_operations ocfs2_aops; 117extern const struct address_space_operations ocfs2_aops;
118 118
119struct buffer_head *ocfs2_bread(struct inode *inode, int block, 119struct buffer_head *ocfs2_bread(struct inode *inode, int block,
120 int *err, int reada); 120 int *err, int reada);
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 2f24c46f72a1..8bc182a88748 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -450,7 +450,7 @@ static sector_t qnx4_bmap(struct address_space *mapping, sector_t block)
450{ 450{
451 return generic_block_bmap(mapping,block,qnx4_get_block); 451 return generic_block_bmap(mapping,block,qnx4_get_block);
452} 452}
453static struct address_space_operations qnx4_aops = { 453static const struct address_space_operations qnx4_aops = {
454 .readpage = qnx4_readpage, 454 .readpage = qnx4_readpage,
455 .writepage = qnx4_writepage, 455 .writepage = qnx4_writepage,
456 .sync_page = block_sync_page, 456 .sync_page = block_sync_page,
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
index 00a933eb820c..86f14cacf641 100644
--- a/fs/ramfs/file-mmu.c
+++ b/fs/ramfs/file-mmu.c
@@ -26,7 +26,7 @@
26 26
27#include <linux/fs.h> 27#include <linux/fs.h>
28 28
29struct address_space_operations ramfs_aops = { 29const struct address_space_operations ramfs_aops = {
30 .readpage = simple_readpage, 30 .readpage = simple_readpage,
31 .prepare_write = simple_prepare_write, 31 .prepare_write = simple_prepare_write,
32 .commit_write = simple_commit_write 32 .commit_write = simple_commit_write
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index f443a84b98a5..99fffc9e1bfd 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -27,7 +27,7 @@
27 27
28static int ramfs_nommu_setattr(struct dentry *, struct iattr *); 28static int ramfs_nommu_setattr(struct dentry *, struct iattr *);
29 29
30struct address_space_operations ramfs_aops = { 30const struct address_space_operations ramfs_aops = {
31 .readpage = simple_readpage, 31 .readpage = simple_readpage,
32 .prepare_write = simple_prepare_write, 32 .prepare_write = simple_prepare_write,
33 .commit_write = simple_commit_write 33 .commit_write = simple_commit_write
diff --git a/fs/ramfs/internal.h b/fs/ramfs/internal.h
index 313237631b49..c2bb58e74653 100644
--- a/fs/ramfs/internal.h
+++ b/fs/ramfs/internal.h
@@ -10,6 +10,6 @@
10 */ 10 */
11 11
12 12
13extern struct address_space_operations ramfs_aops; 13extern const struct address_space_operations ramfs_aops;
14extern const struct file_operations ramfs_file_operations; 14extern const struct file_operations ramfs_file_operations;
15extern struct inode_operations ramfs_file_inode_operations; 15extern struct inode_operations ramfs_file_inode_operations;
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 9857e50f85e7..a24858a632fa 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2996,7 +2996,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
2996 return error; 2996 return error;
2997} 2997}
2998 2998
2999struct address_space_operations reiserfs_address_space_operations = { 2999const struct address_space_operations reiserfs_address_space_operations = {
3000 .writepage = reiserfs_writepage, 3000 .writepage = reiserfs_writepage,
3001 .readpage = reiserfs_readpage, 3001 .readpage = reiserfs_readpage,
3002 .readpages = reiserfs_readpages, 3002 .readpages = reiserfs_readpages,
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 283fbc6b8eea..22eed61ebf69 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -459,7 +459,7 @@ err_out:
459 459
460/* Mapping from our types to the kernel */ 460/* Mapping from our types to the kernel */
461 461
462static struct address_space_operations romfs_aops = { 462static const struct address_space_operations romfs_aops = {
463 .readpage = romfs_readpage 463 .readpage = romfs_readpage
464}; 464};
465 465
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index ed9a24d19d7d..dae67048baba 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -306,7 +306,7 @@ static int smb_commit_write(struct file *file, struct page *page,
306 return status; 306 return status;
307} 307}
308 308
309struct address_space_operations smb_file_aops = { 309const struct address_space_operations smb_file_aops = {
310 .readpage = smb_readpage, 310 .readpage = smb_readpage,
311 .writepage = smb_writepage, 311 .writepage = smb_writepage,
312 .prepare_write = smb_prepare_write, 312 .prepare_write = smb_prepare_write,
diff --git a/fs/smbfs/proto.h b/fs/smbfs/proto.h
index 972ed7dad388..34fb462b2379 100644
--- a/fs/smbfs/proto.h
+++ b/fs/smbfs/proto.h
@@ -63,7 +63,7 @@ extern int smb_revalidate_inode(struct dentry *dentry);
63extern int smb_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); 63extern int smb_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
64extern int smb_notify_change(struct dentry *dentry, struct iattr *attr); 64extern int smb_notify_change(struct dentry *dentry, struct iattr *attr);
65/* file.c */ 65/* file.c */
66extern struct address_space_operations smb_file_aops; 66extern const struct address_space_operations smb_file_aops;
67extern const struct file_operations smb_file_operations; 67extern const struct file_operations smb_file_operations;
68extern struct inode_operations smb_file_inode_operations; 68extern struct inode_operations smb_file_inode_operations;
69/* ioctl.c */ 69/* ioctl.c */
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index f0b347bd12ca..5e0e31cc46f5 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -16,7 +16,7 @@
16 16
17extern struct super_block * sysfs_sb; 17extern struct super_block * sysfs_sb;
18 18
19static struct address_space_operations sysfs_aops = { 19static const struct address_space_operations sysfs_aops = {
20 .readpage = simple_readpage, 20 .readpage = simple_readpage,
21 .prepare_write = simple_prepare_write, 21 .prepare_write = simple_prepare_write,
22 .commit_write = simple_commit_write 22 .commit_write = simple_commit_write
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 86f5f8d43d0f..f2bcccd1d6fc 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -465,7 +465,7 @@ static sector_t sysv_bmap(struct address_space *mapping, sector_t block)
465{ 465{
466 return generic_block_bmap(mapping,block,get_block); 466 return generic_block_bmap(mapping,block,get_block);
467} 467}
468struct address_space_operations sysv_aops = { 468const struct address_space_operations sysv_aops = {
469 .readpage = sysv_readpage, 469 .readpage = sysv_readpage,
470 .writepage = sysv_writepage, 470 .writepage = sysv_writepage,
471 .sync_page = block_sync_page, 471 .sync_page = block_sync_page,
diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h
index 393a480e4deb..9dcc82120935 100644
--- a/fs/sysv/sysv.h
+++ b/fs/sysv/sysv.h
@@ -161,7 +161,7 @@ extern struct inode_operations sysv_dir_inode_operations;
161extern struct inode_operations sysv_fast_symlink_inode_operations; 161extern struct inode_operations sysv_fast_symlink_inode_operations;
162extern const struct file_operations sysv_file_operations; 162extern const struct file_operations sysv_file_operations;
163extern const struct file_operations sysv_dir_operations; 163extern const struct file_operations sysv_dir_operations;
164extern struct address_space_operations sysv_aops; 164extern const struct address_space_operations sysv_aops;
165extern struct super_operations sysv_sops; 165extern struct super_operations sysv_sops;
166extern struct dentry_operations sysv_dentry_operations; 166extern struct dentry_operations sysv_dentry_operations;
167 167
diff --git a/fs/udf/file.c b/fs/udf/file.c
index e34b00e303f1..a59e5f33daf6 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -95,7 +95,7 @@ static int udf_adinicb_commit_write(struct file *file, struct page *page, unsign
95 return 0; 95 return 0;
96} 96}
97 97
98struct address_space_operations udf_adinicb_aops = { 98const struct address_space_operations udf_adinicb_aops = {
99 .readpage = udf_adinicb_readpage, 99 .readpage = udf_adinicb_readpage,
100 .writepage = udf_adinicb_writepage, 100 .writepage = udf_adinicb_writepage,
101 .sync_page = block_sync_page, 101 .sync_page = block_sync_page,
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 2983afd5e7fd..605f5111b6d8 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -132,7 +132,7 @@ static sector_t udf_bmap(struct address_space *mapping, sector_t block)
132 return generic_block_bmap(mapping,block,udf_get_block); 132 return generic_block_bmap(mapping,block,udf_get_block);
133} 133}
134 134
135struct address_space_operations udf_aops = { 135const struct address_space_operations udf_aops = {
136 .readpage = udf_readpage, 136 .readpage = udf_readpage,
137 .writepage = udf_writepage, 137 .writepage = udf_writepage,
138 .sync_page = block_sync_page, 138 .sync_page = block_sync_page,
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index 674bb40edc83..ba068a786563 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -113,6 +113,6 @@ out:
113/* 113/*
114 * symlinks can't do much... 114 * symlinks can't do much...
115 */ 115 */
116struct address_space_operations udf_symlink_aops = { 116const struct address_space_operations udf_symlink_aops = {
117 .readpage = udf_symlink_filler, 117 .readpage = udf_symlink_filler,
118}; 118};
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 023e19ba5a2e..2f992387cc9e 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -47,9 +47,9 @@ extern struct inode_operations udf_dir_inode_operations;
47extern const struct file_operations udf_dir_operations; 47extern const struct file_operations udf_dir_operations;
48extern struct inode_operations udf_file_inode_operations; 48extern struct inode_operations udf_file_inode_operations;
49extern const struct file_operations udf_file_operations; 49extern const struct file_operations udf_file_operations;
50extern struct address_space_operations udf_aops; 50extern const struct address_space_operations udf_aops;
51extern struct address_space_operations udf_adinicb_aops; 51extern const struct address_space_operations udf_adinicb_aops;
52extern struct address_space_operations udf_symlink_aops; 52extern const struct address_space_operations udf_symlink_aops;
53 53
54struct udf_fileident_bh 54struct udf_fileident_bh
55{ 55{
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 259bd196099d..8e1f90e42040 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -574,7 +574,7 @@ static sector_t ufs_bmap(struct address_space *mapping, sector_t block)
574{ 574{
575 return generic_block_bmap(mapping,block,ufs_getfrag_block); 575 return generic_block_bmap(mapping,block,ufs_getfrag_block);
576} 576}
577struct address_space_operations ufs_aops = { 577const struct address_space_operations ufs_aops = {
578 .readpage = ufs_readpage, 578 .readpage = ufs_readpage,
579 .writepage = ufs_writepage, 579 .writepage = ufs_writepage,
580 .sync_page = block_sync_page, 580 .sync_page = block_sync_page,
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 3e807b828e22..c40f81ba9b13 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1454,7 +1454,7 @@ xfs_vm_invalidatepage(
1454 block_invalidatepage(page, offset); 1454 block_invalidatepage(page, offset);
1455} 1455}
1456 1456
1457struct address_space_operations xfs_address_space_operations = { 1457const struct address_space_operations xfs_address_space_operations = {
1458 .readpage = xfs_vm_readpage, 1458 .readpage = xfs_vm_readpage,
1459 .readpages = xfs_vm_readpages, 1459 .readpages = xfs_vm_readpages,
1460 .writepage = xfs_vm_writepage, 1460 .writepage = xfs_vm_writepage,
diff --git a/fs/xfs/linux-2.6/xfs_aops.h b/fs/xfs/linux-2.6/xfs_aops.h
index 706d8c781b8a..2244e516b66a 100644
--- a/fs/xfs/linux-2.6/xfs_aops.h
+++ b/fs/xfs/linux-2.6/xfs_aops.h
@@ -40,7 +40,7 @@ typedef struct xfs_ioend {
40 struct work_struct io_work; /* xfsdatad work queue */ 40 struct work_struct io_work; /* xfsdatad work queue */
41} xfs_ioend_t; 41} xfs_ioend_t;
42 42
43extern struct address_space_operations xfs_address_space_operations; 43extern const struct address_space_operations xfs_address_space_operations;
44extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int); 44extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int);
45 45
46#endif /* __XFS_AOPS_H__ */ 46#endif /* __XFS_AOPS_H__ */
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 26fed0756f01..2af528dcfb04 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1520,7 +1520,7 @@ xfs_mapping_buftarg(
1520 struct backing_dev_info *bdi; 1520 struct backing_dev_info *bdi;
1521 struct inode *inode; 1521 struct inode *inode;
1522 struct address_space *mapping; 1522 struct address_space *mapping;
1523 static struct address_space_operations mapping_aops = { 1523 static const struct address_space_operations mapping_aops = {
1524 .sync_page = block_sync_page, 1524 .sync_page = block_sync_page,
1525 .migratepage = fail_migrate_page, 1525 .migratepage = fail_migrate_page,
1526 }; 1526 };
diff --git a/include/asm-arm/arch-at91rm9200/memory.h b/include/asm-arm/arch-at91rm9200/memory.h
index 3c327c404373..f985069e6d01 100644
--- a/include/asm-arm/arch-at91rm9200/memory.h
+++ b/include/asm-arm/arch-at91rm9200/memory.h
@@ -33,9 +33,7 @@
33 * bus_to_virt: Used to convert an address for DMA operations 33 * bus_to_virt: Used to convert an address for DMA operations
34 * to an address that the kernel can use. 34 * to an address that the kernel can use.
35 */ 35 */
36#define __virt_to_bus__is_a_macro
37#define __virt_to_bus(x) __virt_to_phys(x) 36#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) 37#define __bus_to_virt(x) __phys_to_virt(x)
40 38
41#endif 39#endif
diff --git a/include/asm-arm/arch-h720x/memory.h b/include/asm-arm/arch-h720x/memory.h
index 4a1bfd78a0fe..53e923dba76e 100644
--- a/include/asm-arm/arch-h720x/memory.h
+++ b/include/asm-arm/arch-h720x/memory.h
@@ -23,9 +23,7 @@
23 * There is something to do here later !, Mar 2000, Jungjun Kim 23 * There is something to do here later !, Mar 2000, Jungjun Kim
24 */ 24 */
25 25
26#define __virt_to_bus__is_a_macro
27#define __virt_to_bus(x) __virt_to_phys(x) 26#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) 27#define __bus_to_virt(x) __phys_to_virt(x)
30 28
31#endif 29#endif
diff --git a/include/asm-arm/arch-imx/memory.h b/include/asm-arm/arch-imx/memory.h
index d09ae32cd2f4..5ad90127915f 100644
--- a/include/asm-arm/arch-imx/memory.h
+++ b/include/asm-arm/arch-imx/memory.h
@@ -30,9 +30,7 @@
30 * bus_to_virt: Used to convert an address for DMA operations 30 * bus_to_virt: Used to convert an address for DMA operations
31 * to an address that the kernel can use. 31 * to an address that the kernel can use.
32 */ 32 */
33#define __virt_to_bus__is_a_macro 33#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET)
34#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET) 34#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)
35#define __bus_to_virt__is_a_macro
36#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)
37 35
38#endif 36#endif
diff --git a/include/asm-arm/arch-ixp23xx/ixp23xx.h b/include/asm-arm/arch-ixp23xx/ixp23xx.h
index d0a72201ee96..3927b1d61b17 100644
--- a/include/asm-arm/arch-ixp23xx/ixp23xx.h
+++ b/include/asm-arm/arch-ixp23xx/ixp23xx.h
@@ -295,15 +295,4 @@
295#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160) 295#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160)
296 296
297 297
298#ifndef __ASSEMBLY__
299/*
300 * Is system memory on the XSI or CPP bus?
301 */
302static 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 298#endif
diff --git a/include/asm-arm/arch-ixp23xx/platform.h b/include/asm-arm/arch-ixp23xx/platform.h
index 19a73b39c864..56e16d66645a 100644
--- a/include/asm-arm/arch-ixp23xx/platform.h
+++ b/include/asm-arm/arch-ixp23xx/platform.h
@@ -43,5 +43,15 @@ extern struct sys_timer ixp23xx_timer;
43 43
44#define IXP23XX_UART_XTAL 14745600 44#define IXP23XX_UART_XTAL 14745600
45 45
46#ifndef __ASSEMBLY__
47/*
48 * Is system memory on the XSI or CPP bus?
49 */
50static inline unsigned ixp23xx_cpp_boot(void)
51{
52 return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);
53}
54#endif
55
46 56
47#endif 57#endif
diff --git a/include/asm-arm/arch-ixp23xx/uncompress.h b/include/asm-arm/arch-ixp23xx/uncompress.h
index 013575e6a9a1..16c1110f2304 100644
--- a/include/asm-arm/arch-ixp23xx/uncompress.h
+++ b/include/asm-arm/arch-ixp23xx/uncompress.h
@@ -11,7 +11,7 @@
11#ifndef __ASM_ARCH_UNCOMPRESS_H 11#ifndef __ASM_ARCH_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H 12#define __ASM_ARCH_UNCOMPRESS_H
13 13
14#include <asm/hardware.h> 14#include <asm/arch/ixp23xx.h>
15#include <linux/serial_reg.h> 15#include <linux/serial_reg.h>
16 16
17#define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS) 17#define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS)
diff --git a/include/asm-arm/arch-s3c2410/regs-dsc.h b/include/asm-arm/arch-s3c2410/regs-dsc.h
index 84aca61cbaa3..a0a124875164 100644
--- a/include/asm-arm/arch-s3c2410/regs-dsc.h
+++ b/include/asm-arm/arch-s3c2410/regs-dsc.h
@@ -7,25 +7,23 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * S3C2440 Signal Drive Strength Control 10 * S3C2440/S3C2412 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*/ 11*/
16 12
17 13
18#ifndef __ASM_ARCH_REGS_DSC_H 14#ifndef __ASM_ARCH_REGS_DSC_H
19#define __ASM_ARCH_REGS_DSC_H "2440-dsc" 15#define __ASM_ARCH_REGS_DSC_H "2440-dsc"
20 16
21#ifdef CONFIG_CPU_S3C2440 17#if defined(CONFIG_CPU_S3C2412)
18#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)
19#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)
20#endif
21
22#if defined(CONFIG_CPU_S3C2440)
22 23
23#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4) 24#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4)
24#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8) 25#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8)
25 26
26#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)
27#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)
28
29#define S3C2440_SELECT_DSC0 (0) 27#define S3C2440_SELECT_DSC0 (0)
30#define S3C2440_SELECT_DSC1 (1<<31) 28#define S3C2440_SELECT_DSC1 (1<<31)
31 29
diff --git a/include/asm-arm/bugs.h b/include/asm-arm/bugs.h
index 4c80ec519d45..ca54eb0f12d7 100644
--- a/include/asm-arm/bugs.h
+++ b/include/asm-arm/bugs.h
@@ -10,8 +10,12 @@
10#ifndef __ASM_BUGS_H 10#ifndef __ASM_BUGS_H
11#define __ASM_BUGS_H 11#define __ASM_BUGS_H
12 12
13#ifdef CONFIG_MMU
13extern void check_writebuffer_bugs(void); 14extern void check_writebuffer_bugs(void);
14 15
15#define check_bugs() check_writebuffer_bugs() 16#define check_bugs() check_writebuffer_bugs()
17#else
18#define check_bugs() do { } while (0)
19#endif
16 20
17#endif 21#endif
diff --git a/include/asm-arm/domain.h b/include/asm-arm/domain.h
index f8ea2de4848e..4c2885abbe6c 100644
--- a/include/asm-arm/domain.h
+++ b/include/asm-arm/domain.h
@@ -50,6 +50,8 @@
50#define domain_val(dom,type) ((type) << (2*(dom))) 50#define domain_val(dom,type) ((type) << (2*(dom)))
51 51
52#ifndef __ASSEMBLY__ 52#ifndef __ASSEMBLY__
53
54#ifdef CONFIG_MMU
53#define set_domain(x) \ 55#define set_domain(x) \
54 do { \ 56 do { \
55 __asm__ __volatile__( \ 57 __asm__ __volatile__( \
@@ -66,5 +68,10 @@
66 set_domain(thread->cpu_domain); \ 68 set_domain(thread->cpu_domain); \
67 } while (0) 69 } while (0)
68 70
71#else
72#define set_domain(x) do { } while (0)
73#define modify_domain(dom,type) do { } while (0)
74#endif
75
69#endif 76#endif
70#endif /* !__ASSEMBLY__ */ 77#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-arm/fpstate.h b/include/asm-arm/fpstate.h
index 132c3c5628b2..6af4e6bd1290 100644
--- a/include/asm-arm/fpstate.h
+++ b/include/asm-arm/fpstate.h
@@ -72,6 +72,14 @@ union fp_state {
72 72
73#define FP_SIZE (sizeof(union fp_state) / sizeof(int)) 73#define FP_SIZE (sizeof(union fp_state) / sizeof(int))
74 74
75struct crunch_state {
76 unsigned int mvdx[16][2];
77 unsigned int mvax[4][3];
78 unsigned int dspsc[2];
79};
80
81#define CRUNCH_SIZE sizeof(struct crunch_state)
82
75#endif 83#endif
76 84
77#endif 85#endif
diff --git a/include/asm-arm/mach/map.h b/include/asm-arm/mach/map.h
index e8ea67c97c73..cef5364ed5fe 100644
--- a/include/asm-arm/mach/map.h
+++ b/include/asm-arm/mach/map.h
@@ -16,8 +16,6 @@ struct map_desc {
16 unsigned int type; 16 unsigned int type;
17}; 17};
18 18
19struct meminfo;
20
21#define MT_DEVICE 0 19#define MT_DEVICE 0
22#define MT_CACHECLEAN 1 20#define MT_CACHECLEAN 1
23#define MT_MINICLEAN 2 21#define MT_MINICLEAN 2
@@ -28,7 +26,8 @@ struct meminfo;
28#define MT_IXP2000_DEVICE 7 26#define MT_IXP2000_DEVICE 7
29#define MT_NONSHARED_DEVICE 8 27#define MT_NONSHARED_DEVICE 8
30 28
31extern void create_memmap_holes(struct meminfo *); 29#ifdef CONFIG_MMU
32extern void memtable_init(struct meminfo *);
33extern void iotable_init(struct map_desc *, int); 30extern void iotable_init(struct map_desc *, int);
34extern void setup_io_desc(void); 31#else
32#define iotable_init(map,num) do { } while (0)
33#endif
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index 731e321a57d1..94f973b704f1 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -2,6 +2,7 @@
2 * linux/include/asm-arm/memory.h 2 * linux/include/asm-arm/memory.h
3 * 3 *
4 * Copyright (C) 2000-2002 Russell King 4 * Copyright (C) 2000-2002 Russell King
5 * modification for nommu, Hyok S. Choi, 2004
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -26,6 +27,8 @@
26#include <asm/arch/memory.h> 27#include <asm/arch/memory.h>
27#include <asm/sizes.h> 28#include <asm/sizes.h>
28 29
30#ifdef CONFIG_MMU
31
29#ifndef TASK_SIZE 32#ifndef TASK_SIZE
30/* 33/*
31 * TASK_SIZE - the maximum size of a user space task. 34 * TASK_SIZE - the maximum size of a user space task.
@@ -48,6 +51,60 @@
48#endif 51#endif
49 52
50/* 53/*
54 * The module space lives between the addresses given by TASK_SIZE
55 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
56 */
57#define MODULE_END (PAGE_OFFSET)
58#define MODULE_START (MODULE_END - 16*1048576)
59
60#if TASK_SIZE > MODULE_START
61#error Top of user space clashes with start of module space
62#endif
63
64/*
65 * The XIP kernel gets mapped at the bottom of the module vm area.
66 * Since we use sections to map it, this macro replaces the physical address
67 * with its virtual address while keeping offset from the base section.
68 */
69#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))
70
71#else /* CONFIG_MMU */
72
73/*
74 * The limitation of user task size can grow up to the end of free ram region.
75 * It is difficult to define and perhaps will never meet the original meaning
76 * of this define that was meant to.
77 * Fortunately, there is no reference for this in noMMU mode, for now.
78 */
79#ifndef TASK_SIZE
80#define TASK_SIZE (CONFIG_DRAM_SIZE)
81#endif
82
83#ifndef TASK_UNMAPPED_BASE
84#define TASK_UNMAPPED_BASE UL(0x00000000)
85#endif
86
87#ifndef PHYS_OFFSET
88#define PHYS_OFFSET (CONFIG_DRAM_BASE)
89#endif
90
91#ifndef END_MEM
92#define END_MEM (CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE)
93#endif
94
95#ifndef PAGE_OFFSET
96#define PAGE_OFFSET (PHYS_OFFSET)
97#endif
98
99/*
100 * The module can be at any place in ram in nommu mode.
101 */
102#define MODULE_END (END_MEM)
103#define MODULE_START (PHYS_OFFSET)
104
105#endif /* !CONFIG_MMU */
106
107/*
51 * Size of DMA-consistent memory region. Must be multiple of 2M, 108 * Size of DMA-consistent memory region. Must be multiple of 2M,
52 * between 2MB and 14MB inclusive. 109 * between 2MB and 14MB inclusive.
53 */ 110 */
@@ -71,24 +128,6 @@
71#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT) 128#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
72#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 129#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
73 130
74/*
75 * The module space lives between the addresses given by TASK_SIZE
76 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
77 */
78#define MODULE_END (PAGE_OFFSET)
79#define MODULE_START (MODULE_END - 16*1048576)
80
81#if TASK_SIZE > MODULE_START
82#error Top of user space clashes with start of module space
83#endif
84
85/*
86 * The XIP kernel gets mapped at the bottom of the module vm area.
87 * Since we use sections to map it, this macro replaces the physical address
88 * with its virtual address while keeping offset from the base section.
89 */
90#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))
91
92#ifndef __ASSEMBLY__ 131#ifndef __ASSEMBLY__
93 132
94/* 133/*
diff --git a/include/asm-arm/mmu.h b/include/asm-arm/mmu.h
index a457cb71984f..23dde52e0945 100644
--- a/include/asm-arm/mmu.h
+++ b/include/asm-arm/mmu.h
@@ -1,6 +1,8 @@
1#ifndef __ARM_MMU_H 1#ifndef __ARM_MMU_H
2#define __ARM_MMU_H 2#define __ARM_MMU_H
3 3
4#ifdef CONFIG_MMU
5
4typedef struct { 6typedef struct {
5#if __LINUX_ARM_ARCH__ >= 6 7#if __LINUX_ARM_ARCH__ >= 6
6 unsigned int id; 8 unsigned int id;
@@ -13,4 +15,18 @@ typedef struct {
13#define ASID(mm) (0) 15#define ASID(mm) (0)
14#endif 16#endif
15 17
18#else
19
20/*
21 * From nommu.h:
22 * Copyright (C) 2002, David McCullough <davidm@snapgear.com>
23 * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com>
24 */
25typedef struct {
26 struct vm_list_struct *vmlist;
27 unsigned long end_brk;
28} mm_context_t;
29
30#endif
31
16#endif 32#endif
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index 81c59facea3b..9fadb01e030d 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -82,6 +82,7 @@ static inline void
82switch_mm(struct mm_struct *prev, struct mm_struct *next, 82switch_mm(struct mm_struct *prev, struct mm_struct *next,
83 struct task_struct *tsk) 83 struct task_struct *tsk)
84{ 84{
85#ifdef CONFIG_MMU
85 unsigned int cpu = smp_processor_id(); 86 unsigned int cpu = smp_processor_id();
86 87
87 if (prev != next) { 88 if (prev != next) {
@@ -91,6 +92,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
91 if (cache_is_vivt()) 92 if (cache_is_vivt())
92 cpu_clear(cpu, prev->cpu_vm_mask); 93 cpu_clear(cpu, prev->cpu_vm_mask);
93 } 94 }
95#endif
94} 96}
95 97
96#define deactivate_mm(tsk,mm) do { } while (0) 98#define deactivate_mm(tsk,mm) do { } while (0)
diff --git a/include/asm-arm/page-nommu.h b/include/asm-arm/page-nommu.h
new file mode 100644
index 000000000000..a1bcad060480
--- /dev/null
+++ b/include/asm-arm/page-nommu.h
@@ -0,0 +1,51 @@
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 */
31typedef unsigned long pte_t;
32typedef unsigned long pmd_t;
33typedef unsigned long pgd_t[2];
34typedef 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
48extern unsigned long memory_start;
49extern unsigned long memory_end;
50
51#endif
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 66cfeb5290ea..63d12f0244c5 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -23,6 +23,12 @@
23 23
24#ifndef __ASSEMBLY__ 24#ifndef __ASSEMBLY__
25 25
26#ifndef CONFIG_MMU
27
28#include "page-nommu.h"
29
30#else
31
26#include <asm/glue.h> 32#include <asm/glue.h>
27 33
28/* 34/*
@@ -171,6 +177,8 @@ typedef unsigned long pgprot_t;
171/* the upper-most page table pointer */ 177/* the upper-most page table pointer */
172extern pmd_t *top_pmd; 178extern pmd_t *top_pmd;
173 179
180#endif /* CONFIG_MMU */
181
174#include <asm/memory.h> 182#include <asm/memory.h>
175 183
176#endif /* !__ASSEMBLY__ */ 184#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h
index c4ac2e67768d..4d4394552911 100644
--- a/include/asm-arm/pgalloc.h
+++ b/include/asm-arm/pgalloc.h
@@ -16,6 +16,10 @@
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18 18
19#define check_pgt_cache() do { } while (0)
20
21#ifdef CONFIG_MMU
22
19#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER)) 23#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)) 24#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL))
21 25
@@ -32,8 +36,6 @@ extern void free_pgd_slow(pgd_t *pgd);
32#define pgd_alloc(mm) get_pgd_slow(mm) 36#define pgd_alloc(mm) get_pgd_slow(mm)
33#define pgd_free(pgd) free_pgd_slow(pgd) 37#define pgd_free(pgd) free_pgd_slow(pgd)
34 38
35#define check_pgt_cache() do { } while (0)
36
37/* 39/*
38 * Allocate one PTE table. 40 * Allocate one PTE table.
39 * 41 *
@@ -126,4 +128,6 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
126 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE); 128 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE);
127} 129}
128 130
131#endif /* CONFIG_MMU */
132
129#endif 133#endif
diff --git a/include/asm-arm/pgtable-nommu.h b/include/asm-arm/pgtable-nommu.h
new file mode 100644
index 000000000000..b13322dccf41
--- /dev/null
+++ b/include/asm-arm/pgtable-nommu.h
@@ -0,0 +1,123 @@
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
58typedef pte_t *pte_addr_t;
59
60static 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 */
78extern unsigned int kobjsize(const void *objp);
79extern 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 */
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index e85c08d78dda..8d3919c6458c 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -11,9 +11,15 @@
11#define _ASMARM_PGTABLE_H 11#define _ASMARM_PGTABLE_H
12 12
13#include <asm-generic/4level-fixup.h> 13#include <asm-generic/4level-fixup.h>
14#include <asm/proc-fns.h>
15
16#ifndef CONFIG_MMU
17
18#include "pgtable-nommu.h"
19
20#else
14 21
15#include <asm/memory.h> 22#include <asm/memory.h>
16#include <asm/proc-fns.h>
17#include <asm/arch/vmalloc.h> 23#include <asm/arch/vmalloc.h>
18 24
19/* 25/*
@@ -378,4 +384,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
378 384
379#endif /* !__ASSEMBLY__ */ 385#endif /* !__ASSEMBLY__ */
380 386
387#endif /* CONFIG_MMU */
388
381#endif /* _ASMARM_PGTABLE_H */ 389#endif /* _ASMARM_PGTABLE_H */
diff --git a/include/asm-arm/proc-fns.h b/include/asm-arm/proc-fns.h
index e9310895e79d..1bde92cdaebd 100644
--- a/include/asm-arm/proc-fns.h
+++ b/include/asm-arm/proc-fns.h
@@ -165,6 +165,8 @@
165 165
166#include <asm/memory.h> 166#include <asm/memory.h>
167 167
168#ifdef CONFIG_MMU
169
168#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm) 170#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
169 171
170#define cpu_get_pgd() \ 172#define cpu_get_pgd() \
@@ -176,6 +178,8 @@
176 (pgd_t *)phys_to_virt(pg); \ 178 (pgd_t *)phys_to_virt(pg); \
177 }) 179 })
178 180
181#endif
182
179#endif /* __ASSEMBLY__ */ 183#endif /* __ASSEMBLY__ */
180#endif /* __KERNEL__ */ 184#endif /* __KERNEL__ */
181#endif /* __ASM_PROCFNS_H */ 185#endif /* __ASM_PROCFNS_H */
diff --git a/include/asm-arm/ptrace.h b/include/asm-arm/ptrace.h
index 2bebe3dc0a30..5a8ef787dbf8 100644
--- a/include/asm-arm/ptrace.h
+++ b/include/asm-arm/ptrace.h
@@ -25,6 +25,11 @@
25 25
26#define PTRACE_SET_SYSCALL 23 26#define PTRACE_SET_SYSCALL 23
27 27
28/* PTRACE_SYSCALL is 24 */
29
30#define PTRACE_GETCRUNCHREGS 25
31#define PTRACE_SETCRUNCHREGS 26
32
28/* 33/*
29 * PSR bits 34 * PSR bits
30 */ 35 */
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h
index cfbccb63c67b..c46b5c84275f 100644
--- a/include/asm-arm/thread_info.h
+++ b/include/asm-arm/thread_info.h
@@ -59,6 +59,7 @@ struct thread_info {
59 struct cpu_context_save cpu_context; /* cpu context */ 59 struct cpu_context_save cpu_context; /* cpu context */
60 __u8 used_cp[16]; /* thread used copro */ 60 __u8 used_cp[16]; /* thread used copro */
61 unsigned long tp_value; 61 unsigned long tp_value;
62 struct crunch_state crunchstate;
62 union fp_state fpstate __attribute__((aligned(8))); 63 union fp_state fpstate __attribute__((aligned(8)));
63 union vfp_state vfpstate; 64 union vfp_state vfpstate;
64 struct restart_block restart_block; 65 struct restart_block restart_block;
@@ -101,6 +102,11 @@ extern void free_thread_info(struct thread_info *);
101#define thread_saved_fp(tsk) \ 102#define thread_saved_fp(tsk) \
102 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) 103 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
103 104
105extern void crunch_task_disable(struct thread_info *);
106extern void crunch_task_copy(struct thread_info *, void *);
107extern void crunch_task_restore(struct thread_info *, void *);
108extern void crunch_task_release(struct thread_info *);
109
104extern void iwmmxt_task_disable(struct thread_info *); 110extern void iwmmxt_task_disable(struct thread_info *);
105extern void iwmmxt_task_copy(struct thread_info *, void *); 111extern void iwmmxt_task_copy(struct thread_info *, void *);
106extern void iwmmxt_task_restore(struct thread_info *, void *); 112extern void iwmmxt_task_restore(struct thread_info *, void *);
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h
index 064f0f5e8e2b..87aba57a66c4 100644
--- a/include/asm-arm/uaccess.h
+++ b/include/asm-arm/uaccess.h
@@ -41,15 +41,24 @@ struct exception_table_entry
41extern int fixup_exception(struct pt_regs *regs); 41extern int fixup_exception(struct pt_regs *regs);
42 42
43/* 43/*
44 * These two are intentionally not defined anywhere - if the kernel
45 * code generates any references to them, that's a bug.
46 */
47extern int __get_user_bad(void);
48extern int __put_user_bad(void);
49
50/*
44 * Note that this is actually 0x1,0000,0000 51 * Note that this is actually 0x1,0000,0000
45 */ 52 */
46#define KERNEL_DS 0x00000000 53#define KERNEL_DS 0x00000000
47#define USER_DS TASK_SIZE
48
49#define get_ds() (KERNEL_DS) 54#define get_ds() (KERNEL_DS)
55
56#ifdef CONFIG_MMU
57
58#define USER_DS TASK_SIZE
50#define get_fs() (current_thread_info()->addr_limit) 59#define get_fs() (current_thread_info()->addr_limit)
51 60
52static inline void set_fs (mm_segment_t fs) 61static inline void set_fs(mm_segment_t fs)
53{ 62{
54 current_thread_info()->addr_limit = fs; 63 current_thread_info()->addr_limit = fs;
55 modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER); 64 modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER);
@@ -75,8 +84,6 @@ static inline void set_fs (mm_segment_t fs)
75 : "cc"); \ 84 : "cc"); \
76 flag; }) 85 flag; })
77 86
78#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
79
80/* 87/*
81 * Single-value transfer routines. They automatically use the right 88 * Single-value transfer routines. They automatically use the right
82 * size if we just have the right pointer type. Note that the functions 89 * size if we just have the right pointer type. Note that the functions
@@ -87,20 +94,10 @@ static inline void set_fs (mm_segment_t fs)
87 * fixup code, but there are a few places where it intrudes on the 94 * 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 95 * main code path. When we only write to user space, there is no
89 * problem. 96 * problem.
90 *
91 * The "__xxx" versions of the user access functions do not verify the
92 * address space - it must have been done previously with a separate
93 * "access_ok()" call.
94 *
95 * The "xxx_error" versions set the third argument to EFAULT if an
96 * error occurs, and leave it unchanged on success. Note that these
97 * versions are void (ie, don't return a value as such).
98 */ 97 */
99
100extern int __get_user_1(void *); 98extern int __get_user_1(void *);
101extern int __get_user_2(void *); 99extern int __get_user_2(void *);
102extern int __get_user_4(void *); 100extern int __get_user_4(void *);
103extern int __get_user_bad(void);
104 101
105#define __get_user_x(__r2,__p,__e,__s,__i...) \ 102#define __get_user_x(__r2,__p,__e,__s,__i...) \
106 __asm__ __volatile__ ( \ 103 __asm__ __volatile__ ( \
@@ -131,6 +128,74 @@ extern int __get_user_bad(void);
131 __e; \ 128 __e; \
132 }) 129 })
133 130
131extern int __put_user_1(void *, unsigned int);
132extern int __put_user_2(void *, unsigned int);
133extern int __put_user_4(void *, unsigned int);
134extern int __put_user_8(void *, unsigned long long);
135
136#define __put_user_x(__r2,__p,__e,__s) \
137 __asm__ __volatile__ ( \
138 __asmeq("%0", "r0") __asmeq("%2", "r2") \
139 "bl __put_user_" #__s \
140 : "=&r" (__e) \
141 : "0" (__p), "r" (__r2) \
142 : "ip", "lr", "cc")
143
144#define put_user(x,p) \
145 ({ \
146 const register typeof(*(p)) __r2 asm("r2") = (x); \
147 const register typeof(*(p)) __user *__p asm("r0") = (p);\
148 register int __e asm("r0"); \
149 switch (sizeof(*(__p))) { \
150 case 1: \
151 __put_user_x(__r2, __p, __e, 1); \
152 break; \
153 case 2: \
154 __put_user_x(__r2, __p, __e, 2); \
155 break; \
156 case 4: \
157 __put_user_x(__r2, __p, __e, 4); \
158 break; \
159 case 8: \
160 __put_user_x(__r2, __p, __e, 8); \
161 break; \
162 default: __e = __put_user_bad(); break; \
163 } \
164 __e; \
165 })
166
167#else /* CONFIG_MMU */
168
169/*
170 * uClinux has only one addr space, so has simplified address limits.
171 */
172#define USER_DS KERNEL_DS
173
174#define segment_eq(a,b) (1)
175#define __addr_ok(addr) (1)
176#define __range_ok(addr,size) (0)
177#define get_fs() (KERNEL_DS)
178
179static inline void set_fs(mm_segment_t fs)
180{
181}
182
183#define get_user(x,p) __get_user(x,p)
184#define put_user(x,p) __put_user(x,p)
185
186#endif /* CONFIG_MMU */
187
188#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
189
190/*
191 * The "__xxx" versions of the user access functions do not verify the
192 * address space - it must have been done previously with a separate
193 * "access_ok()" call.
194 *
195 * The "xxx_error" versions set the third argument to EFAULT if an
196 * error occurs, and leave it unchanged on success. Note that these
197 * versions are void (ie, don't return a value as such).
198 */
134#define __get_user(x,ptr) \ 199#define __get_user(x,ptr) \
135({ \ 200({ \
136 long __gu_err = 0; \ 201 long __gu_err = 0; \
@@ -212,43 +277,6 @@ do { \
212 : "r" (addr), "i" (-EFAULT) \ 277 : "r" (addr), "i" (-EFAULT) \
213 : "cc") 278 : "cc")
214 279
215extern int __put_user_1(void *, unsigned int);
216extern int __put_user_2(void *, unsigned int);
217extern int __put_user_4(void *, unsigned int);
218extern int __put_user_8(void *, unsigned long long);
219extern int __put_user_bad(void);
220
221#define __put_user_x(__r2,__p,__e,__s) \
222 __asm__ __volatile__ ( \
223 __asmeq("%0", "r0") __asmeq("%2", "r2") \
224 "bl __put_user_" #__s \
225 : "=&r" (__e) \
226 : "0" (__p), "r" (__r2) \
227 : "ip", "lr", "cc")
228
229#define put_user(x,p) \
230 ({ \
231 const register typeof(*(p)) __r2 asm("r2") = (x); \
232 const register typeof(*(p)) __user *__p asm("r0") = (p);\
233 register int __e asm("r0"); \
234 switch (sizeof(*(__p))) { \
235 case 1: \
236 __put_user_x(__r2, __p, __e, 1); \
237 break; \
238 case 2: \
239 __put_user_x(__r2, __p, __e, 2); \
240 break; \
241 case 4: \
242 __put_user_x(__r2, __p, __e, 4); \
243 break; \
244 case 8: \
245 __put_user_x(__r2, __p, __e, 8); \
246 break; \
247 default: __e = __put_user_bad(); break; \
248 } \
249 __e; \
250 })
251
252#define __put_user(x,ptr) \ 280#define __put_user(x,ptr) \
253({ \ 281({ \
254 long __pu_err = 0; \ 282 long __pu_err = 0; \
@@ -353,66 +381,54 @@ do { \
353 : "r" (x), "i" (-EFAULT) \ 381 : "r" (x), "i" (-EFAULT) \
354 : "cc") 382 : "cc")
355 383
356extern unsigned long __arch_copy_from_user(void *to, const void __user *from, unsigned long n); 384
357extern unsigned long __arch_copy_to_user(void __user *to, const void *from, unsigned long n); 385#ifdef CONFIG_MMU
358extern unsigned long __arch_clear_user(void __user *addr, unsigned long n); 386extern unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n);
359extern unsigned long __arch_strncpy_from_user(char *to, const char __user *from, unsigned long count); 387extern unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n);
360extern unsigned long __arch_strnlen_user(const char __user *s, long n); 388extern unsigned long __clear_user(void __user *addr, unsigned long n);
389#else
390#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0)
391#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0)
392#define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0)
393#endif
394
395extern unsigned long __strncpy_from_user(char *to, const char __user *from, unsigned long count);
396extern unsigned long __strnlen_user(const char __user *s, long n);
361 397
362static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) 398static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
363{ 399{
364 if (access_ok(VERIFY_READ, from, n)) 400 if (access_ok(VERIFY_READ, from, n))
365 n = __arch_copy_from_user(to, from, n); 401 n = __copy_from_user(to, from, n);
366 else /* security hole - plug it */ 402 else /* security hole - plug it */
367 memzero(to, n); 403 memzero(to, n);
368 return n; 404 return n;
369} 405}
370 406
371static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
372{
373 return __arch_copy_from_user(to, from, n);
374}
375
376static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) 407static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
377{ 408{
378 if (access_ok(VERIFY_WRITE, to, n)) 409 if (access_ok(VERIFY_WRITE, to, n))
379 n = __arch_copy_to_user(to, from, n); 410 n = __copy_to_user(to, from, n);
380 return n; 411 return n;
381} 412}
382 413
383static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
384{
385 return __arch_copy_to_user(to, from, n);
386}
387
388#define __copy_to_user_inatomic __copy_to_user 414#define __copy_to_user_inatomic __copy_to_user
389#define __copy_from_user_inatomic __copy_from_user 415#define __copy_from_user_inatomic __copy_from_user
390 416
391static inline unsigned long clear_user (void __user *to, unsigned long n) 417static inline unsigned long clear_user(void __user *to, unsigned long n)
392{ 418{
393 if (access_ok(VERIFY_WRITE, to, n)) 419 if (access_ok(VERIFY_WRITE, to, n))
394 n = __arch_clear_user(to, n); 420 n = __clear_user(to, n);
395 return n; 421 return n;
396} 422}
397 423
398static inline unsigned long __clear_user (void __user *to, unsigned long n) 424static inline long strncpy_from_user(char *dst, const char __user *src, long count)
399{
400 return __arch_clear_user(to, n);
401}
402
403static inline long strncpy_from_user (char *dst, const char __user *src, long count)
404{ 425{
405 long res = -EFAULT; 426 long res = -EFAULT;
406 if (access_ok(VERIFY_READ, src, 1)) 427 if (access_ok(VERIFY_READ, src, 1))
407 res = __arch_strncpy_from_user(dst, src, count); 428 res = __strncpy_from_user(dst, src, count);
408 return res; 429 return res;
409} 430}
410 431
411static inline long __strncpy_from_user (char *dst, const char __user *src, long count)
412{
413 return __arch_strncpy_from_user(dst, src, count);
414}
415
416#define strlen_user(s) strnlen_user(s, ~0UL >> 1) 432#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
417 433
418static inline long strnlen_user(const char __user *s, long n) 434static inline long strnlen_user(const char __user *s, long n)
@@ -420,7 +436,7 @@ static inline long strnlen_user(const char __user *s, long n)
420 unsigned long res = 0; 436 unsigned long res = 0;
421 437
422 if (__addr_ok(s)) 438 if (__addr_ok(s))
423 res = __arch_strnlen_user(s, n); 439 res = __strnlen_user(s, n);
424 440
425 return res; 441 return res;
426} 442}
diff --git a/include/asm-arm/ucontext.h b/include/asm-arm/ucontext.h
index 9e6f7ca9f5ae..bf65e9f4525d 100644
--- a/include/asm-arm/ucontext.h
+++ b/include/asm-arm/ucontext.h
@@ -35,6 +35,17 @@ struct ucontext {
35 * bytes, to prevent unpredictable padding in the signal frame. 35 * bytes, to prevent unpredictable padding in the signal frame.
36 */ 36 */
37 37
38#ifdef CONFIG_CRUNCH
39#define CRUNCH_MAGIC 0x5065cf03
40#define CRUNCH_STORAGE_SIZE (CRUNCH_SIZE + 8)
41
42struct crunch_sigframe {
43 unsigned long magic;
44 unsigned long size;
45 struct crunch_state storage;
46} __attribute__((__aligned__(8)));
47#endif
48
38#ifdef CONFIG_IWMMXT 49#ifdef CONFIG_IWMMXT
39/* iwmmxt_area is 0x98 bytes long, preceeded by 8 bytes of signature */ 50/* iwmmxt_area is 0x98 bytes long, preceeded by 8 bytes of signature */
40#define IWMMXT_MAGIC 0x12ef842a 51#define IWMMXT_MAGIC 0x12ef842a
@@ -74,6 +85,9 @@ struct vfp_sigframe
74 * one of these. 85 * one of these.
75 */ 86 */
76struct aux_sigframe { 87struct aux_sigframe {
88#ifdef CONFIG_CRUNCH
89 struct crunch_sigframe crunch;
90#endif
77#ifdef CONFIG_IWMMXT 91#ifdef CONFIG_IWMMXT
78 struct iwmmxt_sigframe iwmmxt; 92 struct iwmmxt_sigframe iwmmxt;
79#endif 93#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9d11550b4818..db5a3732f106 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -58,6 +58,20 @@
58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ 58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
59 } \ 59 } \
60 \ 60 \
61 /* Kernel symbol table: Normal unused symbols */ \
62 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
64 *(__ksymtab_unused) \
65 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
66 } \
67 \
68 /* Kernel symbol table: GPL-only unused symbols */ \
69 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
70 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
71 *(__ksymtab_unused_gpl) \
72 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
73 } \
74 \
61 /* Kernel symbol table: GPL-future-only symbols */ \ 75 /* Kernel symbol table: GPL-future-only symbols */ \
62 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ 76 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ 77 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
@@ -79,6 +93,20 @@
79 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ 93 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
80 } \ 94 } \
81 \ 95 \
96 /* Kernel symbol table: Normal unused symbols */ \
97 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
98 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
99 *(__kcrctab_unused) \
100 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
101 } \
102 \
103 /* Kernel symbol table: GPL-only unused symbols */ \
104 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
105 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
106 *(__kcrctab_unused_gpl) \
107 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
108 } \
109 \
82 /* Kernel symbol table: GPL-future-only symbols */ \ 110 /* Kernel symbol table: GPL-future-only symbols */ \
83 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ 111 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
84 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ 112 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index cd490b20d592..bd4452bda357 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -85,6 +85,7 @@
85#define SN_SAL_GET_PROM_FEATURE_SET 0x02000065 85#define SN_SAL_GET_PROM_FEATURE_SET 0x02000065
86#define SN_SAL_SET_OS_FEATURE_SET 0x02000066 86#define SN_SAL_SET_OS_FEATURE_SET 0x02000066
87#define SN_SAL_INJECT_ERROR 0x02000067 87#define SN_SAL_INJECT_ERROR 0x02000067
88#define SN_SAL_SET_CPU_NUMBER 0x02000068
88 89
89/* 90/*
90 * Service-specific constants 91 * Service-specific constants
@@ -1150,4 +1151,13 @@ sn_inject_error(u64 paddr, u64 *data, u64 *ecc)
1150 local_irq_restore(irq_flags); 1151 local_irq_restore(irq_flags);
1151 return ret_stuff.status; 1152 return ret_stuff.status;
1152} 1153}
1154
1155static inline int
1156ia64_sn_set_cpu_number(int cpu)
1157{
1158 struct ia64_sal_retval rv;
1159
1160 SAL_CALL_NOLOCK(rv, SN_SAL_SET_CPU_NUMBER, cpu, 0, 0, 0, 0, 0, 0);
1161 return rv.status;
1162}
1153#endif /* _ASM_IA64_SN_SN_SAL_H */ 1163#endif /* _ASM_IA64_SN_SN_SAL_H */
diff --git a/include/asm-m68knommu/bootstd.h b/include/asm-m68knommu/bootstd.h
index 3fdc79f06d50..bdc1a4ac4fe9 100644
--- a/include/asm-m68knommu/bootstd.h
+++ b/include/asm-m68knommu/bootstd.h
@@ -52,7 +52,7 @@ type name(void) \
52 __asm__ __volatile__ ("trap #2" \ 52 __asm__ __volatile__ ("trap #2" \
53 : "=g" (__res) \ 53 : "=g" (__res) \
54 : "0" (__res) \ 54 : "0" (__res) \
55 : "%d0"); \ 55 ); \
56 __bsc_return(type,__res); \ 56 __bsc_return(type,__res); \
57} 57}
58 58
@@ -64,7 +64,7 @@ type name(atype a) \
64 __asm__ __volatile__ ("trap #2" \ 64 __asm__ __volatile__ ("trap #2" \
65 : "=g" (__res) \ 65 : "=g" (__res) \
66 : "0" (__res), "d" (__a) \ 66 : "0" (__res), "d" (__a) \
67 : "%d0"); \ 67 ); \
68 __bsc_return(type,__res); \ 68 __bsc_return(type,__res); \
69} 69}
70 70
@@ -77,7 +77,7 @@ type name(atype a, btype b) \
77 __asm__ __volatile__ ("trap #2" \ 77 __asm__ __volatile__ ("trap #2" \
78 : "=g" (__res) \ 78 : "=g" (__res) \
79 : "0" (__res), "d" (__a), "d" (__b) \ 79 : "0" (__res), "d" (__a), "d" (__b) \
80 : "%d0"); \ 80 ); \
81 __bsc_return(type,__res); \ 81 __bsc_return(type,__res); \
82} 82}
83 83
@@ -92,7 +92,7 @@ type name(atype a, btype b, ctype c) \
92 : "=g" (__res) \ 92 : "=g" (__res) \
93 : "0" (__res), "d" (__a), "d" (__b), \ 93 : "0" (__res), "d" (__a), "d" (__b), \
94 "d" (__c) \ 94 "d" (__c) \
95 : "%d0"); \ 95 ); \
96 __bsc_return(type,__res); \ 96 __bsc_return(type,__res); \
97} 97}
98 98
@@ -108,7 +108,7 @@ type name(atype a, btype b, ctype c, dtype d) \
108 : "=g" (__res) \ 108 : "=g" (__res) \
109 : "0" (__res), "d" (__a), "d" (__b), \ 109 : "0" (__res), "d" (__a), "d" (__b), \
110 "d" (__c), "d" (__d) \ 110 "d" (__c), "d" (__d) \
111 : "%d0"); \ 111 ); \
112 __bsc_return(type,__res); \ 112 __bsc_return(type,__res); \
113} 113}
114 114
@@ -125,7 +125,7 @@ type name(atype a, btype b, ctype c, dtype d, etype e) \
125 : "=g" (__res) \ 125 : "=g" (__res) \
126 : "0" (__res), "d" (__a), "d" (__b), \ 126 : "0" (__res), "d" (__a), "d" (__b), \
127 "d" (__c), "d" (__d), "d" (__e) \ 127 "d" (__c), "d" (__d), "d" (__e) \
128 : "%d0"); \ 128 ); \
129 __bsc_return(type,__res); \ 129 __bsc_return(type,__res); \
130} 130}
131 131
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h
index c35833824e11..2ed2fd855133 100644
--- a/include/linux/ac97_codec.h
+++ b/include/linux/ac97_codec.h
@@ -259,7 +259,7 @@ struct ac97_codec {
259 int type; 259 int type;
260 u32 model; 260 u32 model;
261 261
262 int modem:1; 262 unsigned int modem:1;
263 263
264 struct ac97_ops *codec_ops; 264 struct ac97_ops *codec_ops;
265 265
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 7b5c5df5cb69..be512cc98791 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -27,8 +27,8 @@ extern struct inode_operations coda_dir_inode_operations;
27extern struct inode_operations coda_file_inode_operations; 27extern struct inode_operations coda_file_inode_operations;
28extern struct inode_operations coda_ioctl_inode_operations; 28extern struct inode_operations coda_ioctl_inode_operations;
29 29
30extern struct address_space_operations coda_file_aops; 30extern const struct address_space_operations coda_file_aops;
31extern struct address_space_operations coda_symlink_aops; 31extern const struct address_space_operations coda_symlink_aops;
32 32
33extern const struct file_operations coda_dir_operations; 33extern const struct file_operations coda_dir_operations;
34extern const struct file_operations coda_file_operations; 34extern const struct file_operations coda_file_operations;
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index fbfa6b52e2fb..278ef4495819 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -38,7 +38,7 @@ struct statfs;
38 38
39extern struct inode_operations efs_dir_inode_operations; 39extern struct inode_operations efs_dir_inode_operations;
40extern const struct file_operations efs_dir_operations; 40extern const struct file_operations efs_dir_operations;
41extern struct address_space_operations efs_symlink_aops; 41extern const struct address_space_operations efs_symlink_aops;
42 42
43extern void efs_read_inode(struct inode *); 43extern void efs_read_inode(struct inode *);
44extern efs_block_t efs_map_block(struct inode *, efs_block_t); 44extern efs_block_t efs_map_block(struct inode *, efs_block_t);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2d8b348c1192..e04a5cfe874f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -392,7 +392,7 @@ struct address_space {
392 unsigned int truncate_count; /* Cover race condition with truncate */ 392 unsigned int truncate_count; /* Cover race condition with truncate */
393 unsigned long nrpages; /* number of total pages */ 393 unsigned long nrpages; /* number of total pages */
394 pgoff_t writeback_index;/* writeback starts here */ 394 pgoff_t writeback_index;/* writeback starts here */
395 struct address_space_operations *a_ops; /* methods */ 395 const struct address_space_operations *a_ops; /* methods */
396 unsigned long flags; /* error bits/gfp mask */ 396 unsigned long flags; /* error bits/gfp mask */
397 struct backing_dev_info *backing_dev_info; /* device readahead, etc */ 397 struct backing_dev_info *backing_dev_info; /* device readahead, etc */
398 spinlock_t private_lock; /* for use by the address_space */ 398 spinlock_t private_lock; /* for use by the address_space */
@@ -1405,7 +1405,7 @@ extern void bd_forget(struct inode *inode);
1405extern void bdput(struct block_device *); 1405extern void bdput(struct block_device *);
1406extern struct block_device *open_by_devnum(dev_t, unsigned); 1406extern struct block_device *open_by_devnum(dev_t, unsigned);
1407extern const struct file_operations def_blk_fops; 1407extern const struct file_operations def_blk_fops;
1408extern struct address_space_operations def_blk_aops; 1408extern const struct address_space_operations def_blk_aops;
1409extern const struct file_operations def_chr_fops; 1409extern const struct file_operations def_chr_fops;
1410extern const struct file_operations bad_sock_fops; 1410extern const struct file_operations bad_sock_fops;
1411extern const struct file_operations def_fifo_fops; 1411extern const struct file_operations def_fifo_fops;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index ef7bef207f48..0c100168c0cf 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -793,6 +793,7 @@ typedef struct hwif_s {
793 unsigned auto_poll : 1; /* supports nop auto-poll */ 793 unsigned auto_poll : 1; /* supports nop auto-poll */
794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 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 */ 795 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
796 unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */
796 797
797 struct device gendev; 798 struct device gendev;
798 struct completion gendev_rel_comp; /* To deal with device release() */ 799 struct completion gendev_rel_comp; /* To deal with device release() */
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 4eb851ece080..efe0ee4cc80b 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -155,10 +155,8 @@ static inline void con_schedule_flip(struct tty_struct *t)
155{ 155{
156 unsigned long flags; 156 unsigned long flags;
157 spin_lock_irqsave(&t->buf.lock, flags); 157 spin_lock_irqsave(&t->buf.lock, flags);
158 if (t->buf.tail != NULL) { 158 if (t->buf.tail != NULL)
159 t->buf.tail->active = 0;
160 t->buf.tail->commit = t->buf.tail->used; 159 t->buf.tail->commit = t->buf.tail->used;
161 }
162 spin_unlock_irqrestore(&t->buf.lock, flags); 160 spin_unlock_irqrestore(&t->buf.lock, flags);
163 schedule_work(&t->buf.work); 161 schedule_work(&t->buf.work);
164} 162}
diff --git a/include/linux/module.h b/include/linux/module.h
index 9ebbb74b7b72..9e9dc7c24d95 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -203,6 +203,15 @@ void *__symbol_get_gpl(const char *symbol);
203#define EXPORT_SYMBOL_GPL_FUTURE(sym) \ 203#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
204 __EXPORT_SYMBOL(sym, "_gpl_future") 204 __EXPORT_SYMBOL(sym, "_gpl_future")
205 205
206
207#ifdef CONFIG_UNUSED_SYMBOLS
208#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
209#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
210#else
211#define EXPORT_UNUSED_SYMBOL(sym)
212#define EXPORT_UNUSED_SYMBOL_GPL(sym)
213#endif
214
206#endif 215#endif
207 216
208struct module_ref 217struct module_ref
@@ -261,6 +270,15 @@ struct module
261 unsigned int num_gpl_syms; 270 unsigned int num_gpl_syms;
262 const unsigned long *gpl_crcs; 271 const unsigned long *gpl_crcs;
263 272
273 /* unused exported symbols. */
274 const struct kernel_symbol *unused_syms;
275 unsigned int num_unused_syms;
276 const unsigned long *unused_crcs;
277 /* GPL-only, unused exported symbols. */
278 const struct kernel_symbol *unused_gpl_syms;
279 unsigned int num_unused_gpl_syms;
280 const unsigned long *unused_gpl_crcs;
281
264 /* symbols that will be GPL-only in the near future. */ 282 /* symbols that will be GPL-only in the near future. */
265 const struct kernel_symbol *gpl_future_syms; 283 const struct kernel_symbol *gpl_future_syms;
266 unsigned int num_gpl_future_syms; 284 unsigned int num_gpl_future_syms;
@@ -456,6 +474,8 @@ void module_remove_driver(struct device_driver *);
456#define EXPORT_SYMBOL(sym) 474#define EXPORT_SYMBOL(sym)
457#define EXPORT_SYMBOL_GPL(sym) 475#define EXPORT_SYMBOL_GPL(sym)
458#define EXPORT_SYMBOL_GPL_FUTURE(sym) 476#define EXPORT_SYMBOL_GPL_FUTURE(sym)
477#define EXPORT_UNUSED_SYMBOL(sym)
478#define EXPORT_UNUSED_SYMBOL_GPL(sym)
459 479
460/* Given an address, look for it in the exception tables. */ 480/* Given an address, look for it in the exception tables. */
461static inline const struct exception_table_entry * 481static inline const struct exception_table_entry *
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 0a1740b2532e..d90b1bb37563 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -335,7 +335,7 @@ extern struct inode_operations nfs_file_inode_operations;
335extern struct inode_operations nfs3_file_inode_operations; 335extern struct inode_operations nfs3_file_inode_operations;
336#endif /* CONFIG_NFS_V3 */ 336#endif /* CONFIG_NFS_V3 */
337extern const struct file_operations nfs_file_operations; 337extern const struct file_operations nfs_file_operations;
338extern struct address_space_operations nfs_file_aops; 338extern const struct address_space_operations nfs_file_aops;
339 339
340static inline struct rpc_cred *nfs_file_cred(struct file *file) 340static inline struct rpc_cred *nfs_file_cred(struct file *file)
341{ 341{
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 3404faef542c..b95818a037ad 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -73,6 +73,7 @@
73#ifndef _LINUX_PLIST_H_ 73#ifndef _LINUX_PLIST_H_
74#define _LINUX_PLIST_H_ 74#define _LINUX_PLIST_H_
75 75
76#include <linux/kernel.h>
76#include <linux/list.h> 77#include <linux/list.h>
77#include <linux/spinlock_types.h> 78#include <linux/spinlock_types.h>
78 79
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 5676c4210e2c..daa2d83cefe8 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1973,7 +1973,7 @@ void reiserfs_unmap_buffer(struct buffer_head *);
1973/* file.c */ 1973/* file.c */
1974extern struct inode_operations reiserfs_file_inode_operations; 1974extern struct inode_operations reiserfs_file_inode_operations;
1975extern const struct file_operations reiserfs_file_operations; 1975extern const struct file_operations reiserfs_file_operations;
1976extern struct address_space_operations reiserfs_address_space_operations; 1976extern const struct address_space_operations reiserfs_address_space_operations;
1977 1977
1978/* fix_nodes.c */ 1978/* fix_nodes.c */
1979 1979
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e928c0dcc297..c8bb68099eb9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -642,10 +642,14 @@ struct spi_board_info {
642 u16 bus_num; 642 u16 bus_num;
643 u16 chip_select; 643 u16 chip_select;
644 644
645 /* mode becomes spi_device.mode, and is essential for chips
646 * where the default of SPI_CS_HIGH = 0 is wrong.
647 */
648 u8 mode;
649
645 /* ... may need additional spi_device chip config data here. 650 /* ... may need additional spi_device chip config data here.
646 * avoid stuff protocol drivers can set; but include stuff 651 * avoid stuff protocol drivers can set; but include stuff
647 * needed to behave without being bound to a driver: 652 * needed to behave without being bound to a driver:
648 * - chipselect polarity
649 * - quirks like clock rate mattering when not selected 653 * - quirks like clock rate mattering when not selected
650 */ 654 */
651}; 655};
diff --git a/include/linux/tty.h b/include/linux/tty.h
index cb35ca50a0a6..b3b807e4b050 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -57,7 +57,6 @@ struct tty_buffer {
57 unsigned char *flag_buf_ptr; 57 unsigned char *flag_buf_ptr;
58 int used; 58 int used;
59 int size; 59 int size;
60 int active;
61 int commit; 60 int commit;
62 int read; 61 int read;
63 /* Data points here */ 62 /* Data points here */
@@ -259,7 +258,6 @@ struct tty_struct {
259#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 258#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
260#define TTY_PUSH 6 /* n_tty private */ 259#define TTY_PUSH 6 /* n_tty private */
261#define TTY_CLOSING 7 /* ->close() in progress */ 260#define TTY_CLOSING 7 /* ->close() in progress */
262#define TTY_DONT_FLIP 8 /* Defer buffer flip */
263#define TTY_LDISC 9 /* Line discipline attached */ 261#define TTY_LDISC 9 /* Line discipline attached */
264#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ 262#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
265#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */ 263#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 31548303ee37..eb677cf56106 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -12,7 +12,7 @@ static inline int tty_insert_flip_char(struct tty_struct *tty,
12 unsigned char ch, char flag) 12 unsigned char ch, char flag)
13{ 13{
14 struct tty_buffer *tb = tty->buf.tail; 14 struct tty_buffer *tb = tty->buf.tail;
15 if (tb && tb->active && tb->used < tb->size) { 15 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 16 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 17 tb->char_buf_ptr[tb->used++] = ch;
18 return 1; 18 return 1;
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 914f911325be..e39b7cc43390 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -966,7 +966,7 @@ extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
966extern struct inode_operations ufs_file_inode_operations; 966extern struct inode_operations ufs_file_inode_operations;
967extern const struct file_operations ufs_file_operations; 967extern const struct file_operations ufs_file_operations;
968 968
969extern struct address_space_operations ufs_aops; 969extern const struct address_space_operations ufs_aops;
970 970
971/* ialloc.c */ 971/* ialloc.c */
972extern void ufs_free_inode (struct inode *inode); 972extern void ufs_free_inode (struct inode *inode);
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 1192ed8f4fe8..011bcfeb9f09 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -28,6 +28,9 @@ struct watchdog_info {
28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) 28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int)
29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) 29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int)
30#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, 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)
31 34
32#define WDIOF_UNKNOWN -1 /* Unknown flag error */ 35#define WDIOF_UNKNOWN -1 /* Unknown flag error */
33#define WDIOS_UNKNOWN -1 /* Unknown status error */ 36#define WDIOS_UNKNOWN -1 /* Unknown status error */
@@ -38,9 +41,10 @@ struct watchdog_info {
38#define WDIOF_EXTERN2 0x0008 /* External relay 2 */ 41#define WDIOF_EXTERN2 0x0008 /* External relay 2 */
39#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ 42#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */
40#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ 43#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */
41#define WDIOF_POWEROVER 0x0040 /* Power over voltage */ 44#define WDIOF_POWEROVER 0x0040 /* Power over voltage */
42#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ 45#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */
43#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ 46#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */
47#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */
44#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ 48#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */
45 49
46#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ 50#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
diff --git a/kernel/module.c b/kernel/module.c
index 10e5b872adf6..99c022ac3d21 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1,4 +1,4 @@
1/* Rewritten by Rusty Russell, on the backs of many others... 1/*
2 Copyright (C) 2002 Richard Henderson 2 Copyright (C) 2002 Richard Henderson
3 Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM. 3 Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.
4 4
@@ -122,9 +122,17 @@ extern const struct kernel_symbol __start___ksymtab_gpl[];
122extern const struct kernel_symbol __stop___ksymtab_gpl[]; 122extern const struct kernel_symbol __stop___ksymtab_gpl[];
123extern const struct kernel_symbol __start___ksymtab_gpl_future[]; 123extern const struct kernel_symbol __start___ksymtab_gpl_future[];
124extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; 124extern const struct kernel_symbol __stop___ksymtab_gpl_future[];
125extern const struct kernel_symbol __start___ksymtab_unused[];
126extern const struct kernel_symbol __stop___ksymtab_unused[];
127extern const struct kernel_symbol __start___ksymtab_unused_gpl[];
128extern const struct kernel_symbol __stop___ksymtab_unused_gpl[];
129extern const struct kernel_symbol __start___ksymtab_gpl_future[];
130extern const struct kernel_symbol __stop___ksymtab_gpl_future[];
125extern const unsigned long __start___kcrctab[]; 131extern const unsigned long __start___kcrctab[];
126extern const unsigned long __start___kcrctab_gpl[]; 132extern const unsigned long __start___kcrctab_gpl[];
127extern const unsigned long __start___kcrctab_gpl_future[]; 133extern const unsigned long __start___kcrctab_gpl_future[];
134extern const unsigned long __start___kcrctab_unused[];
135extern const unsigned long __start___kcrctab_unused_gpl[];
128 136
129#ifndef CONFIG_MODVERSIONS 137#ifndef CONFIG_MODVERSIONS
130#define symversion(base, idx) NULL 138#define symversion(base, idx) NULL
@@ -144,6 +152,17 @@ static const struct kernel_symbol *lookup_symbol(const char *name,
144 return NULL; 152 return NULL;
145} 153}
146 154
155static void printk_unused_warning(const char *name)
156{
157 printk(KERN_WARNING "Symbol %s is marked as UNUSED, "
158 "however this module is using it.\n", name);
159 printk(KERN_WARNING "This symbol will go away in the future.\n");
160 printk(KERN_WARNING "Please evalute if this is the right api to use, "
161 "and if it really is, submit a report the linux kernel "
162 "mailinglist together with submitting your code for "
163 "inclusion.\n");
164}
165
147/* Find a symbol, return value, crc and module which owns it */ 166/* Find a symbol, return value, crc and module which owns it */
148static unsigned long __find_symbol(const char *name, 167static unsigned long __find_symbol(const char *name,
149 struct module **owner, 168 struct module **owner,
@@ -186,6 +205,25 @@ static unsigned long __find_symbol(const char *name,
186 return ks->value; 205 return ks->value;
187 } 206 }
188 207
208 ks = lookup_symbol(name, __start___ksymtab_unused,
209 __stop___ksymtab_unused);
210 if (ks) {
211 printk_unused_warning(name);
212 *crc = symversion(__start___kcrctab_unused,
213 (ks - __start___ksymtab_unused));
214 return ks->value;
215 }
216
217 if (gplok)
218 ks = lookup_symbol(name, __start___ksymtab_unused_gpl,
219 __stop___ksymtab_unused_gpl);
220 if (ks) {
221 printk_unused_warning(name);
222 *crc = symversion(__start___kcrctab_unused_gpl,
223 (ks - __start___ksymtab_unused_gpl));
224 return ks->value;
225 }
226
189 /* Now try modules. */ 227 /* Now try modules. */
190 list_for_each_entry(mod, &modules, list) { 228 list_for_each_entry(mod, &modules, list) {
191 *owner = mod; 229 *owner = mod;
@@ -204,6 +242,23 @@ static unsigned long __find_symbol(const char *name,
204 return ks->value; 242 return ks->value;
205 } 243 }
206 } 244 }
245 ks = lookup_symbol(name, mod->unused_syms, mod->unused_syms + mod->num_unused_syms);
246 if (ks) {
247 printk_unused_warning(name);
248 *crc = symversion(mod->unused_crcs, (ks - mod->unused_syms));
249 return ks->value;
250 }
251
252 if (gplok) {
253 ks = lookup_symbol(name, mod->unused_gpl_syms,
254 mod->unused_gpl_syms + mod->num_unused_gpl_syms);
255 if (ks) {
256 printk_unused_warning(name);
257 *crc = symversion(mod->unused_gpl_crcs,
258 (ks - mod->unused_gpl_syms));
259 return ks->value;
260 }
261 }
207 ks = lookup_symbol(name, mod->gpl_future_syms, 262 ks = lookup_symbol(name, mod->gpl_future_syms,
208 (mod->gpl_future_syms + 263 (mod->gpl_future_syms +
209 mod->num_gpl_future_syms)); 264 mod->num_gpl_future_syms));
@@ -1403,10 +1458,27 @@ static struct module *load_module(void __user *umod,
1403 Elf_Ehdr *hdr; 1458 Elf_Ehdr *hdr;
1404 Elf_Shdr *sechdrs; 1459 Elf_Shdr *sechdrs;
1405 char *secstrings, *args, *modmagic, *strtab = NULL; 1460 char *secstrings, *args, *modmagic, *strtab = NULL;
1406 unsigned int i, symindex = 0, strindex = 0, setupindex, exindex, 1461 unsigned int i;
1407 exportindex, modindex, obsparmindex, infoindex, gplindex, 1462 unsigned int symindex = 0;
1408 crcindex, gplcrcindex, versindex, pcpuindex, gplfutureindex, 1463 unsigned int strindex = 0;
1409 gplfuturecrcindex, unwindex = 0; 1464 unsigned int setupindex;
1465 unsigned int exindex;
1466 unsigned int exportindex;
1467 unsigned int modindex;
1468 unsigned int obsparmindex;
1469 unsigned int infoindex;
1470 unsigned int gplindex;
1471 unsigned int crcindex;
1472 unsigned int gplcrcindex;
1473 unsigned int versindex;
1474 unsigned int pcpuindex;
1475 unsigned int gplfutureindex;
1476 unsigned int gplfuturecrcindex;
1477 unsigned int unwindex = 0;
1478 unsigned int unusedindex;
1479 unsigned int unusedcrcindex;
1480 unsigned int unusedgplindex;
1481 unsigned int unusedgplcrcindex;
1410 struct module *mod; 1482 struct module *mod;
1411 long err = 0; 1483 long err = 0;
1412 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ 1484 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
@@ -1487,9 +1559,13 @@ static struct module *load_module(void __user *umod,
1487 exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab"); 1559 exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab");
1488 gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl"); 1560 gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl");
1489 gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future"); 1561 gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future");
1562 unusedindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused");
1563 unusedgplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused_gpl");
1490 crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab"); 1564 crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab");
1491 gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl"); 1565 gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl");
1492 gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future"); 1566 gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future");
1567 unusedcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused");
1568 unusedgplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused_gpl");
1493 setupindex = find_sec(hdr, sechdrs, secstrings, "__param"); 1569 setupindex = find_sec(hdr, sechdrs, secstrings, "__param");
1494 exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table"); 1570 exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table");
1495 obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm"); 1571 obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm");
@@ -1638,14 +1714,27 @@ static struct module *load_module(void __user *umod,
1638 mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr; 1714 mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr;
1639 mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size / 1715 mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size /
1640 sizeof(*mod->gpl_future_syms); 1716 sizeof(*mod->gpl_future_syms);
1717 mod->num_unused_syms = sechdrs[unusedindex].sh_size /
1718 sizeof(*mod->unused_syms);
1719 mod->num_unused_gpl_syms = sechdrs[unusedgplindex].sh_size /
1720 sizeof(*mod->unused_gpl_syms);
1641 mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr; 1721 mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr;
1642 if (gplfuturecrcindex) 1722 if (gplfuturecrcindex)
1643 mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr; 1723 mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr;
1644 1724
1725 mod->unused_syms = (void *)sechdrs[unusedindex].sh_addr;
1726 if (unusedcrcindex)
1727 mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr;
1728 mod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr;
1729 if (unusedgplcrcindex)
1730 mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr;
1731
1645#ifdef CONFIG_MODVERSIONS 1732#ifdef CONFIG_MODVERSIONS
1646 if ((mod->num_syms && !crcindex) || 1733 if ((mod->num_syms && !crcindex) ||
1647 (mod->num_gpl_syms && !gplcrcindex) || 1734 (mod->num_gpl_syms && !gplcrcindex) ||
1648 (mod->num_gpl_future_syms && !gplfuturecrcindex)) { 1735 (mod->num_gpl_future_syms && !gplfuturecrcindex) ||
1736 (mod->num_unused_syms && !unusedcrcindex) ||
1737 (mod->num_unused_gpl_syms && !unusedgplcrcindex)) {
1649 printk(KERN_WARNING "%s: No versions for exported symbols." 1738 printk(KERN_WARNING "%s: No versions for exported symbols."
1650 " Tainting kernel.\n", mod->name); 1739 " Tainting kernel.\n", mod->name);
1651 add_taint(TAINT_FORCED_MODULE); 1740 add_taint(TAINT_FORCED_MODULE);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 5330911ebd30..e4fcbd12cf6e 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -23,6 +23,22 @@ config MAGIC_SYSRQ
23 keys are documented in <file:Documentation/sysrq.txt>. Don't say Y 23 keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
24 unless you really know what this hack does. 24 unless you really know what this hack does.
25 25
26config 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
26config DEBUG_KERNEL 42config DEBUG_KERNEL
27 bool "Kernel debugging" 43 bool "Kernel debugging"
28 help 44 help
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 797428afd111..bed7229378f2 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -489,7 +489,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
489 if (str < end) 489 if (str < end)
490 *str = '\0'; 490 *str = '\0';
491 else 491 else
492 *end = '\0'; 492 end[-1] = '\0';
493 } 493 }
494 /* the trailing null byte doesn't count towards the total */ 494 /* the trailing null byte doesn't count towards the total */
495 return str-buf; 495 return str-buf;
diff --git a/mm/filemap.c b/mm/filemap.c
index d504d6e98886..4082b3b3cea7 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2069,7 +2069,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
2069{ 2069{
2070 struct file *file = iocb->ki_filp; 2070 struct file *file = iocb->ki_filp;
2071 struct address_space * mapping = file->f_mapping; 2071 struct address_space * mapping = file->f_mapping;
2072 struct address_space_operations *a_ops = mapping->a_ops; 2072 const struct address_space_operations *a_ops = mapping->a_ops;
2073 struct inode *inode = mapping->host; 2073 struct inode *inode = mapping->host;
2074 long status = 0; 2074 long status = 0;
2075 struct page *page; 2075 struct page *page;
@@ -2219,7 +2219,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2219 unsigned long nr_segs, loff_t *ppos) 2219 unsigned long nr_segs, loff_t *ppos)
2220{ 2220{
2221 struct file *file = iocb->ki_filp; 2221 struct file *file = iocb->ki_filp;
2222 struct address_space * mapping = file->f_mapping; 2222 const struct address_space * mapping = file->f_mapping;
2223 size_t ocount; /* original count */ 2223 size_t ocount; /* original count */
2224 size_t count; /* after file limit checks */ 2224 size_t count; /* after file limit checks */
2225 struct inode *inode = mapping->host; 2225 struct inode *inode = mapping->host;
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index b960ac8e5918..b4fd0d7c9bfb 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -273,7 +273,7 @@ __xip_file_write(struct file *filp, const char __user *buf,
273 size_t count, loff_t pos, loff_t *ppos) 273 size_t count, loff_t pos, loff_t *ppos)
274{ 274{
275 struct address_space * mapping = filp->f_mapping; 275 struct address_space * mapping = filp->f_mapping;
276 struct address_space_operations *a_ops = mapping->a_ops; 276 const struct address_space_operations *a_ops = mapping->a_ops;
277 struct inode *inode = mapping->host; 277 struct inode *inode = mapping->host;
278 long status = 0; 278 long status = 0;
279 struct page *page; 279 struct page *page;
diff --git a/mm/shmem.c b/mm/shmem.c
index 38bc3334f263..ea64c07cbe72 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -174,7 +174,7 @@ static inline void shmem_unacct_blocks(unsigned long flags, long pages)
174} 174}
175 175
176static struct super_operations shmem_ops; 176static struct super_operations shmem_ops;
177static struct address_space_operations shmem_aops; 177static const struct address_space_operations shmem_aops;
178static struct file_operations shmem_file_operations; 178static struct file_operations shmem_file_operations;
179static struct inode_operations shmem_inode_operations; 179static struct inode_operations shmem_inode_operations;
180static struct inode_operations shmem_dir_inode_operations; 180static struct inode_operations shmem_dir_inode_operations;
@@ -2162,7 +2162,7 @@ static void destroy_inodecache(void)
2162 printk(KERN_INFO "shmem_inode_cache: not all structures were freed\n"); 2162 printk(KERN_INFO "shmem_inode_cache: not all structures were freed\n");
2163} 2163}
2164 2164
2165static struct address_space_operations shmem_aops = { 2165static const struct address_space_operations shmem_aops = {
2166 .writepage = shmem_writepage, 2166 .writepage = shmem_writepage,
2167 .set_page_dirty = __set_page_dirty_nobuffers, 2167 .set_page_dirty = __set_page_dirty_nobuffers,
2168#ifdef CONFIG_TMPFS 2168#ifdef CONFIG_TMPFS
diff --git a/mm/swap_state.c b/mm/swap_state.c
index e0e1583f32c2..7535211bb495 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -24,7 +24,7 @@
24 * vmscan's shrink_list, to make sync_page look nicer, and to allow 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. 25 * future use of radix_tree tags in the swap cache.
26 */ 26 */
27static struct address_space_operations swap_aops = { 27static const struct address_space_operations swap_aops = {
28 .writepage = swap_writepage, 28 .writepage = swap_writepage,
29 .sync_page = block_sync_page, 29 .sync_page = block_sync_page,
30 .set_page_dirty = __set_page_dirty_nobuffers, 30 .set_page_dirty = __set_page_dirty_nobuffers,
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 74368f79ee5d..b81fad893328 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -480,12 +480,8 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
480 480
481 BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len); 481 BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len);
482 482
483 if (test_bit(TTY_DONT_FLIP, &tty->flags)) { 483 tty_insert_flip_string(tty, skb->data, skb->len);
484 tty_buffer_request_room(tty, skb->len); 484 tty_flip_buffer_push(tty);
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 485
490 kfree_skb(skb); 486 kfree_skb(skb);
491} 487}
diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c
index c7f86f09c28d..80f6c08e26e7 100644
--- a/sound/oss/cs4232.c
+++ b/sound/oss/cs4232.c
@@ -405,7 +405,7 @@ static const struct pnp_device_id cs4232_pnp_table[] = {
405 405
406MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table); 406MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table);
407 407
408static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) 408static int __init cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
409{ 409{
410 struct address_info *isapnpcfg; 410 struct address_info *isapnpcfg;
411 411
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 2343dedd44ae..29a6e0cff79f 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -309,7 +309,7 @@ struct via_info {
309 unsigned sixchannel: 1; /* 8233/35 with 6 channel support */ 309 unsigned sixchannel: 1; /* 8233/35 with 6 channel support */
310 unsigned volume: 1; 310 unsigned volume: 1;
311 311
312 int locked_rate : 1; 312 unsigned locked_rate : 1;
313 313
314 int mixer_vol; /* 8233/35 volume - not yet implemented */ 314 int mixer_vol; /* 8233/35 volume - not yet implemented */
315 315