From db8fee17760581685f46195993b7a97dc425a663 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:13:15 -0500 Subject: [PATCH] Import 2.1.37 --- CREDITS | 10 +- Documentation/Changes | 30 +- Documentation/locks.txt | 70 +- arch/i386/defconfig | 1 + arch/i386/kernel/ptrace.c | 14 +- arch/i386/kernel/setup.c | 12 +- arch/i386/kernel/smp.c | 3 + arch/i386/lib/semaphore.S | 9 +- arch/i386/mm/fault.c | 10 +- drivers/block/ide-floppy.c | 6 +- drivers/block/ide-tape.c | 10 +- drivers/char/keyb_m68k.c | 2 +- drivers/isdn/hisax/isdnl1.c | 10 +- drivers/isdn/isdn_net.c | 2 +- drivers/sbus/char/sunkbd.c | 2 +- drivers/sbus/char/sunserial.c | 2 +- drivers/scsi/53c7,8xx.c | 71 +- drivers/scsi/53c7,8xx.h | 2 +- drivers/scsi/ChangeLog.ncr53c8xx | 72 + drivers/scsi/README.ncr53c8xx | 61 +- drivers/scsi/ide-scsi.c | 2 +- drivers/scsi/ncr53c8xx.c | 2119 ++++++++++++++++-------------- drivers/scsi/ncr53c8xx.h | 382 +++--- drivers/scsi/scsi_proc.c | 20 +- drivers/scsi/seagate.c | 30 - drivers/scsi/seagate.h | 3 +- fs/affs/bitmap.c | 6 +- fs/binfmt_elf.c | 3 +- fs/isofs/inode.c | 8 +- fs/locks.c | 105 +- fs/nfs/write.c | 4 +- fs/proc/array.c | 4 +- fs/proc/mem.c | 4 +- include/asm-alpha/spinlock.h | 2 +- include/asm-i386/hardirq.h | 1 - include/asm-i386/semaphore.h | 55 +- include/asm-i386/spinlock.h | 2 +- include/linux/mm.h | 2 - kernel/softirq.c | 11 +- mm/kmalloc.c | 21 +- mm/memory.c | 4 +- mm/page_alloc.c | 26 +- 42 files changed, 1761 insertions(+), 1452 deletions(-) diff --git a/CREDITS b/CREDITS index d94810c40d83..493a6a9daced 100644 --- a/CREDITS +++ b/CREDITS @@ -149,12 +149,8 @@ S: 91452 Wilhermsdorf S: Germany N: Bill Bogstad -E: bogstad@cs.jhu.edu -D: Wrote /proc/self patch -S: Johns Hopkins University -S: Computer Science Department -S: Baltimore, Maryland 21218 -S: USA +E: bogstad@pobox.com +D: wrote /proc/self hack, minor samba & dosemu patches N: Axel Boldt E: boldt@math.ucsb.edu @@ -468,7 +464,7 @@ S: Carnegie, Pennsylvania 15106-4304 S: USA N: Philip Gladstone -E: philipg@onsett.com +E: philip@raptor.com D: Kernel / timekeeping stuff N: Michael A. Griffith diff --git a/Documentation/Changes b/Documentation/Changes index 612fb76b1cdc..0b840fee610f 100644 --- a/Documentation/Changes +++ b/Documentation/Changes @@ -29,7 +29,7 @@ English-language HTML version. Also, don't forget http://www.linuxhq.com/ for all your Linux kernel needs. -Last updated: April 24, 1997. +Last updated: May 12, 1997. Current Author: Chris Ricker (gt1355b@prism.gatech.edu). Current Minimal Requirements @@ -40,13 +40,13 @@ encountered a bug! - Kernel modules modutils-2.1.34 - Gnu C 2.7.2.1 -- Binutils 2.7.0.9 +- Binutils 2.8.0.3 - Linux C Library 5.4.23 - Dynamic Linker (ld.so) 1.8.5 - Linux C++ Library 2.7.2.1 - Procps 1.01 - Mount 2.6g -- Net-tools 1.32-alpha +- Net-tools 1.41 - Loadlin 1.6a - Sh-utils 1.16 - Autofs 0.3.0 @@ -131,6 +131,9 @@ presence. To run bootpd, you'll need to issue the following command: echo 1 >/proc/sys/net/ipv4/ip_boot_agent + For support for new features like IPv6, upgrade to the latest +net-tools. + Mount and network file systems ============================== @@ -179,8 +182,7 @@ How to know the version of the installed programs ************************************************* There are some simple methods useful to know the version of the -installed programs and libraries. The SysVinit version display -requires that you be logged in as root. +installed programs and libraries. Binutils: ld -v Gnu C: gcc -v or gcc --version @@ -190,6 +192,7 @@ Libc: ls -l /lib/libc.so.* Libc++: ls -l /usr/lib/libg++.so.* Modutils: insmod -V Mount: mount --version +Net-tools: hostname -V Procps: ps --version RPM: rpm --version Sh-utils: expr --v @@ -200,12 +203,12 @@ Where to get the files Binutils ======== -The 2.7.0.9 release: -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/binutils-2.7.0.9.bin.tar.gz -ftp://sunsite.unc.edu/pub/Linux/GCC/binutils-2.7.0.9.bin.tar.gz +The 2.8.0.3 release: +ftp://tsx-11.mit.edu/pub/linux/packages/GCC/binutils-2.8.0.3.bin.tar.gz +ftp://sunsite.unc.edu/pub/Linux/GCC/binutils-2.8.0.3.bin.tar.gz Installation notes: -ftp://tsx-11.mit.edu/pub/linux/packages/GCC/release.binutils-2.7.0.9 -ftp://sunsite.unc.edu/pub/Linux/GCC/release.binutils-2.7.0.9 +ftp://tsx-11.mit.edu/pub/linux/packages/GCC/release.binutils-2.8.0.3 +ftp://sunsite.unc.edu/pub/Linux/GCC/release.binutils-2.8.0.3 Gnu C ===== @@ -311,6 +314,13 @@ The 0.4.21 release: ftp://ftp.mathematik.th-darmstadt.de/pub/linux/okir/linux-nfs-0.4.21.tar.gz ftp://linux.nrao.edu/pub/people/okir/linux-nfs-0.4.21.tar.gz +Net-tools +========= + +The 0.41 release: +ftp://ftp.london.uk.eu.org/pub/ipv6/net-tools-1.41.tar.gz +ftp://ftp.cs-ipv6.lancs.ac.uk/pub/Code/Linux/Net_Tools/net-tools-1.41.tar.gz + Other Info ========== diff --git a/Documentation/locks.txt b/Documentation/locks.txt index ea91be8a2fa5..3911417b2fb1 100644 --- a/Documentation/locks.txt +++ b/Documentation/locks.txt @@ -2,42 +2,30 @@ Andy Walker - 21 Sep 1996 + 12 May 1997 1. What's New? -------------- -1.1 Flock Emulation Warnings ----------------------------- -Many people will have noticed the ugly messages that the file locking -code started generating with the release of kernel version 1.3.95. The -messages look something like this: +1.1 Broken Flock Emulation +-------------------------- - fcntl_setlk() called by process XX with broken flock() emulation +The old flock(2) emulation in the kernel was swapped for proper BSD +compatible flock(2) support in the 1.3.x series of kernels. With the +release of the 2.1.x kernel series, support for the old emulation has +been totally removed, so that we don't need to carry this baggage +forever. -This is a warning for people using older C libraries that those libraries -are still calling the pre 1.3.x flock() emulation routines, instead of -the real flock() system call. The old routines are quite badly broken, -especially with respect to parent-child lock sharing, and can give bad -results if, for example, sendmail attempts to use them. +This should not cause problems for anybody, since everybody using a +2.1.x kernel should have updated their C library to a suitable version +anyway (see the file "linux/Documentation/Changes".) -Fixed versions of the C libraries have been on public release for many -months. The latest versions at the time of writing are 5.3.12 (released) -or 5.4.6 (testing) for ELF. There is also a 4.7.6 release for people -using a.out systems. +1.2 Allow Mixed Locks Again +--------------------------- -With the release of Linux 2.0 Linus decided to be lenient on the -stragglers and changed the warning message so that the kernel will only -complain once and then shut up. That should make life more bearable even -for people who, for some reason, don't want to upgrade their libraries. - - -1.2 Disallow Mixed Locks ------------------------- - -1.2.1 Sendmail Problems ---------------------- +1.2.1 Typical Problems - Sendmail +--------------------------------- Because sendmail was unable to use the old flock() emulation, many sendmail installations use fcntl() instead of flock(). This is true of Slackware 3.0 for example. This gave rise to some other subtle problems if sendmail was @@ -50,23 +38,17 @@ to lock solid with deadlocked processes. 1.2.2 The Solution ------------------ -I have chosen the rather cruel solution of disallowing mixed locking styles -on a given file at a given time. Attempts to lock a file with flock() when -fcntl() locks exist, or vice versa, return with an error status of EBUSY. -This seemed to be the only way to avoid all possible deadlock conditions, -as flock() locks do not strictly have one owner process and so can't be -checked for deadlocking in the usual manner. - -The process that created a lock with flock() might have forked multiple -children and exited. Previously the parent process would have been marked -as the owner of the lock, but deadlocks could just have easily occurred in -one or more of the children, which we would not have been able to identify -and avoid. - -Some programs may break (again, groan). In particular the aforementioned -sendmail may have problems running in 'newaliases' mode. It will no longer -deadlock though. Recompile sendmail to use flock() and your troubles will -be over. +The solution I have chosen, after much experimentation and discussion, +is to make flock() and fcntl() locks oblivious to each other. Both can +exists, and neither will have any effect on the other. + +I wanted the two lock styles to be cooperative, but there were so many +race and deadlock conditions that the current solution was the only +practical one. It puts us in the same position as, for example, SunOS +4.1.x and serveral other commercial Unices. The only OS's that support +cooperative flock()/fcntl() are those that emulate flock() using +fcntl(), with all the problems that implies. + 1.3 Mandatory Locking As A Mount Option --------------------------------------- diff --git a/arch/i386/defconfig b/arch/i386/defconfig index e5b5d9f84cac..a27b6ebce4cf 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -141,6 +141,7 @@ CONFIG_SCSI_OMIT_FLASHPOINT=y # CONFIG_SCSI_QLOGIC_FAS is not set # CONFIG_SCSI_QLOGIC_ISP is not set # CONFIG_SCSI_SEAGATE is not set +# CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_T128 is not set # CONFIG_SCSI_U14_34F is not set # CONFIG_SCSI_ULTRASTOR is not set diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index a446304a20d5..208481483cb4 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c @@ -83,7 +83,7 @@ static unsigned long get_long(struct task_struct * tsk, repeat: pgdir = pgd_offset(vma->vm_mm, addr); if (pgd_none(*pgdir)) { - do_no_page(tsk, vma, addr, 0); + handle_mm_fault(vma, addr, 0); goto repeat; } if (pgd_bad(*pgdir)) { @@ -93,7 +93,7 @@ repeat: } pgmiddle = pmd_offset(pgdir, addr); if (pmd_none(*pgmiddle)) { - do_no_page(tsk, vma, addr, 0); + handle_mm_fault(vma, addr, 0); goto repeat; } if (pmd_bad(*pgmiddle)) { @@ -103,7 +103,7 @@ repeat: } pgtable = pte_offset(pgmiddle, addr); if (!pte_present(*pgtable)) { - do_no_page(tsk, vma, addr, 0); + handle_mm_fault(vma, addr, 0); goto repeat; } page = pte_page(*pgtable); @@ -134,7 +134,7 @@ static void put_long(struct task_struct * tsk, struct vm_area_struct * vma, unsi repeat: pgdir = pgd_offset(vma->vm_mm, addr); if (!pgd_present(*pgdir)) { - do_no_page(tsk, vma, addr, 1); + handle_mm_fault(vma, addr, 1); goto repeat; } if (pgd_bad(*pgdir)) { @@ -144,7 +144,7 @@ repeat: } pgmiddle = pmd_offset(pgdir, addr); if (pmd_none(*pgmiddle)) { - do_no_page(tsk, vma, addr, 1); + handle_mm_fault(vma, addr, 1); goto repeat; } if (pmd_bad(*pgmiddle)) { @@ -154,12 +154,12 @@ repeat: } pgtable = pte_offset(pgmiddle, addr); if (!pte_present(*pgtable)) { - do_no_page(tsk, vma, addr, 1); + handle_mm_fault(vma, addr, 1); goto repeat; } page = pte_page(*pgtable); if (!pte_write(*pgtable)) { - do_wp_page(tsk, vma, addr, 1); + handle_mm_fault(vma, addr, 1); goto repeat; } /* this is a hack for non-kernel-mapped video buffers and similar */ diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index ec59547719c5..a46b0089753f 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -247,7 +247,7 @@ static const char * i586model(unsigned int nr) static const char * i686model(unsigned int nr) { static const char *model[] = { - "PPro A-step", "Pentium Pro" + "PPro A-step", "Pentium Pro", "2", "Pentium II" }; if (nr < sizeof(model)/sizeof(char *)) return model[nr]; @@ -279,9 +279,10 @@ static const char * getmodel(int x86, int model) int get_cpuinfo(char * buffer) { int i, len = 0; + int sep_bug; static const char *x86_cap_flags[] = { "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", - "cx8", "apic", "10", "11", "mtrr", "pge", "mca", "cmov", + "cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov", "16", "17", "18", "19", "20", "21", "22", "mmx", "24", "25", "26", "27", "28", "29", "30", "31" }; @@ -321,10 +322,16 @@ int get_cpuinfo(char * buffer) else len += sprintf(buffer+len, "stepping\t: unknown\n"); + + sep_bug = CD(have_cpuid) && + (CD(x86_capability) & 0x800) && + CD(x86_model) < 3 && + CD(x86_mask) < 3; len += sprintf(buffer+len, "fdiv_bug\t: %s\n" "hlt_bug\t\t: %s\n" + "sep_bug\t\t: %s\n" "fpu\t\t: %s\n" "fpu_exception\t: %s\n" "cpuid\t\t: %s\n" @@ -332,6 +339,7 @@ int get_cpuinfo(char * buffer) "flags\t\t:", CD(fdiv_bug) ? "yes" : "no", CD(hlt_works_ok) ? "no" : "yes", + sep_bug ? "yes" : "no", CD(hard_math) ? "yes" : "no", (CD(hard_math) && ignore_irq13) ? "yes" : "no", diff --git a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c index 2869ecda5757..1dc615501b51 100644 --- a/arch/i386/kernel/smp.c +++ b/arch/i386/kernel/smp.c @@ -1250,10 +1250,13 @@ void smp_message_pass(int target, int msg, unsigned long data, int wait) void smp_flush_tlb(void) { unsigned long flags; + +#if 0 if(smp_activated && smp_processor_id()!=active_kernel_processor) { printk("CPU #%d:Attempted flush tlb IPI when not AKP(=%d)\n",smp_processor_id(),active_kernel_processor); *(char *)0=0; } +#endif /* printk("SMI-");*/ /* diff --git a/arch/i386/lib/semaphore.S b/arch/i386/lib/semaphore.S index ff2443c40daf..bb5650317740 100644 --- a/arch/i386/lib/semaphore.S +++ b/arch/i386/lib/semaphore.S @@ -13,28 +13,31 @@ * there is contention on the semaphore. */ ENTRY(__down_failed) - pushl %eax /* return address */ + pushl %eax /* save %eax */ pushl %edx /* save %edx */ pushl %ecx /* save %ecx (and argument) */ call SYMBOL_NAME(__down) popl %ecx /* restore %ecx (count on __down not changing it) */ popl %edx /* restore %edx */ + popl %eax /* restore %eax */ ret ENTRY(__down_failed_interruptible) - pushl %eax /* return address */ + pushl %eax /* save %eax */ pushl %edx /* save %edx */ pushl %ecx /* save %ecx (and argument) */ call SYMBOL_NAME(__down_interruptible) popl %ecx /* restore %ecx (count on __down_interruptible not changing it) */ popl %edx /* restore %edx */ + popl %eax /* restore %eax */ ret ENTRY(__up_wakeup) - pushl %eax /* return address */ + pushl %eax /* save %eax */ pushl %edx /* save %edx */ pushl %ecx /* save %ecx (and argument) */ call SYMBOL_NAME(__up) popl %ecx /* restore %ecx (count on __up not changing it) */ popl %edx /* restore %edx */ + popl %eax /* restore %eax */ ret diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c index e8c3b9f05188..f22eb606f724 100644 --- a/arch/i386/mm/fault.c +++ b/arch/i386/mm/fault.c @@ -49,7 +49,7 @@ good_area: start &= PAGE_MASK; for (;;) { - do_wp_page(current, vma, start, 1); + handle_mm_fault(vma, start, 1); if (!size) break; size--; @@ -86,10 +86,6 @@ bad_area: */ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code) { - void (*handler)(struct task_struct *, - struct vm_area_struct *, - unsigned long, - int); struct task_struct *tsk = current; struct mm_struct *mm = tsk->mm; struct vm_area_struct * vma; @@ -128,10 +124,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code) */ good_area: write = 0; - handler = do_no_page; switch (error_code & 3) { default: /* 3: write, present */ - handler = do_wp_page; #ifdef TEST_VERIFY_AREA if (regs->cs == KERNEL_CS) printk("WP fault at %08lx\n", regs->eip); @@ -148,7 +142,7 @@ good_area: if (!(vma->vm_flags & (VM_READ | VM_EXEC))) goto bad_area; } - handler(tsk, vma, address, write); + handle_mm_fault(vma, address, write); up(&mm->mmap_sem); /* * Did it hit the DOS screen memory VA from vm86 mode? diff --git a/drivers/block/ide-floppy.c b/drivers/block/ide-floppy.c index d362dfab4082..5a0a603b5f28 100644 --- a/drivers/block/ide-floppy.c +++ b/drivers/block/ide-floppy.c @@ -726,7 +726,7 @@ static void idefloppy_pc_intr (ide_drive_t *drive) return; } #ifdef CONFIG_BLK_DEV_TRITON - if (clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { + if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { printk (KERN_ERR "ide-floppy: The floppy wants to issue more interrupts in DMA mode\n"); printk (KERN_ERR "ide-floppy: DMA disabled, reverting to PIO\n"); HWIF(drive)->dmaproc(ide_dma_off, drive); @@ -842,7 +842,7 @@ static void idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *pc) bcount.all=pc->request_transfer; /* Request to transfer the entire buffer at once */ #ifdef CONFIG_BLK_DEV_TRITON - if (clear_bit (PC_DMA_ERROR, &pc->flags)) { + if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) { printk (KERN_WARNING "ide-floppy: DMA disabled, reverting to PIO\n"); HWIF(drive)->dmaproc(ide_dma_off, drive); } @@ -1182,7 +1182,7 @@ static int idefloppy_media_change (ide_drive_t *drive) { idefloppy_floppy_t *floppy = drive->driver_data; - return clear_bit (IDEFLOPPY_MEDIA_CHANGED, &floppy->flags); + return test_and_clear_bit (IDEFLOPPY_MEDIA_CHANGED, &floppy->flags); } /* diff --git a/drivers/block/ide-tape.c b/drivers/block/ide-tape.c index 537c5dd82894..2fc5f0b9d13d 100644 --- a/drivers/block/ide-tape.c +++ b/drivers/block/ide-tape.c @@ -1777,7 +1777,7 @@ static void idetape_pc_intr (ide_drive_t *drive) return; } #ifdef CONFIG_BLK_DEV_TRITON - if (clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { + if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { printk (KERN_ERR "ide-tape: The tape wants to issue more interrupts in DMA mode\n"); printk (KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n"); HWIF(drive)->dmaproc(ide_dma_off, drive); @@ -1916,7 +1916,7 @@ static void idetape_issue_packet_command (ide_drive_t *drive, idetape_pc_t *pc) bcount.all=pc->request_transfer; /* Request to transfer the entire buffer at once */ #ifdef CONFIG_BLK_DEV_TRITON - if (clear_bit (PC_DMA_ERROR, &pc->flags)) { + if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags)) { printk (KERN_WARNING "ide-tape: DMA disabled, reverting to PIO\n"); HWIF(drive)->dmaproc(ide_dma_off, drive); } @@ -2248,7 +2248,7 @@ static void idetape_do_request (ide_drive_t *drive, struct request *rq, unsigned status.all = GET_STAT(); if (!drive->dsc_overlap && rq->cmd != IDETAPE_PC_RQ2) set_bit (IDETAPE_IGNORE_DSC, &tape->flags); - if (!clear_bit (IDETAPE_IGNORE_DSC, &tape->flags) && !status.b.dsc) { + if (!test_and_clear_bit (IDETAPE_IGNORE_DSC, &tape->flags) && !status.b.dsc) { if (postponed_rq == NULL) { tape->dsc_polling_start = jiffies; tape->dsc_polling_frequency = tape->best_dsc_rw_frequency; @@ -2506,7 +2506,7 @@ static int idetape_add_chrdev_write_request (ide_drive_t *drive, int blocks) if (!idetape_pipeline_active (tape) && tape->nr_stages >= (3 * tape->max_stages) / 4) idetape_insert_pipeline_into_queue (drive); - if (clear_bit (IDETAPE_PIPELINE_ERROR, &tape->flags)) /* Return a deferred error */ + if (test_and_clear_bit (IDETAPE_PIPELINE_ERROR, &tape->flags)) /* Return a deferred error */ return -EIO; return blocks; } @@ -3254,7 +3254,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp) return -ENXIO; tape = drive->driver_data; - if (set_bit (IDETAPE_BUSY, &tape->flags)) + if (test_and_set_bit (IDETAPE_BUSY, &tape->flags)) return -EBUSY; MOD_INC_USE_COUNT; idetape_create_read_position_cmd (&pc); diff --git a/drivers/char/keyb_m68k.c b/drivers/char/keyb_m68k.c index 655a37ec6c25..952dfeeee0fd 100644 --- a/drivers/char/keyb_m68k.c +++ b/drivers/char/keyb_m68k.c @@ -216,7 +216,7 @@ void process_keycode (int keycode) #endif } } else - rep = set_bit(keycode, key_down); + rep = test_and_set_bit(keycode, key_down); if (raw_mode) return; diff --git a/drivers/isdn/hisax/isdnl1.c b/drivers/isdn/hisax/isdnl1.c index cbc91e9d6f06..ebf0957b53bc 100644 --- a/drivers/isdn/hisax/isdnl1.c +++ b/drivers/isdn/hisax/isdnl1.c @@ -461,11 +461,11 @@ isac_bh(struct IsdnCardState *sp) if (!sp) return; - if (clear_bit(ISAC_PHCHANGE, &sp->event)) + if (test_and_clear_bit(ISAC_PHCHANGE, &sp->event)) process_new_ph(sp); - if (clear_bit(ISAC_RCVBUFREADY, &sp->event)) + if (test_and_clear_bit(ISAC_RCVBUFREADY, &sp->event)) process_rcv(sp); - if (clear_bit(ISAC_XMTBUFREADY, &sp->event)) + if (test_and_clear_bit(ISAC_XMTBUFREADY, &sp->event)) process_xmt(sp); } @@ -578,9 +578,9 @@ hscx_bh(struct HscxState *hsp) if (!hsp) return; - if (clear_bit(HSCX_RCVBUFREADY, &hsp->event)) + if (test_and_clear_bit(HSCX_RCVBUFREADY, &hsp->event)) hscx_process_rcv(hsp); - if (clear_bit(HSCX_XMTBUFREADY, &hsp->event)) + if (test_and_clear_bit(HSCX_XMTBUFREADY, &hsp->event)) hscx_process_xmt(hsp); } diff --git a/drivers/isdn/isdn_net.c b/drivers/isdn/isdn_net.c index 5d3ab899ed82..b6b076360fdd 100644 --- a/drivers/isdn/isdn_net.c +++ b/drivers/isdn/isdn_net.c @@ -934,7 +934,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct device *ndev) return 0; } /* Avoid timer-based retransmission conflicts. */ - if (set_bit(0, (void *) &ndev->tbusy) != 0) + if (test_and_set_bit(0, (void *) &ndev->tbusy) != 0) printk(KERN_WARNING "%s: Transmitter access conflict.\n", ndev->name); diff --git a/drivers/sbus/char/sunkbd.c b/drivers/sbus/char/sunkbd.c index 87fb0fea49d3..8e398f345c17 100644 --- a/drivers/sbus/char/sunkbd.c +++ b/drivers/sbus/char/sunkbd.c @@ -487,7 +487,7 @@ void sunkbd_inchar(unsigned char ch, struct pt_regs *regs) add_timer (&auto_repeat_timer); } } - rep = set_bit(keycode, key_down); + rep = test_and_set_bit(keycode, key_down); } if(raw_mode) diff --git a/drivers/sbus/char/sunserial.c b/drivers/sbus/char/sunserial.c index 59b9bda8e173..08fcab8ee480 100644 --- a/drivers/sbus/char/sunserial.c +++ b/drivers/sbus/char/sunserial.c @@ -687,7 +687,7 @@ static void do_softint(void *private_) if (!tty) return; - if (clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); diff --git a/drivers/scsi/53c7,8xx.c b/drivers/scsi/53c7,8xx.c index 3691108e62f5..44a78b12c6a5 100644 --- a/drivers/scsi/53c7,8xx.c +++ b/drivers/scsi/53c7,8xx.c @@ -254,7 +254,6 @@ typedef unsigned int u32; #include #include #include -#undef current #include "scsi.h" #include "hosts.h" @@ -783,7 +782,7 @@ NCR53c7x0_driver_init (struct Scsi_Host *host) { struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) host->hostdata; int i, j; - u32 *current; + u32 *curr; for (i = 0; i < 16; ++i) { hostdata->request_sense[i] = 0; for (j = 0; j < 8; ++j) @@ -792,14 +791,14 @@ NCR53c7x0_driver_init (struct Scsi_Host *host) { } hostdata->issue_queue = NULL; hostdata->running_list = hostdata->finished_queue = - hostdata->current = NULL; - for (i = 0, current = (u32 *) hostdata->schedule; - i < host->can_queue; ++i, current += 2) { - current[0] = hostdata->NOP_insn; - current[1] = 0xdeadbeef; + hostdata->curr = NULL; + for (i = 0, curr = (u32 *) hostdata->schedule; + i < host->can_queue; ++i, curr += 2) { + curr[0] = hostdata->NOP_insn; + curr[1] = 0xdeadbeef; } - current[0] = ((DCMD_TYPE_TCI|DCMD_TCI_OP_JUMP) << 24) | DBC_TCI_TRUE; - current[1] = (u32) virt_to_bus (hostdata->script) + + curr[0] = ((DCMD_TYPE_TCI|DCMD_TCI_OP_JUMP) << 24) | DBC_TCI_TRUE; + curr[1] = (u32) virt_to_bus (hostdata->script) + hostdata->E_wait_reselect; hostdata->reconnect_dsa_head = 0; hostdata->addr_reconnect_dsa_head = (u32) @@ -2104,7 +2103,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) { int left, found; volatile struct NCR53c7x0_cmd * linux_search; volatile struct NCR53c7x0_cmd * volatile *linux_prev; - volatile u32 *ncr_prev, *current, ncr_search; + volatile u32 *ncr_prev, *curr, ncr_search; #if 0 printk ("scsi%d: abnormal finished\n", host->host_no); @@ -2120,13 +2119,13 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) { */ - for (found = 0, left = host->can_queue, current = hostdata->schedule; - left > 0; --left, current += 2) + for (found = 0, left = host->can_queue, curr = hostdata->schedule; + left > 0; --left, curr += 2) { - if (issue_to_cmd (host, hostdata, (u32 *) current) == cmd) + if (issue_to_cmd (host, hostdata, (u32 *) curr) == cmd) { - current[0] = hostdata->NOP_insn; - current[1] = 0xdeadbeef; + curr[0] = hostdata->NOP_insn; + curr[1] = 0xdeadbeef; ++found; break; } @@ -3964,7 +3963,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, Scsi_Cmnd *tmp = cmd->cmd; unsigned long flags; /* dsa start is negative, so subtraction is used */ - volatile u32 *current; + volatile u32 *curr; int i; NCR53c7x0_local_setup(host); @@ -3991,9 +3990,9 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, return; } - for (i = host->can_queue, current = hostdata->schedule; - i > 0 && current[0] != hostdata->NOP_insn; - --i, current += 2 /* JUMP instructions are two words */); + for (i = host->can_queue, curr = hostdata->schedule; + i > 0 && curr[0] != hostdata->NOP_insn; + --i, curr += 2 /* JUMP instructions are two words */); if (i > 0) { ++hostdata->busy[tmp->target][tmp->lun]; @@ -4002,13 +4001,13 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, /* Restore this instruction to a NOP once the command starts */ cmd->dsa [(hostdata->dsa_jump_dest - hostdata->dsa_start) / - sizeof(u32)] = (u32) virt_to_bus ((void *)current); + sizeof(u32)] = (u32) virt_to_bus ((void *)curr); /* Replace the current jump operand. */ - current[1] = + curr[1] = virt_to_bus ((void *) cmd->dsa) + hostdata->E_dsa_code_begin - hostdata->E_dsa_code_template; /* Replace the NOP instruction with a JUMP */ - current[0] = ((DCMD_TYPE_TCI|DCMD_TCI_OP_JUMP) << 24) | + curr[0] = ((DCMD_TYPE_TCI|DCMD_TCI_OP_JUMP) << 24) | DBC_TCI_TRUE; } else { printk ("scsi%d: no free slot\n", host->host_no); @@ -4510,8 +4509,8 @@ restart: /* * NCR53c700 and NCR53c700-66 change the current SCSI - * process, hostdata->current, in the Linux driver so - * cmd = hostdata->current. + * process, hostdata->curr, in the Linux driver so + * cmd = hostdata->curr. * * With other chips, we must look through the commands * executing and find the command structure which @@ -4519,7 +4518,7 @@ restart: */ if (hostdata->options & OPTION_700) { - cmd = (struct NCR53c7x0_cmd *) hostdata->current; + cmd = (struct NCR53c7x0_cmd *) hostdata->curr; } else { dsa = bus_to_virt(NCR53c7x0_read32(DSA_REG)); for (cmd = (struct NCR53c7x0_cmd *) @@ -5872,7 +5871,7 @@ print_queues (struct Scsi_Host *host) { struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) host->hostdata; u32 *dsa, *next_dsa; - volatile u32 *current; + volatile u32 *curr; int left; Scsi_Cmnd *cmd, *next_cmd; unsigned long flags; @@ -5914,11 +5913,11 @@ print_queues (struct Scsi_Host *host) { */ printk ("scsi%d : schedule dsa array :\n", host->host_no); - for (left = host->can_queue, current = hostdata->schedule; - left > 0; current += 2, --left) - if (current[0] != hostdata->NOP_insn) + for (left = host->can_queue, curr = hostdata->schedule; + left > 0; curr += 2, --left) + if (curr[0] != hostdata->NOP_insn) /* FIXME : convert pointer to dsa_begin to pointer to dsa. */ - print_dsa (host, bus_to_virt (current[1] - + print_dsa (host, bus_to_virt (curr[1] - (hostdata->E_dsa_code_begin - hostdata->E_dsa_code_template)), ""); printk ("scsi%d : end schedule dsa array\n", host->host_no); @@ -6108,7 +6107,7 @@ return_outstanding_commands (struct Scsi_Host *host, int free, int issue) { host->hostdata; struct NCR53c7x0_cmd *c; int i; - u32 *current; + u32 *curr; Scsi_Cmnd *list = NULL, *tmp; for (c = (struct NCR53c7x0_cmd *) hostdata->running_list; c; c = (struct NCR53c7x0_cmd *) c->next) { @@ -6129,12 +6128,12 @@ return_outstanding_commands (struct Scsi_Host *host, int free, int issue) { } if (free) { - for (i = 0, current = (u32 *) hostdata->schedule; - i < host->can_queue; ++i, current += 2) { - current[0] = hostdata->NOP_insn; - current[1] = 0xdeadbeef; + for (i = 0, curr = (u32 *) hostdata->schedule; + i < host->can_queue; ++i, curr += 2) { + curr[0] = hostdata->NOP_insn; + curr[1] = 0xdeadbeef; } - hostdata->current = NULL; + hostdata->curr = NULL; } if (issue) { diff --git a/drivers/scsi/53c7,8xx.h b/drivers/scsi/53c7,8xx.h index 80fbad3b51e0..cfddfa6815d4 100644 --- a/drivers/scsi/53c7,8xx.h +++ b/drivers/scsi/53c7,8xx.h @@ -1394,7 +1394,7 @@ struct NCR53c7x0_hostdata { /* commands running, maintained by Linux driver */ - volatile struct NCR53c7x0_cmd *current; /* currently connected + volatile struct NCR53c7x0_cmd *curr; /* currently connected nexus, ONLY valid for NCR53c700/NCR53c700-66 */ diff --git a/drivers/scsi/ChangeLog.ncr53c8xx b/drivers/scsi/ChangeLog.ncr53c8xx index ccf31d453879..edc8f395c08a 100644 --- a/drivers/scsi/ChangeLog.ncr53c8xx +++ b/drivers/scsi/ChangeLog.ncr53c8xx @@ -1,3 +1,75 @@ +Sun May 11 22:30 1997 Gerard Roudier (groudier@club-internet.fr) + * revision 2.1b + - Cosmetic changes. + - Some heavy testings under pre-linux-2.1.37-6 + +Sun May 4 22:30 1997 Gerard Roudier (groudier@club-internet.fr) + * revision 2.1a + - PFEN wrongly used for PREFETCH feature bit testing. + Changed to _F_PFEN. + - 2 SCR_COPY that need NO FLUSH bit to be removed had been missed + in tp->getscr[] script (loads SXFER and SCNTL3 on reselection). + +Sat May 3 22:30 1997 Gerard Roudier (groudier@club-internet.fr) + * revision 2.1 + - Use the NO FLUSH option for MOVE MEMORY (COPY) each time it is + possible. More than 100 COPY with NO FLUSH and 6 with FLUSH for + my configuration (max queued command / device = 8). + This option bit is removed from the script instance for chips + that donnot support prefetching. + - Rewrite the ncr_exception() routine more simple (I think) and + remove useless code. + - Change the data_in and data_out script management. + Use the bottom part of these scripts instead of the beginning. + That avoids to zero the scatter/gather array when a command is + queued (1k) and to deal with some weird IID on MOVE 0 bytes when + a target wants to transfer more bytes than expected. + - Misc. improvements in the init code. + - Remove IOMAPPED/MMIO automatic switching option. + Was useless and reported not reliable. + - Fix a double read of DSTAT and remove DFE testing in the + Phase mismatch service routine. + - Etc... + +Fri Apr 26 20:00 1997 Gerard Roudier (groudier@club-internet.fr) + * revision 2.0a + - Add support if the Diamond FirePort 40 (SYM53C875J chip) + +Mon Apr 22 22:00 1997 Gerard Roudier (groudier@club-internet.fr) + * revision 2.0 + - incorporate __initdata and __initfunc directives in order to + allow 'init' to free unused memory after driver initialisations. + Patch sent by Roberto Fichera. + - rewrite the init code of the driver. Now a feature descriptor + is used for each real chip types. The code is a lot more clean, + since the driver uses device and revision ids only in the + detection procedure. + - add 'pcifix' boot command line. This command allows to fix up PCI + config space for new chips which support features based on the + cache line size and 'write and invalidate'. + - incorporate in the driver, the code used for error recovery + testing. This code is normally not compiled; have to define + SCSI_NCR_DEBUG_ERROR_RECOVERY in order to compile it. + - take into account actual SCSI bus mode for 53C895 LVD/SE controller. + In single ended mode only fast20 is supported. + (Just to not be late since such controllers are not yet available) + + +Sat Apr 20 21:00 1997 Gerard Roudier (groudier@club-internet.fr) + * revision 1.18f + - fix an old bug included in the initial port (version 0.0). + The driver allocated 10 bytes of static data and uses 12 bytes. + No danger, since data are generally aligned on 4 bytes boundary + and so byte 10 and 11 are free (I hope ...) + +Wed Apr 16 12:00 1997 Gerard Roudier (groudier@club-internet.fr) + * revision 1.18e + - reset all when an unexpected data cycle is detected while + disconnecting. + - make changes to abort() ans reset() functions according to + Leonard's documentation. + - small fix in some message for hard errors. + Sat Apr 5 13:00 1997 Gerard Roudier (groudier@club-internet.fr) * revision 1.18d - Probe NCR pci device ids in reverse order if asked by user from diff --git a/drivers/scsi/README.ncr53c8xx b/drivers/scsi/README.ncr53c8xx index 53b690f7cdce..d93492a83dde 100644 --- a/drivers/scsi/README.ncr53c8xx +++ b/drivers/scsi/README.ncr53c8xx @@ -1,10 +1,10 @@ -The linux NCR53C8XX driver README file +The Linux NCR53C8XX driver README file Written by Gerard Roudier 21 Rue Carnot 95170 DEUIL LA BARRE - FRANCE -6 April 1997 +9 May 1997 =============================================================================== 1. Introduction @@ -22,6 +22,7 @@ Written by Gerard Roudier 8.5 Set debug mode 8.6 Clear profile counters 8.7 Set flag (no_sync) + 8.8 Debug error recovery 9. Configuration parameters 10. Boot setup commands 10.1 Syntax @@ -203,7 +204,6 @@ General information: IO port address 0x6000, IRQ number 10 Using memory mapped IO at virtual address 0x282c000 Synchronous transfer period 25, max commands per lun 4 - Profiling information: num_trans = 18014 num_kbytes = 671314 @@ -390,6 +390,57 @@ Available commands: - setflag all will allow disconnection for all devices on the SCSI bus. + +8.8 Debug error recovery + + debug_error_recovery + + Available error type to trigger: + sge: SCSI gross error + abort: abort command from the middle-level driver + reset: reset command from the middle-level driver + parity: scsi parity detected in DATA IN phase + none: restore driver normal behaviour + + The code corresponding to this feature is normally not compiled. + Its purpose is driver testing only. In order to compile the code + that allows to trigger error recovery you must define at compile time + SCSI_NCR_DEBUG_ERROR_RECOVERY. + If you have compiled the driver with this option, nothing will happen + as long as you donnot use the control command 'debug_error_recovery' + with sge, abort, reset or parity as argument. + If you select an error type, it will be triggered by the driver every + 30 seconds. + +8.9 PCI configuration fix-up + + pcifix