From 09b9d40a5b9a33669c927dbf47157b97a1f6035f Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:17:39 -0500 Subject: [PATCH] Import 2.1.132 --- CREDITS | 13 ++ Documentation/Configure.help | 10 ++ Documentation/memory.txt | 8 +- Documentation/paride.txt | 44 +++-- drivers/block/paride/Config.in | 1 + drivers/block/paride/Makefile | 9 ++ drivers/block/paride/friq.c | 282 +++++++++++++++++++++++++++++++++ drivers/block/paride/frpw.c | 11 +- drivers/block/paride/jumbo | 8 +- drivers/block/paride/on26.c | 23 ++- drivers/block/paride/paride.c | 8 +- drivers/block/paride/pseudo.h | 20 +-- drivers/block/paride/pt.c | 2 +- drivers/block/raid1.c | 3 +- drivers/char/serial.c | 6 +- fs/nfs/read.c | 23 ++- include/asm-alpha/irq.h | 3 + include/asm-alpha/system.h | 18 +++ include/asm-i386/softirq.h | 6 +- include/linux/interrupt.h | 2 +- kernel/softirq.c | 5 +- mm/filemap.c | 8 +- net/wanrouter/wanmain.c | 7 +- 23 files changed, 459 insertions(+), 61 deletions(-) create mode 100644 drivers/block/paride/friq.c diff --git a/CREDITS b/CREDITS index 8269e777ef64..b1fe938a9175 100644 --- a/CREDITS +++ b/CREDITS @@ -363,6 +363,11 @@ S: 98 Paxton Street S: East Malvern, Victoria, 3145 S: Australia +N: Neil Conway +E: nconway.list@ukaea.org.uk +D: Assorted sched/mm titbits +S: Oxfordshire, UK. + N: Alan Cox W: http://roadrunner.swansea.linux.org.uk/alan.shtml E: alan@lxorguk.ukuu.org.uk @@ -1271,6 +1276,14 @@ S: Schloessleinsgasse 31 S: D-90453 Nuernberg S: Germany +N: Arnaldo Carvalho de Melo +E: acme@conectiva.com.br +D: wanrouter hacking +D: cyclades 2X sync card driver (still in early devel stage) +S: R. Prof. Rubens Elke Braga, 558 - Parolin +S: 80220-320 Curitiba - Parana +S: Brazil + N: Michael Meskes E: meskes@debian.org P: 1024/04B6E8F5 6C 77 33 CA CC D6 22 03 AB AB 15 A3 AE AD 39 7D diff --git a/Documentation/Configure.help b/Documentation/Configure.help index 26639326c90c..8567a867360f 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -798,6 +798,16 @@ CONFIG_PARIDE_FIT3 called fit3.o. You must also have a high-level driver for the type of device that you want to support. +Freecom IQ ASIC-2 protocol +CONFIG_PARIDE_FRIQ + This option enables support for version 2 of the Freecom IQ parallel + port IDE adapter. This adapter is used by the Maxell Superdisk + drive. If you chose to build PARIDE support into your kernel, you + may answer Y here to build in the protocol driver, otherwise you + should answer M to build it as a loadable module. The module will be + called friq.o. You must also have a high-level driver for the type + of device that you want to support. + FreeCom power protocol CONFIG_PARIDE_FRPW This option enables support for the Freecom power parallel port IDE diff --git a/Documentation/memory.txt b/Documentation/memory.txt index 8e43d27b5c74..638aae42102d 100644 --- a/Documentation/memory.txt +++ b/Documentation/memory.txt @@ -18,13 +18,9 @@ systems. as you add more memory. Consider exchanging your motherboard. - 4) Linux will not currently detect above 64M of RAM, - regardless of how much memory is actually installed. - All of these problems can be addressed with the "mem=XXXM" boot option -(where XXX is the size of RAM to use in megabytes). Adding this boot -option to your boot loader can help Linux see more than 64M. It can -also tell Linux to use less memory than is actually installed. +(where XXX is the size of RAM to use in megabytes). +It can also tell Linux to use less memory than is actually installed. See the documentation of your boot loader (LILO, loadlin, etc.) about how to pass options to the kernel. diff --git a/Documentation/paride.txt b/Documentation/paride.txt index 4eb9a1855015..cef4600cae67 100644 --- a/Documentation/paride.txt +++ b/Documentation/paride.txt @@ -42,6 +42,7 @@ parallel port IDE subsystem, including: SyQuest EZ-135, EZ-230 & SparQ drives Avatar Shark Imation Superdisk LS-120 + Maxell Superdisk LS-120 FreeCom Power CD Hewlett-Packard 5GB and 8GB tape drives Hewlett-Packard 7100 and 7200 CD-RW drives @@ -76,6 +77,7 @@ support is available for almost all known adapter protocols: epia Shuttle EPIA (UK) fit2 FIT TD-2000 (US) fit3 FIT TD-3000 (US) + friq Freecom IQ cable (DE) frpw Freecom Power (DE) kbic KingByte KBIC-951A and KBIC-971A (TW) ktti KT Technology PHd adapter (SG) @@ -111,10 +113,12 @@ and high-level drivers that you would use: MicroSolutions 8000t tape pt bpck SyQuest EZ, SparQ pd epat Imation Superdisk pf epat + Maxell Superdisk pf friq Avatar Shark pd epat FreeCom CD-ROM pcd frpw Hewlett-Packard 5GB Tape pt epat - Hewlett-Packard 7100/7200 pg epat + Hewlett-Packard 7200e (CD) pcd epat + Hewlett-Packard 7200e (CD-R) pg epat 2.1 Configuring built-in drivers @@ -299,7 +303,6 @@ and LS-120 drives. Traditionally, media for these devices are not partitioned. Consequently, the pf driver does not support partitioned media. This may be changed in a future version of the driver. - 2.5 Using the pt driver The pt driver for parallel port ATAPI tape drives is a minimal driver. @@ -307,27 +310,29 @@ It does not yet support many of the standard tape ioctl operations. For best performance, a block size of 32KB should be used. You will probably want to set the parallel port delay to 0, if you can. - 2.6 Using the pg driver The pg driver can be used in conjunction with the cdrecord program -to create CD-ROMs. Please get cdrecord version 1.6.1a3 or later -from ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ (you may have to look -in the alpha subdirectory). To record CD-R media your parallel port -should ideally be set to EPP mode, and the "port delay" should be -set to 0. With those settings it is possible to record at 2x speed -without any buffer underruns. If you cannot get the driver to work +to create CD-ROMs. Please get cdrecord version 1.6.1 or later +from ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ . To record CD-R media +your parallel port should ideally be set to EPP mode, and the "port delay" +should be set to 0. With those settings it is possible to record at 2x +speed without any buffer underruns. If you cannot get the driver to work in EPP mode, try to use "bidirectional" or "PS/2" mode and 1x speeds only. 3. Troubleshooting +3.1 Use EPP mode if you can + The most common problems that people report with the PARIDE drivers concern the parallel port CMOS settings. At this time, none of the PARIDE protocol modules support ECP mode, or any ECP combination modes. If you are able to do so, please set your parallel port into EPP mode using your CMOS setup procedure. +3.2 Check the port delay + Some parallel ports cannot reliably transfer data at full speed. To offset the errors, the PARIDE protocol modules introduce a "port delay" between each access to the i/o ports. Each protocol sets @@ -341,6 +346,25 @@ to each of the high-level drivers. Please see the notes above, or read the comments at the beginning of the driver source files in linux/drivers/block/paride. +3.3 Some drives need a printer reset + +There appear to be a number of "noname" external drives on the market +that do not always power up correctly. We have noticed this with some +drives based on OnSpec and older Freecom adapters. In these rare cases, +the adapter can often be reinitialised by issuing a "printer reset" on +the parallel port. As the reset operation is potentially disruptive in +multiple device environments, the PARIDE drivers will not do it +automatically. You can however, force a printer reset by doing: + + insmod lp + rmmod lp + +If you have one of these marginal cases, you should probably build +your paride drivers as modules, and arrange to do the printer reset +before loading the PARIDE drivers. + +3.4 Use the verbose option and dmesg if you need help + While a lot of testing has gone into these drivers to make them work as smoothly as possible, problems will arise. If you do have problems, please check all the obvious things first: does the drive work in @@ -369,6 +393,8 @@ of two ways. Either send it directly to the author of the PARIDE suite, by e-mail to grant@torque.net, or join the linux-parport mailing list and post your report there. +3.5 For more information or help + You can join the linux-parport mailing list by sending a mail message to linux-parport-request@torque.net diff --git a/drivers/block/paride/Config.in b/drivers/block/paride/Config.in index 00dd9c8e4b78..8d4dc17426e6 100644 --- a/drivers/block/paride/Config.in +++ b/drivers/block/paride/Config.in @@ -16,6 +16,7 @@ dep_tristate ' FIT TD-2000 protocol' CONFIG_PARIDE_FIT2 $CONFIG_PARIDE dep_tristate ' FIT TD-3000 protocol' CONFIG_PARIDE_FIT3 $CONFIG_PARIDE dep_tristate ' Shuttle EPAT/EPEZ protocol' CONFIG_PARIDE_EPAT $CONFIG_PARIDE dep_tristate ' Shuttle EPIA protocol' CONFIG_PARIDE_EPIA $CONFIG_PARIDE +dep_tristate ' Freecom IQ ASIC-2 protocol' CONFIG_PARIDE_FRIQ $CONFIG_PARIDE dep_tristate ' FreeCom power protocol' CONFIG_PARIDE_FRPW $CONFIG_PARIDE dep_tristate ' KingByte KBIC-951A/971A protocols' CONFIG_PARIDE_KBIC $CONFIG_PARIDE dep_tristate ' KT PHd protocol' CONFIG_PARIDE_KTTI $CONFIG_PARIDE diff --git a/drivers/block/paride/Makefile b/drivers/block/paride/Makefile index ae2d54dd9f56..32e85670409d 100644 --- a/drivers/block/paride/Makefile +++ b/drivers/block/paride/Makefile @@ -147,6 +147,15 @@ else endif endif + +ifeq ($(CONFIG_PARIDE_FRIQ),y) + LX_OBJS += friq.o +else + ifeq ($(CONFIG_PARIDE_FRIQ),m) + M_OBJS += friq.o + endif +endif + ifeq ($(CONFIG_PARIDE_ON20),y) LX_OBJS += on20.o else diff --git a/drivers/block/paride/friq.c b/drivers/block/paride/friq.c new file mode 100644 index 000000000000..37ebaa047976 --- /dev/null +++ b/drivers/block/paride/friq.c @@ -0,0 +1,282 @@ +/* + friq.c (c) 1998 Grant R. Guenther + Under the terms of the GNU public license + + friq.c is a low-level protocol driver for the Freecom "IQ" + parallel port IDE adapter. Early versions of this adapter + use the 'frpw' protocol. + + Freecom uses this adapter in a battery powered external + CD-ROM drive. It is also used in LS-120 drives by + Maxell and Panasonic, and other devices. + + The battery powered drive requires software support to + control the power to the drive. This module enables the + drive power when the high level driver (pcd) is loaded + and disables it when the module is unloaded. Note, if + the friq module is built in to the kernel, the power + will never be switched off, so other means should be + used to conserve battery power. + +*/ + +/* Changes: + + 1.01 GRG 1998.12.20 Added support for soft power switch +*/ + +#define FRIQ_VERSION "1.01" + +#include +#include +#include +#include +#include + +#include "paride.h" + +#define CMD(x) w2(4);w0(0xff);w0(0xff);w0(0x73);w0(0x73);\ + w0(0xc9);w0(0xc9);w0(0x26);w0(0x26);w0(x);w0(x); + +#define j44(l,h) (((l>>4)&0x0f)|(h&0xf0)) + +/* cont = 0 - access the IDE register file + cont = 1 - access the IDE command set +*/ + +static int cont_map[2] = { 0x08, 0x10 }; + +static int friq_read_regr( PIA *pi, int cont, int regr ) + +{ int h,l,r; + + r = regr + cont_map[cont]; + + CMD(r); + w2(6); l = r1(); + w2(4); h = r1(); + w2(4); + + return j44(l,h); + +} + +static void friq_write_regr( PIA *pi, int cont, int regr, int val) + +{ int r; + + r = regr + cont_map[cont]; + + CMD(r); + w0(val); + w2(5);w2(7);w2(5);w2(4); +} + +static void friq_read_block_int( PIA *pi, char * buf, int count, int regr ) + +{ int h, l, k, ph; + + switch(pi->mode) { + + case 0: CMD(regr); + for (k=0;kmode) { + + case 0: + case 1: CMD(8); w2(5); + for (k=0;ksaved_r0 = r0(); + pi->saved_r2 = r2(); + w2(4); +} + +static void friq_disconnect ( PIA *pi ) + +{ CMD(0x20); + w0(pi->saved_r0); + w2(pi->saved_r2); +} + +static int friq_test_proto( PIA *pi, char * scratch, int verbose ) + +{ int j, k, r; + int e[2] = {0,0}; + + pi->saved_r0 = r0(); + w0(0xff); udelay(20); CMD(0x3d); /* turn the power on */ + udelay(500); + w0(pi->saved_r0); + + friq_connect(pi); + for (j=0;j<2;j++) { + friq_write_regr(pi,0,6,0xa0+j*0x10); + for (k=0;k<256;k++) { + friq_write_regr(pi,0,2,k^0xaa); + friq_write_regr(pi,0,3,k^0x55); + if (friq_read_regr(pi,0,2) != (k^0xaa)) e[j]++; + } + } + friq_disconnect(pi); + + friq_connect(pi); + friq_read_block_int(pi,scratch,512,0x10); + r = 0; + for (k=0;k<128;k++) if (scratch[k] != k) r++; + friq_disconnect(pi); + + if (verbose) { + printk("%s: friq: port 0x%x, mode %d, test=(%d,%d,%d)\n", + pi->device,pi->port,pi->mode,e[0],e[1],r); + } + + return (r || (e[0] && e[1])); +} + + +static void friq_log_adapter( PIA *pi, char * scratch, int verbose ) + +{ char *mode_string[6] = {"4-bit","8-bit", + "EPP-8","EPP-16","EPP-32"}; + + printk("%s: friq %s, Freecom IQ ASIC-2 adapter at 0x%x, ", pi->device, + FRIQ_VERSION,pi->port); + printk("mode %d (%s), delay %d\n",pi->mode, + mode_string[pi->mode],pi->delay); + + pi->private = 1; + friq_connect(pi); + CMD(0x9e); /* disable sleep timer */ + friq_disconnect(pi); + +} + +static void friq_init_proto( PIA *pi) + +{ MOD_INC_USE_COUNT; + pi->private = 0; +} + +static void friq_release_proto( PIA *pi) + +{ if (pi->private) { /* turn off the power */ + friq_connect(pi); + CMD(0x1d); CMD(0x1e); + friq_disconnect(pi); + pi->private = 0; + } + + MOD_DEC_USE_COUNT; +} + +struct pi_protocol friq = {"friq",0,5,2,1,1, + friq_write_regr, + friq_read_regr, + friq_write_block, + friq_read_block, + friq_connect, + friq_disconnect, + 0, + 0, + friq_test_proto, + friq_log_adapter, + friq_init_proto, + friq_release_proto + }; + + +#ifdef MODULE + +int init_module(void) + +{ return pi_register( &friq ) - 1; +} + +void cleanup_module(void) + +{ pi_unregister( &friq ); +} + +#endif + +/* end of friq.c */ diff --git a/drivers/block/paride/frpw.c b/drivers/block/paride/frpw.c index 680f9e592ffa..f4c98c645175 100644 --- a/drivers/block/paride/frpw.c +++ b/drivers/block/paride/frpw.c @@ -5,6 +5,12 @@ frpw.c is a low-level protocol driver for the Freecom "Power" parallel port IDE adapter. + Some applications of this adapter may require a "printer" reset + prior to loading the driver. This can be done by loading and + unloading the "lp" driver, or it can be done by this driver + if you define FRPW_HARD_RESET. The latter is not recommended + as it may upset devices on other ports. + */ /* Changes: @@ -13,10 +19,11 @@ fix chip detect added EPP-16 and EPP-32 1.02 GRG 1998.09.23 added hard reset to initialisation process + 1.03 GRG 1998.12.14 made hard reset conditional */ -#define FRPW_VERSION "1.02" +#define FRPW_VERSION "1.03" #include #include @@ -185,8 +192,10 @@ static int frpw_test_pnp ( PIA *pi ) { int olddelay, a, b; +#ifdef FRPW_HARD_RESET w0(0); w2(8); udelay(50); w2(0xc); /* parallel bus reset */ mdelay(1500); +#endif olddelay = pi->delay; pi->delay = 10; diff --git a/drivers/block/paride/jumbo b/drivers/block/paride/jumbo index b952fde92b32..f4b8ebf75ef1 100644 --- a/drivers/block/paride/jumbo +++ b/drivers/block/paride/jumbo @@ -53,11 +53,11 @@ FPROTO=-DCONFIG_PARIDE_`echo "$PROTO" | tr [a-z] [A-Z]` FK="-D__KERNEL__ -I ../../../include" FLCH=-D_LINUX_CONFIG_H # -echo cc $FK $FSMP $FLCH $FPARP $FPROTO -Wall -O2 -o Jb.o -c paride.c -cc $FK $FSMP $FLCH $FPARP $FPROTO -Wall -O2 -o Jb.o -c paride.c +echo cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c +cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c # -echo cc $FK $FSMP -Wall -O2 -o Jp.o -c $PROTO.c -cc $FK $FSMP -Wall -O2 -o Jp.o -c $PROTO.c +echo cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c +cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c # echo cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c diff --git a/drivers/block/paride/on26.c b/drivers/block/paride/on26.c index 78477593e545..91dcad101aa2 100644 --- a/drivers/block/paride/on26.c +++ b/drivers/block/paride/on26.c @@ -11,10 +11,12 @@ 1.01 GRG 1998.05.06 init_proto, release_proto 1.02 GRG 1998.09.23 updates for the -E rev chip + 1.03 GRG 1998.12.14 fix for slave drives + 1.04 GRG 1998.12.20 yet another bug fix */ -#define ON26_VERSION "1.02" +#define ON26_VERSION "1.04" #include #include @@ -118,9 +120,11 @@ static void on26_disconnect ( PIA *pi ) w2(pi->saved_r2); } +#define RESET_WAIT 200 + static int on26_test_port( PIA *pi) /* hard reset */ -{ int i, m, d; +{ int i, m, d, x, y; pi->saved_r0 = r0(); pi->saved_r2 = r2(); @@ -151,11 +155,18 @@ static int on26_test_port( PIA *pi) /* hard reset */ on26_write_regr(pi,0,6,0xa0); - for (i=0;i<100;i++) { - if (!(on26_read_regr(pi,0,7) & 0x80)) break; - udelay(100000); + for (i=0;i #include @@ -450,6 +451,11 @@ void paride_init( void ) pi_register(&frpw); }; #endif +#ifdef CONFIG_PARIDE_FRIQ + { extern struct pi_protocol friq; + pi_register(&friq); + }; +#endif #ifdef CONFIG_PARIDE_FIT2 { extern struct pi_protocol fit2; pi_register(&fit2); diff --git a/drivers/block/paride/pseudo.h b/drivers/block/paride/pseudo.h index 17615c2caaf7..13924396cf92 100644 --- a/drivers/block/paride/pseudo.h +++ b/drivers/block/paride/pseudo.h @@ -16,19 +16,21 @@ when either it returns true, or timeout jiffies have passed, continuation() will be invoked. - If nice is true, the test will done approximately once a + If nice is 1, the test will done approximately once a jiffy. If nice is 0, the test will also be done whenever - the scheduler runs (by adding it to a task queue). + the scheduler runs (by adding it to a task queue). If + nice is greater than 1, the test will be done once every + (nice-1) jiffies. */ /* Changes: 1.01 1998.05.03 Switched from cli()/sti() to spinlocks - + 1.02 1998.12.14 Added support for nice > 1 */ -#define PS_VERSION "1.01" +#define PS_VERSION "1.02" #include #include @@ -37,13 +39,13 @@ static void ps_timer_int( unsigned long data); static void ps_tq_int( void *data); -static int ps_use_tq = 1; static void (* ps_continuation)(void); static int (* ps_ready)(void); static int ps_then; static int ps_timeout; static int ps_timer_active = 0; static int ps_tq_active = 0; +static int ps_nice = 0; static spinlock_t ps_spinlock = SPIN_LOCK_UNLOCKED; @@ -62,9 +64,9 @@ static void ps_set_intr( void (*continuation)(void), ps_ready = ready; ps_then = jiffies; ps_timeout = jiffies + timeout; - ps_use_tq = !nice; + ps_nice = nice; - if (ps_use_tq && !ps_tq_active) { + if (!ps_nice && !ps_tq_active) { #ifdef HAVE_DISABLE_HLT disable_hlt(); #endif @@ -74,7 +76,7 @@ static void ps_set_intr( void (*continuation)(void), if (!ps_timer_active) { ps_timer_active = 1; - ps_timer.expires = jiffies; + ps_timer.expires = jiffies + ((ps_nice>0)?(ps_nice-1):0); add_timer(&ps_timer); } @@ -136,7 +138,7 @@ static void ps_timer_int( unsigned long data) return; } ps_timer_active = 1; - ps_timer.expires = jiffies; + ps_timer.expires = jiffies + ((ps_nice>0)?(ps_nice-1):0); add_timer(&ps_timer); spin_unlock_irqrestore(&ps_spinlock,flags); } diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 1a09c84b09d6..2616319f76f2 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c @@ -471,7 +471,7 @@ static int pt_poll_dsc( int unit, int pause, int tmo, char *msg ) { int k, e, s; - k = 0; + k = 0; e = 0; s = 0; while (k < tmo) { pt_sleep(pause); k++; diff --git a/drivers/block/raid1.c b/drivers/block/raid1.c index 12512c8df7a9..890584dcdd68 100644 --- a/drivers/block/raid1.c +++ b/drivers/block/raid1.c @@ -309,8 +309,7 @@ raid1_make_request (struct md_dev *mddev, int rw, struct buffer_head * bh) mirror_bh [i]->b_dev = bh->b_dev; mirror_bh [i]->b_rdev = raid_conf->mirrors [i].dev; mirror_bh [i]->b_rsector = bh->b_rsector; - mirror_bh [i]->b_state = (1<b_state = (1<b_count = 1; mirror_bh [i]->b_size = bh->b_size; mirror_bh [i]->b_data = bh->b_data; diff --git a/drivers/char/serial.c b/drivers/char/serial.c index 4dfbcd087814..f4101d133d71 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -194,7 +194,7 @@ static struct serial_uart_config uart_config[] = { { "16550", 1, 0 }, { "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO }, { "cirrus", 1, 0 }, - { "ST16650", 1, UART_CLEAR_FIFO |UART_STARTECH }, + { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH }, { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH }, { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO}, @@ -2899,8 +2899,8 @@ static unsigned detect_uart_irq (struct serial_state * state) * This routine is called by rs_init() to initialize a specific serial * port. It determines what type of UART chip this serial port is * using: 8250, 16450, 16550, 16550A. The important question is - * whether or not this UART is a 16550A or not, since this will - * determine whether or not we can use its FIFO features or not. + * whether or not this UART is a 16550A, since this will determine + * whether or not we can use its FIFO features. */ static void autoconfig(struct serial_state * state) { diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 3f9b16078781..5f792e31b77d 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -229,6 +229,7 @@ nfs_readpage(struct file *file, struct page *page) dprintk("NFS: nfs_readpage (%p %ld@%ld)\n", page, PAGE_SIZE, page->offset); + atomic_inc(&page->count); set_bit(PG_locked, &page->flags); /* @@ -240,18 +241,24 @@ nfs_readpage(struct file *file, struct page *page) */ error = nfs_wb_page(inode, page); if (error) - return error; + goto out_error; error = -1; - atomic_inc(&page->count); if (!IS_SWAPFILE(inode) && !PageError(page) && NFS_SERVER(inode)->rsize >= PAGE_SIZE) error = nfs_readpage_async(dentry, inode, page); - if (error < 0) { /* couldn't enqueue */ - error = nfs_readpage_sync(dentry, inode, page); - if (error < 0 && IS_SWAPFILE(inode)) - printk("Aiee.. nfs swap-in of page failed!\n"); - free_page(page_address(page)); - } + if (error >= 0) + goto out; + + error = nfs_readpage_sync(dentry, inode, page); + if (error < 0 && IS_SWAPFILE(inode)) + printk("Aiee.. nfs swap-in of page failed!\n"); + goto out_free; + +out_error: + clear_bit(PG_locked, &page->flags); +out_free: + free_page(page_address(page)); +out: return error; } diff --git a/include/asm-alpha/irq.h b/include/asm-alpha/irq.h index 7f8853c5584c..124989d93c0c 100644 --- a/include/asm-alpha/irq.h +++ b/include/asm-alpha/irq.h @@ -93,4 +93,7 @@ static __inline__ int irq_cannonicalize(int irq) extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); +extern void (*perf_irq)(unsigned long, struct pt_regs *); + + #endif /* _ALPHA_IRQ_H */ diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index 798207747f95..cec9175254ed 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -116,6 +116,24 @@ __asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory") #define draina() \ __asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory") + +static inline unsigned long +wrperfmon(unsigned long perf_fun, unsigned long arg) +{ + register unsigned long __r0 __asm__("$0"); + register unsigned long __r16 __asm__("$16"); + register unsigned long __r17 __asm__("$17"); + __r16 = perf_fun; + __r17 = arg; + __asm__ __volatile__( + "call_pal %1" + : "=r"(__r0) + : "i"(PAL_wrperfmon), "r"(__r16), "r"(__r17) + : "$1", "$22", "$23", "$24", "$25", "$26"); + return __r0; +} + + #define call_pal1(palno,arg) \ ({ \ register unsigned long __r0 __asm__("$0"); \ diff --git a/include/asm-i386/softirq.h b/include/asm-i386/softirq.h index c96481626326..83383a2d642b 100644 --- a/include/asm-i386/softirq.h +++ b/include/asm-i386/softirq.h @@ -12,7 +12,7 @@ extern unsigned int local_bh_count[NR_CPUS]; extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } @@ -97,13 +97,13 @@ extern inline void end_bh_atomic(void) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); synchronize_bh(); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 308ad56167eb..aa157d4a5a0f 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -17,7 +17,7 @@ struct irqaction { extern volatile unsigned char bh_running; -extern int bh_mask_count[32]; +extern atomic_t bh_mask_count[32]; extern unsigned long bh_active; extern unsigned long bh_mask; extern void (*bh_base[32])(void); diff --git a/kernel/softirq.c b/kernel/softirq.c index e76820457b4b..1b364a6a1264 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -6,6 +6,9 @@ * do_bottom_half() runs at normal kernel priority: all interrupts * enabled. do_bottom_half() is atomic with respect to itself: a * bottom_half handler need not be re-entrant. + * + * Fixed a disable_bh()/enable_bh() race (was causing a console lockup) + * due bh_mask_count not atomic handling. Copyright (C) 1998 Andrea Arcangeli */ #include @@ -17,7 +20,7 @@ /* intr_count died a painless death... -DaveM */ -int bh_mask_count[32]; +atomic_t bh_mask_count[32]; unsigned long bh_active = 0; unsigned long bh_mask = 0; void (*bh_base[32])(void); diff --git a/mm/filemap.c b/mm/filemap.c index 08c9771faabb..8d81ed9078ca 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -141,10 +141,12 @@ int shrink_mmap(int priority, int gfp_mask) clock = page->map_nr; } - if (PageLocked(page)) + if (test_and_clear_bit(PG_referenced, &page->flags)) continue; - if (test_and_clear_bit(PG_referenced, &page->flags)) + /* Decrement count only for non-referenced pages */ + count--; + if (PageLocked(page)) continue; if ((gfp_mask & __GFP_DMA) && !PageDMA(page)) @@ -176,7 +178,7 @@ int shrink_mmap(int priority, int gfp_mask) return 1; } - } while (--count >= 0); + } while (count > 0); return 0; } diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index 85f177aa7965..cce9df8c9cf5 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c @@ -25,6 +25,8 @@ * Oct 15, 1997 Farhan Thawar changed wan_encapsulate to add a pad byte of 0 * Apr 20, 1998 Alan Cox Fixed 2.1 symbols * May 17, 1998 K. Baranowski Fixed SNAP encapsulation in wan_encapsulate +* Dec 15, 1998 Arnaldo Melo support for firmwares of up to 128000 bytes +* check wandev->setup return value *****************************************************************************/ #include /* offsetof(), etc. */ @@ -459,7 +461,7 @@ static int device_setup (wan_device_t* wandev, wandev_conf_t* u_conf) if (conf->data_size && conf->data) { - if(conf->data_size > 64000 || conf->data_size < 0){ + if(conf->data_size > 128000 || conf->data_size < 0){ goto bail; } data = kmalloc(conf->data_size, GFP_KERNEL); @@ -468,8 +470,7 @@ static int device_setup (wan_device_t* wandev, wandev_conf_t* u_conf) if(!copy_from_user(data, conf->data, conf->data_size)) { conf->data=data; - wandev->setup(wandev,conf); - err = 0; + err = wandev->setup(wandev,conf); } else err = -ENOBUFS; -- 2.39.5