]> git.hungrycats.org Git - linux/commitdiff
v2.4.10.5 -> v2.4.10.6
authorLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 04:21:22 +0000 (20:21 -0800)
committerLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 04:21:22 +0000 (20:21 -0800)
  - various: fix some module exports uncovered by stricter error checking
  - Urban Widmark: make smbfs use same error define names as samba and win32
  - Greg KH: USB update
  - Tom Rini: MPC8xx ppc update
  - Matthew Wilcox: rd.c page cache flushing fix
  - Richard Gooch: devfs race fix: rwsem for symlinks
  - Björn Wesen: Cris arch update
  - Nikita Danilov: reiserfs cleanup
  - Tim Waugh: parport update
  - Peter Rival: update alpha SMP bootup to match wait_init_idle fixes
  - Trond Myklebust: lockd/grace period fix

122 files changed:
Documentation/Configure.help
Documentation/filesystems/devfs/ChangeLog
Makefile
arch/alpha/kernel/smp.c
arch/cris/Makefile
arch/cris/boot/rescue/Makefile
arch/cris/boot/rescue/head.S
arch/cris/boot/rescue/kimagerescue.S
arch/cris/boot/rescue/rescue.ld
arch/cris/boot/rescue/testrescue.S
arch/cris/config.in
arch/cris/cris.ld
arch/cris/defconfig
arch/cris/drivers/Config.in
arch/cris/drivers/axisflashmap.c
arch/cris/drivers/ethernet.c
arch/cris/drivers/lpslave/bintocarr.pl
arch/cris/drivers/parport.c
arch/cris/drivers/serial.c
arch/cris/drivers/serial.h
arch/cris/drivers/usb-host.c
arch/cris/kernel/Makefile
arch/cris/kernel/entry.S
arch/cris/kernel/head.S
arch/cris/kernel/ksyms.c
arch/cris/kernel/process.c
arch/cris/kernel/ptrace.c
arch/cris/kernel/setup.c
arch/cris/kernel/signal.c
arch/cris/lib/checksum.S
arch/cris/lib/checksumcopy.S
arch/cris/lib/csumcpfruser.S
arch/cris/lib/dram_init.S
arch/cris/lib/memset.c
arch/cris/lib/string.c
arch/cris/lib/usercopy.c
arch/cris/mm/extable.c
arch/i386/defconfig
arch/i386/kernel/entry.S
arch/ppc/8260_io/enet.c
arch/ppc/8xx_io/commproc.c
arch/ppc/8xx_io/commproc.h [deleted file]
arch/ppc/8xx_io/enet.c
arch/ppc/8xx_io/fec.c
arch/ppc/8xx_io/uart.c
arch/ppc/boot/mbx/iic.c
arch/ppc/boot/mbx/m8xx_tty.c
arch/ppc/boot/prep/Makefile
arch/ppc/configs/IVMS8_defconfig
arch/ppc/configs/TQM860L_defconfig
arch/ppc/kernel/cputable.c
arch/ppc/kernel/m8260_setup.c
arch/ppc/kernel/m8xx_setup.c
arch/ppc/kernel/ppc_ksyms.c
arch/ppc/kernel/process.c
arch/ppc/kernel/residual.c
arch/ppc/kernel/time.c
arch/ppc/xmon/start_8xx.c
arch/ppc/xmon/xmon.c
drivers/block/paride/paride.c
drivers/block/rd.c
drivers/char/Makefile
drivers/ide/Config.in
drivers/ide/Makefile
drivers/ide/ide-m8xx.c [new file with mode: 0644]
drivers/ide/ide.c
drivers/ide/ide_modes.h
drivers/ieee1394/Makefile
drivers/parport/ChangeLog
drivers/parport/parport_pc.c
drivers/parport/parport_serial.c
drivers/parport/share.c
drivers/scsi/ips.c
drivers/usb/uhci-debug.h
drivers/usb/uhci.c
drivers/usb/uhci.h
drivers/video/sis/Makefile
fs/devfs/base.c
fs/lockd/clntproc.c
fs/reiserfs/bitmap.c
fs/reiserfs/buffer2.c
fs/reiserfs/dir.c
fs/reiserfs/do_balan.c
fs/reiserfs/fix_node.c
fs/reiserfs/ibalance.c
fs/reiserfs/inode.c
fs/reiserfs/item_ops.c
fs/reiserfs/journal.c
fs/reiserfs/lbalance.c
fs/reiserfs/namei.c
fs/reiserfs/objectid.c
fs/reiserfs/stree.c
fs/reiserfs/tail_conversion.c
fs/smbfs/proc.c
include/asm-cris/bitops.h
include/asm-cris/checksum.h
include/asm-cris/current.h
include/asm-cris/delay.h
include/asm-cris/io.h
include/asm-cris/irq.h
include/asm-cris/module.h
include/asm-cris/pgtable.h
include/asm-cris/processor.h
include/asm-cris/system.h
include/asm-cris/tlb.h [new file with mode: 0644]
include/asm-cris/uaccess.h
include/asm-i386/unistd.h
include/asm-ppc/commproc.h [new file with mode: 0644]
include/asm-ppc/ide.h
include/asm-ppc/oak.h
include/asm-ppc/spd8xx.h
include/asm-ppc/walnut.h
include/linux/module.h
include/linux/pci_ids.h
include/linux/reiserfs_fs.h
include/linux/smbno.h
kernel/timer.c
mm/page_alloc.c
mm/swap_state.c
mm/vmscan.c
net/sunrpc/xprt.c
scripts/split-include.c

index 99906c6a00c28308d2b4ad5f1b40d9694a7a947b..721c44f40ff6d6a1bc8bc4743c073714390df9f7 100644 (file)
@@ -1164,6 +1164,29 @@ CONFIG_BLK_DEV_MAC_IDE
   devices (hard disks, CD-ROM drives, etc.) that are connected to the
   builtin IDE interface.
 
+MPC8xx IDE support
+CONFIG_BLK_DEV_MPC8xx_IDE
+  This option provides support for IDE on Motorola MPC8xx Systems.
+  Please see 'Type of MPC8xx IDE interface' for details.
+
+  If unsure, say N.
+
+Type of MPC8xx IDE interface
+CONFIG_IDE_8xx_PCCARD
+  Select how the IDE devices are connected to the MPC8xx system:
+
+  8xx_PCCARD uses the 8xx internal PCMCIA interface in combination
+             with a PC Card (e.g. ARGOSY portable Hard Disk Adapter),
+             ATA PC Card HDDs or ATA PC Flash Cards (example: TQM8xxL
+             systems)
+
+  8xx_DIRECT is used for directly connected IDE devices using the 8xx
+             internal PCMCIA interface (example: IVMS8 systems)
+
+  EXT_DIRECT is used for IDE devices directly connected to the 8xx
+             bus using some glue logic, but _not_ the 8xx internal
+             PCMCIA interface (example: IDIF860 systems)
+
 ICS IDE interface support
 CONFIG_BLK_DEV_IDE_ICSIDE
   On Acorn systems, say Y here if you wish to use the ICS IDE
index 5574db38aafee89a386ac16398b44258fca048f6..3951f6c432cd47fba8e14e9e46b297d28d974654 100644 (file)
@@ -1755,3 +1755,7 @@ Changes for patch v192
 - Ported to kernel 2.4.10-pre11
 
 - Set inode->i_mapping->a_ops for block nodes in <get_vfs_inode>
+===============================================================================
+Changes for patch v193
+
+- Went back to global rwsem for symlinks (refcount scheme no good)
index fb352eb1b35ffa2d3d6050f8e6dd1d74a6ca28c8..4f0cac677e02b484b30ab7024f3ac8d077589c6f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 11
-EXTRAVERSION =-pre5
+EXTRAVERSION =-pre6
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
index 473af79a78b71c41178064bea04a85af512a3f66..e7c736053d56e02e1fe1fd0a61db729976b35977 100644 (file)
@@ -171,13 +171,6 @@ smp_callin(void)
        /* Set interrupt vector.  */
        wrent(entInt, 0);
 
-       /* Setup the scheduler for this processor.  */
-       init_idle();
-
-       /* ??? This should be in init_idle.  */
-       atomic_inc(&init_mm.mm_count);
-       current->active_mm = &init_mm;
-
        /* Get our local ticker going. */
        smp_setup_percpu_timer(cpuid);
 
@@ -207,6 +200,12 @@ smp_callin(void)
        DBGS(("smp_callin: commencing CPU %d current %p\n",
              cpuid, current));
 
+       /* Setup the scheduler for this processor.  */
+       init_idle();
+
+       /* ??? This should be in init_idle.  */
+       atomic_inc(&init_mm.mm_count);
+       current->active_mm = &init_mm;
        /* Do nothing.  */
        cpu_idle();
 }
index 2c6d03f5ad345f4f97badb43384895d198ae2633..61db7aea665b13d52abc524b2b2fb17296941759 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.20 2001/07/05 10:07:58 jonashg Exp $
+# $Id: Makefile,v 1.22 2001/10/01 14:42:38 bjornw Exp $
 # cris/Makefile
 #
 # This file is included by the global makefile so that you can add your own
@@ -29,24 +29,26 @@ LD = if [ ! -e $(LD_SCRIPT).tmp -o $(LD_SCRIPT) -nt $(LD_SCRIPT).tmp ]; then \
               -e s/@CONFIG_ETRAX_DRAM_SIZE_M@/$(CONFIG_ETRAX_DRAM_SIZE)/ \
               < $(LD_SCRIPT) > $(LD_SCRIPT).tmp; \
      else true; \
-     fi && $(CROSS_COMPILE)ld -mcriself
+     fi && $(CROSS_COMPILE)gcc -mlinux -nostdlib
 
-LINKFLAGS =-qmagic -mcriself -T $(LD_SCRIPT).tmp
+LINKFLAGS = -mlinux -T $(LD_SCRIPT).tmp
 
 # objcopy is used to make binary images from the resulting linked file
 
 OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
 
 # normally, gcc on a linux box adds __linux__ but we do it "manually"
-# gcc-cris defaults to a.out, we need ELF, so -melf
+# -mlinux enables -march=v10, -fno-underscores among others
 
-CFLAGS := $(CFLAGS) -march=v10 -fno-strict-aliasing -pipe -D__linux__
+CFLAGS := $(CFLAGS) -mlinux -fno-strict-aliasing -pipe -D__linux__
 
 ifdef CONFIG_ETRAX_KGDB
 CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g
 CFLAGS += -fno-omit-frame-pointer
 endif
 
+AFLAGS += -mlinux
+
 HEAD := arch/cris/kernel/head.o
 
 SUBDIRS += arch/cris/kernel arch/cris/mm arch/cris/lib arch/cris/drivers
index c4599b436feeb9ab895b4afb0558511f6fcc03dc..43b1fa6b8e969a9cb154c939c8ce739c22c0f6f6 100644 (file)
@@ -4,9 +4,9 @@
 ifndef TOPDIR
 TOPDIR = ../../../..
 endif
-CC = gcc-cris -I $(TOPDIR)/include
+CC = gcc-cris -mlinux -I $(TOPDIR)/include
 CFLAGS = -O2
-LD = ld-cris
+LD = gcc-cris -mlinux -nostdlib
 OBJCOPY = objcopy-cris
 
 all: rescue.bin testrescue.bin kimagerescue.bin
@@ -48,3 +48,7 @@ clean:
        rm -f *.o *.bin
 
 fastdep:
+
+modules:
+
+modules-install:
index 57239c3ec3079e05d19bb29e09c5579928618b03..7904252a36d264e819711771e06916fd3e4eee86 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.7 2001/04/18 12:05:07 bjornw Exp $
+/* $Id: head.S,v 1.8 2001/10/03 17:15:15 bjornw Exp $
  * 
  * Rescue code, made to reside at the beginning of the
  * flash-memory. when it starts, it checks a partition
@@ -134,12 +134,12 @@ in_cache:
        ;; change 1's to 0's without erasing the sector, it is possible to add new
        ;; code after this and altering the jumptarget in an upgrade.
 
-jtcd:  move.d  [jumptarget], r0
-       cmp.d   0xffffffff, r0
+jtcd:  move.d  [jumptarget], $r0
+       cmp.d   0xffffffff, $r0
        beq     no_newjump
        nop
        
-       jump    [r0]
+       jump    [$r0]
 
 jumptarget:    
        .dword  0xffffffff      ; can be overwritten later to insert new code
@@ -151,69 +151,69 @@ no_newjump:
        ;; we now should go through the checksum-table and check the listed
        ;; partitions for errors.
        
-       move.d  PTABLE_START, r3
-       move.d  [r3], r0
-       cmp.d   NOP_DI, r0      ; make sure the nop/di is there...
+       move.d  PTABLE_START, $r3
+       move.d  [$r3], $r0
+       cmp.d   NOP_DI, $r0     ; make sure the nop/di is there...
        bne     do_rescue
        nop
        
        ;; skip the code transparency block (10 bytes).
 
-       addq    10, r3
+       addq    10, $r3
        
        ;; check for correct magic
        
-       move.w  [r3+], r0
-       cmp.w   PTABLE_MAGIC, r0
+       move.w  [$r3+], $r0
+       cmp.w   PTABLE_MAGIC, $r0
        bne     do_rescue       ; didn't recognize - trig rescue
        nop
 
        ;; check for correct ptable checksum
 
-       movu.w  [r3+], r2       ; ptable length
-       move.d  r2, r8          ; save for later, length of total ptable
-       addq    28, r8          ; account for the rest
-       move.d  [r3+], r4       ; ptable checksum
-       move.d  r3, r1
+       movu.w  [$r3+], $r2     ; ptable length
+       move.d  $r2, $r8        ; save for later, length of total ptable
+       addq    28, $r8         ; account for the rest
+       move.d  [$r3+], $r4     ; ptable checksum
+       move.d  $r3, $r1
        jsr     checksum        ; r1 source, r2 length, returns in r0
 
-       cmp.d   r0, r4
+       cmp.d   $r0, $r4
        bne     do_rescue       ; didn't match - trig rescue
        nop
        
        ;; ptable is ok. validate each entry.
 
-       moveq   -1, r7
+       moveq   -1, $r7
        
-ploop: move.d  [r3+], r1       ; partition offset (from ptable start)
+ploop: move.d  [$r3+], $r1     ; partition offset (from ptable start)
        bne     notfirst        ; check if its the partition containing ptable
        nop                     ; yes..
-       move.d  r8, r1          ; for its checksum check, skip the ptable
-       move.d  [r3+], r2       ; partition length
-       sub.d   r8, r2          ; minus the ptable length
+       move.d  $r8, $r1        ; for its checksum check, skip the ptable
+       move.d  [$r3+], $r2     ; partition length
+       sub.d   $r8, $r2        ; minus the ptable length
        ba      bosse
        nop
 notfirst:      
-       cmp.d   -1, r1          ; the end of the ptable ?
+       cmp.d   -1, $r1         ; the end of the ptable ?
        beq     flash_ok        ;   if so, the flash is validated
-       move.d  [r3+], r2       ; partition length
-bosse: move.d  [r3+], r5       ; checksum
-       move.d  [r3+], r4       ; type and flags
-       addq    16, r3          ; skip the reserved bytes
-       btstq   16, r4          ; check ro flag
+       move.d  [$r3+], $r2     ; partition length
+bosse: move.d  [$r3+], $r5     ; checksum
+       move.d  [$r3+], $r4     ; type and flags
+       addq    16, $r3         ; skip the reserved bytes
+       btstq   16, $r4         ; check ro flag
        bpl     ploop           ;   rw partition, skip validation
        nop
-       btstq   17, r4          ; check bootable flag
+       btstq   17, $r4         ; check bootable flag
        bpl     1f
        nop
-       move.d  r1, r7          ; remember boot partition offset
+       move.d  $r1, $r7        ; remember boot partition offset
 1:     
 
-       add.d   PTABLE_START, r1
+       add.d   PTABLE_START, $r1
        
        jsr     checksum        ; checksum the partition
        
-       cmp.d   r0, r5
+       cmp.d   $r0, $r5
        beq     ploop           ; checksums matched, go to next entry
        nop
 
@@ -223,92 +223,92 @@ do_rescue:
        ;; setup port PA and PB default initial directions and data
        ;; (so we can flash LEDs, and so that DTR and others are set)
        
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0
-       move.b  r0, [R_PORT_PA_DIR]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0
-       move.b  r0, [R_PORT_PA_DATA]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
+       move.b  $r0, [R_PORT_PA_DIR]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
+       move.b  $r0, [R_PORT_PA_DATA]
        
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0
-       move.b  r0, [R_PORT_PB_DIR]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0
-       move.b  r0, [R_PORT_PB_DATA]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
+       move.b  $r0, [R_PORT_PB_DIR]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
+       move.b  $r0, [R_PORT_PB_DATA]
 
        ;; setup the serial port at 115200 baud
        
-       moveq   0, r0
-       move.d  r0, [SERXOFF] 
+       moveq   0, $r0
+       move.d  $r0, [SERXOFF] 
 
-       move.b  0x99, r0
-       move.b  r0, [SERBAUD]           ; 115.2kbaud for both transmit and receive
+       move.b  0x99, $r0
+       move.b  $r0, [SERBAUD]          ; 115.2kbaud for both transmit and receive
 
-       move.b  0x40, r0                ; rec enable
-       move.b  r0, [SERRECC] 
+       move.b  0x40, $r0               ; rec enable
+       move.b  $r0, [SERRECC] 
 
-       moveq   0, r1           ; "timer" to clock out a LED red flash
-       move.d  CODE_START, r3  ; destination counter
-       movu.w  CODE_LENGTH, r4 ; length
+       moveq   0, $r1          ; "timer" to clock out a LED red flash
+       move.d  CODE_START, $r3 ; destination counter
+       movu.w  CODE_LENGTH, $r4; length
        
 wait_ser:
-       addq    1, r1
+       addq    1, $r1
 #ifndef CONFIG_ETRAX_NO_LEDS
 #ifdef CONFIG_ETRAX_PA_LEDS
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r2
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r2
 #endif
 #ifdef CONFIG_ETRAX_PB_LEDS
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r2
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r2
 #endif
-       move.d  (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), r0
-       btstq   16, r1
+       move.d  (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
+       btstq   16, $r1
        bpl     1f
        nop
-       or.d    r0, r2          ; set bit
+       or.d    $r0, $r2        ; set bit
        ba      2f
        nop
-1:     not     r0              ; clear bit
-       and.d   r0, r2
+1:     not     $r0             ; clear bit
+       and.d   $r0, $r2
 2:     
 #ifdef CONFIG_ETRAX_PA_LEDS
-       move.b  r2, [R_PORT_PA_DATA]    
+       move.b  $r2, [R_PORT_PA_DATA]   
 #endif 
 #ifdef CONFIG_ETRAX_PB_LEDS
-       move.b  r2, [R_PORT_PB_DATA]    
+       move.b  $r2, [R_PORT_PB_DATA]   
 #endif
 #ifdef CONFIG_ETRAX_90000000_LEDS
-       move.b  r2, [0x90000000]
+       move.b  $r2, [0x90000000]
 #endif
 #endif
        
        ;; check if we got something on the serial port
        
-       move.b  [SERSTAT], r0
-       btstq   0, r0           ; data_avail
+       move.b  [SERSTAT], $r0
+       btstq   0, $r0          ; data_avail
        bpl     wait_ser
        nop
 
        ;; got something - copy the byte and loop
 
-       move.b  [SERRDAT], r0
-       move.b  r0, [r3+]
+       move.b  [SERRDAT], $r0
+       move.b  $r0, [$r3+]
        
-       subq    1, r4           ; decrease length
+       subq    1, $r4          ; decrease length
        bne     wait_ser
        nop
 
        ;; jump into downloaded code
 
-       move.d  RAM_INIT_MAGIC, r8      ; Tell next product that DRAM is initialized
+       move.d  RAM_INIT_MAGIC, $r8     ; Tell next product that DRAM is initialized
        jump    CODE_START
 
 flash_ok:
        ;; check r7, which contains either -1 or the partition to boot from
 
-       cmp.d   -1, r7
+       cmp.d   -1, $r7
        bne     1f
        nop
-       move.d  PTABLE_START, r7; otherwise use the ptable start
+       move.d  PTABLE_START, $r7; otherwise use the ptable start
 1:
-       move.d  RAM_INIT_MAGIC, r8      ; Tell next product that DRAM is initialized
-       jump    r7              ; boot!
+       move.d  RAM_INIT_MAGIC, $r8     ; Tell next product that DRAM is initialized
+       jump    $r7             ; boot!
 
 
        ;; Helper subroutines
@@ -318,9 +318,9 @@ flash_ok:
        ;; r2 - length in bytes
        ;; result will be in r0
 checksum:
-       moveq   0, r0
-1:     addu.b  [r1+], r0
-       subq    1, r2
+       moveq   0, $r0
+1:     addu.b  [$r1+], $r0
+       subq    1, $r2
        bne     1b
        nop
        ret
index 8562d6a6b88631e485193ea7a31b8059ef5617e2..500ed5ede8035d234a2e5a76904f147ef87fdb0e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kimagerescue.S,v 1.4 2001/04/18 12:04:46 bjornw Exp $
+/* $Id: kimagerescue.S,v 1.5 2001/10/03 17:15:15 bjornw Exp $
  * 
  * Rescue code to be prepended on a kimage and copied to the
  * rescue serial port.
        ;; setup port PA and PB default initial directions and data
        ;; (so we can flash LEDs, and so that DTR and others are set)
        
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0
-       move.b  r0, [R_PORT_PA_DIR]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0
-       move.b  r0, [R_PORT_PA_DATA]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
+       move.b  $r0, [R_PORT_PA_DIR]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
+       move.b  $r0, [R_PORT_PA_DATA]
        
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0
-       move.b  r0, [R_PORT_PB_DIR]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0
-       move.b  r0, [R_PORT_PB_DATA]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
+       move.b  $r0, [R_PORT_PB_DIR]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
+       move.b  $r0, [R_PORT_PB_DATA]
        
        ;; We need to setup the bus registers before we start using the DRAM
 #include "../../lib/dram_init.S"
        ;; We assume 8 MB is the minimum DRAM in an eLinux
        ;; product and put the sp at the top for now.
 
-       move.d  0x40800000, sp
+       move.d  0x40800000, $sp
        
        ;; setup the serial port at 115200 baud
        
-       moveq   0, r0
-       move.d  r0, [SERXOFF] 
+       moveq   0, $r0
+       move.d  $r0, [SERXOFF] 
 
-       move.b  0x99, r0
-       move.b  r0, [SERBAUD]           ; 115.2kbaud for both transmit and receive
+       move.b  0x99, $r0
+       move.b  $r0, [SERBAUD]          ; 115.2kbaud for both transmit and receive
 
-       move.b  0x40, r0                ; rec enable
-       move.b  r0, [SERRECC] 
+       move.b  0x40, $r0               ; rec enable
+       move.b  $r0, [SERRECC] 
 
 
-       moveq   0, r1           ; "timer" to clock out a LED red flash
-       move.d  CODE_START, r3  ; destination counter
-       move.d  CODE_LENGTH, r4 ; length
-       move.d  TIMEOUT_VALUE, r5       ; "timeout" until jump
+       moveq   0, $r1          ; "timer" to clock out a LED red flash
+       move.d  CODE_START, $r3 ; destination counter
+       move.d  CODE_LENGTH, $r4        ; length
+       move.d  TIMEOUT_VALUE, $r5      ; "timeout" until jump
 
 wait_ser:
-       addq    1, r1
-       subq    1, r5           ; decrease timeout
+       addq    1, $r1
+       subq    1, $r5          ; decrease timeout
        beq     jump_start      ; timed out
        nop
 #ifndef CONFIG_ETRAX_NO_LEDS
 #ifdef CONFIG_ETRAX_PA_LEDS
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r2
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r2
 #endif
 #ifdef CONFIG_ETRAX_PB_LEDS
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r2
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r2
 #endif
-       move.d  (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), r0
-       btstq   16, r1
+       move.d  (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
+       btstq   16, $r1
        bpl     1f
        nop
-       or.d    r0, r2          ; set bit
+       or.d    $r0, $r2                ; set bit
        ba      2f
        nop
-1:     not     r0              ; clear bit
-       and.d   r0, r2
+1:     not     $r0             ; clear bit
+       and.d   $r0, $r2
 2:     
 #ifdef CONFIG_ETRAX_PA_LEDS
-       move.b  r2, [R_PORT_PA_DATA]
+       move.b  $r2, [R_PORT_PA_DATA]
 #endif 
 #ifdef CONFIG_ETRAX_PB_LEDS
-       move.b  r2, [R_PORT_PB_DATA]
+       move.b  $r2, [R_PORT_PB_DATA]
 #endif
 #endif
                
        ;; check if we got something on the serial port
        
-       move.b  [SERSTAT], r0
-       btstq   0, r0           ; data_avail
+       move.b  [SERSTAT], $r0
+       btstq   0, $r0          ; data_avail
        bpl     wait_ser
        nop
 
        ;; got something - copy the byte and loop
 
-       move.b  [SERRDAT], r0
-       move.b  r0, [r3+]
-       move.d  TIMEOUT_VALUE, r5       ; reset "timeout"
-       subq    1, r4           ; decrease length
+       move.b  [SERRDAT], $r0
+       move.b  $r0, [$r3+]
+       move.d  TIMEOUT_VALUE, $r5      ; reset "timeout"
+       subq    1, $r4          ; decrease length
        bne     wait_ser
        nop
 jump_start:
index 118da6dcea4a8468cf4d82b40f8f5cfc8c093b98..0b52a9490db65618f77d532fd758d328128718e0 100644 (file)
@@ -8,13 +8,13 @@ SECTIONS
 {
        .text :
        {
-               _stext = . ;
+               stext = . ;
                *(.text)
-               _etext = . ;
+               etext = . ;
        } > flash
        .data :
        {
                *(.data)
-               _edata = . ;
+               edata = . ;
        } > flash
 }
index 5ec2b188d405cd9abc79e6b1f1c86f42ea4309cd..2e0f0ce004d3d35b8ac45b9fb985a5973b5002ae 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: testrescue.S,v 1.2 2001/04/18 12:05:07 bjornw Exp $
+/* $Id: testrescue.S,v 1.3 2001/10/03 17:15:15 bjornw Exp $
  *
  * Simple testcode to download by the rescue block.
  * Just lits some LEDs to show it was downloaded correctly.
 
        nop
        nop
-       moveq   -1, r2
-       move.b  r2, [R_PORT_PA_DIR]
-       moveq   0, r2
-       move.b  r2, [R_PORT_PA_DATA]    
+       moveq   -1, $r2
+       move.b  $r2, [R_PORT_PA_DIR]
+       moveq   0, $r2
+       move.b  $r2, [R_PORT_PA_DATA]   
 
 endless:
        nop
index 77b5480c19e7b94583bd2dd51b42f5549d0c82db..4af20bc2e48650b01997451d57ee78f4fbb52317 100644 (file)
@@ -13,6 +13,15 @@ comment 'Code maturity level options'
 bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
 endmenu
 
+mainmenu_option next_comment
+comment 'Loadable module support'
+bool 'Enable loadable module support' CONFIG_MODULES
+if [ "$CONFIG_MODULES" = "y" ]; then
+   bool '  Set version information on all module symbols' CONFIG_MODVERSIONS
+   bool '  Kernel module loader' CONFIG_KMOD
+fi
+endmenu
+
 mainmenu_option next_comment
 comment 'General setup'
 
@@ -49,10 +58,8 @@ fi
 int 'DRAM size (dec, in MB)' CONFIG_ETRAX_DRAM_SIZE 8
 
 int 'Buswidth of flash in bytes' CONFIG_ETRAX_FLASH_BUSWIDTH 2
-bool 'Use flash mirroring (for cramfs)' CONFIG_ETRAX_FLASH_MIRRORING_FOR_CRAMFS
-if [ "$CONFIG_ETRAX_FLASH_MIRRORING_FOR_CRAMFS" = "y" ]; then
-       int '  Individual flash chip size (in MB)' CONFIG_ETRAX_FLASH_SIZE 2
-fi
+
+string 'Root device name' CONFIG_ETRAX_ROOT_DEVICE "/dev/mtdblock3"
 
 choice 'Product LED port' \
        "Port-PA-LEDs   CONFIG_ETRAX_PA_LEDS    \
index e0ffb51d9985369aa4c93285e3dc0ee4eb71de26..66e797309af817157bc62f92523209d1eee5ea19 100644 (file)
 SECTIONS
 {
        . = @CONFIG_ETRAX_DRAM_VIRTUAL_BASE@;
-       _dram_start = .;
-       _ibr_start = .;
+       dram_start = .;
+       ibr_start = .;
        . = . + 0x4000; /* see head.S and pages reserved at the start */
 
        _text = .;                    /* Text and read-only data */
-       _text_start = .;              /* lots of aliases */
+       text_start = .;              /* lots of aliases */
        _stext = .;
        __stext = .;
        .text : {
                *(.text)
                *(.fixup)
                *(.text.__*)
-               *(.rodata)
-               *(.rodata.__*)
        }
+       .text.lock : { *(.text.lock) }        /* out-of-line lock text */
+
+       _etext = . ;                  /* End of text section */ 
+       __etext = .;
+
+       .rodata : { *(.rodata) *(.rodata.__*) }
+       .kstrtab : { *(.kstrtab) }
 
        . = ALIGN(4);                /* Exception table */
        __start___ex_table = .;
        __ex_table : { *(__ex_table) }
        __stop___ex_table = .;
 
-       _etext = . ;                  /* End of text section */ 
-       __etext = .;
+       __start___ksymtab = .;        /* Kernel symbol table */
+       __ksymtab : { *(__ksymtab) }
+       __stop___ksymtab = .;
 
        . = ALIGN (4);
-       ___data_rom_start = . ;
        ___data_start = . ;
        __Sdata = . ;
        .data : {                     /* Data */
@@ -49,17 +54,17 @@ SECTIONS
        .data.init_task : { *(.data.init_task) }
 
        . = ALIGN(8192);              /* Init code and data */
-       ___init_begin = .;
+       __init_begin = .;
        .text.init : { *(.text.init) }
        .data.init : { *(.data.init) }
        . = ALIGN(16);
-       ___setup_start = .;
+       __setup_start = .;
        .setup.init : { *(.setup.init) }
-       ___setup_end = .;
+       __setup_end = .;
        .initcall.init : {
-               ___initcall_start = .;
+               __initcall_start = .;
                *(.initcall.init);
-               ___initcall_end = .;
+               __initcall_end = .;
 
                /* We fill to the next page, so we can discard all init
                   pages without needing to consider what payload might be
@@ -68,7 +73,7 @@ SECTIONS
                . = ALIGN (8192);
        }
        __vmlinux_end = .;            /* last address of the physical file */
-       ___init_end = .;
+       __init_end = .;
 
        __data_end = . ;              /* Move to _edata ? */
        __bss_start = .;              /* BSS */
@@ -88,5 +93,5 @@ SECTIONS
                *(.exitcall.exit)
         }
 
-       _dram_end = _dram_start + @CONFIG_ETRAX_DRAM_SIZE_M@*1024*1024;
+       dram_end = dram_start + @CONFIG_ETRAX_DRAM_SIZE_M@*1024*1024;
 }
index f613b601286e5b039b2cbf195f3acb46fd444acd..61fc16f594f4e992378f36853d8f7d05ee6b1722 100644 (file)
@@ -31,6 +31,7 @@ CONFIG_CRIS_LOW_MAP=y
 CONFIG_ETRAX_DRAM_VIRTUAL_BASE=60000000
 CONFIG_ETRAX_DRAM_SIZE=8
 CONFIG_ETRAX_FLASH_BUSWIDTH=2
+CONFIG_ETRAX_ROOT_DEVICE="/dev/mtdblock3"
 CONFIG_ETRAX_PA_LEDS=y
 # CONFIG_ETRAX_PB_LEDS is not set
 # CONFIG_ETRAX_CSP0_LEDS is not set
index 3ebb5c6158c746bfe2efaa56c99f0f20ff8fa32a..06b68ef5ab7ec5b2bfd3b2f894988f8578214208 100644 (file)
@@ -23,15 +23,17 @@ fi
 
 bool 'Serial-port support' CONFIG_ETRAX_SERIAL
 if [ "$CONFIG_ETRAX_SERIAL" = "y" ]; then
-  comment '  Port 0 is always enabled'
-  bool '  Ser0 DTR, RI, DSR, CD on PB' CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB
-  if [ "$CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB" = "y" ]; then
-    int '    Ser0 DTR on PB bit' CONFIG_ETRAX_SER0_DTR_ON_PB_BIT 4
-    int '    Ser0 RI  on PB bit' CONFIG_ETRAX_SER0_RI_ON_PB_BIT 5
-    int '    Ser0 DSR on PB bit' CONFIG_ETRAX_SER0_DSR_ON_PB_BIT 6
-    int '    Ser0 CD  on PB bit' CONFIG_ETRAX_SER0_CD_ON_PB_BIT 7
+  bool '  Serial port 0 enabled' CONFIG_ETRAX_SERIAL_PORT0
+  if [ "$CONFIG_ETRAX_SERIAL_PORT0" = "y" ]; then
+    bool '  Ser0 DTR, RI, DSR, CD on PB' CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB
+    if [ "$CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB" = "y" ]; then
+      int '    Ser0 DTR on PB bit' CONFIG_ETRAX_SER0_DTR_ON_PB_BIT 4
+      int '    Ser0 RI  on PB bit' CONFIG_ETRAX_SER0_RI_ON_PB_BIT 5
+      int '    Ser0 DSR on PB bit' CONFIG_ETRAX_SER0_DSR_ON_PB_BIT 6
+      int '    Ser0 CD  on PB bit' CONFIG_ETRAX_SER0_CD_ON_PB_BIT 7
+    fi
   fi
+
   bool '  Serial port 1 enabled' CONFIG_ETRAX_SERIAL_PORT1
   if [ "$CONFIG_ETRAX_SERIAL_PORT1" = "y" ]; then
     bool '  Ser1 DTR, RI, DSR, CD on PB' CONFIG_ETRAX_SER1_DTR_RI_DSR_CD_ON_PB
@@ -137,6 +139,7 @@ if [ "$CONFIG_ETRAX_AXISFLASHMAP" = "y" ]; then
 
        define_bool CONFIG_MTD_CHAR y
        define_bool CONFIG_MTD_BLOCK y
+       define_bool CONFIG_MTD_PARTITIONS y
 fi
 
 bool 'I2C support' CONFIG_ETRAX_I2C
index 8c476679509816c90eebd25e5a077b47c9f142ff..93233154f953142e0ea0c7ba98a3d4db6ad40280 100644 (file)
  * partition split defined below.
  *
  * $Log: axisflashmap.c,v $
+ * Revision 1.14  2001/09/21 07:14:10  jonashg
+ * Made root filesystem (cramfs) use mtdblock driver when booting from flash.
+ *
+ * Revision 1.13  2001/08/15 13:57:35  jonashg
+ * Entire MTD updated to the linux 2.4.7 version.
+ *
  * Revision 1.12  2001/06/11 09:50:30  jonashg
  * Oops, 2MB is 0x200000 bytes.
  *
@@ -84,6 +90,8 @@
 
 #define WINDOW_SIZE  (128 * 1024 * 1024)
 
+extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* From head.S */
+
 /* 
  * Map driver
  *
@@ -229,11 +237,11 @@ init_axis_flash(void)
        printk(KERN_NOTICE "Axis flash mapping: %x at %x\n",
               WINDOW_SIZE, FLASH_CACHED_ADDR);
 
-       mymtd = (struct mtd_info *)do_cfi_probe(&axis_map);
+       mymtd = (struct mtd_info *)do_map_probe("cfi", &axis_map);
 
 #ifdef CONFIG_MTD_AMDSTD
        if (!mymtd) {
-               mymtd = (struct mtd_info *)do_amd_flash_probe(&axis_map);
+               mymtd = (struct mtd_info *)do_map_probe("amd_flash", &axis_map);
        }
 #endif
 
@@ -310,11 +318,23 @@ init_axis_flash(void)
                use_default_ptable = !ptable_ok;
        }
 
-       if(use_default_ptable) {
+       if (use_default_ptable) {
                printk(" Using default partition table\n");
                return add_mtd_partitions(mymtd, axis_default_partitions,
                                          NUM_DEFAULT_PARTITIONS);
        } else {
+               if (romfs_in_flash) {
+                       axis_partitions[pidx].name = "romfs";
+                       axis_partitions[pidx].size = romfs_length;
+                       axis_partitions[pidx].offset = romfs_start -
+                                                      FLASH_CACHED_ADDR;
+                       axis_partitions[pidx].mask_flags |= MTD_WRITEABLE;
+
+                       printk(" Adding readonly partition for romfs image:\n");
+                       printk(pmsg, pidx, axis_partitions[pidx].offset,
+                              axis_partitions[pidx].size);
+                       pidx++;
+               }
                return add_mtd_partitions(mymtd, axis_partitions, pidx);
        }               
 }
index 5df0819bf834fed5cb9a88fea0accc3a9ced54cb..707c295f353f972bb25654b71ea736bd7aaaa8e4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ethernet.c,v 1.17 2001/06/11 12:43:46 olof Exp $
+/* $Id: ethernet.c,v 1.18 2001/10/03 14:40:43 jonashg Exp $
  *
  * e100net.c: A network driver for the ETRAX 100LX network controller.
  *
@@ -7,6 +7,9 @@
  * The outline of this driver comes from skeleton.c.
  *
  * $Log: ethernet.c,v $
+ * Revision 1.18  2001/10/03 14:40:43  jonashg
+ * Update rx_bytes counter.
+ *
  * Revision 1.17  2001/06/11 12:43:46  olof
  * Modified defines for network LED behavior
  *
@@ -833,6 +836,7 @@ e100_rx(struct net_device *dev)
        }
 
        length += myNextRxDesc->hw_len; /* use hw_len for the last descr */
+       ((struct net_local *)dev->priv)->stats.rx_bytes += length;
 
 #ifdef ETHDEBUG
        printk("Got a packet of length %d:\n", length);
index 30b9b4bf70853451757d84893e71b380b54ac51f..a400fa16853bc560ffc665723fe9166d9872fc2b 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# $Id: bintocarr.pl,v 1.3 2001/06/08 08:46:50 olof Exp $
+# $Id: bintocarr.pl,v 1.4 2001/08/08 08:18:13 bjarne Exp $
 # Copy of mkjulbin.pl made by Olof
 # convert a binary stdin to a C-file containing a char array of the input
 # first argument is the symbol name
@@ -7,7 +7,8 @@
 $symbol = shift @ARGV;
 
 print "#include <linux/init.h>\n\n";
-print "unsigned char $symbol", "[] __initdata = {\n";
+#print "unsigned char $symbol", "[] __initdata = {\n";
+print "unsigned char $symbol", "[]  = {\n";
 
 my $char;
 
index e9ba07dd9499dad62ec31ce965c3bde06a762c81..1d792968f149a2f7bfe562557369249a7f8360cf 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: parport.c,v 1.7 2001/06/25 16:17:30 jonashg Exp $
+/* $Id: parport.c,v 1.8 2001/09/26 11:51:52 bjornw Exp $
  * 
  * Elinux parallel port driver
  * NOTE!
index b291c52532f0f1d2cebe6216049fb928cd53d27b..b59ce87134e565a2d414e50516a58b6dc0d95b88 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: serial.c,v 1.13 2001/05/09 12:40:31 johana Exp $
+/* $Id: serial.c,v 1.18 2001/09/24 09:27:22 pkj Exp $
  *
  * Serial port driver for the ETRAX 100LX chip
  *
@@ -7,6 +7,30 @@
  *      Many, many authors. Based once upon a time on serial.c for 16x50.
  *
  * $Log: serial.c,v $
+ * Revision 1.18  2001/09/24 09:27:22  pkj
+ * Completed ext_baud_table[] in cflag_to_baud() and cflag_to_etrax_baud().
+ *
+ * Revision 1.17  2001/08/24 11:32:49  ronny
+ * More fixes for the CONFIG_ETRAX_SERIAL_PORT0 define.
+ *
+ * Revision 1.16  2001/08/24 07:56:22  ronny
+ * Added config ifdefs around ser0 irq requests.
+ *
+ * Revision 1.15  2001/08/16 09:10:31  bjarne
+ * serial.c - corrected the initialization of rs_table, the wrong defines
+ *            where used.
+ *            Corrected a test in timed_flush_handler.
+ *            Changed configured to enabled.
+ * serial.h - Changed configured to enabled.
+ *
+ * Revision 1.14  2001/08/15 07:31:23  bjarne
+ * Introduced two new members to the e100_serial struct.
+ * configured - Will be set to 1 if the port has been configured in .config
+ * uses_dma   - Should be set to 1 if the port uses DMA. Currently it is set to 1
+ *              when a port is opened. This is used to limit the DMA interrupt
+ *              routines to only manipulate DMA channels actually used by the
+ *              serial driver.
+ *
  * Revision 1.13  2001/05/09 12:40:31  johana
  * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h
  *
  *
  */
 
-static char *serial_version = "$Revision: 1.13 $";
+static char *serial_version = "$Revision: 1.18 $";
 
 #include <linux/config.h>
 #include <linux/version.h>
@@ -333,28 +357,52 @@ static struct e100_serial rs_table[] = {
          R_DMA_CH6_STATUS, R_DMA_CH6_HWSW,
          R_DMA_CH7_CLR_INTR, R_DMA_CH7_FIRST, R_DMA_CH7_CMD,
          R_DMA_CH7_STATUS, R_DMA_CH7_HWSW,
-         STD_FLAGS, DEF_RX, DEF_TX, 2 },  /* ttyS0 */
+         STD_FLAGS, DEF_RX, DEF_TX, 2,
+#ifdef CONFIG_ETRAX_SERIAL_PORT0
+          1
+#else
+          0
+#endif
+},  /* ttyS0 */
 #ifndef CONFIG_SVINTO_SIM
        { DEF_BAUD, (unsigned char *)R_SERIAL1_CTRL, 1U << 16, /* uses DMA 8 and 9 */
          R_DMA_CH8_CLR_INTR, R_DMA_CH8_FIRST, R_DMA_CH8_CMD,
          R_DMA_CH8_STATUS, R_DMA_CH8_HWSW,
          R_DMA_CH9_CLR_INTR, R_DMA_CH9_FIRST, R_DMA_CH9_CMD,
          R_DMA_CH9_STATUS, R_DMA_CH9_HWSW,
-         STD_FLAGS, DEF_RX, DEF_TX, 3 },  /* ttyS1 */
+         STD_FLAGS, DEF_RX, DEF_TX, 3 ,
+#ifdef CONFIG_ETRAX_SERIAL_PORT1
+          1
+#else
+          0
+#endif
+},  /* ttyS1 */
 
        { DEF_BAUD, (unsigned char *)R_SERIAL2_CTRL, 1U << 4,  /* uses DMA 2 and 3 */
          R_DMA_CH2_CLR_INTR, R_DMA_CH2_FIRST, R_DMA_CH2_CMD,
          R_DMA_CH2_STATUS, R_DMA_CH2_HWSW,
          R_DMA_CH3_CLR_INTR, R_DMA_CH3_FIRST, R_DMA_CH3_CMD,
          R_DMA_CH3_STATUS, R_DMA_CH3_HWSW,
-         STD_FLAGS, DEF_RX, DEF_TX, 0 },  /* ttyS2 */
+         STD_FLAGS, DEF_RX, DEF_TX, 0,
+#ifdef CONFIG_ETRAX_SERIAL_PORT2
+          1
+#else
+          0
+#endif
+ },  /* ttyS2 */
 
        { DEF_BAUD, (unsigned char *)R_SERIAL3_CTRL, 1U << 8,  /* uses DMA 4 and 5 */
          R_DMA_CH4_CLR_INTR, R_DMA_CH4_FIRST, R_DMA_CH4_CMD,
          R_DMA_CH4_STATUS, R_DMA_CH4_HWSW,
          R_DMA_CH5_CLR_INTR, R_DMA_CH5_FIRST, R_DMA_CH5_CMD,
          R_DMA_CH5_STATUS, R_DMA_CH5_HWSW,
-         STD_FLAGS, DEF_RX, DEF_TX, 1 }   /* ttyS3 */
+         STD_FLAGS, DEF_RX, DEF_TX, 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT3
+          1
+#else
+          0
+#endif
+ }   /* ttyS3 */
 #endif
 };
 
@@ -544,11 +592,12 @@ cflag_to_baud(unsigned int cflag)
        static int baud_table[] = {
                0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400,
                4800, 9600, 19200, 38400 };
-       
+
        static int ext_baud_table[] = {
-               0, 57600, 115200, 230400, 460800, 921600, 1843200, 6250000 };
-       
-       if(cflag & CBAUDEX)
+               0, 57600, 115200, 230400, 460800, 921600, 1843200, 6250000,
+                0, 0, 0, 0, 0, 0, 0, 0 };
+
+       if (cflag & CBAUDEX)
                return ext_baud_table[(cflag & CBAUD) & ~CBAUDEX];
        else 
                return baud_table[cflag & CBAUD];
@@ -560,19 +609,19 @@ static unsigned char
 cflag_to_etrax_baud(unsigned int cflag)
 {
        char retval;
-       
+
        static char baud_table[] = {
                -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, -1, 3, 4, 5, 6, 7 };
-       
+
        static char ext_baud_table[] = {
-               -1, 8, 9, 10, 11, 12, 13, 14 };
-       
-       if(cflag & CBAUDEX)
+               -1, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, -1, -1 };
+
+       if (cflag & CBAUDEX)
                retval = ext_baud_table[(cflag & CBAUD) & ~CBAUDEX];
        else 
                retval = baud_table[cflag & CBAUD];
-       
-       if(retval < 0) {
+
+       if (retval < 0) {
                printk("serdriver tried setting invalid baud rate, flags %x.\n", cflag);
                retval = 5; /* choose default 9600 instead */
        }
@@ -1266,6 +1315,8 @@ tr_interrupt(int irq, void *dev_id, struct pt_regs * regs)
        
        for(i = 0; i < NR_PORTS; i++) {
                info = rs_table + i;
+               if (!info->uses_dma) 
+                       continue; 
                /* check for dma_descr (dont need to check for dma_eop in output dma for serial */
                if(ireg & info->irq) {  
                        /* we can send a new dma bunch. make it so. */
@@ -1303,6 +1354,8 @@ rec_interrupt(int irq, void *dev_id, struct pt_regs * regs)
        
        for(i = 0; i < NR_PORTS; i++) {
                info = rs_table + i;
+               if (!info->uses_dma) 
+                       continue; 
                /* check for both dma_eop and dma_descr for the input dma channel */
                if(ireg & ((info->irq << 2) | (info->irq << 3))) {
                        /* we have received something */
@@ -1340,7 +1393,7 @@ timed_flush_handler(unsigned long ptr)
        
        for(i = 0; i < NR_PORTS; i++) {
                info = rs_table + i;
-               if(!(info->flags & ASYNC_INITIALIZED))
+               if(!info->enabled || !(info->flags & ASYNC_INITIALIZED))
                        continue;
 
                /* istatusadr (bit 6-0) hold number of bytes in fifo 
@@ -1394,8 +1447,9 @@ ser_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        unsigned char rstat;
 
        for(i = 0; i < NR_PORTS; i++) {
-
                info = rs_table + i;
+               if (!info->uses_dma) 
+                       continue; 
                rstat = info->port[REG_STATUS];
                
                if(*R_IRQ_MASK1_RD & (1U << (8+2*info->line))) { /* This line caused the irq */
@@ -1553,6 +1607,7 @@ startup(struct e100_serial * info)
         * Reset the DMA channels and make sure their interrupts are cleared
         */
        
+       info->uses_dma = 1;
        *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
        *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
 
@@ -2753,23 +2808,11 @@ rs_open(struct tty_struct *tty, struct file * filp)
        if (line < 0 || line >= NR_PORTS)
                return -ENODEV;
 
-       /* dont allow opening ports that are not enabled in the HW config */
-#ifndef CONFIG_ETRAX_SERIAL_PORT1
-       if (line == 1)
-               return -ENODEV;
-#endif
-#ifndef CONFIG_ETRAX_SERIAL_PORT2
-       if (line == 2)
-               return -ENODEV;
-#endif
-#ifndef CONFIG_ETRAX_SERIAL_PORT3
-       if (line == 3)
-               return -ENODEV;
-#endif
-
        /* find the corresponding e100_serial struct in the table */
 
        info = rs_table + line;
+       /* dont allow the opening of ports that are not enabled in the HW config */
+       if (!info->enabled) return -ENODEV; 
   
 #ifdef SERIAL_DEBUG_OPEN
        printk("[%d] rs_open %s%d, count = %d\n", current->pid,
@@ -2911,6 +2954,8 @@ int rs_read_proc(char *page, char **start, off_t off, int count,
        len += sprintf(page, "serinfo:1.0 driver:%s\n",
                       serial_version);
        for (i = 0; i < NR_PORTS && len < 4000; i++) {
+               if (!rs_table[i].enabled) 
+                       continue; 
                l = line_info(page + len, &rs_table[i]);
                len += l;
                if (len+begin > off+count)
@@ -3022,6 +3067,7 @@ rs_init(void)
        /* do some initializing for the separate ports */
   
        for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
+               info->uses_dma = 0;   
                info->line = i;
                info->tty = 0;
                info->type = PORT_ETRAX;
@@ -3043,18 +3089,21 @@ rs_init(void)
                init_waitqueue_head(&info->close_wait);
                info->xmit.buf = 0;
                info->xmit.tail = info->xmit.head = 0;
-
-               printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n",
-                      serial_driver.name, info->line, (unsigned int)info->port);
+               if (info->enabled) {
+                       printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n",
+                              serial_driver.name, info->line, (unsigned int)info->port);
+               }
        }
 
 #ifndef CONFIG_SVINTO_SIM
        /* Not needed in simulator.  May only complicate stuff. */
        /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */
+#ifdef CONFIG_ETRAX_SERIAL_PORT0
        if(request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 0 dma tr", NULL))
                panic("irq22");
        if(request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 0 dma rec", NULL))
                panic("irq23");
+#endif
 #ifdef SERIAL_HANDLE_EARLY_ERRORS
        if(request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_INTERRUPT, "serial ", NULL))
                panic("irq8");
index 21c7c72cb1c066ef9125ba69500fb5ad7f4b89d5..0b49ee2e6fbc12ee59ec210d12644326f913442c 100644 (file)
@@ -45,7 +45,11 @@ struct e100_serial {
        u8           rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
        u8           tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
        u8           iseteop; /* bit number for R_SET_EOP for the input dma */
+       int          enabled;    /* Set to 1 if the port is enabled in HW config */
+  
+  
 /* end of fields defined in rs_table[] in .c-file */
+       int          uses_dma; /* Set to 1 if DMA should be used */
        unsigned char           fifo_didmagic; /* a fifo eop has been forced */
 
        struct etrax_dma_descr tr_descr, rec_descr;
index 51d6f5e8ffd94a27ce6e90e9dc288380545436b1..19d87693170a15be38761f5d278eb87b59c8125a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2001 Axis Communications AB.
  *
- * $Id: usb-host.c,v 1.9 2001/05/09 12:54:12 johana Exp $
+ * $Id: usb-host.c,v 1.11 2001/09/26 11:52:16 bjornw Exp $
  *
  */
 
@@ -34,7 +34,7 @@
 #define ETRAX_USB_RX_IRQ USB_DMA_RX_IRQ_NBR
 #define ETRAX_USB_TX_IRQ USB_DMA_TX_IRQ_NBR
 
-static const char *usb_hcd_version = "$Revision: 1.9 $";
+static const char *usb_hcd_version = "$Revision: 1.11 $";
 
 #undef KERN_DEBUG
 #define KERN_DEBUG ""
@@ -792,6 +792,8 @@ static void etrax_usb_setup_epid(char epid, char devnum, char endpoint, char pac
        cli();
        
        if (test_bit(epid, (void *)&ep_usage_bitmask)) {
+               restore_flags(flags);
+
                warn("Trying to setup used epid %d", epid);
                DBFEXIT;
                return;
@@ -828,12 +830,16 @@ static void etrax_usb_free_epid(char epid)
 
        save_flags(flags);
        cli();
+
        *R_USB_EPT_INDEX = IO_FIELD(R_USB_EPT_INDEX, value, epid);
        nop();
-       while (*R_USB_EPT_DATA & IO_MASK(R_USB_EPT_DATA, hold))printk("+");
+       while (*R_USB_EPT_DATA & IO_MASK(R_USB_EPT_DATA, hold))
+               printk("+");
        *R_USB_EPT_DATA = 0;
        clear_bit(epid, (void *)&ep_usage_bitmask);
+
        restore_flags(flags);
+
        dbg_ep("epid: %d freed", epid);
        
        DBFEXIT;
@@ -861,6 +867,8 @@ static int etrax_usb_lookup_epid(unsigned char devnum, char endpoint, char slow,
                            (IO_EXTRACT(R_USB_EPT_DATA, ep, data) == endpoint) &&
                            (IO_EXTRACT(R_USB_EPT_DATA, low_speed, data) == slow) &&
                            (IO_EXTRACT(R_USB_EPT_DATA, max_len, data) == maxp)) {
+                               restore_flags(flags);
+       
                                dbg_ep("Found ep_id %d for devnum %d, endpoint %d",
                                       i, devnum, endpoint);
                                DBFEXIT;
@@ -1337,6 +1345,7 @@ static int etrax_usb_do_ctrl_hw_add(urb_t *urb, char epid, char maxlen)
        TxCtrlEPList[epid].sub = virt_to_phys(sb_desc_1);
        TxCtrlEPList[epid].hw_len = 0;
        TxCtrlEPList[epid].command |= IO_STATE(USB_EP_command, enable, yes);
+
        restore_flags(flags);
 
        dump_ep_desc(&TxCtrlEPList[epid]);
@@ -1775,8 +1784,10 @@ static void etrax_usb_hc_intr_bottom_half(void *data)
 
                save_flags(flags);
                cli();
+
                *R_USB_EPT_INDEX = IO_FIELD(R_USB_EPT_INDEX, value, epid); nop();
                r_usb_ept_data = *R_USB_EPT_DATA;
+
                restore_flags(flags);
 
                if (r_usb_ept_data & IO_MASK(R_USB_EPT_DATA, hold)) {
index 3c4dcc76507b081c69cea556df0f9693ab13deb2..4edd9cabfc38e28621071c3a4e9744fa7d2b7778 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.7 2001/07/05 01:11:48 hp Exp $
+# $Id: Makefile,v 1.8 2001/10/01 14:44:07 bjornw Exp $
 #
 # Makefile for the linux kernel.
 #
@@ -20,6 +20,7 @@ obj-y   := process.o signal.o entry.o traps.o irq.o \
            ptrace.o setup.o time.o sys_cris.o shadows.o \
           debugport.o semaphore.o
 
+obj-$(CONFIG_MODULES)    += ksyms.o
 obj-$(CONFIG_ETRAX_KGDB) += kgdb.o
 
 # This dependency isn't caught by mkdep.  See entry.S.
index 7237230c9cfe22dfd771801e4a2d19f3d524f9d2..69b27be3307bef6fe63909ed211e46bb00b3c03a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.31 2001/07/25 16:07:42 bjornw Exp $
+/* $Id: entry.S,v 1.34 2001/10/01 14:45:03 bjornw Exp $
  *
  *  linux/arch/cris/entry.S
  *
@@ -7,6 +7,15 @@
  *  Authors:   Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: entry.S,v $
+ *  Revision 1.34  2001/10/01 14:45:03  bjornw
+ *  Removed underscores and added register prefixes
+ *
+ *  Revision 1.33  2001/08/21 13:48:01  jonashg
+ *  Added fix by HP to avoid oops when doing a hard_reset_now.
+ *
+ *  Revision 1.32  2001/08/14 04:32:02  hp
+ *  In _resume, add comment why R9 is saved; don't sound like it's call-saved.
+ *
  *  Revision 1.31  2001/07/25 16:07:42  bjornw
  *  softirq_active/mask -> softirq_pending only
  *
        
        ;; functions exported from this file
        
-       .globl _system_call
-       .globl _ret_from_intr
-       .globl _ret_from_sys_call
-       .globl _resume
-       .globl _multiple_interrupt
-       .globl _hwbreakpoint
-       .globl _IRQ1_interrupt
-       .globl _timer_interrupt
-       .globl _timer_shortcut
-       .globl _spurious_interrupt
-       .globl _hw_bp_trigs
-       .globl _mmu_bus_fault
-       .globl _do_sigtrap
-       .globl _gdb_handle_breakpoint
+       .globl system_call
+       .globl ret_from_intr
+       .globl ret_from_sys_call
+       .globl resume
+       .globl multiple_interrupt
+       .globl hwbreakpoint
+       .globl IRQ1_interrupt
+       .globl timer_interrupt
+       .globl timer_shortcut
+       .globl spurious_interrupt
+       .globl hw_bp_trigs
+       .globl mmu_bus_fault
+       .globl do_sigtrap
+       .globl gdb_handle_breakpoint
                        
-       .globl _sys_call_table
+       .globl sys_call_table
        
        ;; Get values and offsets into various structs.  The file isn't
        ;; suitable for consumption by the preprocessor, so don't use
@@ -196,38 +205,38 @@ PT_TRACESYS_BIT     = 1
        
        ;; handle software irqs
                                
-handle_softirq:
-       move.d  r9,r1
-       jsr     _do_softirq             ; call the C routine for softirq handling
-       move.d  r1,r9
+_handle_softirq:
+       move.d  $r9, $r1
+       jsr     do_softirq      ; call the C routine for softirq handling
+       move.d  $r1, $r9
 
        ;; fall-through
        
-_ret_from_intr:
+ret_from_intr:
        ;; check for resched only if we're going back to user-mode
 
-       move    ccr, r0
-       btstq   8, r0           ; U-flag
-       bpl     Rexit           ; go back directly
+       move    $ccr, $r0
+       btstq   8, $r0          ; U-flag
+       bpl     _Rexit          ; go back directly
        nop
-       ba      ret_with_reschedule  ; go back but check schedule and signals first 
+       ba      _ret_with_reschedule  ; go back but check schedule and signals first 
        nop
 
-reschedule:
+_reschedule:
        ;; keep r9 intact
-       move.d  r9,r1
-       jsr     _schedule
-       ba      _ret_from_sys_call
-       move.d  r1,r9
+       move.d  $r9, $r1
+       jsr     schedule
+       ba      ret_from_sys_call
+       move.d  $r1, $r9
 
        ;; return but call do_signal first
-signal_return:
+_signal_return:
        ei                      ; we can get here from an interrupt
-       move.d  r9,r10          ; do_signals syscall/irq param
-       moveq   0,r11           ; oldset param - 0 in this case
-       move.d  sp,r12          ; another argument to do_signal (the regs param)
-       jsr     _do_signal      ; arch/cris/kernel/signal.c
-       ba      Rexit
+       move.d  $r9, $r10       ; do_signals syscall/irq param
+       moveq   0, $r11         ; oldset param - 0 in this case
+       move.d  $sp, $r12       ; another argument to do_signal (the regs param)
+       jsr     do_signal       ; arch/cris/kernel/signal.c
+       ba      _Rexit
        nop
        
        ;; The system_call is called by a BREAK instruction, which works like
@@ -246,112 +255,114 @@ signal_return:
        ;; really designed so that the fast-path does not force cache-loading of non-used
        ;; instructions. Only the non-common cases cause the outlined code to run..
 
-_system_call:
+system_call:
        ;; stack-frame similar to the irq heads, which is reversed in ret_from_sys_call
-       move    brp,[sp=sp-16]  ; instruction pointer and room for a fake SBFS frame
-       push    srp
-       push    dccr
-       push    mof
-       subq    14*4,sp         ; make room for r0-r13
-       movem   r13,[sp]        ; push r0-r13
-       push    r10             ; push orig_r10
-       clear.d [sp=sp-4]       ; frametype == 0, normal stackframe
+       move    $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
+       push    $srp
+       push    $dccr
+       push    $mof
+       subq    14*4, $sp               ; make room for r0-r13
+       movem   $r13, [$sp]     ; push r0-r13
+       push    $r10            ; push orig_r10
+       clear.d [$sp=$sp-4]     ; frametype == 0, normal stackframe
        
-       movs.w  -ENOSYS,r0
-       move.d  r0,[sp+LR10]    ; put the default return value in r10 in the frame
+       movs.w  -ENOSYS, $r0
+       move.d  $r0, [$sp+LR10] ; put the default return value in r10 in the frame
 
        ;; check if this process is syscall-traced
 
-       movs.w  -8192,r0        ; THREAD_SIZE == 8192
-       and.d   sp,r0
+       movs.w  -8192, $r0      ; THREAD_SIZE == 8192
+       and.d   $sp, $r0
        
-       move.d  [r0+LTASK_PTRACE],r0
-       btstq   PT_TRACESYS_BIT, r0
-       bmi     tracesys
+       move.d  [$r0+LTASK_PTRACE], $r0
+       btstq   PT_TRACESYS_BIT, $r0
+       bmi     _tracesys
        nop     
 
        ;; check for sanity in the requested syscall number
        
-       cmpu.w  NR_syscalls,r9  
-       bcc     _ret_from_sys_call
-       lslq    2,r9            ;  multiply by 4, in the delay slot
+       cmpu.w  NR_syscalls, $r9        
+       bcc     ret_from_sys_call
+       lslq    2, $r9          ;  multiply by 4, in the delay slot
 
        ;; as a bonus 7th parameter, we give the location on the stack
        ;; of the register structure itself. some syscalls need this.
 
-       push    sp
+       push    $sp
        
        ;; the parameter carrying registers r10, r11, r12 and 13 are intact.
        ;; the fifth and sixth parameters (if any) was in mof and srp 
        ;; respectively, and we need to put them on the stack.
 
-       push    srp
-       push    mof
+       push    $srp
+       push    $mof
        
-       jsr     [r9+_sys_call_table]    ; actually do the system call
-       addq    3*4,sp                  ; pop the mof, srp and regs parameters
-       move.d  r10,[sp+LR10]           ; save the return value
+       jsr     [$r9+sys_call_table]    ; actually do the system call
+       addq    3*4, $sp                ; pop the mof, srp and regs parameters
+       move.d  $r10, [$sp+LR10]        ; save the return value
 
-       moveq   1,r9            ; "parameter" to ret_from_sys_call to show it was a sys call
+       moveq   1, $r9          ; "parameter" to ret_from_sys_call to show it was a sys call
        
        ;; fall through into ret_from_sys_call to return
        
-_ret_from_sys_call:
+ret_from_sys_call:
        ;; r9 is a parameter - if 1, we came from a syscall, if 0, from an irq
                
        ;; check if any bottom halves need service
        
-       test.d  [_irq_stat]            ; softirq_pending
-       bne     handle_softirq
+       test.d  [irq_stat]             ; softirq_pending
+       bne     _handle_softirq
        nop
 
-ret_with_reschedule:
+_ret_with_reschedule:
        ;; first get the current task-struct pointer (see top for defs)
 
-       move.d  sp, r0
-       and.d   -8192, r0       ; THREAD_SIZE == 8192
+       move.d  $sp, $r0
+       and.d   -8192, $r0      ; THREAD_SIZE == 8192
        
        ;; see if we want to reschedule into another process
        
-       test.d  [r0+LTASK_NEEDRESCHED]
-       bne     reschedule
+       test.d  [$r0+LTASK_NEEDRESCHED]
+       bne     _reschedule
        nop
 
        ;; see if we need to run signal checks (important that r9 is intact here)
 
-       test.d  [r0+LTASK_SIGPENDING]
-       bne     signal_return
+       test.d  [$r0+LTASK_SIGPENDING]
+       bne     _signal_return
        nop
        
-Rexit:
+_Rexit:
        ;; this epilogue MUST match the prologues in multiple_interrupt, irq.h and ptregs.h
-       pop     r10             ; frametype
-       bne     RBFexit         ; was not CRIS_FRAME_NORMAL, handle otherwise
-       addq    4,sp            ; skip orig_r10, in delayslot
-       movem   [sp+],r13       ; registers r0-r13
-       pop     mof             ; multiply overflow register 
-       pop     dccr            ; condition codes
-       pop     srp             ; subroutine return pointer
+       pop     $r10            ; frametype
+       bne     _RBFexit        ; was not CRIS_FRAME_NORMAL, handle otherwise
+       addq    4, $sp          ; skip orig_r10, in delayslot
+       movem   [$sp+], $r13    ; registers r0-r13
+       pop     $mof            ; multiply overflow register 
+       pop     $dccr           ; condition codes
+       pop     $srp            ; subroutine return pointer
        ;; now we have a 4-word SBFS frame which we do not want to restore
        ;; using RBF since it was not stacked with SBFS. instead we would like to
        ;; just get the PC value to restart it with, and skip the rest of
        ;; the frame.
-       move    [sp=sp+16], p8  ; pop the SBFS frame from the sp
-       jmpu    [sp-16]         ; return through the irp field in the sbfs frame
-
-RBFexit:
-       movem   [sp+],r13       ; registers r0-r13, in delay slot
-       pop     mof             ; multiply overflow register 
-       pop     dccr            ; condition codes
-       pop     srp             ; subroutine return pointer
-       rbf     [sp+]           ; return by popping the CPU status
-
-tracesys:
+       ;; Also notice that it's important to use instructions here that
+       ;; keep the interrupts disabled (since we've already popped DCCR)
+       move    [$sp=$sp+16], $p8; pop the SBFS frame from the sp
+       jmpu    [$sp-16]        ; return through the irp field in the sbfs frame
+
+_RBFexit:
+       movem   [$sp+], $r13    ; registers r0-r13, in delay slot
+       pop     $mof            ; multiply overflow register 
+       pop     $dccr           ; condition codes
+       pop     $srp            ; subroutine return pointer
+       rbf     [$sp+]          ; return by popping the CPU status
+
+_tracesys:
        ;; this first invocation of syscall_trace _requires_ that
        ;; LR10 in the frame contains -ENOSYS (as is set in the beginning
        ;; of system_call).
 
-       jsr     _syscall_trace
+       jsr     syscall_trace
 
        ;; now we should more or less do the same things as in the system_call
        ;; but since our argument regs got clobbered during syscall_trace and
@@ -360,177 +371,188 @@ tracesys:
 
        ;; check for sanity in the requested syscall number
 
-       move.d  [sp+LR9], r9
-       movs.w  -ENOSYS, r10
-       cmpu.w  NR_syscalls,r9  
+       move.d  [$sp+LR9], $r9
+       movs.w  -ENOSYS, $r10
+       cmpu.w  NR_syscalls, $r9        
        bcc     1f
-       lslq    2,r9            ;  multiply by 4, in the delay slot
+       lslq    2, $r9          ;  multiply by 4, in the delay slot
 
        ;; read the system call vector entry into r9
        
-       move.d  [r9+_sys_call_table],r9
+       move.d  [$r9+sys_call_table], $r9
 
        ;; restore r10, r11, r12, r13, mof and srp into the needed registers
 
-       move.d  [sp+LORIG_R10], r10  ; LR10 is already filled with -ENOSYS.
-       move.d  [sp+LR11],      r11
-       move.d  [sp+LR12],      r12
-       move.d  [sp+LR13],      r13
-       move    [sp+LMOF],      mof
-       move    [sp+LSRP],      srp
+       move.d  [$sp+LORIG_R10], $r10  ; LR10 is already filled with -ENOSYS.
+       move.d  [$sp+LR11],      $r11
+       move.d  [$sp+LR12],      $r12
+       move.d  [$sp+LR13],      $r13
+       move    [$sp+LMOF],      $mof
+       move    [$sp+LSRP],      $srp
 
        ;; as a bonus 7th parameter, we give the location on the stack
        ;; of the register structure itself. some syscalls need this.
 
-       push    sp
+       push    $sp
        
        ;; the fifth and sixth parameters needs to be put on the stack for
        ;; the system call to find them
 
-       push    srp
-       push    mof
+       push    $srp
+       push    $mof
 
-       jsr     r9              ; actually call the system-call
-       addq    3*4,sp          ; pop the srp, mof and regs parameters
+       jsr     $r9             ; actually call the system-call
+       addq    3*4, $sp        ; pop the srp, mof and regs parameters
 
-1:     move.d  r10,[sp+LR10]   ; save the return value
+1:     move.d  $r10, [$sp+LR10]; save the return value
 
        ;; second call of syscall_trace, to let it grab the results
                
-       jsr     _syscall_trace
+       jsr     syscall_trace
 
-       moveq   1,r9            ; "parameter" to ret_from_sys_call to show it was a sys call
-       ba      _ret_from_sys_call
+       moveq   1, $r9          ; "parameter" to ret_from_sys_call to show it was a sys call
+       ba      ret_from_sys_call
        nop
                
-       ;; _resume performs the actual task-switching, by switching stack pointers
+       ;; resume performs the actual task-switching, by switching stack pointers
        ;; input arguments: r10 = prev, r11 = next, r12 = thread offset in task struct
        ;; returns old current in r10
        ;;
        ;; TODO:  see the i386 version. The switch_to which calls resume in our version
        ;;        could really be an inline asm of this.
 
-_resume:       
-       push    srp                      ; we keep the old/new PC on the stack 
-       add.d   r12, r10                 ; r10 = current tasks tss
-       move    dccr, [r10+LTHREAD_DCCR] ; save irq enable state
+resume:        
+       push    $srp                     ; we keep the old/new PC on the stack 
+       add.d   $r12, $r10               ; r10 = current tasks tss
+       move    $dccr, [$r10+LTHREAD_DCCR] ; save irq enable state
        di
 
-       move    usp, [r10+LTHREAD_USP]   ; save user-mode stackpointer
+       move    $usp, [$r10+LTHREAD_USP] ; save user-mode stackpointer
        
-       subq    10*4, sp
-       movem   r9, [sp]                 ; save non-scratch registers
+       ;; See copy_thread for the reason why register R9 is saved.
+       subq    10*4, $sp
+       movem   $r9, [$sp]               ; save non-scratch registers and R9.
        
-       move.d  sp, [r10+LTHREAD_KSP]    ; save the kernel stack pointer for the old task
-       move.d  sp, r10                  ; return last running task in r10
-       and.d   -8192, r10               ; get task ptr from stackpointer
-       add.d   r12, r11                 ; find the new tasks tss
-       move.d  [r11+LTHREAD_KSP], sp    ; switch into the new stackframe by restoring kernel sp
+       move.d  $sp, [$r10+LTHREAD_KSP]  ; save the kernel stack pointer for the old task
+       move.d  $sp, $r10                ; return last running task in r10
+       and.d   -8192, $r10              ; get task ptr from stackpointer
+       add.d   $r12, $r11               ; find the new tasks tss
+       move.d  [$r11+LTHREAD_KSP], $sp  ; switch into the new stackframe by restoring kernel sp
 
-       movem   [sp+], r9                ; restore non-scratch registers
+       movem   [$sp+], $r9              ; restore non-scratch registers and R9.
 
-       move    [r11+LTHREAD_USP], usp   ; restore user-mode stackpointer
+       move    [$r11+LTHREAD_USP], $usp ; restore user-mode stackpointer
        
-       move    [r11+LTHREAD_DCCR], dccr ; restore irq enable status
-       jump    [sp+]                    ; restore PC
+       move    [$r11+LTHREAD_DCCR], $dccr ; restore irq enable status
+       jump    [$sp+]                   ; restore PC
 
        ;; This is the MMU bus fault handler.
        ;; It needs to stack the CPU status and overall is different
        ;; from the other interrupt handlers.
 
-_mmu_bus_fault:        
-       sbfs    [sp=sp-16]      ; push the internal CPU status
+mmu_bus_fault: 
+       sbfs    [$sp=$sp-16]    ; push the internal CPU status
        ;; the first longword in the sbfs frame was the interrupted PC
        ;; which fits nicely with the "IRP" slot in pt_regs normally used to
        ;; contain the return address. used by Oops to print kernel errors..
-       push    srp             ; make a stackframe similar to pt_regs
-       push    dccr
-       push    mof
+       push    $srp            ; make a stackframe similar to pt_regs
+       push    $dccr
+       push    $mof
        di
-       subq    14*4, sp
-       movem   r13, [sp]
-       push    r10             ; dummy orig_r10
-       moveq   1, r10
-       push    r10             ; frametype == 1, BUSFAULT frame type
+       subq    14*4, $sp
+       movem   $r13, [$sp]
+       push    $r10            ; dummy orig_r10
+       moveq   1, $r10
+       push    $r10            ; frametype == 1, BUSFAULT frame type
 
-       moveq   0, r9           ; busfault is equivalent to an irq
+       moveq   0, $r9          ; busfault is equivalent to an irq
                
-       move.d  sp, r10         ; pt_regs argument to handle_mmu_bus_fault
+       move.d  $sp, $r10       ; pt_regs argument to handle_mmu_bus_fault
                
-       jsr     _handle_mmu_bus_fault  ; in arch/cris/mm/fault.c
+       jsr     handle_mmu_bus_fault  ; in arch/cris/mm/fault.c
 
        ;; now we need to return through the normal path, we cannot just
        ;; do the RBFexit since we might have killed off the running
        ;; process due to a SEGV, scheduled due to a page blocking or
        ;; whatever.
 
-       ba      _ret_from_intr
+       ba      ret_from_intr
        nop
                
        ;; special handlers for breakpoint and NMI
 #if 0                  
-_hwbreakpoint:
-       push    dccr
+hwbreakpoint:
+       push    $dccr
        di
-       push    r10
-       push    r11
-       push    r12
-       push    r13
+       push    $r10
+       push    $r11
+       push    $r12
+       push    $r13
        clearf  b
-       move    brp,r11
-       move.d  [_hw_bp_msg],r10
-       jsr     _printk
+       move    $brp,$r11
+       move.d  [hw_bp_msg],$r10
+       jsr     printk
        setf    b
-       pop     r13
-       pop     r12
-       pop     r11
-       pop     r10
-       pop     dccr
+       pop     $r13
+       pop     $r12
+       pop     $r11
+       pop     $r10
+       pop     $dccr
        retb
        nop
 #else
-_hwbreakpoint:
-       push    dccr
+hwbreakpoint:
+       push    $dccr
        di
 #if 1
-       push    r10
-       push    r11
-       move.d  [_hw_bp_trig_ptr],r10
-       move.d  [r10],r11
-       cmp.d   42,r11
-       beq     nobp
+       push    $r10
+       push    $r11
+       move.d  [hw_bp_trig_ptr],$r10
+       move.d  [$r10],$r11
+       cmp.d   42,$r11
+       beq     1f
        nop
-       move    brp,r11
-       move.d  r11,[r10+]
-       move.d  r10,[_hw_bp_trig_ptr]
-nobp:  pop     r11
-       pop     r10
+       move    $brp,$r11
+       move.d  $r11,[$r10+]
+       move.d  $r10,[hw_bp_trig_ptr]
+1:     pop     $r11
+       pop     $r10
 #endif
-       pop     dccr
+       pop     $dccr
        retb
        nop
 #endif
        
-_IRQ1_interrupt:
+IRQ1_interrupt:
 
 #if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
 ;; If we receive a watchdog interrupt while it is not expected, then set
 ;; up a canonical frame and dump register contents before dying.
 
        ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
-       move    brp,[sp=sp-16]  ; instruction pointer and room for a fake SBFS frame
-       push    srp
-       push    dccr
-       push    mof
+       move    $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
+       push    $srp
+       push    $dccr
+       push    $mof
        di
-       subq    14*4,sp
-       movem   r13,[sp]
-       push    r10             ; push orig_r10
-       clear.d [sp=sp-4]       ; frametype == 0, normal frame
+       subq    14*4, $sp
+       movem   $r13, [$sp]
+       push    $r10            ; push orig_r10
+       clear.d [$sp=$sp-4]     ; frametype == 0, normal frame
 
 ;; We don't check that we actually were bit by the watchdog as opposed to
 ;; an external NMI, since there is currently no handler for external NMI.
 
+;; Check if we're waiting for reset to happen, as signalled by
+;; hard_reset_now setting cause_of_death to a magic value.  If so, just
+;; get stuck until reset happens.
+       .comm   cause_of_death, 4       ;; Don't declare this anywhere.
+       move.d  [cause_of_death], $r10
+       cmp.d   0xbedead, $r10
+_killed_by_death:
+       beq     _killed_by_death
+       nop
+
 ;; We'll see this in ksymoops dumps.
 Watchdog_bite:
 
@@ -540,134 +562,134 @@ Watchdog_bite:
 ;; Change the watchdog key to an arbitrary 3-bit value and restart the
 ;; watchdog.
 #define WD_INIT 2
-       moveq     IO_FIELD (R_WATCHDOG, key, WD_INIT), r10
-       move.d  R_WATCHDOG, r11
+       moveq     IO_FIELD (R_WATCHDOG, key, WD_INIT), $r10
+       move.d  R_WATCHDOG, $r11
 
-       move.d  r10,[r11]
+       move.d  $r10, [$r11]
        moveq     IO_FIELD (R_WATCHDOG, key,                            \
                            IO_EXTRACT (R_WATCHDOG, key,                \
                                        IO_MASK (R_WATCHDOG, key))      \
                            ^ WD_INIT)                                  \
-               | IO_STATE (R_WATCHDOG, enable, start),r10
-       move.d  r10,[r11]
+               | IO_STATE (R_WATCHDOG, enable, start), $r10
+       move.d  $r10, [$r11]
 
 ;; Note that we don't do "setf m" here (or after two necessary NOPs),
 ;; since *not* doing that saves us from re-entrancy checks.  We don't want
 ;; to get here again due to possible subsequent NMIs; we want the watchdog
 ;; to reset us.
 
-       move.d  watchdogmsg,r10
-       jsr     _printk
+       move.d  _watchdogmsg,$r10
+       jsr     printk
 
-       move.d  sp,r10
-       jsr     _show_registers
+       move.d  $sp, $r10
+       jsr     show_registers
 
 ;; This nop is here so we see the "Watchdog_bite" label in ksymoops dumps
-;; rather than "_spurious_interrupt".
+;; rather than "spurious_interrupt".
        nop
-;; At this point we drop down into _spurious_interrupt, which will do a
+;; At this point we drop down into spurious_interrupt, which will do a
 ;; hard reset.
 
        .section .rodata,"a"
-watchdogmsg:
+_watchdogmsg:
        .ascii  "Oops: bitten by watchdog\n\0"
        .previous
 
 #endif /* CONFIG_ETRAX_WATCHDOG and not CONFIG_SVINTO_SIM */
 
-_spurious_interrupt:   
+spurious_interrupt:    
        di
-       jump _hard_reset_now
+       jump hard_reset_now
 
        ;; this handles the case when multiple interrupts arrive at the same time
        ;; we jump to the first set interrupt bit in a priority fashion
        ;; the hardware will call the unserved interrupts after the handler finishes
        
-_multiple_interrupt:
+multiple_interrupt:
        ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
-       move    irp,[sp=sp-16]  ; instruction pointer and room for a fake SBFS frame
-       push    srp
-       push    dccr
-       push    mof
+       move    $irp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
+       push    $srp
+       push    $dccr
+       push    $mof
        di
-       subq    14*4,sp
-       movem   r13,[sp]
-       push    r10             ; push orig_r10
-       clear.d [sp=sp-4]       ; frametype == 0, normal frame
+       subq    14*4, $sp
+       movem   $r13, [$sp]
+       push    $r10            ; push orig_r10
+       clear.d [$sp=$sp-4]     ; frametype == 0, normal frame
        
-       move.d  _irq_shortcuts + 8,r1
-       moveq   2,r2            ; first bit we care about is the timer0 irq
-       move.d  [R_VECT_MASK_RD],r0     ; read the irq bits that triggered the multiple irq
-multloop:      
-       btst    r2,r0           ; check for the irq given by bit r2
-       bmi     do_shortcut     ; actually do the shortcut
+       move.d  irq_shortcuts + 8, $r1
+       moveq   2, $r2          ; first bit we care about is the timer0 irq
+       move.d  [R_VECT_MASK_RD], $r0; read the irq bits that triggered the multiple irq
+1:     
+       btst    $r2, $r0        ; check for the irq given by bit r2
+       bmi     _do_shortcut    ; actually do the shortcut
        nop
-       addq    1,r2            ; next vector bit
-       addq    4,r1            ; next vector
-       cmp.b   32,r2
-       bne     multloop        ; process all irq's up to and including number 31
+       addq    1, $r2          ; next vector bit
+       addq    4, $r1          ; next vector
+       cmp.b   32, $r2
+       bne     1b      ; process all irq's up to and including number 31
        nop
        
        ;; strange, we didn't get any set vector bits.. oh well, just return
        
-       ba      Rexit
+       ba      _Rexit
        nop
 
-do_shortcut:
-       test.d  [r1]
-       beq     Rexit
+_do_shortcut:
+       test.d  [$r1]
+       beq     _Rexit
        nop
-       jump    [r1]            ; jump to the irq handlers shortcut
+       jump    [$r1]           ; jump to the irq handlers shortcut
 
-_do_sigtrap:
+do_sigtrap:
        ;; 
        ;; SIGTRAP the process that executed the break instruction.
        ;; Make a frame that Rexit in entry.S expects.
        ;;
-       move    brp,[sp=sp-16]          ; Push BRP while faking a cpu status record.
-       push    srp                     ; Push subroutine return pointer.
-       push    dccr                    ; Push condition codes.
-       push    mof                     ; Push multiply overflow reg.
+       move    $brp, [$sp=$sp-16]      ; Push BRP while faking a cpu status record.
+       push    $srp                    ; Push subroutine return pointer.
+       push    $dccr                   ; Push condition codes.
+       push    $mof                    ; Push multiply overflow reg.
        di                              ; Need to disable irq's at this point.
-       subq    14*4,sp                 ; Make room for r0-r13.
-       movem   r13,[sp]                ; Push the r0-r13 registers.
-       push    r10                     ; Push orig_r10.
-       clear.d [sp=sp-4]               ; Frametype - this is a normal stackframe.
-
-       movs.w  -8192,r9                ; THREAD_SIZE == 8192
-       and.d   sp,r9
-       move.d  [r9+LTASK_PID],r10      ; current->pid as arg1.
-       moveq   5,r11                   ; SIGTRAP as arg2.
-       jsr     _sys_kill       
-       jump    _ret_from_intr          ; Use the return routine for interrupts.
-
-_gdb_handle_breakpoint:        
-       push    dccr
-       push    r0
+       subq    14*4, $sp               ; Make room for r0-r13.
+       movem   $r13, [$sp]             ; Push the r0-r13 registers.
+       push    $r10                    ; Push orig_r10.
+       clear.d [$sp=$sp-4]             ; Frametype - this is a normal stackframe.
+
+       movs.w  -8192,$r9               ; THREAD_SIZE == 8192
+       and.d   $sp, $r9
+       move.d  [$r9+LTASK_PID], $r10   ; current->pid as arg1.
+       moveq   5, $r11                 ; SIGTRAP as arg2.
+       jsr     sys_kill       
+       jump    ret_from_intr           ; Use the return routine for interrupts.
+
+gdb_handle_breakpoint: 
+       push    $dccr
+       push    $r0
 #ifdef CONFIG_ETRAX_KGDB
-       move    dccr,r0                 ; U-flag not affected by previous insns. 
-       btstq   8,r0                    ; Test the U-flag.
+       move    $dccr, $r0              ; U-flag not affected by previous insns. 
+       btstq   8, $r0                  ; Test the U-flag.
        bmi     _ugdb_handle_breakpoint ; Go to user mode debugging. 
        nop                             ; Empty delay slot (cannot pop r0 here). 
-       pop     r0                      ; Restore r0.
-       ba      _kgdb_handle_breakpoint ; Go to kernel debugging. 
-       pop     dccr                    ; Restore dccr in delay slot.
+       pop     $r0                     ; Restore r0.
+       ba      kgdb_handle_breakpoint  ; Go to kernel debugging. 
+       pop     $dccr                   ; Restore dccr in delay slot.
 #endif
        
 _ugdb_handle_breakpoint:       
-       move    brp,r0                  ; Use r0 temporarily for calculation.
-       subq    2,r0                    ; Set to address of previous instruction.
-       move    r0,brp
-       pop     r0                      ; Restore r0. 
-       ba      _do_sigtrap             ; SIGTRAP the offending process. 
-       pop     dccr                    ; Restore dccr in delay slot.
+       move    $brp, $r0               ; Use r0 temporarily for calculation.
+       subq    2, $r0                  ; Set to address of previous instruction.
+       move    $r0, $brp
+       pop     $r0                     ; Restore r0. 
+       ba      do_sigtrap              ; SIGTRAP the offending process. 
+       pop     $dccr                   ; Restore dccr in delay slot.
        
        .data
 
-_hw_bp_trigs:
+hw_bp_trigs:
        .space 64*4
-_hw_bp_trig_ptr:
-       .dword _hw_bp_trigs
+hw_bp_trig_ptr:
+       .dword hw_bp_trigs
 
 /*
  * This is the mechanism for creating a new kernel thread.
@@ -686,47 +708,47 @@ _hw_bp_trig_ptr:
 /*                   r10                r11         r12  */
 
        .text
-       .global _kernel_thread
-_kernel_thread:
+       .global kernel_thread
+kernel_thread:
 
        /* Save ARG for later.  */
-       move.d r11,r13
+       move.d $r11, $r13
 
        /* r11 is argument 2 to clone, the flags */
-       move.d r12,r11
-       or.w    LCLONE_VM,r11
+       move.d  $r12, $r11
+       or.w    LCLONE_VM, $r11
 
        /* Save FN for later.  */
-       move.d  r10,r12
+       move.d  $r10, $r12
 
        /* r9 contains syscall number, to sys_clone */
-       movu.w  __NR_clone,r9
+       movu.w  __NR_clone, $r9
 
        /* r10 is argument 1 to clone */
-       clear.d r10
+       clear.d $r10
        
        /* call sys_clone, this will fork */
        break   13
 
        /* parent or child? child returns 0 here. */
-       test.d  r10
+       test.d  $r10
 
        /* jump if parent */
        bne     1f
        nop              /* delay slot */
 
        /* set argument to function to call */
-       move.d  r13,r10
+       move.d  $r13, $r10
 
        /* call specified function */
-       jsr     r12
+       jsr     $r12
        /* If we ever return from the function, something bad has happened.  */
 
        /* r9 is sys_exit syscall number */
-       movu.w  __NR_exit,r9
+       movu.w  __NR_exit, $r9
 
        /* Give a really bad exit-value */
-       moveq   -1,r10
+       moveq   -1, $r10
 
        /* call sys_exit, killing the child */
        break   13
@@ -734,16 +756,8 @@ _kernel_thread:
        ret
        nop              /* delay slot */
 
-
-/* The file include/linux/linkage.h is wrong for compiling the
-   Linux/CRIS kernel.  We currently have C symbols in the kernel (only
-   the kernel) prefixed with _, hence, we need to redefine SYMBOL_NAME.  */
-
-#undef SYMBOL_NAME
-#define SYMBOL_NAME(X) _##X
-
        .section .rodata,"a"
-_sys_call_table:       
+sys_call_table:        
        .long SYMBOL_NAME(sys_ni_syscall)       /* 0  -  old "setup()" system call*/
        .long SYMBOL_NAME(sys_exit)
        .long SYMBOL_NAME(sys_fork)
index 39ae0bb8a2bbbccee18b543b5c9edc09027ba1f6..b98df4a8a1bd0fb7968187a3b71c5d2817a3a565 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.36 2001/06/29 12:39:31 pkj Exp $
+/* $Id: head.S,v 1.40 2001/10/03 14:59:57 pkj Exp $
  * 
  * Head of the kernel - alter with care
  *
@@ -7,6 +7,18 @@
  * Authors:    Bjorn Wesen (bjornw@axis.com)
  * 
  * $Log: head.S,v $
+ * Revision 1.40  2001/10/03 14:59:57  pkj
+ * Added support for resetting the Bluetooth hardware.
+ *
+ * Revision 1.39  2001/10/01 14:45:03  bjornw
+ * Removed underscores and added register prefixes
+ *
+ * Revision 1.38  2001/09/21 07:14:11  jonashg
+ * Made root filesystem (cramfs) use mtdblock driver when booting from flash.
+ *
+ * Revision 1.37  2001/09/11 13:44:29  orjanf
+ * Decouple usage of serial ports for debug and kgdb.
+ *
  * Revision 1.36  2001/06/29 12:39:31  pkj
  * Added support for mirroring the first flash to just below the
  * second one, to make them look consecutive to cramfs.
                
        ;; exported symbols
                
-       .globl  _etrax_irv
-       .globl  _romfs_start
-       .globl  _romfs_length
-       .globl  _romfs_in_flash
-       .globl  _swapper_pg_dir
+       .globl  etrax_irv
+       .globl  romfs_start
+       .globl  romfs_length
+       .globl  romfs_in_flash
+       .globl  swapper_pg_dir
                                        
        .text
 
        move.d    IO_FIELD (R_MMU_KBASE_HI, base_c, 4)          \
                | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb)        \
                | IO_FIELD (R_MMU_KBASE_HI, base_9, 9)          \
-               | IO_FIELD (R_MMU_KBASE_HI, base_8, 8), r0
-       move.d  r0, [R_MMU_KBASE_HI]
+               | IO_FIELD (R_MMU_KBASE_HI, base_8, 8), $r0
+       move.d  $r0, [R_MMU_KBASE_HI]
 
        ; temporary map of 0x40->0x40 and 0x60->0x40 
        move.d    IO_FIELD (R_MMU_KBASE_LO, base_6, 4)          \
-               | IO_FIELD (R_MMU_KBASE_LO, base_4, 4), r0
-       move.d  r0, [R_MMU_KBASE_LO]
+               | IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0
+       move.d  $r0, [R_MMU_KBASE_LO]
 
        ; mmu enable, segs e,c,b,a,6,5,4,0 segment mapped
        move.d    IO_STATE (R_MMU_CONFIG, mmu_enable, enable)   \
                | IO_STATE (R_MMU_CONFIG, seg_3, page)          \
                | IO_STATE (R_MMU_CONFIG, seg_2, page)          \
                | IO_STATE (R_MMU_CONFIG, seg_1, page)          \
-               | IO_STATE (R_MMU_CONFIG, seg_0, seg), r0
-       move.d  r0, [R_MMU_CONFIG]
+               | IO_STATE (R_MMU_CONFIG, seg_0, seg), $r0
+       move.d  $r0, [R_MMU_CONFIG]
 #else
        ; kseg mappings
        move.d    IO_FIELD (R_MMU_KBASE_HI, base_e, 8)          \
                | IO_FIELD (R_MMU_KBASE_HI, base_c, 4)          \
-               | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb), r0
-       move.d  r0, [R_MMU_KBASE_HI]
+               | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb), $r0
+       move.d  $r0, [R_MMU_KBASE_HI]
 
        ; temporary map of 0x40->0x40 and 0x00->0x00 
-       move.d    IO_FIELD (R_MMU_KBASE_LO, base_4, 4), r0
-       move.d  r0, [R_MMU_KBASE_LO]
+       move.d    IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0
+       move.d  $r0, [R_MMU_KBASE_LO]
 
        ; mmu enable, segs f,e,c,b,4,0 segment mapped
        move.d    IO_STATE (R_MMU_CONFIG, mmu_enable, enable)   \
                | IO_STATE (R_MMU_CONFIG, seg_3, page)          \
                | IO_STATE (R_MMU_CONFIG, seg_2, page)          \
                | IO_STATE (R_MMU_CONFIG, seg_1, page)          \
-               | IO_STATE (R_MMU_CONFIG, seg_0, seg), r0
-       move.d  r0, [R_MMU_CONFIG]
+               | IO_STATE (R_MMU_CONFIG, seg_0, seg), $r0
+       move.d  $r0, [R_MMU_CONFIG]
 #endif
 
        ;; Now we need to sort out the segments and their locations in RAM or
        
        ;; Check if we start from DRAM or FLASH by testing PC
        
-       move.d  pc,r0
-       and.d   0x7fffffff,r0   ; get rid of the non-cache bit
-       cmp.d   0x10000,r0      ; arbitrary... just something above this code
-       blo     inflash0
+       move.d  $pc,$r0
+       and.d   0x7fffffff,$r0  ; get rid of the non-cache bit
+       cmp.d   0x10000,$r0     ; arbitrary... just something above this code
+       blo     _inflash0
        nop
 
-       jump    inram           ; enter cached ram
+       jump    _inram          ; enter cached ram
 
        ;; Jumpgate for branches.
-inflash0:
-       jump    inflash
+_inflash0:
+       jump    _inflash
 
        ;; Put this in a suitable section where we can reclaim storage
        ;; after init.
        .section ".text.init"
-inflash:
+_inflash:
        ;; We need to initialze DRAM registers before we start using the DRAM
 
-       cmp.d   RAM_INIT_MAGIC, r8      ; Already initialized?
-       beq     dram_init_finished
+       cmp.d   RAM_INIT_MAGIC, $r8     ; Already initialized?
+       beq     _dram_init_finished
        nop
        
 #include "../lib/dram_init.S"
 
-dram_init_finished:            
+_dram_init_finished:           
        ;; Copy text+data to DRAM
        ;; This is fragile - the calculation of r4 as the image size depends
        ;; on that the labels below actually are the first and last positions
@@ -307,14 +319,14 @@ dram_init_finished:
        ;; and when run with compression, the kernel is actually unpacked to
        ;; DRAM and we never get here in the first place :))
        
-       moveq   0, r0                   ; source
-       move.d  _text_start, r1         ; destination
-       move.d  __vmlinux_end, r2       ; end destination
-       move.d  r2, r4
-       sub.d   r1, r4                  ; r4=__vmlinux_end in flash, used below
-1:     move.w  [r0+], r3
-       move.w  r3, [r1+]
-       cmp.d   r2, r1
+       moveq   0, $r0                  ; source
+       move.d  text_start, $r1         ; destination
+       move.d  __vmlinux_end, $r2      ; end destination
+       move.d  $r2, $r4
+       sub.d   $r1, $r4                ; r4=__vmlinux_end in flash, used below
+1:     move.w  [$r0+], $r3
+       move.w  $r3, [$r1+]
+       cmp.d   $r2, $r1
        blo     1b
        nop
 
@@ -322,33 +334,33 @@ dram_init_finished:
        ;; There might be none, but that does not matter because
        ;; we don't do anything than read some bytes here.
 
-       moveq   0, r0
-       move.d  r0, [_romfs_length] ; default if there is no cramfs
+       moveq   0, $r0
+       move.d  $r0, [romfs_length] ; default if there is no cramfs
 
-       move.d  [r4], r0        ; cramfs_super.magic
-       cmp.d   CRAMFS_MAGIC, r0
+       move.d  [$r4], $r0      ; cramfs_super.magic
+       cmp.d   CRAMFS_MAGIC, $r0
        bne     1f
        nop
-       move.d  [r4 + 4], r0    ; cramfs_super.size
-       move.d  r0, [_romfs_length]
+       move.d  [$r4 + 4], $r0  ; cramfs_super.size
+       move.d  $r0, [romfs_length]
 #ifdef CONFIG_CRIS_LOW_MAP
-       add.d   0x50000000, r4  ; add flash start in virtual memory (cached)
+       add.d   0x50000000, $r4 ; add flash start in virtual memory (cached)
 #else
-       add.d   0xf0000000, r4  ; add flash start in virtual memory (cached)
+       add.d   0xf0000000, $r4 ; add flash start in virtual memory (cached)
 #endif
-       move.d  r4, [_romfs_start]
+       move.d  $r4, [romfs_start]
 1:     
-       moveq   1, r0
-       move.d  r0, [_romfs_in_flash]
+       moveq   1, $r0
+       move.d  $r0, [romfs_in_flash]
                
-       jump    start_it        ; enter code, cached this time
+       jump    _start_it       ; enter code, cached this time
 
-inram:
+_inram:
        ;; Move the ROM fs to after BSS end. This assumes that the cramfs
        ;; second longword contains the length of the cramfs
        
-       moveq   0, r0
-       move.d  r0, [_romfs_length] ; default if there is no cramfs
+       moveq   0, $r0
+       move.d  $r0, [romfs_length] ; default if there is no cramfs
        
        ;; The kernel could have been unpacked to DRAM by the loader, but
        ;; the cramfs image could still be in the Flash directly after the
@@ -360,120 +372,117 @@ inram:
        ;;  garbage but we do sanity checks on it, the chance that it points
        ;;  to a cramfs magic is small.. )
        
-       cmp.d   0x0ffffff8, r9
-       bhs     no_romfs_in_flash       ; r9 points outside the flash area
+       cmp.d   0x0ffffff8, $r9
+       bhs     _no_romfs_in_flash      ; r9 points outside the flash area
        nop
-       move.d  [r9], r0        ; cramfs_super.magic
-       cmp.d   CRAMFS_MAGIC, r0
-       bne     no_romfs_in_flash
+       move.d  [$r9], $r0      ; cramfs_super.magic
+       cmp.d   CRAMFS_MAGIC, $r0
+       bne     _no_romfs_in_flash
        nop
-       move.d  [r9+4], r0      ; cramfs_super.length
-       move.d  r0, [_romfs_length]
+       move.d  [$r9+4], $r0    ; cramfs_super.length
+       move.d  $r0, [romfs_length]
 #ifdef CONFIG_CRIS_LOW_MAP
-       add.d   0x50000000, r9  ; add flash start in virtual memory (cached)
+       add.d   0x50000000, $r9 ; add flash start in virtual memory (cached)
 #else
-       add.d   0xf0000000, r9  ; add flash start in virtual memory (cached)
+       add.d   0xf0000000, $r9 ; add flash start in virtual memory (cached)
 #endif
-#ifdef CONFIG_ETRAX_FLASH_MIRRORING_FOR_CRAMFS
-       add.d   MEM_CSE1_START-CONFIG_ETRAX_FLASH_SIZE*0x100000, r9   ; move flash start to upper mirror
-#endif
-       move.d  r9, [_romfs_start]
+       move.d  $r9, [romfs_start]
 
-       moveq   1, r0
-       move.d  r0, [_romfs_in_flash]
+       moveq   1, $r0
+       move.d  $r0, [romfs_in_flash]
        
-       jump    start_it        ; enter code, cached this time
+       jump    _start_it       ; enter code, cached this time
 
-no_romfs_in_flash:
+_no_romfs_in_flash:
        ;; Check if there is a cramfs (magic value).
        ;; Notice that we check for cramfs magic value - which is
        ;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does
        ;; not need this mechanism anyway)
        
-       move.d  __vmlinux_end, r0 ; the image will be after the vmlinux end address
-       move.d  [r0], r1        ; cramfs assumes same endian on host/target
-       cmp.d   CRAMFS_MAGIC, r1; magic value in cramfs superblock
+       move.d  __vmlinux_end, $r0; the image will be after the vmlinux end address
+       move.d  [$r0], $r1      ; cramfs assumes same endian on host/target
+       cmp.d   CRAMFS_MAGIC, $r1; magic value in cramfs superblock
        bne     1f
        nop
 
        ;; Ok. What is its size ? 
        
-       move.d  [r0 + 4], r2    ; cramfs_super.size (again, no need to swapwb)
+       move.d  [$r0 + 4], $r2  ; cramfs_super.size (again, no need to swapwb)
 
        ;; We want to copy it to the end of the BSS
 
-       move.d  _end, r1
+       move.d  _end, $r1
 
        ;; Remember values so cramfs and setup can find this info
 
-       move.d  r1, [_romfs_start]      ; new romfs location
-       move.d  r2, [_romfs_length]
+       move.d  $r1, [romfs_start]      ; new romfs location
+       move.d  $r2, [romfs_length]
 
        ;; We need to copy it backwards, since they can be overlapping
 
-       add.d   r2, r0
-       add.d   r2, r1
+       add.d   $r2, $r0
+       add.d   $r2, $r1
                
        ;; Go ahead. Make my loop.
 
-       lsrq    1, r2           ; size is in bytes, we copy words
+       lsrq    1, $r2          ; size is in bytes, we copy words
 
-1:     move.w  [r0=r0-2],r3
-       move.w  r3,[r1=r1-2]
-       subq    1, r2
+1:     move.w  [$r0=$r0-2],$r3
+       move.w  $r3,[$r1=$r1-2]
+       subq    1, $r2
        bne     1b
        nop
        
        ;; Dont worry that the BSS is tainted. It will be cleared later.
 
-       moveq   0, r0
-       move.d  r0, [_romfs_in_flash]
+       moveq   0, $r0
+       move.d  $r0, [romfs_in_flash]
 
-       jump    start_it        ; better skip the additional cramfs check below
+       jump    _start_it       ; better skip the additional cramfs check below
        
-start_it:
+_start_it:
        ;; the kernel stack is overlayed with the task structure for each
        ;; task. thus the initial kernel stack is in the same page as the
        ;; init_task (but starts in the top of the page, size 8192)
-       move.d  _init_task_union + 8192,sp
-       move.d  _ibr_start,r0   ; this symbol is set by the linker script 
-       move    r0,ibr
-       move.d  r0,[_etrax_irv] ; set the interrupt base register and pointer
+       move.d  init_task_union + 8192, $sp
+       move.d  ibr_start,$r0   ; this symbol is set by the linker script 
+       move    $r0,$ibr
+       move.d  $r0,[etrax_irv] ; set the interrupt base register and pointer
 
        ;; Clear BSS region, from _bss_start to _end
 
-       move.d  __bss_start, r0
-       move.d  _end, r1
-1:     clear.d [r0+]
-       cmp.d   r1, r0
+       move.d  __bss_start, $r0
+       move.d  _end, $r1
+1:     clear.d [$r0+]
+       cmp.d   $r1, $r0
        blo     1b
        nop
        
 #ifdef CONFIG_BLK_DEV_ETRAXIDE
        ;; disable ATA before enabling it in genconfig below
-       moveq   0,r0
-       move.d  r0,[R_ATA_CTRL_DATA]
-       move.d  r0,[R_ATA_TRANSFER_CNT]
-       move.d  r0,[R_ATA_CONFIG]
+       moveq   0,$r0
+       move.d  $r0,[R_ATA_CTRL_DATA]
+       move.d  $r0,[R_ATA_TRANSFER_CNT]
+       move.d  $r0,[R_ATA_CONFIG]
 #if 0
-       move.d  R_PORT_G_DATA,r1
-       move.d  r0,[r1]; assert ATA bus-reset
+       move.d  R_PORT_G_DATA, $r1
+       move.d  $r0, [$r1]; assert ATA bus-reset
        nop
        nop
        nop
        nop
        nop
        nop
-       move.d  0x08000000,r0
-       move.d  r0,[r1]
+       move.d  0x08000000,$r0
+       move.d  $r0,[$r1]
 #endif
 #endif
 
 #ifdef CONFIG_JULIETTE
        ;; configure external DMA channel 0 before enabling it in genconfig
        
-       moveq   0,r0
-       move.d  r0,[R_EXT_DMA_0_ADDR]
+       moveq   0,$r0
+       move.d  $r0,[R_EXT_DMA_0_ADDR]
        ; cnt enable, word size, output, stop, size 0
        move.d    IO_STATE (R_EXT_DMA_0_CMD, cnt, enable)       \
                | IO_STATE (R_EXT_DMA_0_CMD, rqpol, ahigh)      \
@@ -482,168 +491,216 @@ start_it:
                | IO_STATE (R_EXT_DMA_0_CMD, wid, word)         \
                | IO_STATE (R_EXT_DMA_0_CMD, dir, output)       \
                | IO_STATE (R_EXT_DMA_0_CMD, run, stop)         \
-               | IO_FIELD (R_EXT_DMA_0_CMD, trf_count, 0),r0
-       move.d  r0,[R_EXT_DMA_0_CMD]
+               | IO_FIELD (R_EXT_DMA_0_CMD, trf_count, 0),$r0
+       move.d  $r0,[R_EXT_DMA_0_CMD]
 
        ;; reset dma4 and wait for completion
        
-       moveq   IO_STATE (R_DMA_CH4_CMD, cmd, reset),r0
-       move.b  r0,[R_DMA_CH4_CMD]
-w4u:   move.b  [R_DMA_CH4_CMD],r0
-       and.b   IO_MASK (R_DMA_CH4_CMD, cmd),r0
-       cmp.b   IO_STATE (R_DMA_CH4_CMD, cmd, reset),r0
-       beq     w4u
+       moveq   IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0
+       move.b  $r0,[R_DMA_CH4_CMD]
+1:     move.b  [R_DMA_CH4_CMD],$r0
+       and.b   IO_MASK (R_DMA_CH4_CMD, cmd),$r0
+       cmp.b   IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0
+       beq     1b
        nop
 
        ;; reset dma5 and wait for completion
        
-       moveq   IO_STATE (R_DMA_CH5_CMD, cmd, reset),r0
-       move.b  r0,[R_DMA_CH5_CMD]
-w5u:   move.b  [R_DMA_CH5_CMD],r0
-       and.b   IO_MASK (R_DMA_CH5_CMD, cmd),r0
-       cmp.b   IO_STATE (R_DMA_CH5_CMD, cmd, reset),r0
-       beq     w5u
+       moveq   IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0
+       move.b  $r0,[R_DMA_CH5_CMD]
+1:     move.b  [R_DMA_CH5_CMD],$r0
+       and.b   IO_MASK (R_DMA_CH5_CMD, cmd),$r0
+       cmp.b   IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0
+       beq     1b
        nop
 #endif 
                        
        ;; Etrax product HW genconfig setup
 
-       moveq   0,r0
-#if !defined(CONFIG_ETRAX_KGDB) && !defined(CONFIG_DMA_MEMCPY)
-       ; DMA channels 6 and 7 to ser0, kgdb doesnt want DMA
+       moveq   0,$r0
+#if (!defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT0)) \
+       && !defined(CONFIG_DMA_MEMCPY)
+       ; DMA channels 6 and 7 to se$r0, kgdb doesnt want DMA
        or.d      IO_STATE (R_GEN_CONFIG, dma7, serial0)        \
-               | IO_STATE (R_GEN_CONFIG, dma6, serial0),r0
+               | IO_STATE (R_GEN_CONFIG, dma6, serial0),$r0
 #endif
-#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT1)  
+#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT1)
+       ; DMA channels 8 and 9 to ser1, kgdb doesnt want DMA
        or.d      IO_STATE (R_GEN_CONFIG, dma9, serial1)        \
-               | IO_STATE (R_GEN_CONFIG, dma8, serial1),r0
+               | IO_STATE (R_GEN_CONFIG, dma8, serial1),$r0
 #endif 
 #ifdef CONFIG_DMA_MEMCPY
        ; 6/7 memory-memory DMA
        or.d      IO_STATE (R_GEN_CONFIG, dma7, intdma6)        \
-               | IO_STATE (R_GEN_CONFIG, dma6, intdma7),r0
+               | IO_STATE (R_GEN_CONFIG, dma6, intdma7),$r0
 #endif
 #ifdef CONFIG_ETRAX_SERIAL_PORT2
-       ; DMA channels 2 and 3 to serport 2, port 2 enabled
+       ; Enable serial port 2
+       or.w    IO_STATE (R_GEN_CONFIG, ser2, select),$r0
+#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT2)
+       ; DMA channels 2 and 3 to ser2, kgdb doesnt want DMA
        or.d      IO_STATE (R_GEN_CONFIG, dma3, serial2)        \
-               | IO_STATE (R_GEN_CONFIG, dma2, serial2)        \
-               | IO_STATE (R_GEN_CONFIG, ser2, select),r0
+               | IO_STATE (R_GEN_CONFIG, dma2, serial2),$r0
+#endif
 #endif
 #if defined(CONFIG_ETRAX_SERIAL_PORT3) || defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1)
-       ; DMA channels 4 and 5 to serport 3, port 3 enabled
+       ; Enable serial port 3
+       or.w    IO_STATE (R_GEN_CONFIG, ser3, select),$r0
+#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT3)
+       ; DMA channels 4 and 5 to ser3, kgdb doesnt want DMA
        or.d      IO_STATE (R_GEN_CONFIG, dma5, serial3)        \
-               | IO_STATE (R_GEN_CONFIG, dma4, serial3)        \
-               | IO_STATE (R_GEN_CONFIG, ser3, select),r0
-#endif 
+               | IO_STATE (R_GEN_CONFIG, dma4, serial3),$r0
+#endif
+#endif
 #if defined(CONFIG_ETRAX_PARALLEL_PORT0) || defined(CONFIG_ETRAX_ETHERNET_LPSLAVE)
        ; parport 0 enabled using DMA 2/3
-       or.w    IO_STATE (R_GEN_CONFIG, par0, select),r0
+       or.w    IO_STATE (R_GEN_CONFIG, pa$r0, select),$r0
 #endif
 #if defined(CONFIG_ETRAX_PARALLEL_PORT1) || defined(CONFIG_ETRAX_ETHERNET_LPSLAVE)
        ; parport 1 enabled using DMA 4/5
-       or.w    IO_STATE (R_GEN_CONFIG, par1, select),r0
+       or.w    IO_STATE (R_GEN_CONFIG, par1, select),$r0
 #endif
 #ifdef CONFIG_ETRAX_IDE
        ; DMA channels 2 and 3 to ATA, ATA enabled
        or.d      IO_STATE (R_GEN_CONFIG, dma3, ata)    \
                | IO_STATE (R_GEN_CONFIG, dma2, ata)    \
-               | IO_STATE (R_GEN_CONFIG, ata, select),r0
+               | IO_STATE (R_GEN_CONFIG, ata, select),$r0
 #endif
        
 #ifdef CONFIG_ETRAX_USB_HOST_PORT1
        ; Set the USB port 1 enable bit
-       or.d    IO_STATE (R_GEN_CONFIG, usb1, select),r0
+       or.d    IO_STATE (R_GEN_CONFIG, usb1, select),$r0
 #endif
 #ifdef CONFIG_ETRAX_USB_HOST_PORT2
        ; Set the USB port 2 enable bit
-       or.d    IO_STATE (R_GEN_CONFIG, usb2, select),r0
+       or.d    IO_STATE (R_GEN_CONFIG, usb2, select),$r0
 #endif
 #ifdef CONFIG_ETRAX_USB_HOST
        ; Connect DMA channels 8 and 9 to USB
        and.d   (~(IO_MASK (R_GEN_CONFIG, dma9)         \
                   | IO_MASK (R_GEN_CONFIG, dma8)))     \
                | IO_STATE (R_GEN_CONFIG, dma9, usb)    \
-               | IO_STATE (R_GEN_CONFIG, dma8, usb),r0
+               | IO_STATE (R_GEN_CONFIG, dma8, usb),$r0
 #endif
        
 #ifdef CONFIG_JULIETTE
        ; DMA channels 4 and 5 to EXTDMA0, for Juliette
        or.d      IO_STATE (R_GEN_CONFIG, dma5, extdma0)        \
-               | IO_STATE (R_GEN_CONFIG, dma4, extdma0),r0
+               | IO_STATE (R_GEN_CONFIG, dma4, extdma0),$r0
+#endif
+
+#if defined(CONFIG_BLUETOOTH) && (defined(CONFIG_BLUETOOTH_RESET_G10) || defined(CONFIG_BLUETOOTH_RESET_G11))
+       or.d      IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0
 #endif
-       move.d  r0,[_genconfig_shadow] ; init a shadow register of R_GEN_CONFIG
+
+       move.d  $r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG
 
 #ifndef CONFIG_SVINTO_SIM
-       move.d  r0,[R_GEN_CONFIG]
+       move.d  $r0,[R_GEN_CONFIG]
 
 #if 0
-       moveq   4,r0
-       move.b  r0,[R_DMA_CH6_CMD]      ; reset (ser0 dma out)
-       move.b  r0,[R_DMA_CH7_CMD]      ; reset (ser0 dma in)
-w61:   move.b  [R_DMA_CH6_CMD],r0      ; wait for reset cycle to finish
-       and.b   7,r0
-       cmp.b   4,r0
-       beq     w61
+       moveq   4,$r0
+       move.b  $r0,[R_DMA_CH6_CMD]     ; reset (ser0 dma out)
+       move.b  $r0,[R_DMA_CH7_CMD]     ; reset (ser0 dma in)
+1:     move.b  [R_DMA_CH6_CMD],$r0     ; wait for reset cycle to finish
+       and.b   7,$r0
+       cmp.b   4,$r0
+       beq     1b
        nop
-w71:   move.b  [R_DMA_CH7_CMD],r0      ; wait for reset cycle to finish
-       and.b   7,r0
-       cmp.b   4,r0
-       beq     w71
+1:     move.b  [R_DMA_CH7_CMD],$r0     ; wait for reset cycle to finish
+       and.b   7,$r0
+       cmp.b   4,$r0
+       beq     1b
        nop
 #endif
        
-       moveq   IO_STATE (R_DMA_CH8_CMD, cmd, reset),r0
-       move.b  r0,[R_DMA_CH8_CMD]      ; reset (ser1 dma out)
-       move.b  r0,[R_DMA_CH9_CMD]      ; reset (ser1 dma in)
-w81:   move.b  [R_DMA_CH8_CMD],r0      ; wait for reset cycle to finish
-       and.b   IO_MASK (R_DMA_CH8_CMD, cmd),r0
-       cmp.b   IO_STATE (R_DMA_CH8_CMD, cmd, reset),r0
-       beq     w81
+       moveq   IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0
+       move.b  $r0,[R_DMA_CH8_CMD]     ; reset (ser1 dma out)
+       move.b  $r0,[R_DMA_CH9_CMD]     ; reset (ser1 dma in)
+1:     move.b  [R_DMA_CH8_CMD],$r0     ; wait for reset cycle to finish
+       andq    IO_MASK (R_DMA_CH8_CMD, cmd),$r0
+       cmpq    IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0
+       beq     1b
        nop
-w91:   move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
-       and.b   IO_MASK (R_DMA_CH9_CMD, cmd),r0
-       cmp.b   IO_STATE (R_DMA_CH9_CMD, cmd, reset),r0
-       beq     w91
+1:     move.b  [R_DMA_CH9_CMD],$r0     ; wait for reset cycle to finish
+       andq    IO_MASK (R_DMA_CH9_CMD, cmd),$r0
+       cmpq    IO_STATE (R_DMA_CH9_CMD, cmd, reset),$r0
+       beq     1b
        nop
 
        ;; setup port PA and PB default initial directions and data
        ;; including their shadow registers
                
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR,r0
-       move.b  r0,[_port_pa_dir_shadow]
-       move.b  r0,[R_PORT_PA_DIR]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA,r0
-       move.b  r0,[_port_pa_data_shadow]
-       move.b  r0,[R_PORT_PA_DATA]
-       
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG,r0
-       move.b  r0,[_port_pb_config_shadow]
-       move.b  r0,[R_PORT_PB_CONFIG]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DIR,r0
-       move.b  r0,[_port_pb_dir_shadow]
-       move.b  r0,[R_PORT_PB_DIR]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA,r0
-       move.b  r0,[_port_pb_data_shadow]
-       move.b  r0,[R_PORT_PB_DATA]
-       move.d  0, r0
-       move.d  r0,[_port_pb_i2c_shadow]
-       move.d  r0, [R_PORT_PB_I2C]
-
-       moveq   0,r0
-       move.d  r0,[_port_g_data_shadow]
-       move.d  r0,[R_PORT_G_DATA]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR,$r0
+#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7)
+       or.b    IO_STATE (R_PORT_PA_DIR, dir7, output),$r0
+#endif
+       move.b  $r0,[port_pa_dir_shadow]
+       move.b  $r0,[R_PORT_PA_DIR]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA,$r0
+#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7)
+#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)
+       and.b   ~(1 << 7),$r0
+#else
+       or.b    (1 << 7),$r0
+#endif
+#endif
+       move.b  $r0,[port_pa_data_shadow]
+       move.b  $r0,[R_PORT_PA_DATA]
+       
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG,$r0
+       move.b  $r0,[port_pb_config_shadow]
+       move.b  $r0,[R_PORT_PB_CONFIG]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DIR,$r0
+#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PB5)
+       or.b    IO_STATE (R_PORT_PB_DIR, dir5, output),$r0
+#endif
+       move.b  $r0,[port_pb_dir_shadow]
+       move.b  $r0,[R_PORT_PB_DIR]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PB_DATA,$r0
+#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PB5)
+#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)
+       and.b   ~(1 << 5),$r0
+#else
+       or.b    (1 << 5),$r0
+#endif
+#endif
+       move.b  $r0,[port_pb_data_shadow]
+       move.b  $r0,[R_PORT_PB_DATA]
+
+       moveq   0, $r0
+       move.d  $r0,[port_pb_i2c_shadow]
+       move.d  $r0, [R_PORT_PB_I2C]
+
+       moveq   0,$r0
+#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_G10)
+#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)
+       and.d   ~(1 << 10),$r0
+#else
+       or.d    (1 << 10),$r0
+#endif
+#endif
+#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_G11)
+#if defined(CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH)
+       and.d   ~(1 << 11),$r0
+#else
+       or.d    (1 << 11),$r0
+#endif
+#endif
+       move.d  $r0,[port_g_data_shadow]
+       move.d  $r0,[R_PORT_G_DATA]
        
        ;; setup the serial port 0 at 115200 baud for debug purposes
        
        moveq     IO_STATE (R_SERIAL0_XOFF, tx_stop, enable)            \
                | IO_STATE (R_SERIAL0_XOFF, auto_xoff, disable)         \
-               | IO_FIELD (R_SERIAL0_XOFF, xoff_char, 0),r0
-       move.d  r0,[R_SERIAL0_XOFF] 
+               | IO_FIELD (R_SERIAL0_XOFF, xoff_char, 0),$r0
+       move.d  $r0,[R_SERIAL0_XOFF] 
 
        ; 115.2kbaud for both transmit and receive
        move.b    IO_STATE (R_SERIAL0_BAUD, tr_baud, c115k2Hz)          \
-               | IO_STATE (R_SERIAL0_BAUD, rec_baud, c115k2Hz),r0
-       move.b  r0,[R_SERIAL0_BAUD]
+               | IO_STATE (R_SERIAL0_BAUD, rec_baud, c115k2Hz),$r0
+       move.b  $r0,[R_SERIAL0_BAUD]
 
        ; Set up and enable the serial0 receiver.
        move.b    IO_STATE (R_SERIAL0_REC_CTRL, dma_err, stop)          \
@@ -653,8 +710,8 @@ w91:        move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
                | IO_STATE (R_SERIAL0_REC_CTRL, rec_stick_par, normal)  \
                | IO_STATE (R_SERIAL0_REC_CTRL, rec_par, even)          \
                | IO_STATE (R_SERIAL0_REC_CTRL, rec_par_en, disable)    \
-               | IO_STATE (R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit),r0
-       move.b  r0,[R_SERIAL0_REC_CTRL] 
+               | IO_STATE (R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit),$r0
+       move.b  $r0,[R_SERIAL0_REC_CTRL] 
        
        ; Set up and enable the serial0 transmitter.
        move.b    IO_FIELD (R_SERIAL0_TR_CTRL, txd, 0)                  \
@@ -664,20 +721,20 @@ w91:      move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
                | IO_STATE (R_SERIAL0_TR_CTRL, tr_stick_par, normal)    \
                | IO_STATE (R_SERIAL0_TR_CTRL, tr_par, even)            \
                | IO_STATE (R_SERIAL0_TR_CTRL, tr_par_en, disable)      \
-               | IO_STATE (R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit),r0
-       move.b  r0,[R_SERIAL0_TR_CTRL]
+               | IO_STATE (R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit),$r0
+       move.b  $r0,[R_SERIAL0_TR_CTRL]
 
        ;; setup the serial port 1 at 115200 baud for debug purposes
        
        moveq     IO_STATE (R_SERIAL1_XOFF, tx_stop, enable)            \
                | IO_STATE (R_SERIAL1_XOFF, auto_xoff, disable)         \
-               | IO_FIELD (R_SERIAL1_XOFF, xoff_char, 0),r0
-       move.d  r0,[R_SERIAL1_XOFF] 
+               | IO_FIELD (R_SERIAL1_XOFF, xoff_char, 0),$r0
+       move.d  $r0,[R_SERIAL1_XOFF] 
 
        ; 115.2kbaud for both transmit and receive
        move.b    IO_STATE (R_SERIAL1_BAUD, tr_baud, c115k2Hz)          \
-               | IO_STATE (R_SERIAL1_BAUD, rec_baud, c115k2Hz),r0
-       move.b  r0,[R_SERIAL1_BAUD]
+               | IO_STATE (R_SERIAL1_BAUD, rec_baud, c115k2Hz),$r0
+       move.b  $r0,[R_SERIAL1_BAUD]
 
        ; Set up and enable the serial1 receiver.
        move.b    IO_STATE (R_SERIAL1_REC_CTRL, dma_err, stop)          \
@@ -687,8 +744,8 @@ w91:        move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
                | IO_STATE (R_SERIAL1_REC_CTRL, rec_stick_par, normal)  \
                | IO_STATE (R_SERIAL1_REC_CTRL, rec_par, even)          \
                | IO_STATE (R_SERIAL1_REC_CTRL, rec_par_en, disable)    \
-               | IO_STATE (R_SERIAL1_REC_CTRL, rec_bitnr, rec_8bit),r0
-       move.b  r0,[R_SERIAL1_REC_CTRL] 
+               | IO_STATE (R_SERIAL1_REC_CTRL, rec_bitnr, rec_8bit),$r0
+       move.b  $r0,[R_SERIAL1_REC_CTRL] 
        
        ; Set up and enable the serial1 transmitter.
        move.b    IO_FIELD (R_SERIAL1_TR_CTRL, txd, 0)                  \
@@ -698,8 +755,8 @@ w91:        move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
                | IO_STATE (R_SERIAL1_TR_CTRL, tr_stick_par, normal)    \
                | IO_STATE (R_SERIAL1_TR_CTRL, tr_par, even)            \
                | IO_STATE (R_SERIAL1_TR_CTRL, tr_par_en, disable)      \
-               | IO_STATE (R_SERIAL1_TR_CTRL, tr_bitnr, tr_8bit),r0
-       move.b  r0,[R_SERIAL1_TR_CTRL]
+               | IO_STATE (R_SERIAL1_TR_CTRL, tr_bitnr, tr_8bit),$r0
+       move.b  $r0,[R_SERIAL1_TR_CTRL]
 
        
 #ifdef CONFIG_ETRAX_SERIAL_PORT3       
@@ -707,13 +764,13 @@ w91:      move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
        
        moveq     IO_STATE (R_SERIAL3_XOFF, tx_stop, enable)            \
                | IO_STATE (R_SERIAL3_XOFF, auto_xoff, disable)         \
-               | IO_FIELD (R_SERIAL3_XOFF, xoff_char, 0),r0
-       move.d  r0,[R_SERIAL3_XOFF] 
+               | IO_FIELD (R_SERIAL3_XOFF, xoff_char, 0),$r0
+       move.d  $r0,[R_SERIAL3_XOFF] 
 
        ; 115.2kbaud for both transmit and receive
        move.b    IO_STATE (R_SERIAL3_BAUD, tr_baud, c115k2Hz)          \
-               | IO_STATE (R_SERIAL3_BAUD, rec_baud, c115k2Hz),r0
-       move.b  r0,[R_SERIAL3_BAUD]
+               | IO_STATE (R_SERIAL3_BAUD, rec_baud, c115k2Hz),$r0
+       move.b  $r0,[R_SERIAL3_BAUD]
 
        ; Set up and enable the serial3 receiver.
        move.b    IO_STATE (R_SERIAL3_REC_CTRL, dma_err, stop)          \
@@ -723,8 +780,8 @@ w91:        move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
                | IO_STATE (R_SERIAL3_REC_CTRL, rec_stick_par, normal)  \
                | IO_STATE (R_SERIAL3_REC_CTRL, rec_par, even)          \
                | IO_STATE (R_SERIAL3_REC_CTRL, rec_par_en, disable)    \
-               | IO_STATE (R_SERIAL3_REC_CTRL, rec_bitnr, rec_8bit),r0
-       move.b  r0,[R_SERIAL3_REC_CTRL] 
+               | IO_STATE (R_SERIAL3_REC_CTRL, rec_bitnr, rec_8bit),$r0
+       move.b  $r0,[R_SERIAL3_REC_CTRL] 
        
        ; Set up and enable the serial3 transmitter.
        move.b    IO_FIELD (R_SERIAL3_TR_CTRL, txd, 0)                  \
@@ -734,31 +791,31 @@ w91:      move.b  [R_DMA_CH9_CMD],r0      ; wait for reset cycle to finish
                | IO_STATE (R_SERIAL3_TR_CTRL, tr_stick_par, normal)    \
                | IO_STATE (R_SERIAL3_TR_CTRL, tr_par, even)            \
                | IO_STATE (R_SERIAL3_TR_CTRL, tr_par_en, disable)      \
-               | IO_STATE (R_SERIAL3_TR_CTRL, tr_bitnr, tr_8bit),r0
-       move.b  r0,[R_SERIAL3_TR_CTRL]
+               | IO_STATE (R_SERIAL3_TR_CTRL, tr_bitnr, tr_8bit),$r0
+       move.b  $r0,[R_SERIAL3_TR_CTRL]
 #endif
        
 #endif /* CONFIG_SVINTO_SIM */
 
-       jump    _start_kernel   ; jump into the C-function _start_kernel in init/main.c
+       jump    start_kernel    ; jump into the C-function start_kernel in init/main.c
                
        .data
-_etrax_irv:    
+etrax_irv:     
        .dword  0
-_romfs_start:
+romfs_start:
        .dword  0
-_romfs_length:
+romfs_length:
        .dword  0
-_romfs_in_flash:
+romfs_in_flash:
        .dword  0
        
        ;; put some special pages at the beginning of the kernel aligned
        ;; to page boundaries - the kernel cannot start until after this
 
 #ifdef CONFIG_CRIS_LOW_MAP
-_swapper_pg_dir = 0x60002000
+swapper_pg_dir = 0x60002000
 #else  
-_swapper_pg_dir = 0xc0002000
+swapper_pg_dir = 0xc0002000
 #endif
 
        .section ".data.init"
index fa48796dc715cc6dd3efe87792a731da77c9ed0d..22e2c8e30e69ee1b1f30d5986b4463fdad531f58 100644 (file)
@@ -1,2 +1,65 @@
-/* no kernel support yet */
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/user.h>
+#include <linux/elfcore.h>
+#include <linux/sched.h>
+#include <linux/in6.h>
+#include <linux/interrupt.h>
+#include <linux/smp_lock.h>
+#include <linux/pm.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+#include <asm/semaphore.h>
+#include <asm/processor.h>
+#include <asm/uaccess.h>
+#include <asm/checksum.h>
+#include <asm/io.h>
+#include <asm/hardirq.h>
+#include <asm/delay.h>
+#include <asm/irq.h>
+#include <asm/pgtable.h>
+
+extern void dump_thread(struct pt_regs *, struct user *);
+extern unsigned long get_cmos_time(void);
+extern void __ashrdi3(void);
+
+/* platform dependent support */
+
+EXPORT_SYMBOL(dump_thread);
+EXPORT_SYMBOL(enable_irq);
+EXPORT_SYMBOL(disable_irq);
+EXPORT_SYMBOL(kernel_thread);
+EXPORT_SYMBOL(get_cmos_time);
+
+EXPORT_SYMBOL(strtok);
+EXPORT_SYMBOL(strpbrk);
+EXPORT_SYMBOL(simple_strtol);
+EXPORT_SYMBOL(strstr);
+
+EXPORT_SYMBOL(strchr);
+EXPORT_SYMBOL(strcmp);
+EXPORT_SYMBOL(strlen);
+EXPORT_SYMBOL(strncat);
+EXPORT_SYMBOL(strncmp);
+EXPORT_SYMBOL(__ashrdi3);
+
+/* other stuff */
+
+EXPORT_SYMBOL(strncpy_from_user);
+EXPORT_SYMBOL(__strncpy_from_user);
+EXPORT_SYMBOL(__generic_copy_from_user);
+EXPORT_SYMBOL(__generic_copy_to_user);
+EXPORT_SYMBOL(strnlen_user);
+EXPORT_SYMBOL(__copy_user_zeroing);
+EXPORT_SYMBOL(__copy_user);
+
+#undef memcpy
+#undef memset
+extern void * memset(void *,int,__kernel_size_t);
+extern void * memcpy(void *,const void *,__kernel_size_t);
+EXPORT_SYMBOL_NOVERS(memcpy);
+EXPORT_SYMBOL_NOVERS(memset);
+
 
index 8658fe615ffd8e7ba80370969bc5052ee6657f9f..1f80b9baf8f5a82d512d084463b8b0f325490d28 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.16 2001/06/21 02:00:40 hp Exp $
+/* $Id: process.c,v 1.20 2001/10/03 08:21:39 jonashg Exp $
  * 
  *  linux/arch/cris/kernel/process.c
  *
@@ -8,6 +8,18 @@
  *  Authors:   Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: process.c,v $
+ *  Revision 1.20  2001/10/03 08:21:39  jonashg
+ *  cause_of_death does not exist if CONFIG_SVINTO_SIM is defined.
+ *
+ *  Revision 1.19  2001/09/26 11:52:54  bjornw
+ *  INIT_MMAP is gone in 2.4.10
+ *
+ *  Revision 1.18  2001/08/21 21:43:51  hp
+ *  Move last watchdog fix inside #ifdef CONFIG_ETRAX_WATCHDOG
+ *
+ *  Revision 1.17  2001/08/21 13:48:01  jonashg
+ *  Added fix by HP to avoid oops when doing a hard_reset_now.
+ *
  *  Revision 1.16  2001/06/21 02:00:40  hp
  *     * entry.S: Include asm/unistd.h.
  *     (_sys_call_table): Use section .rodata, not .data.
@@ -118,10 +130,20 @@ int cpu_idle(void *unused)
 
 void hard_reset_now (void)
 {
+       /*
+        * Don't declare this variable elsewhere.  We don't want any other
+        * code to know about it than the watchdog handler in entry.S and
+        * this code, implementing hard reset through the watchdog.
+        */
+       extern int cause_of_death;
+
        printk("*** HARD RESET ***\n");
        cli();
 
-#ifndef CONFIG_ETRAX_WATCHDOG
+#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
+       cause_of_death = 0xbedead;
+
+#else
        /* Since we dont plan to keep on reseting the watchdog,
           the key can be arbitrary hence three */
        *R_WATCHDOG = IO_FIELD(R_WATCHDOG, key, 3) |
index 9bd35f605a455b13391aaee09ced89c01d0bb262..fd0f231596f676a25aac01cebdbd55c7d5203dd5 100644 (file)
@@ -8,6 +8,9 @@
  * Authors:   Bjorn Wesen
  *
  * $Log: ptrace.c,v $
+ * Revision 1.7  2001/09/26 11:53:49  bjornw
+ * PTRACE_DETACH works more simple in 2.4.10
+ *
  * Revision 1.6  2001/07/25 16:08:47  bjornw
  * PTRACE_ATTACH bulk moved into arch-independant code in 2.4.7
  *
@@ -89,7 +92,7 @@ static inline int put_reg(struct task_struct *task, unsigned int regno,
  */
 void ptrace_disable(struct task_struct *child)
 {
-       /* Todo - pending singlesteps? */
+       /* Todo - pending singlesteps? */
 }
 
 /* Note that this implementation of ptrace behaves differently from vanilla
index df9b93417b01114dc0b9377d809de9944bf0badc..95f2d71f3358f7aef2c0eefd6b6dc6de5ac670b2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.18 2001/06/28 04:47:16 hp Exp $
+/* $Id: setup.c,v 1.21 2001/10/01 14:45:35 bjornw Exp $
  *
  *  linux/arch/cris/kernel/setup.c
  *
@@ -166,7 +166,17 @@ setup_arch(char **cmdline_p)
           saving anything that might be there.  */
 
        *cmdline_p = command_line;
-       strcpy(command_line, "root=/dev/rom"); /* use the appended romdisk as root */
+
+       if (romfs_in_flash) {
+               strncpy(command_line, "root=", COMMAND_LINE_SIZE);
+               strncpy(command_line+5, CONFIG_ETRAX_ROOT_DEVICE,
+                       COMMAND_LINE_SIZE-5);
+
+               /* Save command line copy for /proc/cmdline */
+
+               memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
+               saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
+       }
 
        /* give credit for the CRIS port */
 
@@ -213,15 +223,10 @@ static struct cpu_info {
 int get_cpuinfo(char *buffer)
 {
        int revision;
-#ifndef CONFIG_SVINTO_SIM
-       unsigned char tmp;
-
-       __asm__ volatile ("move vr,%0" : "=rm" (tmp));
-       revision = tmp;
-#else
-        /* Fake a revision for the simulator */
-       revision = 7;
-#endif
+
+       /* read the version register in the CPU and print some stuff */
+
+       revision = rdvr();
 
        return sprintf(buffer,
                       "cpu\t\t: CRIS\n"
index cca18d379740fb26ce601865f4e5dd819bc9c68c..4605fc108c7fb534e4795d2388050a9c562487f7 100644 (file)
@@ -64,6 +64,7 @@ int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)
                err |= __put_user(from->si_pid, &to->si_pid);
                switch (from->si_code >> 16) {
                case __SI_FAULT >> 16:
+                        err |= __put_user(from->si_addr, &to->si_addr);
                        break;
                case __SI_CHLD >> 16:
                        err |= __put_user(from->si_utime, &to->si_utime);
@@ -347,6 +348,11 @@ setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask
 
        err |= __copy_to_user(sc, regs, sizeof(struct pt_regs));
 
+        /* Set the frametype to CRIS_FRAME_NORMAL for the execution of
+           the signal handler. The frametype will be restored to its previous
+           value in restore_sigcontext. */
+        regs->frametype = CRIS_FRAME_NORMAL;
+
        /* then some other stuff */
 
        err |= __put_user(mask, &sc->oldmask);
@@ -476,10 +482,10 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        } else {
                /* trampoline - the desired return ip is the retcode itself */
                return_ip = (unsigned long)&frame->retcode;
-               /* This is movu.w __NR_sigreturn, r9; break 13; */
-               err |= __put_user(0x9c5f,         (short *)(frame->retcode+0));
-               err |= __put_user(__NR_sigreturn, (short *)(frame->retcode+2));
-               err |= __put_user(0xe93d,         (short *)(frame->retcode+4));
+               /* This is movu.w __NR_rt_sigreturn, r9; break 13; */
+               err |= __put_user(0x9c5f,            (short *)(frame->retcode+0));
+               err |= __put_user(__NR_rt_sigreturn, (short *)(frame->retcode+2));
+               err |= __put_user(0xe93d,            (short *)(frame->retcode+4));
        }
 
        if (err)
@@ -492,6 +498,8 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        regs->irp = (unsigned long) ka->sa.sa_handler;  /* what we enter NOW   */
        regs->srp = return_ip;                          /* what we enter LATER */
        regs->r10 = sig;                                /* first argument is signo */
+        regs->r11 = (unsigned long) &frame->info;       /* second argument is (siginfo_t *) */
+        regs->r12 = 0;                                  /* third argument is unused */
 
        /* actually move the usp to reflect the stacked frame */
 
index e945d229ae00fb342c524493c08795c88409c121..134aac28d9e5b2e936e0292225077da661567e21 100644 (file)
@@ -1,12 +1,12 @@
-/* $Id: checksum.S,v 1.5 2001/05/29 11:40:14 markusl Exp $
+/* $Id: checksum.S,v 1.6 2001/10/01 14:47:35 bjornw Exp $
  * A fast checksum routine using movem
  * Copyright (c) 1998-2001 Axis Communications AB
  *
  * csum_partial(const unsigned char * buff, int len, unsigned int sum)
  */
 
-       .globl  _csum_partial
-_csum_partial:
+       .globl  csum_partial
+csum_partial:
        
        ;; r10 - src
        ;; r11 - length
@@ -16,8 +16,8 @@ _csum_partial:
        ;; we also do _NOT_ want to compute a checksum over more than the 
        ;; actual length when length < 40
        
-       cmpu.w  80,r11
-       blo     word_loop
+       cmpu.w  80,$r11
+       blo     _word_loop
        nop
 
        ;; need to save the registers we use below in the movem loop
@@ -25,100 +25,100 @@ _csum_partial:
        ;; only r0 - r8 have to be saved, the other ones are clobber-able
        ;; according to the ABI
        
-       subq    9*4,sp
-       movem   r8,[sp]
+       subq    9*4,$sp
+       movem   $r8,[$sp]
        
        ;; do a movem checksum
 
-       subq    10*4,r11        ; update length for the first loop
+       subq    10*4,$r11       ; update length for the first loop
        
-mloop: movem   [r10+],r9       ; read 10 longwords
+_mloop:        movem   [$r10+],$r9     ; read 10 longwords
 
        ;; perform dword checksumming on the 10 longwords
        
-       add.d   r0,r12
+       add.d   $r0,$r12
        ax
-       add.d   r1,r12
+       add.d   $r1,$r12
        ax
-       add.d   r2,r12
+       add.d   $r2,$r12
        ax
-       add.d   r3,r12
+       add.d   $r3,$r12
        ax
-       add.d   r4,r12
+       add.d   $r4,$r12
        ax
-       add.d   r5,r12
+       add.d   $r5,$r12
        ax
-       add.d   r6,r12
+       add.d   $r6,$r12
        ax
-       add.d   r7,r12
+       add.d   $r7,$r12
        ax
-       add.d   r8,r12
+       add.d   $r8,$r12
        ax
-       add.d   r9,r12
+       add.d   $r9,$r12
 
        ;; fold the carry into the checksum, to avoid having to loop the carry
        ;; back into the top
        
        ax
-       addq    0,r12
+       addq    0,$r12
        ax                      ; do it again, since we might have generated a carry
-       addq    0,r12
+       addq    0,$r12
 
-       subq    10*4,r11
-       bge     mloop
+       subq    10*4,$r11
+       bge     _mloop
        nop
 
-       addq    10*4,r11        ; compensate for last loop underflowing length
+       addq    10*4,$r11       ; compensate for last loop underflowing length
 
-       movem   [sp+],r8        ; restore regs
+       movem   [$sp+],$r8      ; restore regs
 
-word_loop:
+_word_loop:
        ;; only fold if there is anything to fold.
 
-       cmpq    0,r12
-       beq     no_fold
+       cmpq    0,$r12
+       beq     _no_fold
 
        ;; fold 32-bit checksum into a 16-bit checksum, to avoid carries below.
        ;; r9 and r13 can be used as temporaries.
        
-       moveq   -1,r9           ; put 0xffff in r9, faster than move.d 0xffff,r9
-       lsrq    16,r9
+       moveq   -1,$r9          ; put 0xffff in r9, faster than move.d 0xffff,r9
+       lsrq    16,$r9
        
-       move.d  r12,r13
-       lsrq    16,r13          ; r13 = checksum >> 16
-       and.d   r9,r12          ; checksum = checksum & 0xffff
-       add.d   r13,r12         ; checksum += r13
-       move.d  r12,r13         ; do the same again, maybe we got a carry last add
-       lsrq    16,r13
-       and.d   r9,r12
-       add.d   r13,r12
+       move.d  $r12,$r13
+       lsrq    16,$r13         ; r13 = checksum >> 16
+       and.d   $r9,$r12                ; checksum = checksum & 0xffff
+       add.d   $r13,$r12               ; checksum += r13
+       move.d  $r12,$r13               ; do the same again, maybe we got a carry last add
+       lsrq    16,$r13
+       and.d   $r9,$r12
+       add.d   $r13,$r12
 
-no_fold:
-       cmpq    2,r11
-       blt     no_words
+_no_fold:
+       cmpq    2,$r11
+       blt     _no_words
        nop
        
        ;; checksum the rest of the words
        
-       subq    2,r11
+       subq    2,$r11
        
-wloop: subq    2,r11
-       bge     wloop
-       addu.w  [r10+],r12
+_wloop:        subq    2,$r11
+       bge     _wloop
+       addu.w  [$r10+],$r12
        
-       addq    2,r11
+       addq    2,$r11
                
-no_words:
+_no_words:
        ;; see if we have one odd byte more
-       cmpq    1,r11
-       beq     do_byte
+       cmpq    1,$r11
+       beq     _do_byte
        nop
        ret
-       move.d  r12, r10
+       move.d  $r12, $r10
 
-do_byte:       
+_do_byte:      
        ;; copy and checksum the last byte
-       addu.b  [r10],r12
+       addu.b  [$r10],$r12
        ret
-       move.d  r12, r10
+       move.d  $r12, $r10
                
index 60d7f1a7edaabe32bf06e0a74db26b126c469308..ad3a8f5dbbaf129fb4492e3543580d2c9aca8b52 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: checksumcopy.S,v 1.6 2001/06/28 03:57:16 hp Exp $
+/* $Id: checksumcopy.S,v 1.7 2001/10/01 14:47:35 bjornw Exp $
  * A fast checksum+copy routine using movem
  * Copyright (c) 1998, 2001 Axis Communications AB
  *
@@ -8,8 +8,8 @@
  *                          int len, unsigned int sum)
  */
 
-       .globl  _csum_partial_copy_nocheck
-_csum_partial_copy_nocheck:    
+       .globl  csum_partial_copy_nocheck
+csum_partial_copy_nocheck:     
        
        ;; r10 - src
        ;; r11 - dst
@@ -20,8 +20,8 @@ _csum_partial_copy_nocheck:
        ;; we also do _NOT_ want to compute a checksum over more than the 
        ;; actual length when length < 40
        
-       cmpu.w  80,r12
-       blo     word_loop
+       cmpu.w  80, $r12
+       blo     _word_loop
        nop
 
        ;; need to save the registers we use below in the movem loop
@@ -29,104 +29,104 @@ _csum_partial_copy_nocheck:
        ;; only r0 - r8 have to be saved, the other ones are clobber-able
        ;; according to the ABI
        
-       subq    9*4,sp
-       movem   r8,[sp]
+       subq    9*4, $sp
+       movem   $r8, [$sp]
        
        ;; do a movem copy and checksum
 
-       subq    10*4,r12        ; update length for the first loop
+       subq    10*4, $r12      ; update length for the first loop
        
-mloop: movem   [r10+],r9       ; read 10 longwords
+_mloop:        movem   [$r10+],$r9     ; read 10 longwords
 1:     ;; A failing userspace access will have this as PC.
-       movem   r9,[r11+]       ; write 10 longwords
+       movem   $r9,[$r11+]     ; write 10 longwords
 
        ;; perform dword checksumming on the 10 longwords
        
-       add.d   r0,r13
+       add.d   $r0,$r13
        ax
-       add.d   r1,r13
+       add.d   $r1,$r13
        ax
-       add.d   r2,r13
+       add.d   $r2,$r13
        ax
-       add.d   r3,r13
+       add.d   $r3,$r13
        ax
-       add.d   r4,r13
+       add.d   $r4,$r13
        ax
-       add.d   r5,r13
+       add.d   $r5,$r13
        ax
-       add.d   r6,r13
+       add.d   $r6,$r13
        ax
-       add.d   r7,r13
+       add.d   $r7,$r13
        ax
-       add.d   r8,r13
+       add.d   $r8,$r13
        ax
-       add.d   r9,r13
+       add.d   $r9,$r13
 
        ;; fold the carry into the checksum, to avoid having to loop the carry
        ;; back into the top
        
        ax
-       addq    0,r13
+       addq    0,$r13
        ax                      ; do it again, since we might have generated a carry
-       addq    0,r13
+       addq    0,$r13
 
-       subq    10*4,r12
-       bge     mloop
+       subq    10*4,$r12
+       bge     _mloop
        nop
 
-       addq    10*4,r12        ; compensate for last loop underflowing length
+       addq    10*4,$r12       ; compensate for last loop underflowing length
 
-       movem   [sp+],r8        ; restore regs
+       movem   [$sp+],$r8      ; restore regs
 
-word_loop:
+_word_loop:
        ;; only fold if there is anything to fold.
 
-       cmpq    0,r13
-       beq     no_fold
+       cmpq    0,$r13
+       beq     _no_fold
 
        ;; fold 32-bit checksum into a 16-bit checksum, to avoid carries below
        ;; r9 can be used as temporary.
        
-       move.d  r13,r9
-       lsrq    16,r9           ; r0 = checksum >> 16
-       and.d   0xffff,r13      ; checksum = checksum & 0xffff
-       add.d   r9,r13          ; checksum += r0
-       move.d  r13,r9          ; do the same again, maybe we got a carry last add
-       lsrq    16,r9
-       and.d   0xffff,r13
-       add.d   r9,r13
+       move.d  $r13,$r9
+       lsrq    16,$r9          ; r0 = checksum >> 16
+       and.d   0xffff,$r13     ; checksum = checksum & 0xffff
+       add.d   $r9,$r13        ; checksum += r0
+       move.d  $r13,$r9        ; do the same again, maybe we got a carry last add
+       lsrq    16,$r9
+       and.d   0xffff,$r13
+       add.d   $r9,$r13
        
-no_fold:
-       cmpq    2,r12
-       blt     no_words
+_no_fold:
+       cmpq    2,$r12
+       blt     _no_words
        nop
        
        ;; copy and checksum the rest of the words
        
-       subq    2,r12
+       subq    2,$r12
        
-wloop: move.w  [r10+],r9
+_wloop:        move.w  [$r10+],$r9
 2:     ;; A failing userspace access will have this as PC.
-       addu.w  r9,r13
-       subq    2,r12
-       bge     wloop
-       move.w  r9,[r11+]
+       addu.w  $r9,$r13
+       subq    2,$r12
+       bge     _wloop
+       move.w  $r9,[$r11+]
        
-       addq    2,r12
+       addq    2,$r12
                
-no_words:
+_no_words:
        ;; see if we have one odd byte more
-       cmpq    1,r12
-       beq     do_byte
+       cmpq    1,$r12
+       beq     _do_byte
        nop
        ret
-       move.d  r13, r10
+       move.d  $r13, $r10
 
-do_byte:       
+_do_byte:      
        ;; copy and checksum the last byte
-       move.b  [r10],r9
+       move.b  [$r10],$r9
 3:     ;; A failing userspace access will have this as PC.
-       addu.b  r9,r13
-       move.b  r9,[r11]
+       addu.b  $r9,$r13
+       move.b  $r9,[$r11]
        ret
-       move.d  r13, r10
+       move.d  $r13, $r10
index d364e4d4378cbade7748cdf6a3da2fd10240853f..5f41ccd62754425b5d849f6ecd23ec3d050df48d 100644 (file)
@@ -21,7 +21,7 @@
    It is conveniently located on the stack, so the normal function body
    does not have to handle it.  */
 
-#define _csum_partial_copy_nocheck _csum_partial_copy_from_user
+#define csum_partial_copy_nocheck csum_partial_copy_from_user
 
 /* There are local labels numbered 1, 2 and 3 present to mark the
    different from-user accesses.  */
 
 ;; Here from the movem loop; restore stack.
 4:
-       movem   [sp+],r8
+       movem   [$sp+],$r8
 ;; r12 is already decremented.  Add back chunk_size-2.
-       addq    40-2,r12
+       addq    40-2,$r12
 
 ;; Here from the word loop; r12 is off by 2; add it back.
 5:
-       addq    2,r12
+       addq    2,$r12
 
 ;; Here from a failing single byte.
 6:
 
 ;; Signal in *errptr that we had a failing access.
-       moveq   -EFAULT,r9
-       move.d  r9,[[sp]]
+       moveq   -EFAULT,$r9
+       move.d  $r9,[[$sp]]
 
 ;; Clear the rest of the destination area using memset.  Preserve the
 ;; checksum for the readable bytes.
-       push    srp
-       push    r13
-       move.d  r11,r10
-       clear.d r11
-       jsr     _memset
-       pop     r10
-       jump    [sp+]
+       push    $srp
+       push    $r13
+       move.d  $r11,$r10
+       clear.d $r11
+       jsr     memset
+       pop     $r10
+       jump    [$sp+]
 
        .previous
        .section __ex_table,"a"
index 1d5886bab5b905d17234cebc370d9b82529c4632..0d59ce119e41c3965384fbbe50e11dfa59906b4f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dram_init.S,v 1.8 2001/05/15 07:12:45 hp Exp $
+/* $Id: dram_init.S,v 1.10 2001/10/04 12:00:21 martinnn Exp $
  * 
  * DRAM/SDRAM initialization - alter with care
  * This file is intended to be included from other assembler files
  * Authors:  Mikael Starvik (starvik@axis.com) 
  * 
  * $Log: dram_init.S,v $
+ * Revision 1.10  2001/10/04 12:00:21  martinnn
+ * Added missing underscores.
+ *
+ * Revision 1.9  2001/10/01 14:47:35  bjornw
+ * Added register prefixes and removed underscores
+ *
  * Revision 1.8  2001/05/15 07:12:45  hp
  * Copy warning from head.S about r8 and r9
  *
        ;; They should not be used in the code below.
 
 #ifndef CONFIG_SVINTO_SIM      
-       move.d   CONFIG_ETRAX_DEF_R_WAITSTATES, r0
-       move.d   r0, [R_WAITSTATES]
+       move.d   CONFIG_ETRAX_DEF_R_WAITSTATES, $r0
+       move.d   $r0, [R_WAITSTATES]
 
-       move.d   CONFIG_ETRAX_DEF_R_BUS_CONFIG, r0
-       move.d   r0, [R_BUS_CONFIG]
+       move.d   CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0
+       move.d   $r0, [R_BUS_CONFIG]
        
 #ifndef CONFIG_ETRAX_SDRAM
-       move.d   CONFIG_ETRAX_DEF_R_DRAM_CONFIG, r0
-       move.d   r0, [R_DRAM_CONFIG]
+       move.d   CONFIG_ETRAX_DEF_R_DRAM_CONFIG, $r0
+       move.d   $r0, [R_DRAM_CONFIG]
 
-       move.d   CONFIG_ETRAX_DEF_R_DRAM_TIMING, r0
-       move.d   r0, [R_DRAM_TIMING]
+       move.d   CONFIG_ETRAX_DEF_R_DRAM_TIMING, $r0
+       move.d   $r0, [R_DRAM_TIMING]
 #else  
        ; Refer to ETRAX 100LX Designers Reference for a description of SDRAM initialization
        
        ; Bank configuration
-       move.d   CONFIG_ETRAX_DEF_R_SDRAM_CONFIG, r0
-       move.d   r0, [R_SDRAM_CONFIG]
+       move.d   CONFIG_ETRAX_DEF_R_SDRAM_CONFIG, $r0
+       move.d   $r0, [R_SDRAM_CONFIG]
 
        ; Calculate value of mrs_data 
        ; CAS latency = 2 && bus_width = 32 => 0x40
        ; CAS latency = 2 && bus_width = 16 => 0x20
        ; CAS latency = 3 && bus_width = 16 => 0x30
        
-       move.d   0x40, r2       ; Assume 32 bits and CAS latency = 2
-       move.d   CONFIG_ETRAX_DEF_R_SDRAM_TIMING, r1
-       move.d   r1, r3
-       and.d    0x03, r1       ; Get CAS latency
-       and.d    0x1000, r3     ; 50 or 100 MHz?
-       beq      speed_50
+       move.d   0x40, $r2       ; Assume 32 bits and CAS latency = 2
+       move.d   CONFIG_ETRAX_DEF_R_SDRAM_TIMING, $r1
+       move.d   $r1, $r3
+       and.d    0x03, $r1       ; Get CAS latency
+       and.d    0x1000, $r3     ; 50 or 100 MHz?
+       beq      _speed_50
        nop
-speed_100:             
-       cmp.d    0x00, r1       ; CAS latency = 2?
-       beq      bw_check
+_speed_100:            
+       cmp.d    0x00, $r1      ; CAS latency = 2?
+       beq      _bw_check
        nop
-       or.d     0x20, r2       ; CAS latency = 3 
-       ba       bw_check
+       or.d     0x20, $r2      ; CAS latency = 3 
+       ba       _bw_check
        nop
-speed_50:                      
-       cmp.d    0x01, r1       ; CAS latency = 2?
-       beq      bw_check
+_speed_50:                     
+       cmp.d    0x01, $r1      ; CAS latency = 2?
+       beq      _bw_check
        nop
-       or.d     0x20, r2       ; CAS latency = 3
-bw_check:
-       move.d   CONFIG_ETRAX_DEF_R_SDRAM_CONFIG, r1
-       and.d    0x800000, r1   ; DRAM width is bit 23
-       bne      set_timing
+       or.d     0x20, $r2       ; CAS latency = 3
+_bw_check:
+       move.d   CONFIG_ETRAX_DEF_R_SDRAM_CONFIG, $r1
+       and.d    0x800000, $r1  ; DRAM width is bit 23
+       bne      _set_timing
        nop
-       lsrq     1, r2          ;  16 bits. Shift down value.
+       lsrq     1, $r2         ;  16 bits. Shift down value.
 
        ; Set timing parameters. Starts master clock
-set_timing:
-       move.d   CONFIG_ETRAX_DEF_R_SDRAM_TIMING, r1
-       and.d    0x8000f9ff, r1 ; Make sure mrs data and command is 0 
-       or.d     0x80000000, r1 ; Make sure sdram enable bit is set
-       move.d   r1, r5
-       or.d     0x0000c000, r1 ; ref = disable
-       lslq     16, r2         ; mrs data starts at bit 16
-       or.d     r2, r1 
-       move.d   r1, [R_SDRAM_TIMING]   
+_set_timing:
+       move.d   CONFIG_ETRAX_DEF_R_SDRAM_TIMING, $r1
+       and.d    0x8000f9ff, $r1 ; Make sure mrs data and command is 0 
+       or.d     0x80000000, $r1        ; Make sure sdram enable bit is set
+       move.d   $r1, $r5
+       or.d     0x0000c000, $r1 ; ref = disable
+       lslq     16, $r2                ; mrs data starts at bit 16
+       or.d     $r2, $r1 
+       move.d   $r1, [R_SDRAM_TIMING]  
                
        ; Wait 200us
-       move.d   10000, r2
-sdram_loop:
-       bne      sdram_loop
-       subq     1, r2
+       move.d   10000, $r2
+1:     bne      1b
+       subq     1, $r2
        
        ; Issue initialization command sequence
-       move.d   sdram_commands_start, r2
-       move.d   sdram_commands_end,  r3
-command_loop:
-       clear.d  r4
-       move.b   [r2+], r4
-       lslq     9, r4  ; Command starts at bit 9
-       or.d     r1, r4
-       move.d   r4, [R_SDRAM_TIMING]
+       move.d   _sdram_commands_start, $r2
+       move.d   _sdram_commands_end,  $r3
+1:     clear.d  $r4
+       move.b   [$r2+], $r4
+       lslq     9, $r4 ; Command starts at bit 9
+       or.d     $r1, $r4
+       move.d   $r4, [R_SDRAM_TIMING]
        nop             ; Wait five nop cycles between each command
        nop
        nop
        nop
        nop
-       cmp.d    r2, r3
-       bne      command_loop
+       cmp.d    $r2, $r3
+       bne      1b
        nop
-       move.d   r5, [R_SDRAM_TIMING]
-       ba       sdram_commands_end
+       move.d   $r5, [R_SDRAM_TIMING]
+       ba       _sdram_commands_end
        nop
 
-sdram_commands_start:
+_sdram_commands_start:
        .byte   3       ; Precharge
        .byte   0       ; nop
        .byte   2       ; refresh
@@ -162,6 +166,6 @@ sdram_commands_start:
        .byte   0       ; nop
        .byte   1       ; mrs
        .byte   0       ; nop 
-sdram_commands_end:            
+_sdram_commands_end:           
 #endif
 #endif
index d68005eb81f39500ed1a1809ba73b155d6c30c6e..82bb668391715279afb0619a46d3d4b208323ed5 100644 (file)
@@ -56,12 +56,12 @@ void *memset(void *pdst,
 
   /* Ugh.  This is fragile at best.  Check with newer GCC releases, if
      they compile cascaded "x |= x << 8" sanely! */
-  __asm__("movu.b %0,r13\n\t"
-          "lslq 8,r13\n\t"
-         "move.b %0,r13\n\t"
-         "move.d r13,%0\n\t"
-         "lslq 16,r13\n\t"
-         "or.d r13,%0"
+  __asm__("movu.b %0,$r13\n\t"
+          "lslq 8,$r13\n\t"
+         "move.b %0,$r13\n\t"
+         "move.d $r13,%0\n\t"
+         "lslq 16,$r13\n\t"
+         "or.d $r13,%0"
           : "=r" (lc) : "0" (lc) : "r13");
 
   {
@@ -118,36 +118,36 @@ void *memset(void *pdst,
        ;; Save the registers we'll clobber in the movem process
        ;; on the stack.  Don't mention them to gcc, it will only be
        ;; upset.
-       subq    11*4,sp
-        movem   r10,[sp]
-
-        move.d  r11,r0
-        move.d  r11,r1
-        move.d  r11,r2
-        move.d  r11,r3
-        move.d  r11,r4
-        move.d  r11,r5
-        move.d  r11,r6
-        move.d  r11,r7
-        move.d  r11,r8
-        move.d  r11,r9
-        move.d  r11,r10
+       subq    11*4,$sp
+        movem   $r10,[$sp]
+
+        move.d  $r11,$r0
+        move.d  $r11,$r1
+        move.d  $r11,$r2
+        move.d  $r11,$r3
+        move.d  $r11,$r4
+        move.d  $r11,$r5
+        move.d  $r11,$r6
+        move.d  $r11,$r7
+        move.d  $r11,$r8
+        move.d  $r11,$r9
+        move.d  $r11,$r10
 
         ;; Now we've got this:
        ;; r13 - dst
        ;; r12 - n
        
         ;; Update n for the first loop
-        subq    12*4,r12
+        subq    12*4,$r12
 0:
-        subq   12*4,r12
+        subq   12*4,$r12
         bge     0b
-       movem   r11,[r13+]
+       movem   $r11,[$r13+]
 
-        addq   12*4,r12  ;; compensate for last loop underflowing n
+        addq   12*4,$r12  ;; compensate for last loop underflowing n
 
        ;; Restore registers from stack
-        movem [sp+],r10" 
+        movem [$sp+],$r10" 
 
      /* Outputs */ : "=r" (dst), "=r" (n)
      /* Inputs */ : "0" (dst), "1" (n), "r" (lc));
index ebd39b410957dfd2f0564deabb00b0ca86f73c51..8ffde4901b5730c9738b047c608926f9ceaa1f84 100644 (file)
@@ -102,8 +102,8 @@ void *memcpy(void *pdst,
         ;;
        ;; Save the registers we'll use in the movem process
        ;; on the stack.
-       subq    11*4,sp
-       movem   r10,[sp]
+       subq    11*4,$sp
+       movem   $r10,[$sp]
 
         ;; Now we've got this:
        ;; r11 - src
@@ -111,17 +111,17 @@ void *memcpy(void *pdst,
        ;; r12 - n
        
         ;; Update n for the first loop
-        subq    44,r12
+        subq    44,$r12
 0:
-       movem   [r11+],r10
-        subq   44,r12
+       movem   [$r11+],$r10
+        subq   44,$r12
         bge     0b
-       movem   r10,[r13+]
+       movem   $r10,[$r13+]
 
-        addq   44,r12  ;; compensate for last loop underflowing n
+        addq   44,$r12  ;; compensate for last loop underflowing n
 
        ;; Restore registers from stack
-        movem [sp+],r10" 
+        movem [$sp+],$r10" 
 
      /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n) 
      /* Inputs */ : "0" (dst), "1" (src), "2" (n));
index b0b854c63e2d1a77810b42ade58e272058ea9755..fc0b89cc57fec81522929d955cd689dfde50c7da 100644 (file)
@@ -95,8 +95,8 @@ __copy_user (void *pdst, const void *psrc, unsigned long pn)
        ;;
        ;; Save the registers we'll use in the movem process
        ;; on the stack.
-       subq    11*4,sp
-       movem   r10,[sp]
+       subq    11*4,$sp
+       movem   $r10,[$sp]
 
        ;; Now we've got this:
        ;; r11 - src
@@ -104,7 +104,7 @@ __copy_user (void *pdst, const void *psrc, unsigned long pn)
        ;; r12 - n
 
        ;; Update n for the first loop
-       subq    44,r12
+       subq    44,$r12
 
 ; Since the noted PC of a faulting instruction in a delay-slot of a taken
 ; branch, is that of the branch target, we actually point at the from-movem
@@ -113,15 +113,15 @@ __copy_user (void *pdst, const void *psrc, unsigned long pn)
 ; after *that* movem.
 
 0:
-       movem   [r11+],r10
-       subq   44,r12
+       movem   [$r11+],$r10
+       subq   44,$r12
        bge     0b
-       movem   r10,[r13+]
+       movem   $r10,[$r13+]
 1:
-       addq   44,r12  ;; compensate for last loop underflowing n
+       addq   44,$r12  ;; compensate for last loop underflowing n
 
        ;; Restore registers from stack
-       movem [sp+],r10
+       movem [$sp+],$r10
 2:
        .section .fixup,\"ax\"
 
@@ -130,14 +130,14 @@ __copy_user (void *pdst, const void *psrc, unsigned long pn)
 ; performance penalty for sany use; the program will segfault soon enough.
 
 3:
-       move.d [sp],r10
-       addq 44,r10
-       move.d r10,[sp]
+       move.d [$sp],$r10
+       addq 44,$r10
+       move.d $r10,[$sp]
        jump 0b
 4:
-       movem [sp+],r10
-       addq 44,r10
-       addq 44,r12
+       movem [$sp+],$r10
+       addq 44,$r10
+       addq 44,$r12
        jump 2b
 
        .previous
@@ -255,8 +255,8 @@ __copy_user_zeroing (void *pdst, const void *psrc, unsigned long pn)
        ;;
        ;; Save the registers we'll use in the movem process
        ;; on the stack.
-       subq    11*4,sp
-       movem   r10,[sp]
+       subq    11*4,$sp
+       movem   $r10,[$sp]
 
        ;; Now we've got this:
        ;; r11 - src
@@ -264,18 +264,18 @@ __copy_user_zeroing (void *pdst, const void *psrc, unsigned long pn)
        ;; r12 - n
 
        ;; Update n for the first loop
-       subq    44,r12
+       subq    44,$r12
 0:
-       movem   [r11+],r10
+       movem   [$r11+],$r10
 1:
-       subq   44,r12
+       subq   44,$r12
        bge     0b
-       movem   r10,[r13+]
+       movem   $r10,[$r13+]
 
-       addq   44,r12  ;; compensate for last loop underflowing n
+       addq   44,$r12  ;; compensate for last loop underflowing n
 8:
        ;; Restore registers from stack
-       movem [sp+],r10
+       movem [$sp+],$r10
 
        .section .fixup,\"ax\"
 
@@ -287,57 +287,57 @@ __copy_user_zeroing (void *pdst, const void *psrc, unsigned long pn)
 ;; the SIZE bytes at PAGE after the first fault.
 
 3:
-       move.d [sp],r10
+       move.d [$sp],$r10
 
 ;; Number of remaining bytes, cleared but not copied, is r12 + 44.
 
-       add.d r12,r10
-       addq 44,r10
-
-       move.d r10,[sp]
-       clear.d r0
-       clear.d r1
-       clear.d r2
-       clear.d r3
-       clear.d r4
-       clear.d r5
-       clear.d r6
-       clear.d r7
-       clear.d r8
-       clear.d r9
-       clear.d r10
+       add.d $r12,$r10
+       addq 44,$r10
+
+       move.d $r10,[$sp]
+       clear.d $r0
+       clear.d $r1
+       clear.d $r2
+       clear.d $r3
+       clear.d $r4
+       clear.d $r5
+       clear.d $r6
+       clear.d $r7
+       clear.d $r8
+       clear.d $r9
+       clear.d $r10
 
 ;; Perform clear similar to the copy-loop.
 
 4:
-       subq 44,r12
+       subq 44,$r12
        bge 4b
-       movem r10,[r13+]
+       movem $r10,[$r13+]
 
 ;; Clear by four for the remaining multiples.
 
-       addq 40,r12
+       addq 40,$r12
        bmi 6f
        nop
 5:
-       subq 4,r12
+       subq 4,$r12
        bpl 5b
-       clear.d [r13+]
+       clear.d [$r13+]
 6:
-       addq 4,r12
+       addq 4,$r12
        beq 7f
        nop
 
-       subq 1,r12
+       subq 1,$r12
        beq 7f
-       clear.b [r13+]
+       clear.b [$r13+]
 
-       subq 1,r12
+       subq 1,$r12
        beq 7f
-       clear.b [r13+]
+       clear.b [$r13+]
 
-       clear.d r12
-       clear.b [r13+]
+       clear.d $r12
+       clear.b [$r13+]
 7:
        jump 8b
 
@@ -451,50 +451,50 @@ __do_clear_user (void *pto, unsigned long pn)
        ;; Save the registers we'll clobber in the movem process
        ;; on the stack.  Don't mention them to gcc, it will only be
        ;; upset.
-       subq    11*4,sp
-       movem   r10,[sp]
-
-       clear.d r0
-       clear.d r1
-       clear.d r2
-       clear.d r3
-       clear.d r4
-       clear.d r5
-       clear.d r6
-       clear.d r7
-       clear.d r8
-       clear.d r9
-       clear.d r10
-       clear.d r11
+       subq    11*4,$sp
+       movem   $r10,[$sp]
+
+       clear.d $r0
+       clear.d $r1
+       clear.d $r2
+       clear.d $r3
+       clear.d $r4
+       clear.d $r5
+       clear.d $r6
+       clear.d $r7
+       clear.d $r8
+       clear.d $r9
+       clear.d $r10
+       clear.d $r11
 
        ;; Now we've got this:
        ;; r13 - dst
        ;; r12 - n
 
        ;; Update n for the first loop
-       subq    12*4,r12
+       subq    12*4,$r12
 0:
-       subq   12*4,r12
+       subq   12*4,$r12
        bge     0b
-       movem   r11,[r13+]
+       movem   $r11,[$r13+]
 1:
-       addq   12*4,r12  ;; compensate for last loop underflowing n
+       addq   12*4,$r12        ;; compensate for last loop underflowing n
 
        ;; Restore registers from stack
-       movem [sp+],r10
+       movem [$sp+],$r10
 2:
        .section .fixup,\"ax\"
 3:
-       move.d [sp],r10
-       addq 12*4,r10
-       move.d r10,[sp]
-       clear.d r10
+       move.d [$sp],$r10
+       addq 12*4,$r10
+       move.d $r10,[$sp]
+       clear.d $r10
        jump 0b
 
 4:
-       movem [sp+],r10
-       addq 12*4,r10
-       addq 12*4,r12
+       movem [$sp+],$r10
+       addq 12*4,$r10
+       addq 12*4,$r12
        jump 2b
 
        .previous
index 6ac9f25e1b3e1423a74c4c6b7a42d3458ede86ca..2431ee1433bd09b34fc4a1d3602c413b31b41d7c 100644 (file)
@@ -1,13 +1,19 @@
 /*
  * linux/arch/cris/mm/extable.c
+ *
+ * $Log: extable.c,v $
+ * Revision 1.3  2001/09/27 13:52:40  bjornw
+ * Harmonize underscore-ness with other parts
+ *
+ *
  */
 
 #include <linux/config.h>
 #include <linux/module.h>
 #include <asm/uaccess.h>
 
-extern const struct exception_table_entry _start___ex_table[];
-extern const struct exception_table_entry _stop___ex_table[];
+extern const struct exception_table_entry __start___ex_table[];
+extern const struct exception_table_entry __stop___ex_table[];
 
 static inline unsigned long
 search_one_table(const struct exception_table_entry *first,
@@ -37,7 +43,7 @@ search_exception_table(unsigned long addr)
 
 #ifndef CONFIG_MODULES
        /* There is only the kernel to search.  */
-       return search_one_table(_start___ex_table, _stop___ex_table-1, addr);
+       return search_one_table(__start___ex_table, __stop___ex_table-1, addr);
 #else
        /* The kernel is the last "module" -- no need to treat it special.  */
        struct module *mp;
index 0a478648fa2ac1cdaab0af499bcf0cb2816eaeb7..a0f2f0470d620ba3892355120fb76819c14d2cfb 100644 (file)
@@ -738,6 +738,7 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_SCANNER is not set
 # CONFIG_USB_MICROTEK is not set
+# CONFIG_USB_HPUSBSCSI is not set
 
 #
 # USB Multimedia devices
index 39b43802893cd22520ada5a5f6049b9e82535263..582c0d5b240d1be600b554193cee6bbcee876a7f 100644 (file)
@@ -620,6 +620,7 @@ ENTRY(sys_call_table)
        .long SYMBOL_NAME(sys_fcntl64)
        .long SYMBOL_NAME(sys_ni_syscall)       /* reserved for TUX */
        .long SYMBOL_NAME(sys_ni_syscall)       /* Reserved for Security */
+       .long SYMBOL_NAME(sys_gettid)
 
        .rept NR_syscalls-(.-sys_call_table)/4
                .long SYMBOL_NAME(sys_ni_syscall)
index 96589a280920712ec6f33beea73f7af90889014a..c41b0881d24f93c8e32484e6c20e7a02cc84d3f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.enet.c 1.6 05/17/01 18:14:19 cort
+ * BK Id: SCCS/s.enet.c 1.9 09/14/01 18:01:16 trini
  */
 /*
  * Ethernet driver for Motorola MPC8260.
@@ -13,7 +13,7 @@
  * This version of the driver is somewhat selectable for the different
  * processor/board combinations.  It works for the boards I know about
  * now, and should be easily modified to include others.  Some of the
- * configuration information is contained in "commproc.h" and the
+ * configuration information is contained in <asm/commproc.h> and the
  * remainder is here.
  *
  * Buffer descriptors are kept in the CPM dual port RAM, and the frame
index 2e27a6e26c197364078b489dd815a6dc7f2c4e4a..44901be733ebf36ef0daf869d6c8b378b7b726e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.commproc.c 1.11 06/15/01 13:00:20 paulus
+ * BK Id: SCCS/s.commproc.c 1.13 09/14/01 18:01:16 trini
  */
 
 /*
@@ -36,7 +36,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/8xx_immap.h>
-#include "commproc.h"
+#include <asm/commproc.h>
 
 static uint    dp_alloc_base;  /* Starting offset in DP ram */
 static uint    dp_alloc_top;   /* Max offset + 1 */
diff --git a/arch/ppc/8xx_io/commproc.h b/arch/ppc/8xx_io/commproc.h
deleted file mode 100644 (file)
index 5ed4f2a..0000000
+++ /dev/null
@@ -1,796 +0,0 @@
-/*
- * BK Id: SCCS/s.commproc.h 1.13 06/15/01 13:00:20 paulus
- */
-
-/*
- * MPC8xx Communication Processor Module.
- * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
- *
- * This file contains structures and information for the communication
- * processor channels.  Some CPM control and status is available
- * throught the MPC8xx internal memory map.  See immap.h for details.
- * This file only contains what I need for the moment, not the total
- * CPM capabilities.  I (or someone else) will add definitions as they
- * are needed.  -- Dan
- *
- * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
- * bytes of the DP RAM and relocates the I2C parameter area to the
- * IDMA1 space.  The remaining DP RAM is available for buffer descriptors
- * or other use.
- */
-#ifndef __CPM_8XX__
-#define __CPM_8XX__
-
-#include <linux/config.h>
-#include <asm/8xx_immap.h>
-
-/* CPM Command register.
-*/
-#define CPM_CR_RST     ((ushort)0x8000)
-#define CPM_CR_OPCODE  ((ushort)0x0f00)
-#define CPM_CR_CHAN    ((ushort)0x00f0)
-#define CPM_CR_FLG     ((ushort)0x0001)
-
-/* Some commands (there are more...later)
-*/
-#define CPM_CR_INIT_TRX                ((ushort)0x0000)
-#define CPM_CR_INIT_RX         ((ushort)0x0001)
-#define CPM_CR_INIT_TX         ((ushort)0x0002)
-#define CPM_CR_HUNT_MODE       ((ushort)0x0003)
-#define CPM_CR_STOP_TX         ((ushort)0x0004)
-#define CPM_CR_RESTART_TX      ((ushort)0x0006)
-#define CPM_CR_SET_GADDR       ((ushort)0x0008)
-
-/* Channel numbers.
-*/
-#define CPM_CR_CH_SCC1 ((ushort)0x0000)
-#define CPM_CR_CH_I2C  ((ushort)0x0001)        /* I2C and IDMA1 */
-#define CPM_CR_CH_SCC2 ((ushort)0x0004)
-#define CPM_CR_CH_SPI  ((ushort)0x0005)        /* SPI / IDMA2 / Timers */
-#define CPM_CR_CH_SCC3 ((ushort)0x0008)
-#define CPM_CR_CH_SMC1 ((ushort)0x0009)        /* SMC1 / DSP1 */
-#define CPM_CR_CH_SCC4 ((ushort)0x000c)
-#define CPM_CR_CH_SMC2 ((ushort)0x000d)        /* SMC2 / DSP2 */
-
-#define mk_cr_cmd(CH, CMD)     ((CMD << 8) | (CH << 4))
-
-/* The dual ported RAM is multi-functional.  Some areas can be (and are
- * being) used for microcode.  There is an area that can only be used
- * as data ram for buffer descriptors, which is all we use right now.
- * Currently the first 512 and last 256 bytes are used for microcode.
- */
-#define CPM_DATAONLY_BASE      ((uint)0x0800)
-#define CPM_DATAONLY_SIZE      ((uint)0x0700)
-#define CPM_DP_NOSPACE         ((uint)0x7fffffff)
-
-/* Export the base address of the communication processor registers
- * and dual port ram.
- */
-extern cpm8xx_t        *cpmp;          /* Pointer to comm processor */
-uint           m8xx_cpm_dpalloc(uint size);
-uint           m8xx_cpm_hostalloc(uint size);
-void           m8xx_cpm_setbrg(uint brg, uint rate);
-
-/* Buffer descriptors used by many of the CPM protocols.
-*/
-typedef struct cpm_buf_desc {
-       ushort  cbd_sc;         /* Status and Control */
-       ushort  cbd_datlen;     /* Data length in buffer */
-       uint    cbd_bufaddr;    /* Buffer address in host memory */
-} cbd_t;
-
-#define BD_SC_EMPTY    ((ushort)0x8000)        /* Receive is empty */
-#define BD_SC_READY    ((ushort)0x8000)        /* Transmit is ready */
-#define BD_SC_WRAP     ((ushort)0x2000)        /* Last buffer descriptor */
-#define BD_SC_INTRPT   ((ushort)0x1000)        /* Interrupt on change */
-#define BD_SC_LAST     ((ushort)0x0800)        /* Last buffer in frame */
-#define BD_SC_CM       ((ushort)0x0200)        /* Continous mode */
-#define BD_SC_ID       ((ushort)0x0100)        /* Rec'd too many idles */
-#define BD_SC_P                ((ushort)0x0100)        /* xmt preamble */
-#define BD_SC_BR       ((ushort)0x0020)        /* Break received */
-#define BD_SC_FR       ((ushort)0x0010)        /* Framing error */
-#define BD_SC_PR       ((ushort)0x0008)        /* Parity error */
-#define BD_SC_OV       ((ushort)0x0002)        /* Overrun */
-#define BD_SC_CD       ((ushort)0x0001)        /* ?? */
-
-/* Parameter RAM offsets.
-*/
-#define PROFF_SCC1     ((uint)0x0000)
-#define PROFF_IIC      ((uint)0x0080)
-#define PROFF_SCC2     ((uint)0x0100)
-#define PROFF_SCC3     ((uint)0x0200)
-#define PROFF_SMC1     ((uint)0x0280)
-#define PROFF_SCC4     ((uint)0x0300)
-#define PROFF_SMC2     ((uint)0x0380)
-
-/* Define enough so I can at least use the serial port as a UART.
- * The MBX uses SMC1 as the host serial port.
- */
-typedef struct smc_uart {
-       ushort  smc_rbase;      /* Rx Buffer descriptor base address */
-       ushort  smc_tbase;      /* Tx Buffer descriptor base address */
-       u_char  smc_rfcr;       /* Rx function code */
-       u_char  smc_tfcr;       /* Tx function code */
-       ushort  smc_mrblr;      /* Max receive buffer length */
-       uint    smc_rstate;     /* Internal */
-       uint    smc_idp;        /* Internal */
-       ushort  smc_rbptr;      /* Internal */
-       ushort  smc_ibc;        /* Internal */
-       uint    smc_rxtmp;      /* Internal */
-       uint    smc_tstate;     /* Internal */
-       uint    smc_tdp;        /* Internal */
-       ushort  smc_tbptr;      /* Internal */
-       ushort  smc_tbc;        /* Internal */
-       uint    smc_txtmp;      /* Internal */
-       ushort  smc_maxidl;     /* Maximum idle characters */
-       ushort  smc_tmpidl;     /* Temporary idle counter */
-       ushort  smc_brklen;     /* Last received break length */
-       ushort  smc_brkec;      /* rcv'd break condition counter */
-       ushort  smc_brkcr;      /* xmt break count register */
-       ushort  smc_rmask;      /* Temporary bit mask */
-} smc_uart_t;
-
-/* Function code bits.
-*/
-#define SMC_EB ((u_char)0x10)  /* Set big endian byte order */
-
-/* SMC uart mode register.
-*/
-#define        SMCMR_REN       ((ushort)0x0001)
-#define SMCMR_TEN      ((ushort)0x0002)
-#define SMCMR_DM       ((ushort)0x000c)
-#define SMCMR_SM_GCI   ((ushort)0x0000)
-#define SMCMR_SM_UART  ((ushort)0x0020)
-#define SMCMR_SM_TRANS ((ushort)0x0030)
-#define SMCMR_SM_MASK  ((ushort)0x0030)
-#define SMCMR_PM_EVEN  ((ushort)0x0100)        /* Even parity, else odd */
-#define SMCMR_REVD     SMCMR_PM_EVEN
-#define SMCMR_PEN      ((ushort)0x0200)        /* Parity enable */
-#define SMCMR_BS       SMCMR_PEN
-#define SMCMR_SL       ((ushort)0x0400)        /* Two stops, else one */
-#define SMCR_CLEN_MASK ((ushort)0x7800)        /* Character length */
-#define smcr_mk_clen(C)        (((C) << 11) & SMCR_CLEN_MASK)
-
-/* SMC2 as Centronics parallel printer.  It is half duplex, in that
- * it can only receive or transmit.  The parameter ram values for
- * each direction are either unique or properly overlap, so we can
- * include them in one structure.
- */
-typedef struct smc_centronics {
-       ushort  scent_rbase;
-       ushort  scent_tbase;
-       u_char  scent_cfcr;
-       u_char  scent_smask;
-       ushort  scent_mrblr;
-       uint    scent_rstate;
-       uint    scent_r_ptr;
-       ushort  scent_rbptr;
-       ushort  scent_r_cnt;
-       uint    scent_rtemp;
-       uint    scent_tstate;
-       uint    scent_t_ptr;
-       ushort  scent_tbptr;
-       ushort  scent_t_cnt;
-       uint    scent_ttemp;
-       ushort  scent_max_sl;
-       ushort  scent_sl_cnt;
-       ushort  scent_character1;
-       ushort  scent_character2;
-       ushort  scent_character3;
-       ushort  scent_character4;
-       ushort  scent_character5;
-       ushort  scent_character6;
-       ushort  scent_character7;
-       ushort  scent_character8;
-       ushort  scent_rccm;
-       ushort  scent_rccr;
-} smc_cent_t;
-
-/* Centronics Status Mask Register.
-*/
-#define SMC_CENT_F     ((u_char)0x08)
-#define SMC_CENT_PE    ((u_char)0x04)
-#define SMC_CENT_S     ((u_char)0x02)
-
-/* SMC Event and Mask register.
-*/
-#define        SMCM_BRKE       ((unsigned char)0x40)   /* When in UART Mode */
-#define        SMCM_BRK        ((unsigned char)0x10)   /* When in UART Mode */
-#define        SMCM_TXE        ((unsigned char)0x10)   /* When in Transparent Mode */
-#define        SMCM_BSY        ((unsigned char)0x04)
-#define        SMCM_TX         ((unsigned char)0x02)
-#define        SMCM_RX         ((unsigned char)0x01)
-
-/* Baud rate generators.
-*/
-#define CPM_BRG_RST            ((uint)0x00020000)
-#define CPM_BRG_EN             ((uint)0x00010000)
-#define CPM_BRG_EXTC_INT       ((uint)0x00000000)
-#define CPM_BRG_EXTC_CLK2      ((uint)0x00004000)
-#define CPM_BRG_EXTC_CLK6      ((uint)0x00008000)
-#define CPM_BRG_ATB            ((uint)0x00002000)
-#define CPM_BRG_CD_MASK                ((uint)0x00001ffe)
-#define CPM_BRG_DIV16          ((uint)0x00000001)
-
-/* SCCs.
-*/
-#define SCC_GSMRH_IRP          ((uint)0x00040000)
-#define SCC_GSMRH_GDE          ((uint)0x00010000)
-#define SCC_GSMRH_TCRC_CCITT   ((uint)0x00008000)
-#define SCC_GSMRH_TCRC_BISYNC  ((uint)0x00004000)
-#define SCC_GSMRH_TCRC_HDLC    ((uint)0x00000000)
-#define SCC_GSMRH_REVD         ((uint)0x00002000)
-#define SCC_GSMRH_TRX          ((uint)0x00001000)
-#define SCC_GSMRH_TTX          ((uint)0x00000800)
-#define SCC_GSMRH_CDP          ((uint)0x00000400)
-#define SCC_GSMRH_CTSP         ((uint)0x00000200)
-#define SCC_GSMRH_CDS          ((uint)0x00000100)
-#define SCC_GSMRH_CTSS         ((uint)0x00000080)
-#define SCC_GSMRH_TFL          ((uint)0x00000040)
-#define SCC_GSMRH_RFW          ((uint)0x00000020)
-#define SCC_GSMRH_TXSY         ((uint)0x00000010)
-#define SCC_GSMRH_SYNL16       ((uint)0x0000000c)
-#define SCC_GSMRH_SYNL8                ((uint)0x00000008)
-#define SCC_GSMRH_SYNL4                ((uint)0x00000004)
-#define SCC_GSMRH_RTSM         ((uint)0x00000002)
-#define SCC_GSMRH_RSYN         ((uint)0x00000001)
-
-#define SCC_GSMRL_SIR          ((uint)0x80000000)      /* SCC2 only */
-#define SCC_GSMRL_EDGE_NONE    ((uint)0x60000000)
-#define SCC_GSMRL_EDGE_NEG     ((uint)0x40000000)
-#define SCC_GSMRL_EDGE_POS     ((uint)0x20000000)
-#define SCC_GSMRL_EDGE_BOTH    ((uint)0x00000000)
-#define SCC_GSMRL_TCI          ((uint)0x10000000)
-#define SCC_GSMRL_TSNC_3       ((uint)0x0c000000)
-#define SCC_GSMRL_TSNC_4       ((uint)0x08000000)
-#define SCC_GSMRL_TSNC_14      ((uint)0x04000000)
-#define SCC_GSMRL_TSNC_INF     ((uint)0x00000000)
-#define SCC_GSMRL_RINV         ((uint)0x02000000)
-#define SCC_GSMRL_TINV         ((uint)0x01000000)
-#define SCC_GSMRL_TPL_128      ((uint)0x00c00000)
-#define SCC_GSMRL_TPL_64       ((uint)0x00a00000)
-#define SCC_GSMRL_TPL_48       ((uint)0x00800000)
-#define SCC_GSMRL_TPL_32       ((uint)0x00600000)
-#define SCC_GSMRL_TPL_16       ((uint)0x00400000)
-#define SCC_GSMRL_TPL_8                ((uint)0x00200000)
-#define SCC_GSMRL_TPL_NONE     ((uint)0x00000000)
-#define SCC_GSMRL_TPP_ALL1     ((uint)0x00180000)
-#define SCC_GSMRL_TPP_01       ((uint)0x00100000)
-#define SCC_GSMRL_TPP_10       ((uint)0x00080000)
-#define SCC_GSMRL_TPP_ZEROS    ((uint)0x00000000)
-#define SCC_GSMRL_TEND         ((uint)0x00040000)
-#define SCC_GSMRL_TDCR_32      ((uint)0x00030000)
-#define SCC_GSMRL_TDCR_16      ((uint)0x00020000)
-#define SCC_GSMRL_TDCR_8       ((uint)0x00010000)
-#define SCC_GSMRL_TDCR_1       ((uint)0x00000000)
-#define SCC_GSMRL_RDCR_32      ((uint)0x0000c000)
-#define SCC_GSMRL_RDCR_16      ((uint)0x00008000)
-#define SCC_GSMRL_RDCR_8       ((uint)0x00004000)
-#define SCC_GSMRL_RDCR_1       ((uint)0x00000000)
-#define SCC_GSMRL_RENC_DFMAN   ((uint)0x00003000)
-#define SCC_GSMRL_RENC_MANCH   ((uint)0x00002000)
-#define SCC_GSMRL_RENC_FM0     ((uint)0x00001000)
-#define SCC_GSMRL_RENC_NRZI    ((uint)0x00000800)
-#define SCC_GSMRL_RENC_NRZ     ((uint)0x00000000)
-#define SCC_GSMRL_TENC_DFMAN   ((uint)0x00000600)
-#define SCC_GSMRL_TENC_MANCH   ((uint)0x00000400)
-#define SCC_GSMRL_TENC_FM0     ((uint)0x00000200)
-#define SCC_GSMRL_TENC_NRZI    ((uint)0x00000100)
-#define SCC_GSMRL_TENC_NRZ     ((uint)0x00000000)
-#define SCC_GSMRL_DIAG_LE      ((uint)0x000000c0)      /* Loop and echo */
-#define SCC_GSMRL_DIAG_ECHO    ((uint)0x00000080)
-#define SCC_GSMRL_DIAG_LOOP    ((uint)0x00000040)
-#define SCC_GSMRL_DIAG_NORM    ((uint)0x00000000)
-#define SCC_GSMRL_ENR          ((uint)0x00000020)
-#define SCC_GSMRL_ENT          ((uint)0x00000010)
-#define SCC_GSMRL_MODE_ENET    ((uint)0x0000000c)
-#define SCC_GSMRL_MODE_DDCMP   ((uint)0x00000009)
-#define SCC_GSMRL_MODE_BISYNC  ((uint)0x00000008)
-#define SCC_GSMRL_MODE_V14     ((uint)0x00000007)
-#define SCC_GSMRL_MODE_AHDLC   ((uint)0x00000006)
-#define SCC_GSMRL_MODE_PROFIBUS        ((uint)0x00000005)
-#define SCC_GSMRL_MODE_UART    ((uint)0x00000004)
-#define SCC_GSMRL_MODE_SS7     ((uint)0x00000003)
-#define SCC_GSMRL_MODE_ATALK   ((uint)0x00000002)
-#define SCC_GSMRL_MODE_HDLC    ((uint)0x00000000)
-
-#define SCC_TODR_TOD           ((ushort)0x8000)
-
-/* SCC Event and Mask register.
-*/
-#define        SCCM_TXE        ((unsigned char)0x10)
-#define        SCCM_BSY        ((unsigned char)0x04)
-#define        SCCM_TX         ((unsigned char)0x02)
-#define        SCCM_RX         ((unsigned char)0x01)
-
-typedef struct scc_param {
-       ushort  scc_rbase;      /* Rx Buffer descriptor base address */
-       ushort  scc_tbase;      /* Tx Buffer descriptor base address */
-       u_char  scc_rfcr;       /* Rx function code */
-       u_char  scc_tfcr;       /* Tx function code */
-       ushort  scc_mrblr;      /* Max receive buffer length */
-       uint    scc_rstate;     /* Internal */
-       uint    scc_idp;        /* Internal */
-       ushort  scc_rbptr;      /* Internal */
-       ushort  scc_ibc;        /* Internal */
-       uint    scc_rxtmp;      /* Internal */
-       uint    scc_tstate;     /* Internal */
-       uint    scc_tdp;        /* Internal */
-       ushort  scc_tbptr;      /* Internal */
-       ushort  scc_tbc;        /* Internal */
-       uint    scc_txtmp;      /* Internal */
-       uint    scc_rcrc;       /* Internal */
-       uint    scc_tcrc;       /* Internal */
-} sccp_t;
-
-/* Function code bits.
-*/
-#define SCC_EB ((u_char)0x10)  /* Set big endian byte order */
-
-/* CPM Ethernet through SCCx.
- */
-typedef struct scc_enet {
-       sccp_t  sen_genscc;
-       uint    sen_cpres;      /* Preset CRC */
-       uint    sen_cmask;      /* Constant mask for CRC */
-       uint    sen_crcec;      /* CRC Error counter */
-       uint    sen_alec;       /* alignment error counter */
-       uint    sen_disfc;      /* discard frame counter */
-       ushort  sen_pads;       /* Tx short frame pad character */
-       ushort  sen_retlim;     /* Retry limit threshold */
-       ushort  sen_retcnt;     /* Retry limit counter */
-       ushort  sen_maxflr;     /* maximum frame length register */
-       ushort  sen_minflr;     /* minimum frame length register */
-       ushort  sen_maxd1;      /* maximum DMA1 length */
-       ushort  sen_maxd2;      /* maximum DMA2 length */
-       ushort  sen_maxd;       /* Rx max DMA */
-       ushort  sen_dmacnt;     /* Rx DMA counter */
-       ushort  sen_maxb;       /* Max BD byte count */
-       ushort  sen_gaddr1;     /* Group address filter */
-       ushort  sen_gaddr2;
-       ushort  sen_gaddr3;
-       ushort  sen_gaddr4;
-       uint    sen_tbuf0data0; /* Save area 0 - current frame */
-       uint    sen_tbuf0data1; /* Save area 1 - current frame */
-       uint    sen_tbuf0rba;   /* Internal */
-       uint    sen_tbuf0crc;   /* Internal */
-       ushort  sen_tbuf0bcnt;  /* Internal */
-       ushort  sen_paddrh;     /* physical address (MSB) */
-       ushort  sen_paddrm;
-       ushort  sen_paddrl;     /* physical address (LSB) */
-       ushort  sen_pper;       /* persistence */
-       ushort  sen_rfbdptr;    /* Rx first BD pointer */
-       ushort  sen_tfbdptr;    /* Tx first BD pointer */
-       ushort  sen_tlbdptr;    /* Tx last BD pointer */
-       uint    sen_tbuf1data0; /* Save area 0 - current frame */
-       uint    sen_tbuf1data1; /* Save area 1 - current frame */
-       uint    sen_tbuf1rba;   /* Internal */
-       uint    sen_tbuf1crc;   /* Internal */
-       ushort  sen_tbuf1bcnt;  /* Internal */
-       ushort  sen_txlen;      /* Tx Frame length counter */
-       ushort  sen_iaddr1;     /* Individual address filter */
-       ushort  sen_iaddr2;
-       ushort  sen_iaddr3;
-       ushort  sen_iaddr4;
-       ushort  sen_boffcnt;    /* Backoff counter */
-
-       /* NOTE: Some versions of the manual have the following items
-        * incorrectly documented.  Below is the proper order.
-        */
-       ushort  sen_taddrh;     /* temp address (MSB) */
-       ushort  sen_taddrm;
-       ushort  sen_taddrl;     /* temp address (LSB) */
-} scc_enet_t;
-
-/***  MBX  ************************************************************/
-
-#ifdef CONFIG_MBX
-/* Bits in parallel I/O port registers that have to be set/cleared
- * to configure the pins for SCC1 use.  The TCLK and RCLK seem unique
- * to the MBX860 board.  Any two of the four available clocks could be
- * used, and the MPC860 cookbook manual has an example using different
- * clock pins.
- */
-#define PA_ENET_RXD    ((ushort)0x0001)
-#define PA_ENET_TXD    ((ushort)0x0002)
-#define PA_ENET_TCLK   ((ushort)0x0200)
-#define PA_ENET_RCLK   ((ushort)0x0800)
-#define PC_ENET_TENA   ((ushort)0x0001)
-#define PC_ENET_CLSN   ((ushort)0x0010)
-#define PC_ENET_RENA   ((ushort)0x0020)
-
-/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
- * SCC1.  Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
- */
-#define SICR_ENET_MASK ((uint)0x000000ff)
-#define SICR_ENET_CLKRT        ((uint)0x0000003d)
-#endif /* CONFIG_MBX */
-
-/***  RPXLITE  ********************************************************/
-
-#ifdef CONFIG_RPXLITE
-/* This ENET stuff is for the MPC850 with ethernet on SCC2.  Some of
- * this may be unique to the RPX-Lite configuration.
- * Note TENA is on Port B.
- */
-#define PA_ENET_RXD    ((ushort)0x0004)
-#define PA_ENET_TXD    ((ushort)0x0008)
-#define PA_ENET_TCLK   ((ushort)0x0200)
-#define PA_ENET_RCLK   ((ushort)0x0800)
-#define PB_ENET_TENA   ((uint)0x00002000)
-#define PC_ENET_CLSN   ((ushort)0x0040)
-#define PC_ENET_RENA   ((ushort)0x0080)
-
-#define SICR_ENET_MASK ((uint)0x0000ff00)
-#define SICR_ENET_CLKRT        ((uint)0x00003d00)
-#endif /* CONFIG_RPXLITE */
-
-/***  BSEIP  **********************************************************/
-
-#ifdef CONFIG_BSEIP
-/* This ENET stuff is for the MPC823 with ethernet on SCC2.
- * This is unique to the BSE ip-Engine board.
- */
-#define PA_ENET_RXD    ((ushort)0x0004)
-#define PA_ENET_TXD    ((ushort)0x0008)
-#define PA_ENET_TCLK   ((ushort)0x0100)
-#define PA_ENET_RCLK   ((ushort)0x0200)
-#define PB_ENET_TENA   ((uint)0x00002000)
-#define PC_ENET_CLSN   ((ushort)0x0040)
-#define PC_ENET_RENA   ((ushort)0x0080)
-
-/* BSE uses port B and C bits for PHY control also.
-*/
-#define PB_BSE_POWERUP ((uint)0x00000004)
-#define PB_BSE_FDXDIS  ((uint)0x00008000)
-#define PC_BSE_LOOPBACK        ((ushort)0x0800)
-
-#define SICR_ENET_MASK ((uint)0x0000ff00)
-#define SICR_ENET_CLKRT        ((uint)0x00002c00)
-#endif /* CONFIG_BSEIP */
-
-/***  RPXCLASSIC  *****************************************************/
-
-#ifdef CONFIG_RPXCLASSIC
-/* Bits in parallel I/O port registers that have to be set/cleared
- * to configure the pins for SCC1 use.
- */
-#define PA_ENET_RXD    ((ushort)0x0001)
-#define PA_ENET_TXD    ((ushort)0x0002)
-#define PA_ENET_TCLK   ((ushort)0x0200)
-#define PA_ENET_RCLK   ((ushort)0x0800)
-#define PB_ENET_TENA   ((uint)0x00001000)
-#define PC_ENET_CLSN   ((ushort)0x0010)
-#define PC_ENET_RENA   ((ushort)0x0020)
-
-/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
- * SCC1.  Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
- */
-#define SICR_ENET_MASK ((uint)0x000000ff)
-#define SICR_ENET_CLKRT        ((uint)0x0000003d)
-#endif /* CONFIG_RPXCLASSIC */
-
-/***  TQM823L, TQM850L  ***********************************************/
-
-#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L)
-/* Bits in parallel I/O port registers that have to be set/cleared
- * to configure the pins for SCC1 use.
- */
-#define PA_ENET_RXD    ((ushort)0x0004)        /* PA 13 */
-#define PA_ENET_TXD    ((ushort)0x0008)        /* PA 12 */
-#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
-#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
-
-#define PB_ENET_TENA   ((uint)0x00002000)      /* PB 18 */
-
-#define PC_ENET_CLSN   ((ushort)0x0040)        /* PC  9 */
-#define PC_ENET_RENA   ((ushort)0x0080)        /* PC  8 */
-
-/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
- * SCC2.  Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
- */
-#define SICR_ENET_MASK ((uint)0x0000ff00)
-#define SICR_ENET_CLKRT        ((uint)0x00002600)
-#endif /* CONFIG_TQM823L, CONFIG_TQM850L */
-
-/***  FPS850L  *********************************************************/
-
-#ifdef CONFIG_FPS850L
-/* Bits in parallel I/O port registers that have to be set/cleared
- * to configure the pins for SCC1 use.
- */
-#define PA_ENET_RXD    ((ushort)0x0004)        /* PA 13 */
-#define PA_ENET_TXD    ((ushort)0x0008)        /* PA 12 */
-#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
-#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
-
-#define PC_ENET_TENA   ((ushort)0x0002)        /* PC 14 */
-#define PC_ENET_CLSN   ((ushort)0x0040)        /* PC  9 */
-#define PC_ENET_RENA   ((ushort)0x0080)        /* PC  8 */
-
-/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
- * SCC2.  Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
- */
-#define SICR_ENET_MASK ((uint)0x0000ff00)
-#define SICR_ENET_CLKRT        ((uint)0x00002600)
-#endif /* CONFIG_FPS850L */
-
-/***  TQM860L  ********************************************************/
-
-#ifdef CONFIG_TQM860L
-/* Bits in parallel I/O port registers that have to be set/cleared
- * to configure the pins for SCC1 use.
- */
-#define PA_ENET_RXD    ((ushort)0x0001)        /* PA 15 */
-#define PA_ENET_TXD    ((ushort)0x0002)        /* PA 14 */
-#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
-#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
-
-#define PC_ENET_TENA   ((ushort)0x0001)        /* PC 15 */
-#define PC_ENET_CLSN   ((ushort)0x0010)        /* PC 11 */
-#define PC_ENET_RENA   ((ushort)0x0020)        /* PC 10 */
-
-/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
- * SCC1.  Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
- */
-#define SICR_ENET_MASK ((uint)0x000000ff)
-#define SICR_ENET_CLKRT        ((uint)0x00000026)
-#endif /* CONFIG_TQM860L */
-
-/***  SPD823TS  *******************************************************/
-
-#ifdef CONFIG_SPD823TS
-/* Bits in parallel I/O port registers that have to be set/cleared
- * to configure the pins for SCC2 use.
- */
-#define PA_ENET_MDC    ((ushort)0x0001)        /* PA 15 !!! */
-#define PA_ENET_MDIO   ((ushort)0x0002)        /* PA 14 !!! */
-#define PA_ENET_RXD    ((ushort)0x0004)        /* PA 13 */
-#define PA_ENET_TXD    ((ushort)0x0008)        /* PA 12 */
-#define PA_ENET_RCLK   ((ushort)0x0200)        /* PA  6 */
-#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
-
-#define PB_ENET_TENA   ((uint)0x00002000)      /* PB 18 */
-
-#define PC_ENET_CLSN   ((ushort)0x0040)        /* PC  9 */
-#define PC_ENET_RENA   ((ushort)0x0080)        /* PC  8 */
-#define        PC_ENET_RESET   ((ushort)0x0100)        /* PC  7 !!! */
-
-/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
- * SCC2.  Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
- */
-#define SICR_ENET_MASK ((uint)0x0000ff00)
-#define SICR_ENET_CLKRT        ((uint)0x00002E00)
-#endif /* CONFIG_SPD823TS */
-
-
-/***  SM850  *********************************************************/
-
-/* The SM850 Service Module uses SCC2 for IrDA and SCC3 for Ethernet */
-
-#ifdef CONFIG_SM850
-#define PB_ENET_RXD    ((uint)0x00000004)      /* PB 29 */
-#define PB_ENET_TXD    ((uint)0x00000002)      /* PB 30 */
-#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
-#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
-
-#define PC_ENET_LBK    ((ushort)0x0008)        /* PC 12 */
-#define PC_ENET_TENA   ((ushort)0x0004)        /* PC 13 */
-
-#define PC_ENET_RENA   ((ushort)0x0800)        /* PC  4 */
-#define PC_ENET_CLSN   ((ushort)0x0400)        /* PC  5 */
-
-/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
- * SCC3.  Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
- */
-#define SICR_ENET_MASK ((uint)0x00FF0000)
-#define SICR_ENET_CLKRT        ((uint)0x00260000)
-#endif /* CONFIG_SM850 */
-
-/*********************************************************************/
-
-/* SCC Event register as used by Ethernet.
-*/
-#define SCCE_ENET_GRA  ((ushort)0x0080)        /* Graceful stop complete */
-#define SCCE_ENET_TXE  ((ushort)0x0010)        /* Transmit Error */
-#define SCCE_ENET_RXF  ((ushort)0x0008)        /* Full frame received */
-#define SCCE_ENET_BSY  ((ushort)0x0004)        /* All incoming buffers full */
-#define SCCE_ENET_TXB  ((ushort)0x0002)        /* A buffer was transmitted */
-#define SCCE_ENET_RXB  ((ushort)0x0001)        /* A buffer was received */
-
-/* SCC Mode Register (PMSR) as used by Ethernet.
-*/
-#define SCC_PMSR_HBC   ((ushort)0x8000)        /* Enable heartbeat */
-#define SCC_PMSR_FC    ((ushort)0x4000)        /* Force collision */
-#define SCC_PMSR_RSH   ((ushort)0x2000)        /* Receive short frames */
-#define SCC_PMSR_IAM   ((ushort)0x1000)        /* Check individual hash */
-#define SCC_PMSR_ENCRC ((ushort)0x0800)        /* Ethernet CRC mode */
-#define SCC_PMSR_PRO   ((ushort)0x0200)        /* Promiscuous mode */
-#define SCC_PMSR_BRO   ((ushort)0x0100)        /* Catch broadcast pkts */
-#define SCC_PMSR_SBT   ((ushort)0x0080)        /* Special backoff timer */
-#define SCC_PMSR_LPB   ((ushort)0x0040)        /* Set Loopback mode */
-#define SCC_PMSR_SIP   ((ushort)0x0020)        /* Sample Input Pins */
-#define SCC_PMSR_LCW   ((ushort)0x0010)        /* Late collision window */
-#define SCC_PMSR_NIB22 ((ushort)0x000a)        /* Start frame search */
-#define SCC_PMSR_FDE   ((ushort)0x0001)        /* Full duplex enable */
-
-/* Buffer descriptor control/status used by Ethernet receive.
-*/
-#define BD_ENET_RX_EMPTY       ((ushort)0x8000)
-#define BD_ENET_RX_WRAP                ((ushort)0x2000)
-#define BD_ENET_RX_INTR                ((ushort)0x1000)
-#define BD_ENET_RX_LAST                ((ushort)0x0800)
-#define BD_ENET_RX_FIRST       ((ushort)0x0400)
-#define BD_ENET_RX_MISS                ((ushort)0x0100)
-#define BD_ENET_RX_LG          ((ushort)0x0020)
-#define BD_ENET_RX_NO          ((ushort)0x0010)
-#define BD_ENET_RX_SH          ((ushort)0x0008)
-#define BD_ENET_RX_CR          ((ushort)0x0004)
-#define BD_ENET_RX_OV          ((ushort)0x0002)
-#define BD_ENET_RX_CL          ((ushort)0x0001)
-#define BD_ENET_RX_STATS       ((ushort)0x013f)        /* All status bits */
-
-/* Buffer descriptor control/status used by Ethernet transmit.
-*/
-#define BD_ENET_TX_READY       ((ushort)0x8000)
-#define BD_ENET_TX_PAD         ((ushort)0x4000)
-#define BD_ENET_TX_WRAP                ((ushort)0x2000)
-#define BD_ENET_TX_INTR                ((ushort)0x1000)
-#define BD_ENET_TX_LAST                ((ushort)0x0800)
-#define BD_ENET_TX_TC          ((ushort)0x0400)
-#define BD_ENET_TX_DEF         ((ushort)0x0200)
-#define BD_ENET_TX_HB          ((ushort)0x0100)
-#define BD_ENET_TX_LC          ((ushort)0x0080)
-#define BD_ENET_TX_RL          ((ushort)0x0040)
-#define BD_ENET_TX_RCMASK      ((ushort)0x003c)
-#define BD_ENET_TX_UN          ((ushort)0x0002)
-#define BD_ENET_TX_CSL         ((ushort)0x0001)
-#define BD_ENET_TX_STATS       ((ushort)0x03ff)        /* All status bits */
-
-/* SCC as UART
-*/
-typedef struct scc_uart {
-       sccp_t  scc_genscc;
-       uint    scc_res1;       /* Reserved */
-       uint    scc_res2;       /* Reserved */
-       ushort  scc_maxidl;     /* Maximum idle chars */
-       ushort  scc_idlc;       /* temp idle counter */
-       ushort  scc_brkcr;      /* Break count register */
-       ushort  scc_parec;      /* receive parity error counter */
-       ushort  scc_frmec;      /* receive framing error counter */
-       ushort  scc_nosec;      /* receive noise counter */
-       ushort  scc_brkec;      /* receive break condition counter */
-       ushort  scc_brkln;      /* last received break length */
-       ushort  scc_uaddr1;     /* UART address character 1 */
-       ushort  scc_uaddr2;     /* UART address character 2 */
-       ushort  scc_rtemp;      /* Temp storage */
-       ushort  scc_toseq;      /* Transmit out of sequence char */
-       ushort  scc_char1;      /* control character 1 */
-       ushort  scc_char2;      /* control character 2 */
-       ushort  scc_char3;      /* control character 3 */
-       ushort  scc_char4;      /* control character 4 */
-       ushort  scc_char5;      /* control character 5 */
-       ushort  scc_char6;      /* control character 6 */
-       ushort  scc_char7;      /* control character 7 */
-       ushort  scc_char8;      /* control character 8 */
-       ushort  scc_rccm;       /* receive control character mask */
-       ushort  scc_rccr;       /* receive control character register */
-       ushort  scc_rlbc;       /* receive last break character */
-} scc_uart_t;
-
-/* SCC Event and Mask registers when it is used as a UART.
-*/
-#define UART_SCCM_GLR          ((ushort)0x1000)
-#define UART_SCCM_GLT          ((ushort)0x0800)
-#define UART_SCCM_AB           ((ushort)0x0200)
-#define UART_SCCM_IDL          ((ushort)0x0100)
-#define UART_SCCM_GRA          ((ushort)0x0080)
-#define UART_SCCM_BRKE         ((ushort)0x0040)
-#define UART_SCCM_BRKS         ((ushort)0x0020)
-#define UART_SCCM_CCR          ((ushort)0x0008)
-#define UART_SCCM_BSY          ((ushort)0x0004)
-#define UART_SCCM_TX           ((ushort)0x0002)
-#define UART_SCCM_RX           ((ushort)0x0001)
-
-/* The SCC PMSR when used as a UART.
-*/
-#define SCU_PMSR_FLC           ((ushort)0x8000)
-#define SCU_PMSR_SL            ((ushort)0x4000)
-#define SCU_PMSR_CL            ((ushort)0x3000)
-#define SCU_PMSR_UM            ((ushort)0x0c00)
-#define SCU_PMSR_FRZ           ((ushort)0x0200)
-#define SCU_PMSR_RZS           ((ushort)0x0100)
-#define SCU_PMSR_SYN           ((ushort)0x0080)
-#define SCU_PMSR_DRT           ((ushort)0x0040)
-#define SCU_PMSR_PEN           ((ushort)0x0010)
-#define SCU_PMSR_RPM           ((ushort)0x000c)
-#define SCU_PMSR_REVP          ((ushort)0x0008)
-#define SCU_PMSR_TPM           ((ushort)0x0003)
-#define SCU_PMSR_TEVP          ((ushort)0x0003)
-
-/* CPM Transparent mode SCC.
- */
-typedef struct scc_trans {
-       sccp_t  st_genscc;
-       uint    st_cpres;       /* Preset CRC */
-       uint    st_cmask;       /* Constant mask for CRC */
-} scc_trans_t;
-
-#define BD_SCC_TX_LAST         ((ushort)0x0800)
-
-/* IIC parameter RAM.
-*/
-typedef struct iic {
-       ushort  iic_rbase;      /* Rx Buffer descriptor base address */
-       ushort  iic_tbase;      /* Tx Buffer descriptor base address */
-       u_char  iic_rfcr;       /* Rx function code */
-       u_char  iic_tfcr;       /* Tx function code */
-       ushort  iic_mrblr;      /* Max receive buffer length */
-       uint    iic_rstate;     /* Internal */
-       uint    iic_rdp;        /* Internal */
-       ushort  iic_rbptr;      /* Internal */
-       ushort  iic_rbc;        /* Internal */
-       uint    iic_rxtmp;      /* Internal */
-       uint    iic_tstate;     /* Internal */
-       uint    iic_tdp;        /* Internal */
-       ushort  iic_tbptr;      /* Internal */
-       ushort  iic_tbc;        /* Internal */
-       uint    iic_txtmp;      /* Internal */
-} iic_t;
-
-#define BD_IIC_START           ((ushort)0x0400)
-
-/* CPM interrupts.  There are nearly 32 interrupts generated by CPM
- * channels or devices.  All of these are presented to the PPC core
- * as a single interrupt.  The CPM interrupt handler dispatches its
- * own handlers, in a similar fashion to the PPC core handler.  We
- * use the table as defined in the manuals (i.e. no special high
- * priority and SCC1 == SCCa, etc...).
- */
-#define CPMVEC_NR              32
-#define        CPMVEC_PIO_PC15         ((ushort)0x1f)
-#define        CPMVEC_SCC1             ((ushort)0x1e)
-#define        CPMVEC_SCC2             ((ushort)0x1d)
-#define        CPMVEC_SCC3             ((ushort)0x1c)
-#define        CPMVEC_SCC4             ((ushort)0x1b)
-#define        CPMVEC_PIO_PC14         ((ushort)0x1a)
-#define        CPMVEC_TIMER1           ((ushort)0x19)
-#define        CPMVEC_PIO_PC13         ((ushort)0x18)
-#define        CPMVEC_PIO_PC12         ((ushort)0x17)
-#define        CPMVEC_SDMA_CB_ERR      ((ushort)0x16)
-#define CPMVEC_IDMA1           ((ushort)0x15)
-#define CPMVEC_IDMA2           ((ushort)0x14)
-#define CPMVEC_TIMER2          ((ushort)0x12)
-#define CPMVEC_RISCTIMER       ((ushort)0x11)
-#define CPMVEC_I2C             ((ushort)0x10)
-#define        CPMVEC_PIO_PC11         ((ushort)0x0f)
-#define        CPMVEC_PIO_PC10         ((ushort)0x0e)
-#define CPMVEC_TIMER3          ((ushort)0x0c)
-#define        CPMVEC_PIO_PC9          ((ushort)0x0b)
-#define        CPMVEC_PIO_PC8          ((ushort)0x0a)
-#define        CPMVEC_PIO_PC7          ((ushort)0x09)
-#define CPMVEC_TIMER4          ((ushort)0x07)
-#define        CPMVEC_PIO_PC6          ((ushort)0x06)
-#define        CPMVEC_SPI              ((ushort)0x05)
-#define        CPMVEC_SMC1             ((ushort)0x04)
-#define        CPMVEC_SMC2             ((ushort)0x03)
-#define        CPMVEC_PIO_PC5          ((ushort)0x02)
-#define        CPMVEC_PIO_PC4          ((ushort)0x01)
-#define        CPMVEC_ERROR            ((ushort)0x00)
-
-/* CPM interrupt configuration vector.
-*/
-#define        CICR_SCD_SCC4           ((uint)0x00c00000)      /* SCC4 @ SCCd */
-#define        CICR_SCC_SCC3           ((uint)0x00200000)      /* SCC3 @ SCCc */
-#define        CICR_SCB_SCC2           ((uint)0x00040000)      /* SCC2 @ SCCb */
-#define        CICR_SCA_SCC1           ((uint)0x00000000)      /* SCC1 @ SCCa */
-#define CICR_IRL_MASK          ((uint)0x0000e000)      /* Core interrrupt */
-#define CICR_HP_MASK           ((uint)0x00001f00)      /* Hi-pri int. */
-#define CICR_IEN               ((uint)0x00000080)      /* Int. enable */
-#define CICR_SPS               ((uint)0x00000001)      /* SCC Spread */
-
-extern void cpm_install_handler(int vec, 
-               void (*handler)(void *, struct pt_regs *regs), void *dev_id);
-extern void cpm_free_handler(int vec);
-
-#endif /* __CPM_8XX__ */
index 52f7a52e53ea67060d990d27649ac3c24df519ae..d446ad907aaa40291391b285e0349731f01cf5c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.enet.c 1.10 05/17/01 18:14:20 cort
+ * BK Id: SCCS/s.enet.c 1.15 09/14/01 18:01:16 trini
  */
 /*
  * Ethernet driver for Motorola MPC8xx.
@@ -11,7 +11,7 @@
  * This version of the driver is somewhat selectable for the different
  * processor/board combinations.  It works for the boards I know about
  * now, and should be easily modified to include others.  Some of the
- * configuration information is contained in "commproc.h" and the
+ * configuration information is contained in <asm/commproc.h> and the
  * remainder is here.
  *
  * Buffer descriptors are kept in the CPM dual port RAM, and the frame
@@ -47,7 +47,7 @@
 #include <asm/mpc8xx.h>
 #include <asm/bitops.h>
 #include <asm/uaccess.h>
-#include "commproc.h"
+#include <asm/commproc.h>
 
 /*
  *                             Theory of Operation
@@ -83,7 +83,7 @@
  * programming documents for details unique to your board.
  *
  * For the TQM8xx(L) modules, there is no control register interface.
- * All functions are directly controlled using I/O pins.  See commproc.h.
+ * All functions are directly controlled using I/O pins.  See <asm/commproc.h>.
  */
 
 /* The transmitter timeout
index dea3952c70cc19a46bd372311770a5c82a8c4e48..89f493278cfba9d4fd3b6a46dc27cb954f0abd9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.fec.c 1.12 05/18/01 07:54:04 patch
+ * BK Id: SCCS/s.fec.c 1.18 09/22/01 09:12:32 trini
  */
 /*
  * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx.
@@ -60,7 +60,7 @@
 #include <asm/irq.h>
 #include <asm/bitops.h>
 #include <asm/uaccess.h>
-#include "commproc.h"
+#include <asm/commproc.h>
 
 #ifdef CONFIG_USE_MDIO
 /* Forward declarations of some structures to support different PHYs
@@ -412,8 +412,10 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
                bdp++;
        }
 
-       if (bdp->cbd_sc & BD_ENET_TX_READY)
+       if (bdp->cbd_sc & BD_ENET_TX_READY) {
                netif_stop_queue(dev);
+               fep->tx_full = 1;
+       }
 
        fep->cur_tx = (cbd_t *)bdp;
 
index 55d2be35014c3d037dc5b3ca724ac77f0482bd01..92fec7e8c2adce397bb941d15a141406e7521e7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.uart.c 1.14 06/27/01 14:49:55 trini
+ * BK Id: SCCS/s.uart.c 1.16 09/14/01 18:01:17 trini
  */
 /*
  *  UART driver for MPC860 CPM SCC or SMC
@@ -43,7 +43,7 @@
 #include <asm/uaccess.h>
 #include <asm/8xx_immap.h>
 #include <asm/mpc8xx.h>
-#include "commproc.h"
+#include <asm/commproc.h>
 #ifdef CONFIG_MAGIC_SYSRQ
 #include <linux/sysrq.h>
 #endif
index c47fd7c3832b7be3b3d8d004ee5000a20979be67..8e4401036e4f6d5e1fede5ed626351c14f96e103 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.iic.c 1.8 05/18/01 07:54:04 patch
+ * BK Id: SCCS/s.iic.c 1.10 09/14/01 19:30:13 trini
  */
 
 /* Minimal support functions to read configuration from IIC EEPROMS
@@ -9,7 +9,7 @@
 #include <linux/types.h>
 #include <asm/uaccess.h>
 #include <asm/mpc8xx.h>
-#include "../../8xx_io/commproc.h"
+#include <asm/commproc.h>
 
 
 /* IIC functions.
index 992800e01d7231bbd7cb4f81e88ff80933bc3509..902faba609fd78f5d45838b96a9117dc00d600a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.m8xx_tty.c 1.8 05/18/01 07:54:04 patch
+ * BK Id: SCCS/s.m8xx_tty.c 1.10 09/14/01 19:30:13 trini
  */
 
 
@@ -17,7 +17,7 @@
 #include <linux/types.h>
 #include <asm/uaccess.h>
 #include <asm/mpc8xx.h>
-#include "../../8xx_io/commproc.h"
+#include <asm/commproc.h>
 
 #ifdef CONFIG_MBX
 #define MBX_CSR1       ((volatile u_char *)0xfa100000)
index efa88cf3a9d4d968a15feeae67a0f9d9a7387ca7..f740c82ab90165412c97b0fcbd68f0810fe6c750 100644 (file)
@@ -1,4 +1,4 @@
-# BK Id: SCCS/s.Makefile 1.24 08/01/01 13:25:40 trini
+# BK Id: SCCS/s.Makefile 1.26 09/25/01 07:54:40 trini
 #
 # arch/ppc/boot/Makefile
 #
@@ -44,7 +44,7 @@ misc.o: misc.c
        $(CC) $(CFLAGS) -DINITRD_OFFSET=0 -DINITRD_SIZE=0 -DZIMAGE_OFFSET=0 \
                -DZIMAGE_SIZE=0 -c -o $@ $*.c
 
-zvmlinux.initrd: zvmlinux ../images/vmlinux.gz
+zvmlinux.initrd: $(obj-y) $(LIBS) ../images/vmlinux.gz
        $(LD) $(ZLINKFLAGS) -o $@.tmp $(obj-y) $(LIBS)
        $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
                --add-section=initrd=../images/ramdisk.image.gz \
index 7fc157f890095e7c3f841d7236c0f9c1452dfe6c..4ac1ee18051d270ca456774fb4e4a3b2a8dab756 100644 (file)
@@ -110,6 +110,7 @@ CONFIG_PPC_RTC=y
 # CONFIG_MD_RAID0 is not set
 # CONFIG_MD_RAID1 is not set
 # CONFIG_MD_RAID5 is not set
+# CONFIG_MD_MULTIPATH is not set
 # CONFIG_BLK_DEV_LVM is not set
 
 #
@@ -197,10 +198,17 @@ CONFIG_BLK_DEV_IDECD=y
 # CONFIG_BLK_DEV_CMD640 is not set
 # CONFIG_BLK_DEV_CMD640_ENHANCED is not set
 # CONFIG_BLK_DEV_ISAPNP is not set
+CONFIG_BLK_DEV_MPC8xx_IDE=y
+CONFIG_IDE_8xx_PCCARD=y
+# CONFIG_IDE_8xx_DIRECT is not set
+# CONFIG_IDE_EXT_DIRECT is not set
 # CONFIG_IDE_CHIPSETS is not set
 # CONFIG_IDEDMA_AUTO is not set
 # CONFIG_DMA_NONPCI is not set
-# CONFIG_BLK_DEV_IDE_MODES is not set
+CONFIG_BLK_DEV_IDE_MODES=y
+# CONFIG_BLK_DEV_ATARAID is not set
+# CONFIG_BLK_DEV_ATARAID_PDC is not set
+# CONFIG_BLK_DEV_ATARAID_HPT is not set
 
 #
 # SCSI support
@@ -226,11 +234,9 @@ CONFIG_NETDEVICES=y
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
-# CONFIG_ARM_AM79C961A is not set
 # CONFIG_MACE is not set
 # CONFIG_BMAC is not set
 # CONFIG_GMAC is not set
-# CONFIG_NCR885E is not set
 # CONFIG_OAKNET is not set
 # CONFIG_SUNLANCE is not set
 # CONFIG_SUNBMAC is not set
@@ -249,9 +255,9 @@ CONFIG_NET_ETHERNET=y
 # Ethernet (1000 Mbit)
 #
 # CONFIG_ACENIC is not set
-# CONFIG_ACENIC_OMIT_TIGON_I is not set
 # CONFIG_DL2K is not set
 # CONFIG_MYRI_SBUS is not set
+# CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_SK98LIN is not set
@@ -312,6 +318,10 @@ CONFIG_NET_ETHERNET=y
 # Input core support
 #
 # CONFIG_INPUT is not set
+# CONFIG_INPUT_KEYBDEV is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_EVDEV is not set
 
 #
 # Macintosh device drivers
@@ -341,7 +351,11 @@ CONFIG_UNIX98_PTY_COUNT=32
 #
 # Joysticks
 #
-# CONFIG_JOYSTICK is not set
+# CONFIG_INPUT_GAMEPORT is not set
+
+#
+# Input core support is needed for gameports
+#
 
 #
 # Input core support is needed for joysticks
@@ -391,6 +405,7 @@ CONFIG_UNIX98_PTY_COUNT=32
 # CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_JFFS_FS is not set
+# CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
 CONFIG_TMPFS=y
 # CONFIG_RAMFS is not set
@@ -475,6 +490,7 @@ CONFIG_ENET_BIG_BUFFERS=y
 #
 CONFIG_8xx_COPYBACK=y
 # CONFIG_8xx_CPU6 is not set
+# CONFIG_UCODE_PATCH is not set
 CONFIG_BLK_DEV_MPC8xx_IDE=y
 
 #
index a29724193326b5fff987ac080d3f68a6d2a22a9f..92378b32a6682f93cc7a1866e40bb6545f8ea132 100644 (file)
@@ -111,6 +111,7 @@ CONFIG_PPC_RTC=y
 # CONFIG_MD_RAID0 is not set
 # CONFIG_MD_RAID1 is not set
 # CONFIG_MD_RAID5 is not set
+# CONFIG_MD_MULTIPATH is not set
 # CONFIG_BLK_DEV_LVM is not set
 
 #
@@ -163,9 +164,52 @@ CONFIG_IP_PNP=y
 #
 # ATA/IDE/MFM/RLL support
 #
-# CONFIG_IDE is not set
-# CONFIG_BLK_DEV_IDE_MODES is not set
+CONFIG_IDE=y
+
+#
+# IDE, ATA and ATAPI Block devices
+#
+CONFIG_BLK_DEV_IDE=y
+
+#
+# Please see Documentation/ide.txt for help/info on IDE drives
+#
+# CONFIG_BLK_DEV_HD_IDE is not set
 # CONFIG_BLK_DEV_HD is not set
+CONFIG_BLK_DEV_IDEDISK=y
+# CONFIG_IDEDISK_MULTI_MODE is not set
+# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set
+# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set
+# CONFIG_BLK_DEV_IDEDISK_IBM is not set
+# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set
+# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set
+# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set
+# CONFIG_BLK_DEV_IDEDISK_WD is not set
+# CONFIG_BLK_DEV_COMMERIAL is not set
+# CONFIG_BLK_DEV_TIVO is not set
+# CONFIG_BLK_DEV_IDECS is not set
+# CONFIG_BLK_DEV_IDECD is not set
+# CONFIG_BLK_DEV_IDETAPE is not set
+# CONFIG_BLK_DEV_IDEFLOPPY is not set
+# CONFIG_BLK_DEV_IDESCSI is not set
+
+#
+# IDE chipset support/bugfixes
+#
+# CONFIG_BLK_DEV_CMD640 is not set
+# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
+# CONFIG_BLK_DEV_ISAPNP is not set
+CONFIG_BLK_DEV_MPC8xx_IDE=y
+CONFIG_IDE_8xx_PCCARD=y
+# CONFIG_IDE_8xx_DIRECT is not set
+# CONFIG_IDE_EXT_DIRECT is not set
+# CONFIG_IDE_CHIPSETS is not set
+# CONFIG_IDEDMA_AUTO is not set
+# CONFIG_DMA_NONPCI is not set
+CONFIG_BLK_DEV_IDE_MODES=y
+# CONFIG_BLK_DEV_ATARAID is not set
+# CONFIG_BLK_DEV_ATARAID_PDC is not set
+# CONFIG_BLK_DEV_ATARAID_HPT is not set
 
 #
 # SCSI support
@@ -191,11 +235,9 @@ CONFIG_NETDEVICES=y
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
-# CONFIG_ARM_AM79C961A is not set
 # CONFIG_MACE is not set
 # CONFIG_BMAC is not set
 # CONFIG_GMAC is not set
-# CONFIG_NCR885E is not set
 # CONFIG_OAKNET is not set
 # CONFIG_SUNLANCE is not set
 # CONFIG_SUNBMAC is not set
@@ -214,9 +256,9 @@ CONFIG_NET_ETHERNET=y
 # Ethernet (1000 Mbit)
 #
 # CONFIG_ACENIC is not set
-# CONFIG_ACENIC_OMIT_TIGON_I is not set
 # CONFIG_DL2K is not set
 # CONFIG_MYRI_SBUS is not set
+# CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_SK98LIN is not set
@@ -277,6 +319,10 @@ CONFIG_NET_ETHERNET=y
 # Input core support
 #
 # CONFIG_INPUT is not set
+# CONFIG_INPUT_KEYBDEV is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_EVDEV is not set
 
 #
 # Macintosh device drivers
@@ -306,7 +352,11 @@ CONFIG_UNIX98_PTY_COUNT=32
 #
 # Joysticks
 #
-# CONFIG_JOYSTICK is not set
+# CONFIG_INPUT_GAMEPORT is not set
+
+#
+# Input core support is needed for gameports
+#
 
 #
 # Input core support is needed for joysticks
@@ -356,6 +406,7 @@ CONFIG_UNIX98_PTY_COUNT=32
 # CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_JFFS_FS is not set
+# CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
 CONFIG_TMPFS=y
 # CONFIG_RAMFS is not set
@@ -374,7 +425,7 @@ CONFIG_DEVPTS_FS=y
 # CONFIG_QNX4FS_FS is not set
 # CONFIG_QNX4FS_RW is not set
 # CONFIG_ROMFS_FS is not set
-# CONFIG_EXT2_FS is not set
+CONFIG_EXT2_FS=y
 # CONFIG_SYSV_FS is not set
 # CONFIG_UDF_FS is not set
 # CONFIG_UDF_RW is not set
@@ -411,8 +462,12 @@ CONFIG_PARTITION_ADVANCED=y
 # CONFIG_OSF_PARTITION is not set
 # CONFIG_AMIGA_PARTITION is not set
 # CONFIG_ATARI_PARTITION is not set
-# CONFIG_MAC_PARTITION is not set
-# CONFIG_MSDOS_PARTITION is not set
+CONFIG_MAC_PARTITION=y
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
 # CONFIG_LDM_PARTITION is not set
 # CONFIG_SGI_PARTITION is not set
 # CONFIG_ULTRIX_PARTITION is not set
@@ -444,6 +499,8 @@ CONFIG_SMC2_UART=y
 #
 CONFIG_8xx_COPYBACK=y
 # CONFIG_8xx_CPU6 is not set
+# CONFIG_UCODE_PATCH is not set
+CONFIG_BLK_DEV_MPC8xx_IDE=y
 
 #
 # USB support
index 665b575856e48ef97e847d38c9fb9573f063e069..f718c1a916672077c62322f7aeca1e720d33a3a0 100644 (file)
@@ -171,7 +171,7 @@ struct cpu_spec     cpu_specs[] = {
        __setup_cpu_7450
     },
     {  /* 82xx (8240, 8245, 8260 are all 603e cores) */
-       0xffff0000, 0x00810000, "82xx",
+       0x7fff0000, 0x00810000, "82xx",
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB,
        COMMON_PPC,
        32, 32,
@@ -231,7 +231,7 @@ struct cpu_spec     cpu_specs[] = {
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB,
        PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
        16, 16,
-       0, __setup_cpu_8xx
+       __setup_cpu_8xx /* Empty */
     },
 #endif /* CONFIG_8xx */
 #ifdef CONFIG_4xx
index e2e8f1aac6e34beeed259445effcfa1e1c5dc7c8..0b82733fb41fff4e5c7065b08c2919ba96993450 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.m8260_setup.c 1.24 08/20/01 15:25:16 paulus
+ * BK Id: SCCS/s.m8260_setup.c 1.26 09/22/01 11:33:22 trini
  */
 /*
  *  linux/arch/ppc/kernel/setup.c
@@ -270,13 +270,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 #ifdef CONFIG_MAGIC_SYSRQ
        ppc_md.kbd_sysrq_xlate   = NULL;
 #endif
-
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-        ppc_ide_md.default_irq = m8xx_ide_default_irq;
-        ppc_ide_md.default_io_base = m8xx_ide_default_io_base;
-        ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports;
-        ppc_ide_md.ide_request_irq = m8xx_ide_request_irq;
-#endif         
 }
 
 /* Mainly for ksyms.
index af522f11cc2723a07699f132460fdd6f30b4d28e..97953011464743a1bef797f43e7f2f5e1b9df092 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.m8xx_setup.c 1.29 08/30/01 09:01:04 trini
+ * BK Id: SCCS/s.m8xx_setup.c 1.32 09/27/01 09:01:12 trini
  *
  *  linux/arch/ppc/kernel/setup.c
  *
@@ -32,8 +32,6 @@
 #include <linux/init.h>
 #include <linux/blk.h>
 #include <linux/ioport.h>
-#include <asm/mpc8xx.h>  /* Before ide.h to avoid warning: `MAX_HWIFS' redefined */
-#include <linux/ide.h>
 #include <linux/bootmem.h>
 
 #include <asm/mmu.h>
@@ -41,7 +39,7 @@
 #include <asm/residual.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
-#include <asm/ide.h>
+#include <asm/mpc8xx.h>
 #include <asm/8xx_immap.h>
 #include <asm/machdep.h>
 
 #include "ppc8xx_pic.h"
 
 static int m8xx_set_rtc_time(unsigned long time);
-unsigned long m8xx_get_rtc_time(void);
+static unsigned long m8xx_get_rtc_time(void);
 void m8xx_calibrate_decr(void);
 
 unsigned char __res[sizeof(bd_t)];
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
 
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-#include "../../../drivers/ide/ide_modes.h"
-
-static void m8xx_ide_tuneproc(ide_drive_t *drive, byte pio);
-
-typedef        struct ide_ioport_desc {
-       unsigned long   base_off;               /* Offset to PCMCIA memory */
-       ide_ioreg_t     reg_off[IDE_NR_PORTS];  /* controller reg. offsets */
-       int             irq;                    /* IRQ  */
-} ide_ioport_desc_t;
-
-ide_ioport_desc_t ioport_dsc[MAX_HWIFS] = {
-#ifdef IDE0_BASE_OFFSET
-       { IDE0_BASE_OFFSET,
-           {
-               IDE0_DATA_REG_OFFSET,
-               IDE0_ERROR_REG_OFFSET,
-               IDE0_NSECTOR_REG_OFFSET,
-               IDE0_SECTOR_REG_OFFSET,
-               IDE0_LCYL_REG_OFFSET,
-               IDE0_HCYL_REG_OFFSET,
-               IDE0_SELECT_REG_OFFSET,
-               IDE0_STATUS_REG_OFFSET,
-               IDE0_CONTROL_REG_OFFSET,
-               IDE0_IRQ_REG_OFFSET,
-           },
-           IDE0_INTERRUPT,
-       },
-# ifdef IDE1_BASE_OFFSET
-       { IDE1_BASE_OFFSET,
-           {
-               IDE1_DATA_REG_OFFSET,
-               IDE1_ERROR_REG_OFFSET,
-               IDE1_NSECTOR_REG_OFFSET,
-               IDE1_SECTOR_REG_OFFSET,
-               IDE1_LCYL_REG_OFFSET,
-               IDE1_HCYL_REG_OFFSET,
-               IDE1_SELECT_REG_OFFSET,
-               IDE1_STATUS_REG_OFFSET,
-               IDE1_CONTROL_REG_OFFSET,
-               IDE1_IRQ_REG_OFFSET,
-           },
-           IDE1_INTERRUPT,
-       },
-# endif /* IDE1_BASE_OFFSET */
-#endif /* IDE0_BASE_OFFSET */
-};
-
-ide_pio_timings_t ide_pio_clocks[6];
-
-/* Make clock cycles and always round up */
-#define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
-
-#endif /* CONFIG_BLK_DEV_MPC8xx_IDE */
-#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
+extern void m8xx_ide_init();
 
 #ifdef CONFIG_BLK_DEV_RAM
 extern int rd_doload;          /* 1 = load ramdisk, 0 = don't load */
@@ -306,8 +249,8 @@ m8xx_setup_residual(char *buffer)
 
        bp = (bd_t *)__res;
                        
-       len += sprintf(len+buffer,"clock\t\t: %dMHz\n"
-                      "bus clock\t: %dMHz\n",
+       len += sprintf(len+buffer,"clock\t\t: %ldMHz\n"
+                      "bus clock\t: %ldMHz\n",
                       bp->bi_intfreq / 1000000,
                       bp->bi_busfreq / 1000000);
 
@@ -345,214 +288,6 @@ m8xx_init_IRQ(void)
 #endif
 }
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-
-/*
- * IDE stuff.
- */
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-static void ide_interrupt_handler (void *dev)
-{
-}
-#endif
-
-static int
-m8xx_ide_default_irq(ide_ioreg_t base)
-{
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-       if (base >= MAX_HWIFS)
-               return 0;
-       
-       return (ioport_dsc[base].irq);
-#else
-        return 9;
-#endif
-}
-
-static ide_ioreg_t
-m8xx_ide_default_io_base(int index)
-{
-        return index;
-}
-
-static int
-m8xx_ide_request_irq(unsigned int irq,
-                      void (*handler)(int, void *, struct pt_regs *),
-                      unsigned long flags, 
-                      const char *device,
-                      void *dev_id)
-{
-       return request_8xxirq(irq, handler, flags, device, dev_id);
-}
-
-/* We can use an external IDE controller
- * or wire the IDE interface to the internal PCMCIA controller.
- *
- * See include/linux/ide.h for definition of hw_regs_t (p, base)
- */
-static void
-m8xx_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, 
-               ide_ioreg_t ctrl_port, int *irq)
-{
-       int i;
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-       ide_ioreg_t *p = hw->io_ports;
-       volatile pcmconf8xx_t   *pcmp;
-
-       static unsigned long pcmcia_base = 0;
-       unsigned long base;
-#endif
-
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-       *p = 0;
-       if (irq)
-               *irq = 0;
-
-       pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia));
-
-       if (!pcmcia_base) {
-               /* relies PCMCIA registers being set up by firmware */
-               pcmcia_base = (unsigned long) ioremap(PCMCIA_MEM_ADDR,
-                                                     PCMCIA_MEM_SIZE);
-
-               /* Compute clock cycles for PIO timings */
-               for (i=0; i<6; ++i) {
-                       bd_t    *binfo = (bd_t *)__res;
-
-                       ide_pio_clocks[i].hold_time   =
-                               PCMCIA_MK_CLKS (ide_pio_timings[i].hold_time,
-                                               binfo->bi_busfreq);
-                       ide_pio_clocks[i].setup_time  =
-                               PCMCIA_MK_CLKS (ide_pio_timings[i].setup_time,
-                                               binfo->bi_busfreq);
-                       ide_pio_clocks[i].active_time =
-                               PCMCIA_MK_CLKS (ide_pio_timings[i].active_time,
-                                               binfo->bi_busfreq);
-                       ide_pio_clocks[i].cycle_time  =
-                               PCMCIA_MK_CLKS (ide_pio_timings[i].cycle_time,
-                                               binfo->bi_busfreq);
-#if 0
-                       printk ("PIO mode %d timings: %d/%d/%d => %d/%d/%d\n",
-                               i,
-                               ide_pio_clocks[i].setup_time,
-                               ide_pio_clocks[i].active_time,
-                               ide_pio_clocks[i].hold_time,
-                               ide_pio_clocks[i].cycle_time,
-                               ide_pio_timings[i].setup_time,
-                               ide_pio_timings[i].active_time,
-                               ide_pio_timings[i].hold_time,
-                               ide_pio_timings[i].cycle_time);
-#endif
-               }
-       }
-
-       if (data_port >= MAX_HWIFS)
-               return;
-
-       base = pcmcia_base + ioport_dsc[data_port].base_off;
-
-# if (!defined(CONFIG_SPD823TS) && !defined(CONFIG_IVMS8))
-       /* SPD823TS and IVMS8 have a direct connection */
-       if (pcmp->pcmc_pipr & 0x18000000)
-               return;         /* No card in slot */
-# endif        /* CONFIG_SPD823TS, CONFIG_IVMS8 */
-
-       for (i = 0; i < IDE_NR_PORTS; ++i) {
-               *p++ = base + ioport_dsc[data_port].reg_off[i] - _IO_BASE;
-       }
-
-       if (irq) {
-           *irq = ioport_dsc[data_port].irq;
-       }
-
-       /* register routine to tune PIO mode */
-       ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc;
-
-       /* Enable Harddisk Interrupt,
-        * and make it edge sensitive
-        */
-       hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_handler;
-       ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel |=
-                                       (0x80000000 >> ioport_dsc[data_port].irq);
-
-#else  /* ! CONFIG_BLK_DEV_MPC8xx_IDE */
-       
-       /* Just a regular IDE drive on some I/O port.
-       */
-       if (data_port == 0)
-               return;
-
-       for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; ++i)
-               hw->io_ports[i] = data_port + i - IDE_DATA_OFFSET;
-
-       hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-        return;
-
-#endif /* CONFIG_BLK_DEV_MPC8xx_IDE */
-}
-
-#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
-
-/* PCMCIA Timing */
-#ifndef        PCMCIA_SHT
-#define PCMCIA_SHT(t)  ((t & 0x0F)<<16)        /* Strobe Hold  Time    */
-#define PCMCIA_SST(t)  ((t & 0x0F)<<12)        /* Strobe Setup Time    */
-#define PCMCIA_SL(t) ((t==32) ? 0 : ((t & 0x1F)<<7)) /* Strobe Length  */
-#endif
-
-/* Calculate PIO timings */
-static void
-m8xx_ide_tuneproc(ide_drive_t *drive, byte pio)
-{
-       volatile pcmconf8xx_t   *pcmp;
-       ide_pio_data_t d;
-       ulong timing, mask, reg;
-
-       pio = ide_get_best_pio_mode(drive, pio, 4, &d);
-
-#if 1
-       printk("%s[%d] %s: best PIO mode: %d\n",
-               __FILE__,__LINE__,__FUNCTION__, pio);
-#endif
-       pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia));
-
-       mask = ~(PCMCIA_SHT(0xFF) | PCMCIA_SST(0xFF) | PCMCIA_SL(0xFF));
-
-       timing  = PCMCIA_SHT(ide_pio_clocks[pio].hold_time  )
-               | PCMCIA_SST(ide_pio_clocks[pio].setup_time )
-               | PCMCIA_SL (ide_pio_clocks[pio].active_time)
-               ;
-
-#if 1
-       printk ("Setting timing bits 0x%08lx in PCMCIA controller\n", timing);
-#endif
-       if ((reg = pcmp->pcmc_por0 & mask) != 0)
-               pcmp->pcmc_por0 = reg | timing;
-
-       if ((reg = pcmp->pcmc_por1 & mask) != 0)
-               pcmp->pcmc_por1 = reg | timing;
-
-       if ((reg = pcmp->pcmc_por2 & mask) != 0)
-               pcmp->pcmc_por2 = reg | timing;
-
-       if ((reg = pcmp->pcmc_por3 & mask) != 0)
-               pcmp->pcmc_por3 = reg | timing;
-
-       if ((reg = pcmp->pcmc_por4 & mask) != 0)
-               pcmp->pcmc_por4 = reg | timing;
-
-       if ((reg = pcmp->pcmc_por5 & mask) != 0)
-               pcmp->pcmc_por5 = reg | timing;
-
-       if ((reg = pcmp->pcmc_por6 & mask) != 0)
-               pcmp->pcmc_por6 = reg | timing;
-
-       if ((reg = pcmp->pcmc_por7 & mask) != 0)
-               pcmp->pcmc_por7 = reg | timing;
-}
-#endif /* CONFIG_BLK_DEV_MPC8xx_IDE */
-#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
-
 /* -------------------------------------------------------------------- */
 
 /*
@@ -669,8 +404,6 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
 #endif
 
 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-        ppc_ide_md.default_irq = m8xx_ide_default_irq;
-        ppc_ide_md.default_io_base = m8xx_ide_default_io_base;
-        ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports;
+       m8xx_ide_init();
 #endif         
 }
index 79c15c83ce808fbb43252d938744debaccbc19f9..c62fed51e097783a60c9bb6bfad4c414c04ff100 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.ppc_ksyms.c 1.51 08/24/01 17:05:47 paulus
+ * BK Id: SCCS/s.ppc_ksyms.c 1.55 10/02/01 12:33:42 trini
  */
 #include <linux/config.h>
 #include <linux/module.h>
@@ -52,7 +52,7 @@
 #include <asm/btext.h>
 
 #ifdef  CONFIG_8xx
-#include "../8xx_io/commproc.h"
+#include <asm/commproc.h>
 #endif
 
 /* Tell string.h we don't want memcpy etc. as cpp defines */
@@ -73,8 +73,10 @@ long long __ashrdi3(long long, int);
 long long __ashldi3(long long, int);
 long long __lshrdi3(long long, int);
 int abs(int);
-extern unsigned long ret_to_user_hook;
 
+extern unsigned char __res[];
+
+extern unsigned long ret_to_user_hook;
 extern unsigned long mm_ptov (unsigned long paddr);
 
 EXPORT_SYMBOL(clear_page);
@@ -338,6 +340,7 @@ EXPORT_SYMBOL(debugger_fault_handler);
 #endif
 
 #ifdef  CONFIG_8xx
+EXPORT_SYMBOL(__res);
 EXPORT_SYMBOL(request_8xxirq);
 EXPORT_SYMBOL(cpm_install_handler);
 EXPORT_SYMBOL(cpm_free_handler);
index 008125b446381379388023db0aeaf00b3dfc23db..eca832613eb8f31c57bbbd8bfff24cc38696b2dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.process.c 1.27 08/28/01 22:01:21 paulus
+ * BK Id: SCCS/s.process.c 1.31 10/02/01 09:51:41 paulus
  */
 /*
  *  linux/arch/ppc/kernel/process.c
@@ -226,8 +226,10 @@ _switch_to(struct task_struct *prev, struct task_struct *new,
        if ((prev->thread.regs && (prev->thread.regs->msr & MSR_VEC)))
                giveup_altivec(prev);
 #endif /* CONFIG_ALTIVEC */    
-       current_set[smp_processor_id()] = new;
 #endif /* CONFIG_SMP */
+
+       current_set[smp_processor_id()] = new;
+
        /* Avoid the trap.  On smp this this never happens since
         * we don't set last_task_used_altivec -- Cort
         */
index e37df1d6f9223eb9cb3f9c6515590f391a1a97ba..cae870a305cafd4142e512ab088d2799f811334b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.residual.c 1.11 09/08/01 15:47:42 paulus
+ * BK Id: SCCS/s.residual.c 1.13 09/11/01 16:54:34 trini
  */
 /*
  * Code to deal with the PReP residual data.
@@ -248,7 +248,7 @@ unsigned char * PnP_INTERFACES[] __initdata = {
 
 static const unsigned char __init *PnP_SUB_TYPE_STR(unsigned char BaseType, 
                                             unsigned char SubType) {
-       const unsigned char ** s=PnP_SUB_TYPES;
+       unsigned char ** s=PnP_SUB_TYPES;
        while (*s && !((*s)[0]==BaseType 
                       && (*s)[1]==SubType)) s++;
        if (*s) return *s+2;
@@ -258,7 +258,7 @@ static const unsigned char __init *PnP_SUB_TYPE_STR(unsigned char BaseType,
 static const unsigned char __init *PnP_INTERFACE_STR(unsigned char BaseType, 
                                              unsigned char SubType,
                                              unsigned char Interface) {
-       const unsigned char ** s=PnP_INTERFACES;
+       unsigned char ** s=PnP_INTERFACES;
        while (*s && !((*s)[0]==BaseType 
                       && (*s)[1]==SubType 
                       && (*s)[2]==Interface)) s++;
index 3fa4969023c338cead9be383811b9ecb2d1e8bcf..92e0854a0dba4d89d9af6fcd494159dcae965490 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.time.c 1.21 08/20/01 22:08:08 paulus
+ * BK Id: SCCS/s.time.c 1.26 10/05/01 08:29:42 trini
  */
 /*
  * Common time routines among all ppc machines.
@@ -200,10 +200,10 @@ int timer_interrupt(struct pt_regs * regs)
 #ifdef CONFIG_SMP
        smp_local_timer_interrupt(regs);
 #endif /* CONFIG_SMP */
-       
+
        if (ppc_md.heartbeat && !ppc_md.heartbeat_count--)
                ppc_md.heartbeat();
-       
+
        hardirq_exit(cpu);
 
        if (softirq_pending(cpu))
@@ -235,7 +235,7 @@ void do_gettimeofday(struct timeval *tv)
        read_unlock_irqrestore(&xtime_lock, flags);
 
        usec += mulhwu(tb_to_us, tb_ticks_per_jiffy * lost_ticks + delta);
-       while (usec > 1000000) {
+       while (usec >= 1000000) {
                sec++;
                usec -= 1000000;
        }
index 73b8e1bc0bb64e21da5371fed87e6f9aa34bbe57..0bc8b1697e3bbf39d22ab1639f21e6ce62225b52 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.start_8xx.c 1.7 05/17/01 18:14:23 cort
+ * BK Id: SCCS/s.start_8xx.c 1.10 09/14/01 18:01:17 trini
  */
 /*
  * Copyright (C) 1996 Paul Mackerras.
@@ -18,7 +18,7 @@
 #include <asm/processor.h>
 #include <asm/8xx_immap.h>
 #include <asm/mpc8xx.h>
-#include "../8xx_io/commproc.h"
+#include <asm/commproc.h>
 
 extern void xmon_printf(const char *fmt, ...);
 extern int xmon_8xx_write(char *str, int nb);
index 68a8adb45846c5640602475167aa3c2150e113a7..3694c85ce8f02053132dfbd07c49e537cd0ff7fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.xmon.c 1.14 06/28/01 15:50:17 paulus
+ * BK Id: SCCS/s.xmon.c 1.16 09/22/01 15:25:10 trini
  */
 /*
  * Routines providing a simple monitor for use on the PowerMac.
@@ -813,10 +813,12 @@ super_regs()
                printf("sprg0-3 = %x %x %x %x\n", get_sprg0(), get_sprg1(),
                       get_sprg2(), get_sprg3());
                printf("srr0 = %x, srr1 = %x\n", get_srr0(), get_srr1());
+#ifdef CONFIG_PPC_STD_MMU
                printf("sr0-15 =");
                for (i = 0; i < 16; ++i)
                        printf(" %x", get_sr(i));
                printf("\n");
+#endif
                asm("mr %0,1" : "=r" (i) :);
                printf("sp = %x ", i);
                asm("mr %0,2" : "=r" (i) :);
index b0b76cc49ebdfd071ba06ba7ebc131d93095bbc1..8e6fff5c5ec08aa304f0e2c96f8518dccb24bad8 100644 (file)
@@ -44,7 +44,7 @@
 
 static struct pi_protocol      *protocols[MAX_PROTOS];
 
-spinlock_t     pi_spinlock = SPIN_LOCK_UNLOCKED;
+static spinlock_t      pi_spinlock = SPIN_LOCK_UNLOCKED;
 
 void pi_write_regr( PIA *pi, int cont, int regr, int val)
 
index 5597c0b307e5a0dfee6456c426d14153873a5005..bca5316d9cd72a5bc4047c5f485ac155421b0549 100644 (file)
@@ -276,7 +276,6 @@ static int rd_blkdev_pagecache_IO(int rw, struct buffer_head * sbh, int minor)
                        if (!Page_Uptodate(page)) {
                                memset(kmap(page), 0, PAGE_CACHE_SIZE);
                                kunmap(page);
-                               flush_dcache_page(page);
                                SetPageUptodate(page);
                        }
 
@@ -301,8 +300,11 @@ static int rd_blkdev_pagecache_IO(int rw, struct buffer_head * sbh, int minor)
                kunmap(page);
                bh_kunmap(sbh);
 
-               if (rw != READ)
+               if (rw == READ) {
+                       flush_dcache_page(page);
+               } else {
                        SetPageDirty(page);
+               }
                if (unlock)
                        UnlockPage(page);
                __free_page(page);
index f7f9d67746d6bf5ac2f96067d1930c06ef2dbc19..eaa0d5568778f4e258b0c697c1e5c88118efaa5f 100644 (file)
@@ -23,7 +23,7 @@ obj-y  += mem.o tty_io.o n_tty.o tty_ioctl.o raw.o pty.o misc.o random.o
 
 export-objs     :=     busmouse.o console.o keyboard.o sysrq.o \
                        misc.o pty.o random.o selection.o serial.o \
-                       sonypi.o tty_io.o tty_ioctl.o
+                       sonypi.o tty_io.o tty_ioctl.o generic_serial.o
 
 mod-subdirs    :=      joystick ftape drm pcmcia
 
index 6fb2d25281ac37b39d96ddebcb7c66ca2f8c6f13..b17e8b01f27fc2581e7b8c18a5380e179a7164dc 100644 (file)
@@ -124,6 +124,16 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
       if [ "$CONFIG_Q40" = "y" ]; then
         dep_bool '  Q40/Q60 IDE interface support' CONFIG_BLK_DEV_Q40IDE $CONFIG_Q40
       fi
+      if [ "$CONFIG_8xx" = "y" ]; then
+         dep_bool '  MPC8xx IDE support' CONFIG_BLK_DEV_MPC8xx_IDE $CONFIG_8xx
+      fi
+
+      if [ "$CONFIG_BLK_DEV_MPC8xx_IDE" = "y" ]; then
+         choice 'Type of MPC8xx IDE interface'         \
+               "8xx_PCCARD     CONFIG_IDE_8xx_PCCARD   \
+                8xx_DIRECT     CONFIG_IDE_8xx_DIRECT   \
+                EXT_DIRECT     CONFIG_IDE_EXT_DIRECT"  8xx_PCCARD
+      fi
 
       bool '  Other IDE chipset support' CONFIG_IDE_CHIPSETS
       if [ "$CONFIG_IDE_CHIPSETS" = "y" ]; then
@@ -182,7 +192,8 @@ if [ "$CONFIG_IDE_CHIPSETS" = "y" -o \
      "$CONFIG_BLK_DEV_SIS5513" = "y" -o \
      "$CONFIG_BLK_DEV_SLC90E66" = "y" -o \
      "$CONFIG_BLK_DEV_SL82C105" = "y" -o \
-     "$CONFIG_BLK_DEV_VIA82CXXX" = "y" ]; then
+     "$CONFIG_BLK_DEV_VIA82CXXX" = "y" -o \
+     "$CONFIG_BLK_DEV_MPC8xx_IDE" = "y" ]; then
    define_bool CONFIG_BLK_DEV_IDE_MODES y
 else
    define_bool CONFIG_BLK_DEV_IDE_MODES n
index b6d3b424213fae8d129ff149dcfba31bf5e4d4e2..ea5394b1b80ddc076c7015f0367483d73e1d7d71 100644 (file)
@@ -10,7 +10,7 @@
 
 O_TARGET := idedriver.o
 
-export-objs            := ide.o ide-features.o
+export-objs            := ide.o ide-features.o ataraid.o
 list-multi             := ide-mod.o ide-probe-mod.o
 
 obj-y          :=
@@ -65,6 +65,7 @@ ide-obj-$(CONFIG_BLK_DEV_SL82C105)    += sl82c105.o
 ide-obj-$(CONFIG_BLK_DEV_TRM290)       += trm290.o
 ide-obj-$(CONFIG_BLK_DEV_UMC8672)      += umc8672.o
 ide-obj-$(CONFIG_BLK_DEV_VIA82CXXX)    += via82cxxx.o
+ide-obj-$(CONFIG_BLK_DEV_MPC8xx_IDE)   += ide-m8xx.o
 
 # The virtualised raid layers MUST come after the ide itself or bad stuff
 # will happen.
diff --git a/drivers/ide/ide-m8xx.c b/drivers/ide/ide-m8xx.c
new file mode 100644 (file)
index 0000000..e77aaef
--- /dev/null
@@ -0,0 +1,851 @@
+/*
+ *
+ *
+ *  linux/drivers/ide/ide-m8xx.c
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/stddef.h>
+#include <linux/unistd.h>
+#include <linux/ptrace.h>
+#include <linux/slab.h>
+#include <linux/user.h>
+#include <linux/a.out.h>
+#include <linux/tty.h>
+#include <linux/major.h>
+#include <linux/interrupt.h>
+#include <linux/reboot.h>
+#include <linux/init.h>
+#include <linux/blk.h>
+#include <linux/ioport.h>
+#include <linux/ide.h>
+#include <linux/bootmem.h>
+
+#include <asm/mpc8xx.h>
+#include <asm/mmu.h>
+#include <asm/processor.h>
+#include <asm/residual.h>
+#include <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/ide.h>
+#include <asm/8xx_immap.h>
+#include <asm/machdep.h>
+#include <asm/irq.h>
+
+#include "ide_modes.h"
+static int identify  (volatile unsigned char *p);
+static void print_fixed (volatile unsigned char *p);
+static void print_funcid (int func);
+static int check_ide_device (unsigned long base);
+
+static void ide_interrupt_ack (void *dev);
+static void m8xx_ide_tuneproc(ide_drive_t *drive, byte pio);
+
+typedef        struct ide_ioport_desc {
+       unsigned long   base_off;               /* Offset to PCMCIA memory      */
+       ide_ioreg_t     reg_off[IDE_NR_PORTS];  /* controller register offsets  */
+       int             irq;                    /* IRQ                          */
+} ide_ioport_desc_t;
+
+ide_ioport_desc_t ioport_dsc[MAX_HWIFS] = {
+#ifdef IDE0_BASE_OFFSET
+       { IDE0_BASE_OFFSET,
+           {
+               IDE0_DATA_REG_OFFSET,
+               IDE0_ERROR_REG_OFFSET,
+               IDE0_NSECTOR_REG_OFFSET,
+               IDE0_SECTOR_REG_OFFSET,
+               IDE0_LCYL_REG_OFFSET,
+               IDE0_HCYL_REG_OFFSET,
+               IDE0_SELECT_REG_OFFSET,
+               IDE0_STATUS_REG_OFFSET,
+               IDE0_CONTROL_REG_OFFSET,
+               IDE0_IRQ_REG_OFFSET,
+           },
+           IDE0_INTERRUPT,
+       },
+#ifdef IDE1_BASE_OFFSET
+       { IDE1_BASE_OFFSET,
+           {
+               IDE1_DATA_REG_OFFSET,
+               IDE1_ERROR_REG_OFFSET,
+               IDE1_NSECTOR_REG_OFFSET,
+               IDE1_SECTOR_REG_OFFSET,
+               IDE1_LCYL_REG_OFFSET,
+               IDE1_HCYL_REG_OFFSET,
+               IDE1_SELECT_REG_OFFSET,
+               IDE1_STATUS_REG_OFFSET,
+               IDE1_CONTROL_REG_OFFSET,
+               IDE1_IRQ_REG_OFFSET,
+           },
+           IDE1_INTERRUPT,
+       },
+#endif /* IDE1_BASE_OFFSET */
+#endif /* IDE0_BASE_OFFSET */
+};
+
+ide_pio_timings_t ide_pio_clocks[6];
+int hold_time[6] =  {30, 20, 15, 10, 10, 10 };   /* PIO Mode 5 with IORDY (nonstandard) */
+
+/*
+ * Warning: only 1 (ONE) PCMCIA slot supported here,
+ * which must be correctly initialized by the firmware (PPCBoot).
+ */
+static int _slot_ = -1;                        /* will be read from PCMCIA registers   */
+
+/* Make clock cycles and always round up */
+#define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U )
+
+
+
+/*
+ * IDE stuff.
+ */
+static int
+m8xx_ide_default_irq(ide_ioreg_t base)
+{
+#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
+       if (base >= MAX_HWIFS)
+               return 0;
+
+       printk("[%d] m8xx_ide_default_irq %d\n",__LINE__,ioport_dsc[base].irq);
+       
+       return (ioport_dsc[base].irq);
+#else
+        return 9;
+#endif
+}
+
+static ide_ioreg_t
+m8xx_ide_default_io_base(int index)
+{
+        return index;
+}
+
+#define M8XX_PCMCIA_CD2(slot)      (0x10000000 >> (slot << 4))
+#define M8XX_PCMCIA_CD1(slot)      (0x08000000 >> (slot << 4))
+
+/*
+ * The TQM850L hardware has two pins swapped! Grrrrgh!
+ */
+#ifdef CONFIG_TQM850L
+#define __MY_PCMCIA_GCRX_CXRESET       PCMCIA_GCRX_CXOE
+#define __MY_PCMCIA_GCRX_CXOE          PCMCIA_GCRX_CXRESET
+#else
+#define __MY_PCMCIA_GCRX_CXRESET       PCMCIA_GCRX_CXRESET
+#define __MY_PCMCIA_GCRX_CXOE          PCMCIA_GCRX_CXOE
+#endif
+
+#if defined(CONFIG_BLK_DEV_MPC8xx_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
+#define PCMCIA_SCHLVL IDE0_INTERRUPT   /* Status Change Interrupt Level        */
+static int pcmcia_schlvl = PCMCIA_SCHLVL;
+#endif
+
+/*
+ * See include/linux/ide.h for definition of hw_regs_t (p, base)
+ */
+
+/*
+ * m8xx_ide_init_hwif_ports for a direct IDE interface _using_
+ */
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
+static void
+m8xx_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, 
+               ide_ioreg_t ctrl_port, int *irq)
+{
+       ide_ioreg_t *p = hw->io_ports;
+       int i;
+
+       typedef struct {
+               ulong br;
+               ulong or;
+       } pcmcia_win_t;
+       volatile pcmcia_win_t *win;
+       volatile pcmconf8xx_t *pcmp;
+
+       uint *pgcrx;
+       u32 pcmcia_phy_base;
+       u32 pcmcia_phy_end;
+       static unsigned long pcmcia_base = 0;
+       unsigned long base;
+
+       *p = 0;
+       if (irq)
+               *irq = 0;
+
+       pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia));
+
+       if (!pcmcia_base) {
+                /*
+                 * Read out PCMCIA registers. Since the reset values
+                 * are undefined, we sure hope that they have been
+                 * set up by firmware
+                */
+
+               /* Scan all registers for valid settings */
+               pcmcia_phy_base = 0xFFFFFFFF;
+               pcmcia_phy_end = 0;
+               /* br0 is start of brX and orX regs */
+               win = (pcmcia_win_t *) \
+                       (&(((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pbr0));
+               for (i = 0; i < 8; i++) {
+                       if (win->or & 1) {      /* This bank is marked as valid */
+                               if (win->br < pcmcia_phy_base) {
+                                       pcmcia_phy_base = win->br;
+                               }
+                               if ((win->br + PCMCIA_MEM_SIZE) > pcmcia_phy_end) {
+                                       pcmcia_phy_end  = win->br + PCMCIA_MEM_SIZE;
+                               }
+                               /* Check which slot that has been defined */
+                               _slot_ = (win->or >> 2) & 1;
+
+                       }                                       /* Valid bank */
+                       win++;
+               }                                               /* for */
+
+               printk ("PCMCIA slot %c: phys mem %08x...%08x (size %08x)\n",
+                       'A' + _slot_,
+                       pcmcia_phy_base, pcmcia_phy_end,
+                       pcmcia_phy_end - pcmcia_phy_base);
+
+               pcmcia_base=(unsigned long)ioremap(pcmcia_phy_base,
+                                                  pcmcia_phy_end-pcmcia_phy_base);
+
+#ifdef DEBUG
+               printk ("PCMCIA virt base: %08lx\n", pcmcia_base);
+#endif
+               /* Compute clock cycles for PIO timings */
+               for (i=0; i<6; ++i) {
+                       bd_t    *binfo = (bd_t *)__res;
+
+                       hold_time[i]   =
+                               PCMCIA_MK_CLKS (hold_time[i],
+                                               binfo->bi_busfreq);
+                       ide_pio_clocks[i].setup_time  =
+                               PCMCIA_MK_CLKS (ide_pio_timings[i].setup_time,
+                                               binfo->bi_busfreq);
+                       ide_pio_clocks[i].active_time =
+                               PCMCIA_MK_CLKS (ide_pio_timings[i].active_time,
+                                               binfo->bi_busfreq);
+                       ide_pio_clocks[i].cycle_time  =
+                               PCMCIA_MK_CLKS (ide_pio_timings[i].cycle_time,
+                                               binfo->bi_busfreq);
+#if 0
+                       printk ("PIO mode %d timings: %d/%d/%d => %d/%d/%d\n",
+                               i,
+                               ide_pio_clocks[i].setup_time,
+                               ide_pio_clocks[i].active_time,
+                               ide_pio_clocks[i].hold_time,
+                               ide_pio_clocks[i].cycle_time,
+                               ide_pio_timings[i].setup_time,
+                               ide_pio_timings[i].active_time,
+                               ide_pio_timings[i].hold_time,
+                               ide_pio_timings[i].cycle_time);
+#endif
+               }
+       }
+
+       if (data_port >= MAX_HWIFS)
+               return;
+
+       if (_slot_ == -1) {
+               printk ("PCMCIA slot has not been defined! Using A as default\n");
+               _slot_ = 0;
+       }
+
+#ifdef CONFIG_IDE_8xx_PCCARD
+
+#ifdef DEBUG
+       printk ("PIPR = 0x%08X  slot %c ==> mask = 0x%X\n",
+               pcmp->pcmc_pipr,
+               'A' + _slot_,
+               M8XX_PCMCIA_CD1(_slot_) | M8XX_PCMCIA_CD2(_slot_) );
+#endif /* DEBUG */
+
+       if (pcmp->pcmc_pipr & (M8XX_PCMCIA_CD1(_slot_)|M8XX_PCMCIA_CD2(_slot_))) {
+               printk ("No card in slot %c: PIPR=%08x\n",
+                       'A' + _slot_, (u32) pcmp->pcmc_pipr);
+               return;         /* No card in slot */
+       }
+
+       check_ide_device (pcmcia_base);
+
+#endif /* CONFIG_IDE_8xx_PCCARD */
+
+       base = pcmcia_base + ioport_dsc[data_port].base_off;
+#ifdef DEBUG
+       printk ("base: %08x + %08x = %08x\n",
+                       pcmcia_base, ioport_dsc[data_port].base_off, base);
+#endif
+
+       for (i = 0; i < IDE_NR_PORTS; ++i) {
+#ifdef DEBUG
+               printk ("port[%d]: %08x + %08x = %08x\n",
+                       i,
+                       base,
+                       ioport_dsc[data_port].reg_off[i],
+                       i, base + ioport_dsc[data_port].reg_off[i]);
+#endif
+               *p++ = base + ioport_dsc[data_port].reg_off[i];
+       }
+
+       if (irq) {
+#ifdef CONFIG_IDE_8xx_PCCARD
+               unsigned int reg;
+
+               *irq = ioport_dsc[data_port].irq;
+               if (_slot_)
+                       pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb;
+               else
+                       pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcra;
+
+               reg = *pgcrx;
+               reg |= mk_int_int_mask (pcmcia_schlvl) << 24;
+               reg |= mk_int_int_mask (pcmcia_schlvl) << 16;
+               *pgcrx = reg;
+#else  /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */
+               *irq = ioport_dsc[data_port].irq;
+#endif /* CONFIG_IDE_8xx_PCCARD */
+       }
+
+       /* register routine to tune PIO mode */
+       ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc;
+
+       hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
+       /* Enable Harddisk Interrupt,
+        * and make it edge sensitive
+        */
+       /* (11-18) Set edge detect for irq, no wakeup from low power mode */
+       ((immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel |=
+                                       (0x80000000 >> ioport_dsc[data_port].irq);
+
+#ifdef CONFIG_IDE_8xx_PCCARD
+       /* Make sure we dont get garbage irq */
+       ((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pscr = 0xFFFF;
+
+       /* Enable falling edge irq */
+       pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
+#endif /* CONFIG_IDE_8xx_PCCARD */
+}      /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */
+#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */
+
+/*
+ * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using
+ * MPC8xx's internal PCMCIA interface
+ */
+#if defined(CONFIG_IDE_EXT_DIRECT)
+void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
+       ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+{
+       ide_ioreg_t *p = hw->io_ports;
+       int i;
+
+       u32 ide_phy_base;
+       u32 ide_phy_end;
+       static unsigned long ide_base = 0;
+       unsigned long base;
+
+       *p = 0;
+       if (irq)
+               *irq = 0;
+
+       if (!ide_base) {
+
+               /* TODO:
+                * - add code to read ORx, BRx
+                */
+               ide_phy_base = CFG_ATA_BASE_ADDR;
+               ide_phy_end  = CFG_ATA_BASE_ADDR + 0x200;
+
+               printk ("IDE phys mem : %08x...%08x (size %08x)\n",
+                       ide_phy_base, ide_phy_end,
+                       ide_phy_end - ide_phy_base);
+               
+               ide_base=(unsigned long)ioremap(ide_phy_base,
+                                               ide_phy_end-ide_phy_base);
+
+#ifdef DEBUG
+               printk ("IDE virt base: %08lx\n", ide_base);
+#endif
+       }
+
+       if (data_port >= MAX_HWIFS)
+               return;
+
+       base = ide_base + ioport_dsc[data_port].base_off;
+#ifdef DEBUG
+       printk ("base: %08x + %08x = %08x\n",
+               ide_base, ioport_dsc[data_port].base_off, base);
+#endif
+
+       for (i = 0; i < IDE_NR_PORTS; ++i) {
+#ifdef DEBUG
+               printk ("port[%d]: %08x + %08x = %08x\n",
+                       i,
+                       base,
+                       ioport_dsc[data_port].reg_off[i],
+                       i, base + ioport_dsc[data_port].reg_off[i]);
+#endif
+               *p++ = base + ioport_dsc[data_port].reg_off[i];
+       }
+
+       if (irq) {
+               /* direct connected IDE drive, i.e. external IRQ */
+               *irq = ioport_dsc[data_port].irq;
+       }
+
+       /* register routine to tune PIO mode */
+       ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc;
+
+       hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
+       /* Enable Harddisk Interrupt,
+        * and make it edge sensitive
+        */
+       /* (11-18) Set edge detect for irq, no wakeup from low power mode */
+       ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
+                       (0x80000000 >> ioport_dsc[data_port].irq);
+}      /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */ 
+
+#endif /* CONFIG_IDE_8xx_DIRECT */
+
+
+/* -------------------------------------------------------------------- */
+
+
+/* PCMCIA Timing */
+#ifndef        PCMCIA_SHT
+#define PCMCIA_SHT(t)  ((t & 0x0F)<<16)        /* Strobe Hold  Time    */
+#define PCMCIA_SST(t)  ((t & 0x0F)<<12)        /* Strobe Setup Time    */
+#define PCMCIA_SL(t) ((t==32) ? 0 : ((t & 0x1F)<<7)) /* Strobe Length  */
+#endif
+
+
+/* Calculate PIO timings */
+static void
+m8xx_ide_tuneproc(ide_drive_t *drive, byte pio)
+{
+       ide_pio_data_t d;
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
+       volatile pcmconf8xx_t   *pcmp;
+       ulong timing, mask, reg;
+#endif
+
+       pio = ide_get_best_pio_mode(drive, pio, 4, &d);
+
+#if 1
+       printk("%s[%d] %s: best PIO mode: %d\n",
+               __FILE__,__LINE__,__FUNCTION__, pio);
+#endif
+
+#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
+       pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia));
+
+       mask = ~(PCMCIA_SHT(0xFF) | PCMCIA_SST(0xFF) | PCMCIA_SL(0xFF));
+
+       timing  = PCMCIA_SHT(hold_time[pio]  )
+               | PCMCIA_SST(ide_pio_clocks[pio].setup_time )
+               | PCMCIA_SL (ide_pio_clocks[pio].active_time)
+               ;
+
+#if 1
+       printk ("Setting timing bits 0x%08lx in PCMCIA controller\n", timing);
+#endif
+       if ((reg = pcmp->pcmc_por0 & mask) != 0)
+               pcmp->pcmc_por0 = reg | timing;
+
+       if ((reg = pcmp->pcmc_por1 & mask) != 0)
+               pcmp->pcmc_por1 = reg | timing;
+
+       if ((reg = pcmp->pcmc_por2 & mask) != 0)
+               pcmp->pcmc_por2 = reg | timing;
+
+       if ((reg = pcmp->pcmc_por3 & mask) != 0)
+               pcmp->pcmc_por3 = reg | timing;
+
+       if ((reg = pcmp->pcmc_por4 & mask) != 0)
+               pcmp->pcmc_por4 = reg | timing;
+
+       if ((reg = pcmp->pcmc_por5 & mask) != 0)
+               pcmp->pcmc_por5 = reg | timing;
+
+       if ((reg = pcmp->pcmc_por6 & mask) != 0)
+               pcmp->pcmc_por6 = reg | timing;
+
+       if ((reg = pcmp->pcmc_por7 & mask) != 0)
+               pcmp->pcmc_por7 = reg | timing;
+
+#elif defined(CONFIG_IDE_EXT_DIRECT)
+
+       printk("%s[%d] %s: not implemented yet!\n",
+               __FILE__,__LINE__,__FUNCTION__);
+#endif /* defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_PCMCIA */
+}
+
+static void
+ide_interrupt_ack (void *dev)
+{
+#ifdef CONFIG_IDE_8xx_PCCARD
+       u_int pscr, pipr;
+
+#if (PCMCIA_SOCKETS_NO == 2)
+       u_int _slot_;
+#endif
+
+       /* get interrupt sources */
+
+       pscr = ((volatile immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr;
+       pipr = ((volatile immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pipr;
+
+       /*
+        * report only if both card detect signals are the same
+        * not too nice done,
+        * we depend on that CD2 is the bit to the left of CD1...
+        */
+
+       if(_slot_==-1){
+         printk("PCMCIA slot has not been defined! Using A as default\n");
+         _slot_=0;
+       }
+
+       if(((pipr & M8XX_PCMCIA_CD2(_slot_)) >> 1) ^
+          (pipr & M8XX_PCMCIA_CD1(_slot_))         ) {
+         printk ("card detect interrupt\n");
+       }
+       /* clear the interrupt sources */
+       ((immap_t *)IMAP_ADDR)->im_pcmcia.pcmc_pscr = pscr;
+
+#else /* ! CONFIG_IDE_8xx_PCCARD */
+       /*
+        * Only CONFIG_IDE_8xx_PCCARD is using the interrupt of the
+        * MPC8xx's PCMCIA controller, so there is nothing to be done here
+        * for CONFIG_IDE_8xx_DIRECT and CONFIG_IDE_EXT_DIRECT.
+        * The interrupt is handled somewhere else.     -- Steven
+        */
+#endif /* CONFIG_IDE_8xx_PCCARD */
+}
+
+
+
+/*
+ * CIS Tupel codes
+ */
+#define CISTPL_NULL            0x00
+#define CISTPL_DEVICE          0x01
+#define CISTPL_LONGLINK_CB     0x02
+#define CISTPL_INDIRECT                0x03
+#define CISTPL_CONFIG_CB       0x04
+#define CISTPL_CFTABLE_ENTRY_CB 0x05
+#define CISTPL_LONGLINK_MFC    0x06
+#define CISTPL_BAR             0x07
+#define CISTPL_PWR_MGMNT       0x08
+#define CISTPL_EXTDEVICE       0x09
+#define CISTPL_CHECKSUM                0x10
+#define CISTPL_LONGLINK_A      0x11
+#define CISTPL_LONGLINK_C      0x12
+#define CISTPL_LINKTARGET      0x13
+#define CISTPL_NO_LINK         0x14
+#define CISTPL_VERS_1          0x15
+#define CISTPL_ALTSTR          0x16
+#define CISTPL_DEVICE_A                0x17
+#define CISTPL_JEDEC_C         0x18
+#define CISTPL_JEDEC_A         0x19
+#define CISTPL_CONFIG          0x1a
+#define CISTPL_CFTABLE_ENTRY   0x1b
+#define CISTPL_DEVICE_OC       0x1c
+#define CISTPL_DEVICE_OA       0x1d
+#define CISTPL_DEVICE_GEO      0x1e
+#define CISTPL_DEVICE_GEO_A    0x1f
+#define CISTPL_MANFID          0x20
+#define CISTPL_FUNCID          0x21
+#define CISTPL_FUNCE           0x22
+#define CISTPL_SWIL            0x23
+#define CISTPL_END             0xff
+
+/*
+ * CIS Function ID codes
+ */
+#define CISTPL_FUNCID_MULTI    0x00
+#define CISTPL_FUNCID_MEMORY   0x01
+#define CISTPL_FUNCID_SERIAL   0x02
+#define CISTPL_FUNCID_PARALLEL 0x03
+#define CISTPL_FUNCID_FIXED    0x04
+#define CISTPL_FUNCID_VIDEO    0x05
+#define CISTPL_FUNCID_NETWORK  0x06
+#define CISTPL_FUNCID_AIMS     0x07
+#define CISTPL_FUNCID_SCSI     0x08
+
+/*
+ * Fixed Disk FUNCE codes
+ */
+#define CISTPL_IDE_INTERFACE   0x01
+
+#define CISTPL_FUNCE_IDE_IFACE 0x01
+#define CISTPL_FUNCE_IDE_MASTER        0x02
+#define CISTPL_FUNCE_IDE_SLAVE 0x03
+
+/* First feature byte */
+#define CISTPL_IDE_SILICON     0x04
+#define CISTPL_IDE_UNIQUE      0x08
+#define CISTPL_IDE_DUAL                0x10
+
+/* Second feature byte */
+#define CISTPL_IDE_HAS_SLEEP   0x01
+#define CISTPL_IDE_HAS_STANDBY 0x02
+#define CISTPL_IDE_HAS_IDLE    0x04
+#define CISTPL_IDE_LOW_POWER   0x08
+#define CISTPL_IDE_REG_INHIBIT 0x10
+#define CISTPL_IDE_HAS_INDEX   0x20
+#define CISTPL_IDE_IOIS16      0x40
+
+
+/* -------------------------------------------------------------------- */
+
+
+#define        MAX_TUPEL_SZ    512
+#define MAX_FEATURES   4
+
+static int check_ide_device (unsigned long base)
+{
+       volatile unsigned char *ident = NULL;
+       volatile unsigned char *feature_p[MAX_FEATURES];
+       volatile unsigned char *p, *start;
+       int n_features = 0;
+       unsigned char func_id = ~0;
+       unsigned char code, len;
+       unsigned short config_base = 0;
+       int found = 0;
+       int i;
+
+#ifdef DEBUG
+       printk ("PCMCIA MEM: %08lX\n", base);
+#endif
+       start = p = (volatile unsigned char *) base;
+
+       while ((p - start) < MAX_TUPEL_SZ) {
+
+               code = *p; p += 2;
+
+               if (code == 0xFF) { /* End of chain */
+                       break;
+               }
+
+               len = *p; p += 2;
+#ifdef DEBUG_PCMCIA
+               { volatile unsigned char *q = p;
+                       printk ("\nTuple code %02x  length %d\n\tData:",
+                               code, len);
+
+                       for (i = 0; i < len; ++i) {
+                               printk (" %02x", *q);
+                               q+= 2;
+                       }
+               }
+#endif /* DEBUG_PCMCIA */
+               switch (code) {
+               case CISTPL_VERS_1:
+                       ident = p + 4;
+                       break;
+               case CISTPL_FUNCID:
+                       func_id = *p;
+                       break;
+               case CISTPL_FUNCE:
+                       if (n_features < MAX_FEATURES)
+                               feature_p[n_features++] = p;
+                       break;
+               case CISTPL_CONFIG:
+                       config_base = (*(p+6) << 8) + (*(p+4));
+               default:
+                       break;
+               }
+               p += 2 * len;
+       }
+
+       found = identify (ident);
+
+       if (func_id != ((unsigned char)~0)) {
+               print_funcid (func_id);
+
+               if (func_id == CISTPL_FUNCID_FIXED)
+                       found = 1;
+               else
+                       return (1);     /* no disk drive */
+       }
+
+       for (i=0; i<n_features; ++i) {
+               print_fixed (feature_p[i]);
+       }
+
+       if (!found) {
+               printk ("unknown card type\n");
+               return (1);
+       }
+
+       /* set level mode irq and I/O mapped device in config reg*/
+       *((unsigned char *)(base + config_base)) = 0x41;
+
+       return (0);
+}
+
+/* ------------------------------------------------------------------------- */
+
+static void print_funcid (int func)
+{
+       switch (func) {
+       case CISTPL_FUNCID_MULTI:
+               printk (" Multi-Function");
+               break;
+       case CISTPL_FUNCID_MEMORY:
+               printk (" Memory");
+               break;
+       case CISTPL_FUNCID_SERIAL:
+               printk (" Serial Port");
+               break;
+       case CISTPL_FUNCID_PARALLEL:
+               printk (" Parallel Port");
+               break;
+       case CISTPL_FUNCID_FIXED:
+               printk (" Fixed Disk");
+               break;
+       case CISTPL_FUNCID_VIDEO:
+               printk (" Video Adapter");
+               break;
+       case CISTPL_FUNCID_NETWORK:
+               printk (" Network Adapter");
+               break;
+       case CISTPL_FUNCID_AIMS:
+               printk (" AIMS Card");
+               break;
+       case CISTPL_FUNCID_SCSI:
+               printk (" SCSI Adapter");
+               break;
+       default:
+               printk (" Unknown");
+               break;
+       }
+       printk (" Card\n");
+}
+
+/* ------------------------------------------------------------------------- */
+
+static void print_fixed (volatile unsigned char *p)
+{
+       if (p == NULL)
+               return;
+
+       switch (*p) {
+       case CISTPL_FUNCE_IDE_IFACE:
+           {   unsigned char iface = *(p+2);
+
+               printk ((iface == CISTPL_IDE_INTERFACE) ? " IDE" : " unknown");
+               printk (" interface ");
+               break;
+           }
+       case CISTPL_FUNCE_IDE_MASTER:
+       case CISTPL_FUNCE_IDE_SLAVE:
+           {   unsigned char f1 = *(p+2);
+               unsigned char f2 = *(p+4);
+
+               printk ((f1 & CISTPL_IDE_SILICON) ? " [silicon]" : " [rotating]");
+
+               if (f1 & CISTPL_IDE_UNIQUE)
+                       printk (" [unique]");
+
+               printk ((f1 & CISTPL_IDE_DUAL) ? " [dual]" : " [single]");
+
+               if (f2 & CISTPL_IDE_HAS_SLEEP)
+                       printk (" [sleep]");
+
+               if (f2 & CISTPL_IDE_HAS_STANDBY)
+                       printk (" [standby]");
+
+               if (f2 & CISTPL_IDE_HAS_IDLE)
+                       printk (" [idle]");
+
+               if (f2 & CISTPL_IDE_LOW_POWER)
+                       printk (" [low power]");
+
+               if (f2 & CISTPL_IDE_REG_INHIBIT)
+                       printk (" [reg inhibit]");
+
+               if (f2 & CISTPL_IDE_HAS_INDEX)
+                       printk (" [index]");
+
+               if (f2 & CISTPL_IDE_IOIS16)
+                       printk (" [IOis16]");
+
+               break;
+           }
+       }
+       printk ("\n");
+}
+
+/* ------------------------------------------------------------------------- */
+
+
+#define MAX_IDENT_CHARS                64
+#define        MAX_IDENT_FIELDS        4
+
+static unsigned char *known_cards[] = {
+       "ARGOSY PnPIDE D5",
+       NULL
+};
+
+static int identify  (volatile unsigned char *p)
+{
+       unsigned char id_str[MAX_IDENT_CHARS];
+       unsigned char data;
+       unsigned char *t;
+       unsigned char **card;
+       int i, done;
+
+       if (p == NULL)
+               return (0);     /* Don't know */
+
+       t = id_str;
+       done =0;
+
+       for (i=0; i<=4 && !done; ++i, p+=2) {
+               while ((data = *p) != '\0') {
+                       if (data == 0xFF) {
+                               done = 1;
+                               break;
+                       }
+                       *t++ = data;
+                       if (t == &id_str[MAX_IDENT_CHARS-1]) {
+                               done = 1;
+                               break;
+                       }
+                       p += 2;
+               }
+               if (!done)
+                       *t++ = ' ';
+       }
+       *t = '\0';
+       while (--t > id_str) {
+               if (*t == ' ')
+                       *t = '\0';
+               else
+                       break;
+       }
+       printk ("Card ID: %s\n", id_str);
+
+       for (card=known_cards; *card; ++card) {
+               if (strcmp(*card, id_str) == 0) {       /* found! */
+                       return (1);
+               }
+       }
+
+       return (0);     /* don't know */
+}
+
+void m8xx_ide_init(void)
+{
+       ppc_ide_md.default_irq          = m8xx_ide_default_irq;
+       ppc_ide_md.default_io_base      = m8xx_ide_default_io_base;
+       ppc_ide_md.ide_init_hwif        = m8xx_ide_init_hwif_ports;
+}
index 0639ebee9e0ba21723265662684f6d3edc3b8380..0a0ddd09a2fca160f2975275fe83f3902f3f7285 100644 (file)
@@ -1146,7 +1146,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct request *rq
                byte sel;
 #ifdef DEBUG
                printk("%s: DRIVE_TASK_CMD data=x%02x cmd=0x%02x fr=0x%02x ns=0x%02x sc=0x%02x lcyl=0x%02x hcyl=0x%02x sel=0x%02x\n",
-                       drive->name, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+                       drive->name,
+                       args[0], args[1], args[2], args[3],
+                       args[4], args[5], args[6], args[7]);
 #endif
                OUT_BYTE(args[1], IDE_FEATURE_REG);
                OUT_BYTE(args[3], IDE_SECTOR_REG);
index 766145dd687ae2379fe48e44bf29c1c2a0b56a1a..16b8cf123a59ab1355e78b3c7690c0c3d57d6acc 100644 (file)
@@ -201,7 +201,7 @@ byte ide_get_best_pio_mode (ide_drive_t *drive, byte mode_wanted, byte max_mode,
                }
 
 #if 0
-               if (drive->id->major_rev_num & 0x0004) printf("ATA-2 ");
+               if (drive->id->major_rev_num & 0x0004) printk("ATA-2 ");
 #endif
 
                /*
index 9a38a03f065067be255867e1bd628e621e803a41..52fa23e91cb9d4ff2efc3595d8e84454f4b05643 100644 (file)
@@ -4,7 +4,7 @@
 
 O_TARGET := ieee1394drv.o
 
-export-objs := ieee1394_syms.o
+export-objs := ieee1394_syms.o ohci1394.o
 
 list-multi := ieee1394.o
 ieee1394-objs := ieee1394_core.o ieee1394_transactions.o hosts.o \
index 3d977689bee8620afd4b4b658b0249191598909b..ac337fde6abe67a9e1e53d455720f643470b604a 100644 (file)
@@ -1,3 +1,23 @@
+2001-10-08  David C. Hansen  <haveblue@us.ibm.com>
+
+       * share.c: Make driverlist_lock and parportlist_lock static.
+
+2001-10-08  Philip Blundell  <philb@gnu.org>
+
+       * parport_pc.c: New modular parameter verbose_logging.
+       Make port->modes indicate the modes that we are prepared to use,
+       rather than the modes that are available.
+
+2001-10-07  Tim Waugh  <twaugh@redhat.com>
+
+       * parport_pc.c (parport_pc_probe_port): Fix memory leak spotted by
+       Kipp Cannon.
+
+2001-10-07  Tim Waugh  <twaugh@redhat.com>
+
+       * parport_serial.c: Remove NetMos support, since it causes problems
+       for some people.
+
 2001-08-30  Tim Waugh  <twaugh@redhat.com>
 
        * parport_serial.c (parport_serial_pci_probe): Clean-up on partial
index a0e8000d06a778e2a2c54a3b8930877268b975cd..5526a125a924b1ebf0dd0a70fecd23ea06e04c76 100644 (file)
@@ -91,6 +91,7 @@ static struct superio_struct {        /* For Super-IO chips autodetection */
 } superios[NR_SUPERIOS] __devinitdata = { {0,},};
 
 static int user_specified __devinitdata = 0;
+static int verbose_probing;
 static int registered_parport;
 
 /* frob_control, but for ECR */
@@ -1244,10 +1245,10 @@ struct parport_operations parport_pc_ops =
 static void __devinit show_parconfig_smsc37c669(int io, int key)
 {
        int cr1,cr4,cra,cr23,cr26,cr27,i=0;
-       char *modes[]={ "SPP and Bidirectional (PS/2)", 
-                       "EPP and SPP",
-                       "ECP",
-                       "ECP and EPP"};
+       static const char *modes[]={ "SPP and Bidirectional (PS/2)",    
+                                    "EPP and SPP",
+                                    "ECP",
+                                    "ECP and EPP" };
 
        outb(key,io);
        outb(key,io);
@@ -1265,23 +1266,25 @@ static void __devinit show_parconfig_smsc37c669(int io, int key)
        cr27=inb(io+1);
        outb(0xaa,io);
 
-       printk (KERN_INFO "SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, "
-               "A=0x%2x, 23=0x%02x, 26=0x%02x, 27=0x%02x\n",
-               cr1,cr4,cra,cr23,cr26,cr27);
-
-       /* The documentation calls DMA and IRQ-Lines by letters, so
-          the board maker can/will wire them
-          appropriately/randomly...  G=reserved H=IDE-irq, */
-       printk (KERN_INFO "SMSC LPT Config: io=0x%04x, irq=%c, dma=%c, "
-               "fifo threshold=%d\n", cr23*4,
-               (cr27 &0x0f) ? 'A'-1+(cr27 &0x0f): '-',
-               (cr26 &0x0f) ? 'A'-1+(cr26 &0x0f): '-', cra & 0x0f);
-       printk(KERN_INFO "SMSC LPT Config: enabled=%s power=%s\n",
-              (cr23*4 >=0x100) ?"yes":"no", (cr1 & 4) ? "yes" : "no");
-       printk(KERN_INFO "SMSC LPT Config: Port mode=%s, EPP version =%s\n",
-              (cr1 & 0x08 ) ? "Standard mode only (SPP)" : modes[cr4 & 0x03], 
-              (cr4 & 0x40) ? "1.7" : "1.9");
-
+       if (verbose_probing) {
+               printk (KERN_INFO "SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, "
+                       "A=0x%2x, 23=0x%02x, 26=0x%02x, 27=0x%02x\n",
+                       cr1,cr4,cra,cr23,cr26,cr27);
+               
+               /* The documentation calls DMA and IRQ-Lines by letters, so
+                  the board maker can/will wire them
+                  appropriately/randomly...  G=reserved H=IDE-irq, */
+               printk (KERN_INFO "SMSC LPT Config: io=0x%04x, irq=%c, dma=%c, "
+                       "fifo threshold=%d\n", cr23*4,
+                       (cr27 &0x0f) ? 'A'-1+(cr27 &0x0f): '-',
+                       (cr26 &0x0f) ? 'A'-1+(cr26 &0x0f): '-', cra & 0x0f);
+               printk(KERN_INFO "SMSC LPT Config: enabled=%s power=%s\n",
+                      (cr23*4 >=0x100) ?"yes":"no", (cr1 & 4) ? "yes" : "no");
+               printk(KERN_INFO "SMSC LPT Config: Port mode=%s, EPP version =%s\n",
+                      (cr1 & 0x08 ) ? "Standard mode only (SPP)" : modes[cr4 & 0x03], 
+                      (cr4 & 0x40) ? "1.7" : "1.9");
+       }
+               
        /* Heuristics !  BIOS setup for this mainboard device limits
           the choices to standard settings, i.e. io-address and IRQ
           are related, however DMA can be 1 or 3, assume DMA_A=DMA1,
@@ -1319,15 +1322,16 @@ static void __devinit show_parconfig_smsc37c669(int io, int key)
 static void __devinit show_parconfig_winbond(int io, int key)
 {
        int cr30,cr60,cr61,cr70,cr74,crf0,i=0;
-       char *modes[]={ "Standard (SPP) and Bidirectional(PS/2)", /* 0 */
-                       "EPP-1.9 and SPP",
-                       "ECP",
-                       "ECP and EPP-1.9",
-                       "Standard (SPP)",
-                       "EPP-1.7 and SPP",              /* 5 */
-                       "undefined!",
-                       "ECP and EPP-1.7"};
-       char *irqtypes[]={"pulsed low, high-Z", "follows nACK"};
+       static const char *modes[] = {
+               "Standard (SPP) and Bidirectional(PS/2)", /* 0 */
+               "EPP-1.9 and SPP",
+               "ECP",
+               "ECP and EPP-1.9",
+               "Standard (SPP)",
+               "EPP-1.7 and SPP",              /* 5 */
+               "undefined!",
+               "ECP and EPP-1.7" };
+       static char *irqtypes[] = { "pulsed low, high-Z", "follows nACK" };
                
        /* The registers are called compatible-PnP because the
            register layout is modelled after ISA-PnP, the access
@@ -1350,17 +1354,19 @@ static void __devinit show_parconfig_winbond(int io, int key)
        crf0=inb(io+1);
        outb(0xaa,io);
 
-       printk(KERN_INFO "Winbond LPT Config: cr_30=%02x 60,61=%02x%02x "
-              "70=%02x 74=%02x, f0=%02x\n", cr30,cr60,cr61,cr70,cr74,crf0);
-       printk(KERN_INFO "Winbond LPT Config: active=%s, io=0x%02x%02x irq=%d, ", 
-              (cr30 & 0x01) ? "yes":"no", cr60,cr61,cr70&0x0f );
-       if ((cr74 & 0x07) > 3)
-               printk("dma=none\n");
-       else
-               printk("dma=%d\n",cr74 & 0x07);
-       printk(KERN_INFO "Winbond LPT Config: irqtype=%s, ECP fifo threshold=%d\n",
-              irqtypes[crf0>>7], (crf0>>3)&0x0f);
-       printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n", modes[crf0 & 0x07]);
+       if (verbose_probing) {
+               printk(KERN_INFO "Winbond LPT Config: cr_30=%02x 60,61=%02x%02x "
+                      "70=%02x 74=%02x, f0=%02x\n", cr30,cr60,cr61,cr70,cr74,crf0);
+               printk(KERN_INFO "Winbond LPT Config: active=%s, io=0x%02x%02x irq=%d, ", 
+                      (cr30 & 0x01) ? "yes":"no", cr60,cr61,cr70&0x0f );
+               if ((cr74 & 0x07) > 3)
+                       printk("dma=none\n");
+               else
+                       printk("dma=%d\n",cr74 & 0x07);
+               printk(KERN_INFO "Winbond LPT Config: irqtype=%s, ECP fifo threshold=%d\n",
+                      irqtypes[crf0>>7], (crf0>>3)&0x0f);
+               printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n", modes[crf0 & 0x07]);
+       }
 
        if(cr30 & 0x01) { /* the settings can be interrogated later ... */
                while((superios[i].io!= 0) && (i<NR_SUPERIOS))
@@ -1378,7 +1384,7 @@ static void __devinit show_parconfig_winbond(int io, int key)
 
 static void __devinit decode_winbond(int efer, int key, int devid, int devrev, int oldid)
 {
-       char *type=NULL;
+       const char *type = "unknown";
        int id,progif=2;
 
        if (devid == devrev)
@@ -1386,8 +1392,6 @@ static void __devinit decode_winbond(int efer, int key, int devid, int devrev, i
                    non-winbond register */
                return;
 
-       printk(KERN_INFO "Winbond chip at EFER=0x%x key=0x%02x devid=%02x devrev=%02x "
-              "oldid=%02x\n", efer,key,devid,devrev,oldid);
        id=(devid<<8) | devrev;
 
        /* Values are from public data sheets pdf files, I can just
@@ -1405,19 +1409,18 @@ static void __devinit decode_winbond(int efer, int key, int devid, int devrev, i
        else if ((oldid &0x0f ) == 0x0d) { type="83877ATF"; progif=1;}
        else progif=0;
 
-       if(type==NULL) 
-               printk(KERN_INFO "Winbond unknown chip type\n");
-       else    
-               printk(KERN_INFO "Winbond chip type %s\n",type);
+       if (verbose_probing)
+               printk(KERN_INFO "Winbond chip at EFER=0x%x key=0x%02x "
+                      "devid=%02x devrev=%02x oldid=%02x type=%s\n", 
+                      efer, key, devid, devrev, oldid, type);
 
-       if(progif==2)
+       if (progif == 2)
                show_parconfig_winbond(efer,key);
-       return;
 }
 
 static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
 {
-        char *type=NULL;
+        const char *type = "unknown";
        void (*func)(int io, int key);
         int id;
 
@@ -1427,8 +1430,6 @@ static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
                return;
 
        func=NULL;
-        printk(KERN_INFO "SMSC chip at EFER=0x%x key=0x%02x devid=%02x devrev=%02x\n",
-              efer,key,devid,devrev);
         id=(devid<<8) | devrev;
 
        if      (id==0x0302) {type="37c669"; func=show_parconfig_smsc37c669;}
@@ -1436,13 +1437,13 @@ static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
        else if (devid==0x65) type="37c665GT";
        else if (devid==0x66) type="37c666GT";
 
-       if(type==NULL)
-                printk(KERN_INFO "SMSC unknown chip type\n");
-        else
-                printk(KERN_INFO "SMSC chip type %s\n",type);
+       if (verbose_probing)
+               printk(KERN_INFO "SMSC chip at EFER=0x%x "
+                      "key=0x%02x devid=%02x devrev=%02x type=%s\n",
+                      efer, key, devid, devrev, type);
 
-       if(func) (func)(efer,key);
-       return;
+       if (func)
+               func(efer,key);
 }
 
 
@@ -1540,8 +1541,8 @@ static void __devinit smsc_check(int io, int key)
 
 static void __devinit detect_and_report_winbond (void)
 { 
-       printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n");
-
+       if (verbose_probing)
+               printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n");
        winbond_check(0x3f0,0x87);
        winbond_check(0x370,0x87);
        winbond_check(0x2e ,0x87);
@@ -1553,7 +1554,8 @@ static void __devinit detect_and_report_winbond (void)
 
 static void __devinit detect_and_report_smsc (void)
 {
-       printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n");
+       if (verbose_probing)
+               printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n");
        smsc_check(0x3f0,0x55);
        smsc_check(0x370,0x55);
        smsc_check(0x3f0,0x44);
@@ -1627,7 +1629,7 @@ static int __devinit parport_SPP_supported(struct parport *pb)
        if (user_specified)
                /* That didn't work, but the user thinks there's a
                 * port here. */
-               printk (KERN_DEBUG "parport 0x%lx (WARNING): CTR: "
+               printk (KERN_INFO "parport 0x%lx (WARNING): CTR: "
                        "wrote 0x%02x, read 0x%02x\n", pb->base, w, r);
 
        /* Try the data register.  The data lines aren't tri-stated at
@@ -1646,9 +1648,9 @@ static int __devinit parport_SPP_supported(struct parport *pb)
        if (user_specified) {
                /* Didn't work, but the user is convinced this is the
                 * place. */
-               printk (KERN_DEBUG "parport 0x%lx (WARNING): DATA: "
+               printk (KERN_INFO "parport 0x%lx (WARNING): DATA: "
                        "wrote 0x%02x, read 0x%02x\n", pb->base, w, r);
-               printk (KERN_DEBUG "parport 0x%lx: You gave this address, "
+               printk (KERN_INFO "parport 0x%lx: You gave this address, "
                        "but there is probably no parallel port there!\n",
                        pb->base);
        }
@@ -1760,9 +1762,8 @@ static int __devinit parport_ECP_supported(struct parport *pb)
        int config, configb;
        int pword;
        struct parport_pc_private *priv = pb->private_data;
-       int intrline[]={0,7,9,10,11,14,15,5}; /* Translate ECP
-                                                 intrLine to ISA irq
-                                                 value */
+       /* Translate ECP intrLine to ISA irq value */   
+       static const int intrline[]= { 0, 7, 9, 10, 11, 14, 15, 5 }; 
 
        /* If there is no ECR, we have no hope of supporting ECP. */
        if (!priv->ecr)
@@ -1784,7 +1785,8 @@ static int __devinit parport_ECP_supported(struct parport *pb)
        }
 
        priv->fifo_depth = i;
-       printk (KERN_INFO "0x%lx: FIFO is %d bytes\n", pb->base, i);
+       if (verbose_probing)
+               printk (KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i);
 
        /* Find out writeIntrThreshold */
        frob_econtrol (pb, 1<<2, 1<<2);
@@ -1796,10 +1798,11 @@ static int __devinit parport_ECP_supported(struct parport *pb)
                        break;
        }
 
-       if (i <= priv->fifo_depth)
-               printk (KERN_INFO "0x%lx: writeIntrThreshold is %d\n",
-                       pb->base, i);
-       else
+       if (i <= priv->fifo_depth) {
+               if (verbose_probing)
+                       printk (KERN_DEBUG "0x%lx: writeIntrThreshold is %d\n",
+                               pb->base, i);
+       } else
                /* Number of bytes we know we can write if we get an
                    interrupt. */
                i = 0;
@@ -1818,10 +1821,11 @@ static int __devinit parport_ECP_supported(struct parport *pb)
                        break;
        }
 
-       if (i <= priv->fifo_depth)
-               printk (KERN_INFO "0x%lx: readIntrThreshold is %d\n",
-                       pb->base, i);
-       else
+       if (i <= priv->fifo_depth) {
+               if (verbose_probing)
+                       printk (KERN_INFO "0x%lx: readIntrThreshold is %d\n",
+                               pb->base, i);
+       } else
                /* Number of bytes we can read if we get an interrupt. */
                i = 0;
 
@@ -1850,28 +1854,30 @@ static int __devinit parport_ECP_supported(struct parport *pb)
                pword = 1;
        }
        priv->pword = pword;
-       printk (KERN_DEBUG "0x%lx: PWord is %d bits\n", pb->base, 8 * pword);
-
-       printk (KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", pb->base,
-               config & 0x80 ? "Level" : "Pulses");
 
-       configb = inb (CONFIGB (pb));
-       printk (KERN_DEBUG "0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n",
-               pb->base, config, configb);
-        printk (KERN_DEBUG "0x%lx: ECP settings irq=", pb->base);
-       if ((configb >>3) & 0x07)
-               printk("%d",intrline[(configb >>3) & 0x07]);
-       else
-               printk("<none or set by other means>");
-       printk (" dma=");
-       if( (configb & 0x03 ) == 0x00)
-               printk("<none or set by other means>\n");
-       else
-               printk("%d\n",configb & 0x07);
+       if (verbose_probing) {
+               printk (KERN_DEBUG "0x%lx: PWord is %d bits\n", pb->base, 8 * pword);
+               
+               printk (KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", pb->base,
+                       config & 0x80 ? "Level" : "Pulses");
+
+               configb = inb (CONFIGB (pb));
+               printk (KERN_DEBUG "0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n",
+                       pb->base, config, configb);
+               printk (KERN_DEBUG "0x%lx: ECP settings irq=", pb->base);
+               if ((configb >>3) & 0x07)
+                       printk("%d",intrline[(configb >>3) & 0x07]);
+               else
+                       printk("<none or set by other means>");
+               printk (" dma=");
+               if( (configb & 0x03 ) == 0x00)
+                       printk("<none or set by other means>\n");
+               else
+                       printk("%d\n",configb & 0x07);
+       }
 
        /* Go back to mode 000 */
        frob_econtrol (pb, 0xe0, ECR_SPP << 5);
-       pb->modes |= PARPORT_MODE_ECP | PARPORT_MODE_COMPAT;
 
        return 1;
 }
@@ -2191,10 +2197,10 @@ struct parport *parport_pc_probe_port (unsigned long int base,
        p->ops = ops;
        p->private_data = priv;
        p->physport = p;
-       if (base_hi && !check_region(base_hi,3)) {
+
+       if (base_hi && !check_region(base_hi,3))
                parport_ECR_present(p);
-               parport_ECP_supported(p);
-       }
+
        if (base != 0x3bc) {
                if (!check_region(base+0x3, 5)) {
                        if (!parport_EPP_supported(p))
@@ -2204,6 +2210,7 @@ struct parport *parport_pc_probe_port (unsigned long int base,
        if (!parport_SPP_supported (p)) {
                /* No port. */
                kfree (priv);
+               kfree (ops);
                return NULL;
        }
        if (priv->ecr)
@@ -2250,8 +2257,10 @@ struct parport *parport_pc_probe_port (unsigned long int base,
                p->dma = PARPORT_DMA_NONE;
 
 #ifdef CONFIG_PARPORT_PC_FIFO
-       if (p->dma != PARPORT_DMA_NOFIFO &&
+       if (parport_ECP_supported(p) &&
+           p->dma != PARPORT_DMA_NOFIFO &&
            priv->fifo_depth > 0 && p->irq != PARPORT_IRQ_NONE) {
+               p->modes |= PARPORT_MODE_ECP | PARPORT_MODE_COMPAT;
                p->ops->compat_write_data = parport_pc_compat_write_block_pio;
 #ifdef CONFIG_PARPORT_1284
                p->ops->ecp_write_data = parport_pc_ecp_write_block_pio;
@@ -2870,6 +2879,8 @@ MODULE_PARM_DESC(irq, "IRQ line");
 MODULE_PARM(irq, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
 MODULE_PARM_DESC(dma, "DMA channel");
 MODULE_PARM(dma, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
+MODULE_PARM(verbose_probing, "i");
+MODULE_PARM_DESC(verbose_probing, "Log chit-chat during initialisation");
 
 int init_module(void)
 {      
index e0e047209c373b20601085a7278958cddfdc9962..8b156f2106199636e16f6f01780fc5df0d77e3eb 100644 (file)
@@ -32,8 +32,6 @@
 enum parport_pc_pci_cards {
        titan_110l = 0,
        titan_210l,
-       netmos_9735,
-       netmos_9835,
        avlab_1s1p,
        avlab_1s1p_650,
        avlab_1s1p_850,
@@ -58,8 +56,6 @@ static struct parport_pc_pci {
 } cards[] __devinitdata = {
        /* titan_110l */                { 1, { { 3, -1 }, } },
        /* titan_210l */                { 1, { { 3, -1 }, } },
-       /* netmos_9735 (not tested) */  { 1, { { 2, 3 }, } },
-       /* netmos_9835 (not tested) */  { 1, { { 2, 3 }, } },
        /* avlab_1s1p     */            { 1, { { 1, 2}, } },
        /* avlab_1s1p_650 */            { 1, { { 1, 2}, } },
        /* avlab_1s1p_850 */            { 1, { { 1, 2}, } },
@@ -77,10 +73,6 @@ static struct pci_device_id parport_serial_pci_tbl[] __devinitdata = {
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_110l },
        { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_210L,
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_210l },
-       { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9735,
-         PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9735 },
-       { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
-         PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9835 },
        /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/
        { 0x14db, 0x2110, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p},
        { 0x14db, 0x2111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p_650},
@@ -119,8 +111,6 @@ static struct pci_board_no_ids pci_boards[] __devinitdata = {
 
 /* titan_110l */       { SPCI_FL_BASE1 | SPCI_FL_BASE_TABLE, 1, 921600 },
 /* titan_210l */       { SPCI_FL_BASE1 | SPCI_FL_BASE_TABLE, 2, 921600 },
-/* netmos_9735 (n/t)*/ { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 115200 },
-/* netmos_9835 (n/t)*/ { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 115200 },
 /* avlab_1s1p (n/t) */ { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 1, 115200 },
 /* avlab_1s1p_650 (nt)*/{ SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 1, 115200 },
 /* avlab_1s1p_850 (nt)*/{ SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 1, 115200 },
index 591cd28ba368192902c31fdf1a099a587bf755b8..39bd9a6bdba74ac3bf8c8b07578406a4680b79c3 100644 (file)
@@ -42,10 +42,10 @@ unsigned long parport_default_timeslice = PARPORT_DEFAULT_TIMESLICE;
 int parport_default_spintime =  DEFAULT_SPIN_TIME;
 
 static struct parport *portlist = NULL, *portlist_tail = NULL;
-spinlock_t parportlist_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t parportlist_lock = SPIN_LOCK_UNLOCKED;
 
 static struct parport_driver *driver_chain = NULL;
-spinlock_t driverlist_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t driverlist_lock = SPIN_LOCK_UNLOCKED;
 
 /* What you can do to a port that's gone away.. */
 static void dead_write_lines (struct parport *p, unsigned char b){}
index 6372807d5602b1ec12157687deeb24ec2584aaa0..27beaa4713c782bdb29f8fa2e2eeb6bba9e38d54 100644 (file)
@@ -7566,10 +7566,8 @@ ips_verify_bios_memio(ips_ha_t *ha, char *buffer, u_int32_t buffersize, u_int32_
       return (0);
 }
 
-#if defined (MODULE)
 static Scsi_Host_Template driver_template = IPS;
 #include "scsi_module.c"
-#endif
 
 /*
  * Overrides for Emacs so that we almost follow Linus's tabbing style.
index f6f912ad08b7be8d9c5ba21e45bd9e2dfdd5e3f9..5ff42d2393d694e602aac106962426b9fd1840ca 100644 (file)
@@ -372,7 +372,9 @@ static int uhci_sprint_schedule(struct uhci *uhci, char *buf, int len)
                                if (td->link != td->dma_handle)
                                        out += sprintf(out, "    skel_term_td does not link to self\n");
 
-                               out += uhci_show_td(td, out, len - (out - buf), 4);
+                               /* Don't show it twice */
+                               if (debug <= 1)
+                                       out += uhci_show_td(td, out, len - (out - buf), 4);
                        }
 
                        continue;
index 867fd0e9ebc869e34b4d0116b57208bcef8769e7..d75713383ddeac218a24b4d5b17447e936ef4381 100644 (file)
@@ -2410,7 +2410,7 @@ static void suspend_hc(struct uhci *uhci)
 {
        unsigned int io_addr = uhci->io_addr;
 
-       dbg("suspend_hc");
+       dbg("%x: suspend_hc", io_addr);
 
        outw(USBCMD_EGSM, io_addr + USBCMD);
 
@@ -2422,7 +2422,7 @@ static void wakeup_hc(struct uhci *uhci)
        unsigned int io_addr = uhci->io_addr;
        unsigned int status;
 
-       dbg("wakeup_hc");
+       dbg("%x: wakeup_hc", io_addr);
 
        outw(0, io_addr + USBCMD);
        
@@ -2564,7 +2564,7 @@ static void release_uhci(struct uhci *uhci)
  *  - The fourth queue is the bandwidth reclamation queue, which loops back
  *    to the high speed control queue.
  */
-static int alloc_uhci(struct pci_dev *dev, int irq, unsigned int io_addr, unsigned int io_size)
+static int alloc_uhci(struct pci_dev *dev, unsigned int io_addr, unsigned int io_size)
 {
        struct uhci *uhci;
        int retval = -EBUSY;
@@ -2602,9 +2602,9 @@ static int alloc_uhci(struct pci_dev *dev, int irq, unsigned int io_addr, unsign
        pci_set_master(dev);
 
 #ifndef __sparc__
-       sprintf(buf, "%d", irq);
+       sprintf(buf, "%d", dev->irq);
 #else
-       bufp = __irq_itoa(irq);
+       bufp = __irq_itoa(dev->irq);
 #endif
        printk(KERN_INFO __FILE__ ": USB UHCI at I/O 0x%x, IRQ %s\n",
                io_addr, bufp);
@@ -2828,13 +2828,13 @@ static int alloc_uhci(struct pci_dev *dev, int irq, unsigned int io_addr, unsign
 
        start_hc(uhci);
 
-       if (request_irq(irq, uhci_interrupt, SA_SHIRQ, "usb-uhci", uhci))
+       if (request_irq(dev->irq, uhci_interrupt, SA_SHIRQ, "usb-uhci", uhci))
                goto err_request_irq;
 
-       uhci->irq = irq;
+       uhci->irq = dev->irq;
 
        /* disable legacy emulation */
-       pci_write_config_word(uhci->dev, USBLEGSUP, 0);
+       pci_write_config_word(uhci->dev, USBLEGSUP, USBLEGSUP_DEFAULT);
 
        usb_connect(uhci->rh.dev);
 
@@ -2925,7 +2925,7 @@ static int __devinit uhci_pci_probe(struct pci_dev *dev, const struct pci_device
                if (!(pci_resource_flags(dev, i) & IORESOURCE_IO))
                        continue;
 
-               return alloc_uhci(dev, dev->irq, io_addr, io_size);
+               return alloc_uhci(dev, io_addr, io_size);
        }
 
        return -ENODEV;
@@ -2958,7 +2958,7 @@ static void __devexit uhci_pci_remove(struct pci_dev *dev)
 #ifdef CONFIG_PM
 static int uhci_pci_suspend(struct pci_dev *dev, u32 state)
 {
-       reset_hc((struct uhci *) dev->driver_data);
+       suspend_hc((struct uhci *) dev->driver_data);
        return 0;
 }
 
index 16986cf4b5968ddbbf290963e4e7f968e9fa25a7..0955c37f3fdce9afd8a956fbb3b24283cc2b78f2 100644 (file)
@@ -53,8 +53,8 @@
 #define   USBPORTSC_SUSP       0x1000  /* Suspend */
 
 /* Legacy support register */
-#define USBLEGSUP 0xc0
-#define USBLEGSUP_DEFAULT      0x2000  /* only PIRQ enable set */
+#define USBLEGSUP              0xc0
+#define   USBLEGSUP_DEFAULT    0x2000  /* only PIRQ enable set */
 
 #define UHCI_NULL_DATA_SIZE    0x7FF   /* for UHCI controller TD */
 
index 9a4a2341740f4ead04062fb63ebd248937dbce7c..a09f4af0ac6433b7d3acecdd407e871c94a7bcc7 100644 (file)
@@ -4,6 +4,8 @@
 
 O_TARGET := sisfb.o
 
+export-objs := sis_main.o
+
 obj-y  := sis_main.o sis_300.o sis_301.o
 obj-m  := $(O_TARGET)
 
index 974379d14d4dff0ac9689187a20b041ff5148a52..db7a1c7778028a139969c660682ce98e3b832d99 100644 (file)
     20010919   Richard Gooch <rgooch@atnf.csiro.au>
               Set inode->i_mapping->a_ops for block nodes in <get_vfs_inode>.
   v0.116
+    20010927   Richard Gooch <rgooch@atnf.csiro.au>
+              Went back to global rwsem for symlinks (refcount scheme no good)
+  v0.117
 */
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <asm/bitops.h>
 #include <asm/atomic.h>
 
-#define DEVFS_VERSION            "0.116 (20010919)"
+#define DEVFS_VERSION            "0.117 (20010927)"
 
 #define DEVFS_NAME "devfs"
 
@@ -659,8 +662,6 @@ struct fcb_type  /*  File, char, block type  */
 
 struct symlink_type
 {
-    atomic_t refcount;           /*  When this drops to zero, it's unused    */
-    rwlock_t lock;               /*  Lock around the registered flag         */
     unsigned int length;         /*  Not including the NULL-termimator       */
     char *linkname;              /*  This is NULL-terminated                 */
 };
@@ -750,6 +751,8 @@ static unsigned int boot_options = OPTION_MOUNT;
 static unsigned int boot_options = OPTION_NONE;
 #endif
 
+static DECLARE_RWSEM (symlink_rwsem);
+
 /*  Forward function declarations  */
 static struct devfs_entry *search_for_entry (struct devfs_entry *dir,
                                             const char *name,
@@ -807,19 +810,12 @@ static struct devfs_entry *search_for_entry_in_dir (struct devfs_entry *parent,
     if (curr == NULL) return NULL;
     if (!S_ISLNK (curr->mode) || !traverse_symlink) return curr;
     /*  Need to follow the link: this is a stack chomper  */
-    read_lock (&curr->u.symlink.lock);
-    if (!curr->registered)
-    {
-       read_unlock (&curr->u.symlink.lock);
-       return NULL;
-    }
-    atomic_inc (&curr->u.symlink.refcount);
-    read_unlock (&curr->u.symlink.lock);
-    retval = search_for_entry (parent, curr->u.symlink.linkname,
-                              curr->u.symlink.length, FALSE, FALSE, NULL,
-                              TRUE);
-    if ( atomic_dec_and_test (&curr->u.symlink.refcount) )
-       kfree (curr->u.symlink.linkname);
+    down_read (&symlink_rwsem);
+    retval = curr->registered ?
+       search_for_entry (parent, curr->u.symlink.linkname,
+                         curr->u.symlink.length, FALSE, FALSE, NULL,
+                         TRUE) : NULL;
+    up_read (&symlink_rwsem);
     return retval;
 }   /*  End Function search_for_entry_in_dir  */
 
@@ -1436,11 +1432,11 @@ static void unregister (struct devfs_entry *de)
     }
     if (S_ISLNK (de->mode) && de->registered)
     {
-       write_lock (&de->u.symlink.lock);
        de->registered = FALSE;
-       write_unlock (&de->u.symlink.lock);
-       if ( atomic_dec_and_test (&de->u.symlink.refcount) )
-           kfree (de->u.symlink.linkname);
+       down_write (&symlink_rwsem);
+       if (de->u.symlink.linkname) kfree (de->u.symlink.linkname);
+       de->u.symlink.linkname = NULL;
+       up_write (&symlink_rwsem);
        return;
     }
     if ( S_ISFIFO (de->mode) )
@@ -1520,8 +1516,10 @@ static int devfs_do_symlink (devfs_handle_t dir, const char *name,
        kfree (newlink);
        return -ENOMEM;
     }
+    down_write (&symlink_rwsem);
     if (de->registered)
     {
+       up_write (&symlink_rwsem);
        kfree (newlink);
        printk ("%s: devfs_do_symlink(%s): entry already exists\n",
                DEVFS_NAME, name);
@@ -1532,9 +1530,8 @@ static int devfs_do_symlink (devfs_handle_t dir, const char *name,
     de->hide = (flags & DEVFS_FL_HIDE) ? TRUE : FALSE;
     de->u.symlink.linkname = newlink;
     de->u.symlink.length = linklength;
-    atomic_set (&de->u.symlink.refcount, 1);
-    rwlock_init (&de->u.symlink.lock);
     de->registered = TRUE;
+    up_write (&symlink_rwsem);
     if (handle != NULL) *handle = de;
     return 0;
 }   /*  End Function devfs_do_symlink  */
@@ -2818,16 +2815,15 @@ static int devfs_unlink (struct inode *dir, struct dentry *dentry)
     if (de == NULL) return -ENOENT;
     devfsd_notify_one (de, DEVFSD_NOTIFY_DELETE, inode->i_mode,
                       inode->i_uid, inode->i_gid, dir->i_sb->u.generic_sbp);
+    de->registered = FALSE;
+    de->hide = TRUE;
     if ( S_ISLNK (de->mode) )
     {
-       write_lock (&de->u.symlink.lock);
-       de->registered = FALSE;
-       write_unlock (&de->u.symlink.lock);
-       if ( atomic_dec_and_test (&de->u.symlink.refcount) )
-           kfree (de->u.symlink.linkname);
+       down_write (&symlink_rwsem);
+       if (de->u.symlink.linkname) kfree (de->u.symlink.linkname);
+       de->u.symlink.linkname = NULL;
+       up_write (&symlink_rwsem);
     }
-    else de->registered = FALSE;
-    de->hide = TRUE;
     free_dentries (de);
     return 0;
 }   /*  End Function devfs_unlink  */
@@ -3029,17 +3025,10 @@ static int devfs_readlink (struct dentry *dentry, char *buffer, int buflen)
 
     de = get_devfs_entry_from_vfs_inode (dentry->d_inode, TRUE);
     if (!de) return -ENODEV;
-    read_lock (&de->u.symlink.lock);
-    if (!de->registered)
-    {
-       read_unlock (&de->u.symlink.lock);
-       return -ENODEV;
-    }
-    atomic_inc (&de->u.symlink.refcount);
-    read_unlock (&de->u.symlink.lock);
-    err = vfs_readlink (dentry, buffer, buflen, de->u.symlink.linkname);
-    if ( atomic_dec_and_test (&de->u.symlink.refcount) )
-       kfree (de->u.symlink.linkname);
+    down_read (&symlink_rwsem);
+    err = de->registered ? vfs_readlink (dentry, buffer, buflen,
+                                        de->u.symlink.linkname) : -ENODEV;
+    up_read (&symlink_rwsem);
     return err;
 }   /*  End Function devfs_readlink  */
 
@@ -3050,17 +3039,10 @@ static int devfs_follow_link (struct dentry *dentry, struct nameidata *nd)
 
     de = get_devfs_entry_from_vfs_inode (dentry->d_inode, TRUE);
     if (!de) return -ENODEV;
-    read_lock (&de->u.symlink.lock);
-    if (!de->registered)
-    {
-       read_unlock (&de->u.symlink.lock);
-       return -ENODEV;
-    }
-    atomic_inc (&de->u.symlink.refcount);
-    read_unlock (&de->u.symlink.lock);
-    err = vfs_follow_link (nd, de->u.symlink.linkname);
-    if ( atomic_dec_and_test (&de->u.symlink.refcount) )
-       kfree (de->u.symlink.linkname);
+    down_read (&symlink_rwsem);
+    err = de->registered ? vfs_follow_link (nd,
+                                           de->u.symlink.linkname) : -ENODEV;
+    up_read (&symlink_rwsem);
     return err;
 }   /*  End Function devfs_follow_link  */
 
index 5d5372f007abdf3b93d04448ea28b0928023e39f..883e4cc5869869a8e87f90992bee01521103f024 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/lockd/sm_inter.h>
 
 #define NLMDBG_FACILITY                NLMDBG_CLIENT
+#define NLMCLNT_GRACE_WAIT     (5*HZ)
 
 static int     nlmclnt_test(struct nlm_rqst *, struct file_lock *);
 static int     nlmclnt_lock(struct nlm_rqst *, struct file_lock *);
@@ -557,19 +558,22 @@ nlmclnt_unlock_callback(struct rpc_task *task)
 
        if (task->tk_status < 0) {
                dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status);
-               goto retry_unlock;
+               goto retry_rebind;
        }
-       if (status != NLM_LCK_GRANTED
-        && status != NLM_LCK_DENIED_GRACE_PERIOD) {
-               printk("lockd: unexpected unlock status: %d\n", status);
+       if (status == NLM_LCK_DENIED_GRACE_PERIOD) {
+               rpc_delay(task, NLMCLNT_GRACE_WAIT);
+               goto retry_unlock;
        }
+       if (status != NLM_LCK_GRANTED)
+               printk(KERN_WARNING "lockd: unexpected unlock status: %d\n", status);
 
 die:
        nlm_release_host(req->a_host);
        kfree(req);
        return;
- retry_unlock:
+ retry_rebind:
        nlm_rebind_host(req->a_host);
+ retry_unlock:
        rpc_restart_call(task);
 }
 
index 18b37f3e1abada5210dce0fe65312d7d72dce0a2..e7960a255df3089f768775fff3db60de3ed290e0 100644 (file)
@@ -68,23 +68,6 @@ int is_reusable (struct super_block * s, unsigned long block, int bit_value)
 
 #endif /* CONFIG_REISERFS_CHECK */
 
-#if 0
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-int is_used (struct super_block * s, unsigned long block)
-{
-    int i, j;
-
-    i = block / (s->s_blocksize << 3);
-    j = block % (s->s_blocksize << 3);
-    if (reiserfs_test_le_bit(j, SB_AP_BITMAP (s)[i]->b_data))
-       return 1;
-    return 0;
-  
-}
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#endif
-
-
 /* get address of corresponding bit (bitmap block number and offset in it) */
 static inline void get_bit_address (struct super_block * s, unsigned long block, int * bmap_nr, int * offset)
 {
@@ -109,13 +92,8 @@ void reiserfs_free_block (struct reiserfs_transaction_handle *th, unsigned long
     struct buffer_head ** apbh;
     int nr, offset;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (!s)
-       reiserfs_panic (s, "vs-4060: reiserfs_free_block: trying to free block on nonexistent device");
-
-    if (is_reusable (s, block, 1) == 0)
-       reiserfs_panic (s, "vs-4070: reiserfs_free_block: can not free such block");
-#endif
+  RFALSE(!s, "vs-4060: trying to free block on nonexistent device");
+  RFALSE(is_reusable (s, block, 1) == 0, "vs-4070: can not free such block");
 
   rs = SB_DISK_SUPER_BLOCK (s);
   sbh = SB_BUFFER_WITH_SB (s);
@@ -317,17 +295,12 @@ static int do_reiserfs_new_blocknrs (struct reiserfs_transaction_handle *th,
           priority 0 */
        return NO_DISK_SPACE;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (!s)
-       reiserfs_panic (s, "vs-4090: reiserfs_new_blocknrs: trying to get new block from nonexistent device");
-    
-    if (search_start == MAX_B_NUM)
-       reiserfs_panic (s, "vs-4100: reiserfs_new_blocknrs: we are optimizing location based on "
-                       "the bogus location of a temp buffer (%lu).", search_start);
-    
-    if (amount_needed < 1 || amount_needed > 2) 
-       reiserfs_panic (s, "vs-4110: reiserfs_new_blocknrs: amount_needed parameter incorrect (%d)", amount_needed);
-#endif /* CONFIG_REISERFS_CHECK */
+  RFALSE( !s, "vs-4090: trying to get new block from nonexistent device");
+  RFALSE( search_start == MAX_B_NUM,
+         "vs-4100: we are optimizing location based on "
+         "the bogus location of a temp buffer (%lu).", search_start);
+  RFALSE( amount_needed < 1 || amount_needed > 2,
+         "vs-4110: amount_needed parameter incorrect (%d)", amount_needed);
 
   /* We continue the while loop if another process snatches our found
    * free block from us after we find it but before we successfully
@@ -337,10 +310,8 @@ static int do_reiserfs_new_blocknrs (struct reiserfs_transaction_handle *th,
   while (amount_needed--) {
     /* skip over any blocknrs already gotten last time. */
     if (*(free_blocknrs) != 0) {
-#ifdef CONFIG_REISERFS_CHECK
-      if (is_reusable (s, *free_blocknrs, 1) == 0)
-       reiserfs_panic(s, "vs-4120: reiserfs_new_blocknrs: bad blocknr on free_blocknrs list");
-#endif /* CONFIG_REISERFS_CHECK */
+      RFALSE( is_reusable (s, *free_blocknrs, 1) == 0, 
+             "vs-4120: bad blocknr on free_blocknrs list");
       free_blocknrs++;
       continue;
     }
@@ -414,10 +385,9 @@ free_and_return:
 
     reiserfs_prepare_for_journal(s, SB_AP_BITMAP(s)[i], 1) ;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (buffer_locked (SB_AP_BITMAP (s)[i]) || is_reusable (s, search_start, 0) == 0)
-       reiserfs_panic (s, "vs-4140: reiserfs_new_blocknrs: bitmap block is locked or bad block number found");
-#endif
+    RFALSE( buffer_locked (SB_AP_BITMAP (s)[i]) || 
+           is_reusable (s, search_start, 0) == 0,
+           "vs-4140: bitmap block is locked or bad block number found");
 
     /* if this bit was already set, we've scheduled, and someone else
     ** has allocated it.  loop around and try again
index ac91f019d0ffd9cd179c06cf52532f502312a896..bdcee58655ad74d057d9ce9a91469a852f613b1c 100644 (file)
@@ -109,11 +109,9 @@ static int get_new_buffer_near_blocknr(
   *pp_s_new_bh = reiserfs_getblk(p_s_sb->s_dev, n_new_blocknumber, p_s_sb->s_blocksize);
   if ( buffer_uptodate(*pp_s_new_bh) ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( buffer_dirty(*pp_s_new_bh) || (*pp_s_new_bh)->b_dev == NODEV ) {
-      reiserfs_panic(p_s_sb, "PAP-14080: get_new_buffer: invalid uptodate buffer %b for the new block", *pp_s_new_bh);
-    }
-#endif
+    RFALSE( buffer_dirty(*pp_s_new_bh) || (*pp_s_new_bh)->b_dev == NODEV,
+           "PAP-14080: invalid uptodate buffer %b for the new block", 
+           *pp_s_new_bh);
 
     /* Free path buffers to prevent deadlock. */
     /* It is possible that this process has the buffer, which this function is getting, already in
@@ -158,12 +156,9 @@ static int get_new_buffer_near_blocknr(
   else {
     ;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (atomic_read (&((*pp_s_new_bh)->b_count)) != 1) {
-      reiserfs_panic(p_s_sb,"PAP-14100: get_new_buffer: not uptodate buffer %b for the new block has b_count more than one",
-                    *pp_s_new_bh);
-    }
-#endif
+    RFALSE( atomic_read (&((*pp_s_new_bh)->b_count)) != 1,
+           "PAP-14100: not uptodate buffer %b for the new block has b_count more than one",
+           *pp_s_new_bh);
 
   }
   return (n_ret_value | n_repeat);
@@ -310,12 +305,10 @@ int get_new_buffer(
     n_repeat |= SCHEDULE_OCCURRED;
   }
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( atomic_read (&((*pp_s_new_bh)->b_count)) != 1 || buffer_dirty (*pp_s_new_bh)) {
-    reiserfs_panic(p_s_sb,"PAP-14100: get_new_buffer: not free or dirty buffer %b for the new block",
-                  *pp_s_new_bh);
-  }
-#endif
+  RFALSE( atomic_read (&((*pp_s_new_bh)->b_count)) != 1 || 
+         buffer_dirty (*pp_s_new_bh),
+         "PAP-14100: not free or dirty buffer %b for the new block", 
+         *pp_s_new_bh);
 
   return n_repeat;
 }
index 29726b69babc63303def8924191aabff5d334cc0..0049e2e055f4aba2fb177575f6b615dd624932a8 100644 (file)
@@ -102,24 +102,18 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
        ih = de.de_ih;
        store_ih (&tmp_ih, ih);
                
-#ifdef CONFIG_REISERFS_CHECK
        /* we must have found item, that is item of this directory, */
-       if (COMP_SHORT_KEYS (&(ih->ih_key), &pos_key))
-           reiserfs_panic (inode->i_sb, "vs-9000: reiserfs_readdir: "
-                           "found item %h does not match to dir we readdir %k",
-                           ih, &pos_key);
-      
-       if (item_num > B_NR_ITEMS (bh) - 1)
-           reiserfs_panic (inode->i_sb, "vs-9005: reiserfs_readdir: "
-                           "item_num == %d, item amount == %d",
-                           item_num, B_NR_ITEMS (bh));
+       RFALSE( COMP_SHORT_KEYS (&(ih->ih_key), &pos_key),
+               "vs-9000: found item %h does not match to dir we readdir %k",
+               ih, &pos_key);
+       RFALSE( item_num > B_NR_ITEMS (bh) - 1,
+               "vs-9005 item_num == %d, item amount == %d", 
+               item_num, B_NR_ITEMS (bh));
       
        /* and entry must be not more than number of entries in the item */
-       if (I_ENTRY_COUNT (ih) < entry_num)
-           reiserfs_panic (inode->i_sb, "vs-9010: reiserfs_readdir: "
-                           "entry number is too big %d (%d)",
-                           entry_num, I_ENTRY_COUNT (ih));
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE( I_ENTRY_COUNT (ih) < entry_num,
+               "vs-9010: entry number is too big %d (%d)", 
+               entry_num, I_ENTRY_COUNT (ih));
 
        if (search_res == POSITION_FOUND || entry_num < I_ENTRY_COUNT (ih)) {
            /* go through all entries in the directory item beginning from the entry, that has been found */
index 3e9a14db4c676a78a6116b676e3997cb9ef5e635..45382100a67658d8d18c0a9a2529a3e1b7e8eead 100644 (file)
@@ -90,18 +90,12 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
     int n;
     struct item_head * ih;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( tb->FR[0] && B_LEVEL (tb->FR[0]) != DISK_LEAF_NODE_LEVEL + 1)
-       reiserfs_panic (tb->tb_sb,
-                       "vs- 12000: balance_leaf_when_delete:level: wrong FR %z\n", tb->FR[0]);
-    if ( tb->blknum[0] > 1 )
-       reiserfs_panic (tb->tb_sb,
-                       "PAP-12005: balance_leaf_when_delete: "
-                       "tb->blknum == %d, can not be > 1", tb->blknum[0]);
-       
-    if ( ! tb->blknum[0] && ! PATH_H_PPARENT(tb->tb_path, 0))
-       reiserfs_panic (tb->tb_sb, "PAP-12010: balance_leaf_when_delete: tree can not be empty");
-#endif
+    RFALSE( tb->FR[0] && B_LEVEL (tb->FR[0]) != DISK_LEAF_NODE_LEVEL + 1,
+           "vs- 12000: level: wrong FR %z\n", tb->FR[0]);
+    RFALSE( tb->blknum[0] > 1,
+           "PAP-12005: tb->blknum == %d, can not be > 1", tb->blknum[0]);
+    RFALSE( ! tb->blknum[0] && ! PATH_H_PPARENT(tb->tb_path, 0),
+           "PAP-12010: tree can not be empty");
 
     ih = B_N_PITEM_HEAD (tbS0, item_pos);
 
@@ -110,10 +104,9 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
     switch (flag) {
     case M_DELETE:   /* delete item in S[0] */
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (le16_to_cpu (ih->ih_item_len) + IH_SIZE != -tb->insert_size [0])
-           reiserfs_panic (tb->tb_sb, "vs-12013: balance_leaf_when_delete: "
-                           "mode Delete, insert size %d, ih to be deleted %h", ih);
+        RFALSE( le16_to_cpu (ih->ih_item_len) + IH_SIZE != -tb->insert_size [0],
+                "vs-12013: mode Delete, insert size %d, ih to be deleted %h", 
+                ih);
 
 #if 0 /* rigth delim key not supported */
        if ( ! item_pos && (! tb->L[0] || COMP_KEYS(B_PRIGHT_DELIM_KEY(tb->L[0]), B_N_PKEY(tbS0, 0))) ) {
@@ -124,8 +117,6 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
                            B_N_PKEY(tbS0, 0),
                            tb->CFL[0] ? B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0]) : 0);
        }
-#endif
-
 #endif
 
        bi.tb = tb;
@@ -152,13 +143,8 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
            }
        } 
 
-#ifdef CONFIG_REISERFS_CHECK
-#if 0
-       if (! item_pos && (!tb->CFL[0] || !tb->L[0]))
-#endif
-           if (! item_pos && !tb->CFL[0])
-               reiserfs_panic (tb->tb_sb, "PAP-12020: balance_leaf_when_delete: tb->CFL[0]==%p, tb->L[0]==%p", tb->CFL[0], tb->L[0]);
-#endif
+       RFALSE( ! item_pos && !tb->CFL[0],
+               "PAP-12020: tb->CFL[0]==%p, tb->L[0]==%p", tb->CFL[0], tb->L[0]);
     
        break;
 
@@ -182,10 +168,9 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
            tb->insert_size[0] = -1;
            leaf_cut_from_buffer (&bi, item_pos, pos_in_item, -tb->insert_size[0]);
 
-#ifdef CONFIG_REISERFS_CHECK
-           if (! item_pos && ! pos_in_item && ! tb->CFL[0])
-               reiserfs_panic (tb->tb_sb, "PAP-12030: balance_leaf_when_delete: can not change delimiting key. CFL[0]=%p", tb->CFL[0]);
-#endif /* CONFIG_REISERFS_CHECK */
+           RFALSE( ! item_pos && ! pos_in_item && ! tb->CFL[0],
+                   "PAP-12030: can not change delimiting key. CFL[0]=%p", 
+                   tb->CFL[0]);
 
            if ( ! item_pos && ! pos_in_item && tb->CFL[0] ) {
                replace_key(tb, tb->CFL[0],tb->lkey[0],tbS0,0);
@@ -197,10 +182,8 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
        } else {
            leaf_cut_from_buffer (&bi, item_pos, pos_in_item, -tb->insert_size[0]);
 
-#ifdef CONFIG_REISERFS_CHECK
-           if (! ih->ih_item_len)
-               reiserfs_panic (tb->tb_sb, "PAP-12035: balance_leaf_when_delete: cut must leave non-zero dynamic length of item");
-#endif /* CONFIG_REISERFS_CHECK */
+           RFALSE( ! ih->ih_item_len,
+                   "PAP-12035: cut must leave non-zero dynamic length of item");
        }
        break;
     }
@@ -259,12 +242,8 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
                return -1;
            }
 
-#ifdef CONFIG_REISERFS_CHECK
-           if ( tb->rnum[0] != 0 )
-               reiserfs_panic (tb->tb_sb, "PAP-12045: balance_leaf_when_delete: "
-                               "rnum must be 0 (%d)", tb->rnum[0]);
-#endif /* CONFIG_REISERFS_CHECK */
-
+           RFALSE( tb->rnum[0] != 0, 
+                   "PAP-12045: rnum must be 0 (%d)", tb->rnum[0]);
            /* all contents of L[0] and S[0] will be in L[0] */
            leaf_shift_left(tb, n, -1);
 
@@ -277,21 +256,18 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
        }
        /* a part of contents of S[0] will be in L[0] and the rest part of S[0] will be in R[0] */
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (( tb->lnum[0] + tb->rnum[0] < n ) || ( tb->lnum[0] + tb->rnum[0] > n+1 ))
-           reiserfs_panic (tb->tb_sb, "PAP-12050: balance_leaf_when_delete: "
-                           "rnum(%d) and lnum(%d) and item number in S[0] are not consistent",
-                           tb->rnum[0], tb->lnum[0], n);
-
-       if (( tb->lnum[0] + tb->rnum[0] == n ) && (tb->lbytes != -1 || tb->rbytes != -1))
-           reiserfs_panic (tb->tb_sb, "PAP-12055: balance_leaf_when_delete: "
-                           "bad rbytes (%d)/lbytes (%d) parameters when items are not split", 
-                           tb->rbytes, tb->lbytes);
-       if (( tb->lnum[0] + tb->rnum[0] == n + 1 ) && (tb->lbytes < 1 || tb->rbytes != -1))
-           reiserfs_panic (tb->tb_sb, "PAP-12060: balance_leaf_when_delete: "
-                           "bad rbytes (%d)/lbytes (%d) parameters when items are split", 
-                           tb->rbytes, tb->lbytes);
-#endif
+       RFALSE( ( tb->lnum[0] + tb->rnum[0] < n ) || 
+               ( tb->lnum[0] + tb->rnum[0] > n+1 ),
+               "PAP-12050: rnum(%d) and lnum(%d) and item number(%d) in S[0] are not consistent",
+               tb->rnum[0], tb->lnum[0], n);
+       RFALSE( ( tb->lnum[0] + tb->rnum[0] == n ) && 
+               (tb->lbytes != -1 || tb->rbytes != -1),
+               "PAP-12055: bad rbytes (%d)/lbytes (%d) parameters when items are not split", 
+               tb->rbytes, tb->lbytes);
+       RFALSE( ( tb->lnum[0] + tb->rnum[0] == n + 1 ) && 
+               (tb->lbytes < 1 || tb->rbytes != -1),
+               "PAP-12060: bad rbytes (%d)/lbytes (%d) parameters when items are split", 
+               tb->rbytes, tb->lbytes);
 
        leaf_shift_left (tb, tb->lnum[0], tb->lbytes);
        leaf_shift_right(tb, tb->rnum[0], tb->rbytes);
@@ -315,12 +291,8 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
        return 0;
     }
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( tb->rnum[0] )
-       reiserfs_panic (tb->tb_sb, "PAP-12065: balance_leaf_when_delete: "
-                       "bad rnum parameter must be 0 (%d)", tb->rnum[0]);
-#endif
-
+    RFALSE( tb->rnum[0], 
+           "PAP-12065: bad rnum parameter must be 0 (%d)", tb->rnum[0]);
     return 0;
 }
 
@@ -394,11 +366,8 @@ static int balance_leaf (struct tree_balance * tb,
                    int new_item_len;
                    int version;
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if (!is_direct_le_ih (ih))
-                       reiserfs_panic (tb->tb_sb, "PAP-12075: balance_leaf: " 
-                                       "only direct inserted item can be broken. %h", ih);
-#endif
+                   RFALSE( !is_direct_le_ih (ih),
+                           "PAP-12075: only direct inserted item can be broken. %h", ih);
                    ret_val = leaf_shift_left (tb, tb->lnum[0]-1, -1);
                    /* when reading the if conditions preceding the subsequent preserve_shifted
                       lines understand that their goal is to determine if all that we are
@@ -415,12 +384,9 @@ static int balance_leaf (struct tree_balance * tb,
                    /* Calculate and check item length to insert to L[0] */
                    ih->ih_item_len -= new_item_len;
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( (int)(ih->ih_item_len) <= 0 )
-                       reiserfs_panic(tb->tb_sb, "PAP-12080: balance_leaf: "
-                                      "there is nothing to insert into L[0]: ih_item_len=%d",
-                                      (int)ih->ih_item_len);
-#endif
+                   RFALSE( (int)(ih->ih_item_len) <= 0,
+                           "PAP-12080: there is nothing to insert into L[0]: ih_item_len=%d",
+                           (int)ih->ih_item_len);
 
                    /* Insert new item into L[0] */
                    bi.tb = tb;
@@ -443,12 +409,9 @@ static int balance_leaf (struct tree_balance * tb,
                    else
                        zeros_num -= tb->lbytes;
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( (int)(ih->ih_item_len) <= 0 )
-                       reiserfs_panic(tb->tb_sb, "PAP-12085: balance_leaf: "
-                                      "there is nothing to insert into S[0]: ih_item_len=%d",
-                                      (int)ih->ih_item_len);
-#endif
+                   RFALSE( (int)(ih->ih_item_len) <= 0,
+                           "PAP-12085: there is nothing to insert into S[0]: ih_item_len=%d",
+                           (int)ih->ih_item_len);
                } else {
                    /* new item in whole falls into L[0] */
                    /* Shift lnum[0]-1 items to L[0] */
@@ -481,11 +444,8 @@ static int balance_leaf (struct tree_balance * tb,
                    /* we must shift the part of the appended item */
                    if ( is_direntry_le_ih (B_N_PITEM_HEAD (tbS0, item_pos))) {
 
-#ifdef CONFIG_REISERFS_CHECK
-                       if ( zeros_num )
-                           reiserfs_panic(tb->tb_sb, "PAP-12090: balance_leaf: illegal parameter in case of a directory");
-#endif
-            
+                       RFALSE( zeros_num,
+                               "PAP-12090: illegal parameter in case of a directory");
                        /* directory item */
                        if ( tb->lbytes > pos_in_item ) {
                            /* new directory entry falls into L[0] */
@@ -535,18 +495,12 @@ static int balance_leaf (struct tree_balance * tb,
                    }
                    else {
                        /* regular object */
-
-#ifdef CONFIG_REISERFS_CHECK
-                       if ( tb->lbytes  <= 0 )
-                           reiserfs_panic(tb->tb_sb, "PAP-12095: balance_leaf: " 
-                                          "there is nothing to shift to L[0]. lbytes=%d",
-                                          tb->lbytes);
-                       if ( pos_in_item != B_N_PITEM_HEAD(tbS0, item_pos)->ih_item_len )
-                           reiserfs_panic(tb->tb_sb, "PAP-12100: balance_leaf: " 
-                                          "incorrect position to paste: item_len=%d, pos_in_item=%d",
-                                          B_N_PITEM_HEAD(tbS0,item_pos)->ih_item_len, pos_in_item);
-#endif
-
+                       RFALSE( tb->lbytes <= 0,
+                               "PAP-12095: there is nothing to shift to L[0]. lbytes=%d",
+                               tb->lbytes);
+                       RFALSE( pos_in_item != B_N_PITEM_HEAD(tbS0, item_pos)->ih_item_len,
+                               "PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d",
+                               B_N_PITEM_HEAD(tbS0,item_pos)->ih_item_len, pos_in_item);
                        if ( tb->lbytes >= pos_in_item ) {
                            /* appended item will be in L[0] in whole */
                            int l_n;
@@ -557,13 +511,9 @@ static int balance_leaf (struct tree_balance * tb,
                            /* Calculate new insert_size[0] */
                            tb->insert_size[0] -= l_n;
 
-#ifdef CONFIG_REISERFS_CHECK
-                           if ( tb->insert_size[0] <= 0 )
-                               reiserfs_panic(tb->tb_sb, "PAP-12105: balance_leaf: " 
-                                              "there is nothing to paste into L[0]. insert_size=%d",
-                                              tb->insert_size[0]);
-#endif
-
+                           RFALSE( tb->insert_size[0] <= 0,
+                                   "PAP-12105: there is nothing to paste into L[0]. insert_size=%d",
+                                   tb->insert_size[0]);
                            ret_val =  leaf_shift_left(tb,tb->lnum[0], 
                                                       B_N_PITEM_HEAD(tbS0,item_pos)->ih_item_len);
 #if 0/*preserve list*/
@@ -581,12 +531,11 @@ static int balance_leaf (struct tree_balance * tb,
                                l_n,body, zeros_num > l_n ? l_n : zeros_num
                                );
 
-#ifdef CONFIG_REISERFS_CHECK
-                           if (l_n && is_indirect_le_ih(B_N_PITEM_HEAD(tb->L[0],
-                                                                       n + item_pos - ret_val)))
-                               reiserfs_panic(tb->tb_sb, "PAP-12110: balance_leaf: "
-                                              "pasting more than 1 unformatted node pointer into indirect item");
-#endif
+                           RFALSE( l_n && 
+                                   is_indirect_le_ih(B_N_PITEM_HEAD
+                                                     (tb->L[0],
+                                                      n + item_pos - ret_val)),
+                                   "PAP-12110: pasting more than 1 unformatted node pointer into indirect item");
 
                            /* 0-th item in S0 can be only of DIRECT type when l_n != 0*/
                            {
@@ -598,18 +547,10 @@ static int balance_leaf (struct tree_balance * tb,
                              set_le_key_k_offset (version, B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0]),
                                                   le_key_k_offset (version, B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0])) + l_n);
                            }
-#if 0
-                           set_le_key_k_offset (B_PRIGHT_DELIM_KEY(tb->L[0]), le_key_k_offset (B_PRIGHT_DELIM_KEY(tb->L[0])) + l_n);
-#endif
                            /*    k_offset (B_N_PKEY (tbS0, 0)) += l_n;
                                  k_offset (B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0])) += l_n;
                                  k_offset (B_PRIGHT_DELIM_KEY(tb->L[0])) += l_n;*/
 
-#ifdef NO_CONFIG_REISERFS_CHECK /* journal victim */
-                           if (!buffer_dirty (tbS0) || !buffer_dirty (tb->CFL[0]) || !buffer_dirty (tb->L[0]))
-                               reiserfs_panic(tb->tb_sb, "PAP-12115: balance_leaf: L, CLF and S must be dirty already");
-#endif
-
                            /* Calculate new body, position in item and insert_size[0] */
                            if ( l_n > zeros_num ) {
                                body += (l_n - zeros_num);
@@ -619,26 +560,24 @@ static int balance_leaf (struct tree_balance * tb,
                                zeros_num -= l_n;
                            pos_in_item = 0;    
 
-#ifdef CONFIG_REISERFS_CHECK   
-                           if (comp_short_le_keys (B_N_PKEY(tbS0,0),
-                                                   B_N_PKEY(tb->L[0],B_NR_ITEMS(tb->L[0])-1)) ||
-                               !op_is_left_mergeable (B_N_PKEY (tbS0, 0), tbS0->b_size) ||
-                               !op_is_left_mergeable(B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0]), tbS0->b_size))
-                               reiserfs_panic (tb->tb_sb, "PAP-12120: balance_leaf: "
-                                               "item must be merge-able with left neighboring item");
-#endif
-
+                           RFALSE( comp_short_le_keys 
+                                   (B_N_PKEY(tbS0,0),
+                                    B_N_PKEY(tb->L[0],B_NR_ITEMS(tb->L[0])-1)) ||
+                               
+                                   !op_is_left_mergeable 
+                                   (B_N_PKEY (tbS0, 0), tbS0->b_size) ||
+                                   !op_is_left_mergeable
+                                   (B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0]), 
+                                    tbS0->b_size),
+                                   "PAP-12120: item must be merge-able with left neighboring item");
                        }
                        else /* only part of the appended item will be in L[0] */
                        {
                            /* Calculate position in item for append in S[0] */
                            pos_in_item -= tb->lbytes;
 
-#ifdef CONFIG_REISERFS_CHECK
-                           if ( pos_in_item <= 0 )
-                               reiserfs_panic(tb->tb_sb, "PAP-12125: balance_leaf: "
-                                              "no place for paste. pos_in_item=%d", pos_in_item);
-#endif
+                           RFALSE( pos_in_item <= 0,
+                                   "PAP-12125: no place for paste. pos_in_item=%d", pos_in_item);
 
                            /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */
                            leaf_shift_left(tb,tb->lnum[0],tb->lbytes);
@@ -723,11 +662,9 @@ static int balance_leaf (struct tree_balance * tb,
                    int version;
                    loff_t offset;
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( !is_direct_le_ih (ih) )
-                       reiserfs_panic(tb->tb_sb, "PAP-12135: balance_leaf: "
-                                      "only direct item can be split. (%h)", ih);
-#endif
+                   RFALSE( !is_direct_le_ih (ih),
+                           "PAP-12135: only direct item can be split. (%h)", 
+                           ih);
 
                    leaf_shift_right(tb,tb->rnum[0]-1,-1);
 #if 0/*preserve list*/
@@ -828,24 +765,18 @@ static int balance_leaf (struct tree_balance * tb,
                    { /* we append to directory item */
                        int entry_count;
 
-#ifdef CONFIG_REISERFS_CHECK
-                       if ( zeros_num )
-                           reiserfs_panic(tb->tb_sb, "PAP-12145: balance_leaf: illegal parametr in case of a directory");
-#endif
-
+                       RFALSE( zeros_num,
+                               "PAP-12145: illegal parametr in case of a directory");
                        entry_count = I_ENTRY_COUNT(B_N_PITEM_HEAD(tbS0, item_pos));
                        if ( entry_count - tb->rbytes < pos_in_item )
                            /* new directory entry falls into R[0] */
                        {
                            int paste_entry_position;
 
-#ifdef CONFIG_REISERFS_CHECK
-                           if ( tb->rbytes - 1 >= entry_count || ! tb->insert_size[0] )
-                               reiserfs_panic(tb->tb_sb, "PAP-12150: balance_leaf: "
-                                              "no enough of entries to shift to R[0]: rbytes=%d, entry_count=%d",
-                                              tb->rbytes, entry_count);
-#endif
-
+                           RFALSE( tb->rbytes - 1 >= entry_count || 
+                                   ! tb->insert_size[0],
+                                   "PAP-12150: no enough of entries to shift to R[0]: rbytes=%d, entry_count=%d",
+                                   tb->rbytes, entry_count);
                            /* Shift rnum[0]-1 items in whole. Shift rbytes-1 directory entries from directory item number rnum[0] */
                            leaf_shift_right(tb,tb->rnum[0],tb->rbytes - 1);
 #if 0/*preserve list*/
@@ -899,11 +830,9 @@ static int balance_leaf (struct tree_balance * tb,
                        if ( (n_shift = tb->rbytes - tb->insert_size[0]) < 0 )
                            n_shift = 0;
 
-#ifdef CONFIG_REISERFS_CHECK
-                       if (pos_in_item != B_N_PITEM_HEAD (tbS0, item_pos)->ih_item_len)
-                           reiserfs_panic(tb->tb_sb,"PAP-12155: balance_leaf: invalid position to paste. ih_item_len=%d, pos_in_item=%d",
-                                          pos_in_item, B_N_PITEM_HEAD(tbS0,item_pos)->ih_item_len);
-#endif
+                       RFALSE( pos_in_item != B_N_PITEM_HEAD (tbS0, item_pos)->ih_item_len,
+                               "PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d",
+                               pos_in_item, B_N_PITEM_HEAD(tbS0,item_pos)->ih_item_len);
 
                        leaf_shift_right(tb,tb->rnum[0],n_shift);
 #if 0/*preserve list*/
@@ -954,10 +883,8 @@ static int balance_leaf (struct tree_balance * tb,
 
                        if (is_indirect_le_ih (B_N_PITEM_HEAD(tb->R[0],0))) {
 
-#ifdef CONFIG_REISERFS_CHECK
-                           if (n_rem)
-                               reiserfs_panic(tb->tb_sb, "PAP-12160: balance_leaf: paste more than one unformatted node pointer");
-#endif
+                           RFALSE( n_rem,
+                                   "PAP-12160: paste more than one unformatted node pointer");
 
                            set_ih_free_space (B_N_PITEM_HEAD(tb->R[0],0), ((struct unfm_nodeinfo*)body)->unfm_freespace);
                        }
@@ -995,11 +922,8 @@ static int balance_leaf (struct tree_balance * tb,
                            );
                        if ( ! pos_in_item ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-                           if ( item_pos - n + tb->rnum[0] )
-                               reiserfs_panic (tb->tb_sb, "PAP-12165: balance_leaf: " 
-                                               "directory item must be first item of node when pasting is in 0th position");
-#endif
+                           RFALSE( item_pos - n + tb->rnum[0],
+                                   "PAP-12165: directory item must be first item of node when pasting is in 0th position");
 
                            /* update delimiting keys */
                            replace_key(tb, tb->CFR[0],tb->rkey[0],tb->R[0],0);
@@ -1032,43 +956,18 @@ static int balance_leaf (struct tree_balance * tb,
     }  /* tb->rnum[0] > 0 */
 
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( tb->blknum[0] > 3 )  
-       reiserfs_panic (tb->tb_sb, "PAP-12180: balance_leaf: blknum can not be %d. It must be <= 3",  tb->blknum[0]);
-
-    if ( tb->blknum[0] < 0 )  
-       reiserfs_panic (tb->tb_sb, "PAP-12185: balance_leaf: blknum can not be %d. It must be >= 0",  tb->blknum[0]);
-#endif
+    RFALSE( tb->blknum[0] > 3,
+           "PAP-12180: blknum can not be %d. It must be <= 3",  tb->blknum[0]);
+    RFALSE( tb->blknum[0] < 0,
+           "PAP-12185: blknum can not be %d. It must be >= 0",  tb->blknum[0]);
 
     /* if while adding to a node we discover that it is possible to split
        it in two, and merge the left part into the left neighbor and the
        right part into the right neighbor, eliminating the node */
     if ( tb->blknum[0] == 0 ) { /* node S[0] is empty now */
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( ! tb->lnum[0] || ! tb->rnum[0] )
-           reiserfs_panic(tb->tb_sb, "PAP-12190: balance_leaf: lnum and rnum must not be zero");
-#if 0
-       if (COMP_KEYS (B_N_PKEY(tb->R[0], 0), B_PRIGHT_DELIM_KEY(tbS0)))
-           reiserfs_panic (tb->tb_sb, "vs-12192: balance_leaf: S[0] is being removed from the tree, it has incorrect right delimiting key");
-#endif
-#endif
-
-#if 0
-       /* if insertion was done before 0-th position in R[0], right
-          delimiting key of the tb->L[0]'s and left delimiting key are
-          not set correctly */
-       if (tb->L[0]) {
-           copy_key(B_PRIGHT_DELIM_KEY(tb->L[0]), B_PRIGHT_DELIM_KEY(tbS0));
-           reiserfs_mark_buffer_dirty (tb->L[0], 0);
-       }
-
-       if (tb->CFL[0]) {
-           copy_key (B_N_PDELIM_KEY (tb->CFL[0], tb->lkey[0]), B_PRIGHT_DELIM_KEY(tbS0));
-           reiserfs_mark_buffer_dirty (tb->CFL[0], 0);
-       }
-#endif
-    
+       RFALSE( ! tb->lnum[0] || ! tb->rnum[0],
+               "PAP-12190: lnum and rnum must not be zero");
        /* if insertion was done before 0-th position in R[0], right
           delimiting key of the tb->L[0]'s and left delimiting key are
           not set correctly */
@@ -1094,10 +993,7 @@ static int balance_leaf (struct tree_balance * tb,
     sbytes[1] = tb->s2bytes;
     for( i = tb->blknum[0] - 2; i >= 0; i-- ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (!snum[i])
-           reiserfs_panic(tb->tb_sb,"PAP-12200: balance_leaf: snum[%d] == %d. Must be > 0", i, snum[i]);
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE( !snum[i], "PAP-12200: snum[%d] == %d. Must be > 0", i, snum[i]);
 
        /* here we shift from S to S_new nodes */
 
@@ -1120,14 +1016,11 @@ static int balance_leaf (struct tree_balance * tb,
                    const char * r_body;
                    int version;
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( !is_direct_le_ih(ih) )
+                   RFALSE( !is_direct_le_ih(ih),
                        /* The items which can be inserted are:
                           Stat_data item, direct item, indirect item and directory item which consist of only two entries "." and "..".
                           These items must not be broken except for a direct one. */
-                       reiserfs_panic(tb->tb_sb, "PAP-12205: balance_leaf: "
-                                      "non-direct item can not be broken when inserting");
-#endif
+                           "PAP-12205: non-direct item can not be broken when inserting");
 
                    /* Move snum[i]-1 items from S[0] to S_new[i] */
                    leaf_move_items (LEAF_FROM_S_TO_SNEW, tb, snum[i] - 1, -1, S_new[i]);
@@ -1210,10 +1103,7 @@ static int balance_leaf (struct tree_balance * tb,
                { /* we must shift part of the appended item */
                    struct item_head * aux_ih;
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( ih )
-                       reiserfs_panic (tb->tb_sb, "PAP-12210: balance_leaf: ih must be 0");
-#endif /* CONFIG_REISERFS_CHECK */
+                   RFALSE( ih, "PAP-12210: ih must be 0");
 
                    if ( is_direntry_le_ih (aux_ih = B_N_PITEM_HEAD(tbS0,item_pos))) {
                        /* we append to directory item */
@@ -1225,14 +1115,11 @@ static int balance_leaf (struct tree_balance * tb,
                        if ( entry_count - sbytes[i] < pos_in_item  && pos_in_item <= entry_count ) {
                            /* new directory entry falls into S_new[i] */
                  
-#ifdef CONFIG_REISERFS_CHECK
-                           if ( ! tb->insert_size[0] )
-                               reiserfs_panic (tb->tb_sb, "PAP-12215: balance_leaif: insert_size is already 0");
-                           if ( sbytes[i] - 1 >= entry_count )
-                               reiserfs_panic (tb->tb_sb, "PAP-12220: balance_leaf: "
-                                               "there are no so much entries (%d), only %d",
-                                               sbytes[i] - 1, entry_count);
-#endif
+                           RFALSE( ! tb->insert_size[0],
+                                   "PAP-12215: insert_size is already 0");
+                           RFALSE( sbytes[i] - 1 >= entry_count,
+                                   "PAP-12220: there are no so much entries (%d), only %d",
+                                   sbytes[i] - 1, entry_count);
 
                            /* Shift snum[i]-1 items in whole. Shift sbytes[i] directory entries from directory item number snum[i] */
                            leaf_move_items (LEAF_FROM_S_TO_SNEW, tb, snum[i], sbytes[i]-1, S_new[i]);
@@ -1268,11 +1155,9 @@ static int balance_leaf (struct tree_balance * tb,
                        int n_shift, n_rem, r_zeros_number;
                        const char * r_body;
 
-#ifdef CONFIG_REISERFS_CHECK
-                       if ( pos_in_item != B_N_PITEM_HEAD(tbS0,item_pos)->ih_item_len ||
-                            tb->insert_size[0] <= 0 )
-                           reiserfs_panic (tb->tb_sb, "PAP-12225: balance_leaf: item too short or insert_size <= 0");
-#endif
+                       RFALSE( pos_in_item != B_N_PITEM_HEAD(tbS0,item_pos)->ih_item_len ||
+                               tb->insert_size[0] <= 0,
+                               "PAP-12225: item too short or insert_size <= 0");
 
                        /* Calculate number of bytes which must be shifted from appended item */
                        n_shift = sbytes[i] - tb->insert_size[0];
@@ -1340,12 +1225,9 @@ static int balance_leaf (struct tree_balance * tb,
                    tbS0 = PATH_PLAST_BUFFER (tb->tb_path);
 #endif
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( ret_val )
-                       reiserfs_panic (tb->tb_sb, "PAP-12240: balance_leaf: "
-                                       "unexpected value returned by leaf_move_items (%d)",
-                                       ret_val);
-#endif /* CONFIG_REISERFS_CHECK */
+                   RFALSE( ret_val,
+                           "PAP-12240: unexpected value returned by leaf_move_items (%d)",
+                           ret_val);
 
                    /* paste into item */
                    bi.tb = tb;
@@ -1387,14 +1269,11 @@ static int balance_leaf (struct tree_balance * tb,
        memcpy (insert_key + i,B_N_PKEY(S_new[i],0),KEY_SIZE);
        insert_ptr[i] = S_new[i];
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (atomic_read (&(S_new[i]->b_count)) != 1) {
-           if (atomic_read(&(S_new[i]->b_count)) != 2 ||
-             !(buffer_journaled(S_new[i]) || buffer_journal_dirty(S_new[i]))) {
-             reiserfs_panic (tb->tb_sb, "PAP-12247: balance_leaf: S_new[%d] : (%b)\n", i, S_new[i]);
-           }
-       }
-#endif
+       RFALSE( (atomic_read (&(S_new[i]->b_count)) != 1) &&
+               (atomic_read(&(S_new[i]->b_count)) != 2 ||
+                !(buffer_journaled(S_new[i]) || 
+                  buffer_journal_dirty(S_new[i]))), 
+               "PAP-12247: S_new[%d] : (%b)\n", i, S_new[i]);
 
 #if 0
        /* update right_delimiting_key fields */
@@ -1452,10 +1331,8 @@ static int balance_leaf (struct tree_balance * tb,
            if (is_direntry_le_ih (pasted)) {
                if ( pos_in_item >= 0 && pos_in_item <= le16_to_cpu (pasted->u.ih_entry_count) ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( ! tb->insert_size[0] )
-                       reiserfs_panic (tb->tb_sb, "PAP-12260: balance_leaf: insert_size is 0 already");
-#endif /* CONFIG_REISERFS_CHECK */
+                   RFALSE( ! tb->insert_size[0], 
+                           "PAP-12260: insert_size is 0 already");
 
                    /* prepare space */
                    bi.tb = tb;
@@ -1479,12 +1356,8 @@ static int balance_leaf (struct tree_balance * tb,
                        body + DEH_SIZE, tb->insert_size[0]
                        );
                    if ( ! item_pos && ! pos_in_item ) {
-
-#ifdef CONFIG_REISERFS_CHECK
-                       if (!tb->CFL[0] || !tb->L[0])
-                           reiserfs_panic (tb->tb_sb, "PAP-12270: balance_leaf: CFL[0]/L[0] must be specified");
-#endif /* CONFIG_REISERFS_CHECK */
-
+                       RFALSE( !tb->CFL[0] || !tb->L[0], 
+                               "PAP-12270: CFL[0]/L[0] must be specified");
                        if (tb->CFL[0]) {
                            replace_key(tb, tb->CFL[0], tb->lkey[0],tbS0,0);
 
@@ -1500,12 +1373,9 @@ static int balance_leaf (struct tree_balance * tb,
                }
            } else { /* regular object */
                if ( pos_in_item == pasted->ih_item_len ) {
-
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( tb->insert_size[0] <= 0 )
-                       reiserfs_panic (tb->tb_sb,
-                                       "PAP-12275: balance_leaf: insert size must not be %d", tb->insert_size[0]);
-#endif /* CONFIG_REISERFS_CHECK */
+                   RFALSE( tb->insert_size[0] <= 0,
+                           "PAP-12275: insert size must not be %d", 
+                           tb->insert_size[0]);
                    bi.tb = tb;
                    bi.bi_bh = tbS0;
                    bi.bi_parent = PATH_H_PPARENT (tb->tb_path, 0);
@@ -1514,13 +1384,9 @@ static int balance_leaf (struct tree_balance * tb,
 
                    if (is_indirect_le_ih (pasted)) {
 
-#ifdef CONFIG_REISERFS_CHECK
-                       if ( tb->insert_size[0] != UNFM_P_SIZE )
-                           reiserfs_panic (tb->tb_sb,
-                                           "PAP-12280: balance_leaf: insert_size for indirect item must be %d, not %d",
-                                           UNFM_P_SIZE, tb->insert_size[0]);
-#endif /* CONFIG_REISERFS_CHECK */
-
+                       RFALSE( tb->insert_size[0] != UNFM_P_SIZE,
+                               "PAP-12280: insert_size for indirect item must be %d, not %d",
+                               UNFM_P_SIZE, tb->insert_size[0]);
                        set_ih_free_space (pasted, ((struct unfm_nodeinfo*)body)->unfm_freespace);
                    }
                    tb->insert_size[0] = 0;
@@ -1557,10 +1423,7 @@ void make_empty_node (struct buffer_info * bi)
 {
     struct block_head * blkh;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (bi->bi_bh == NULL)
-       reiserfs_panic (0, "PAP-12295: make_empty_node: pointer to the buffer is NULL");
-#endif
+    RFALSE( bi->bi_bh == NULL, "PAP-12295: pointer to the buffer is NULL");
 
     (blkh = B_BLK_HEAD(bi->bi_bh))->blk_nr_item = cpu_to_le16 (0);
     blkh->blk_free_space = cpu_to_le16 (MAX_CHILD_SIZE(bi->bi_bh));
@@ -1646,21 +1509,17 @@ void replace_key (struct tree_balance * tb, struct buffer_head * dest, int n_des
                  struct buffer_head * src, int n_src)
 {
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (dest == NULL || src == NULL)
-       reiserfs_panic (0, "vs-12305: replace_key: sourse or destination buffer is 0 (src=%p, dest=%p)", src, dest);
-
-    if ( ! B_IS_KEYS_LEVEL (dest) )
-       reiserfs_panic (0, "vs-12310: replace_key: invalid level (%z) for destination buffer. dest must be leaf",
-                       dest);
-
-    if (n_dest < 0 || n_src < 0)
-       reiserfs_panic (0, "vs-12315: replace_key: src(%d) or dest(%d) key number less than 0", n_src, n_dest);
-
-    if (n_dest >= B_NR_ITEMS(dest) || n_src >= B_NR_ITEMS(src))
-       reiserfs_panic (0, "vs-12320: replace_key: src(%d(%d)) or dest(%d(%d)) key number is too big",
-                       n_src, B_NR_ITEMS(src), n_dest, B_NR_ITEMS(dest));
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( dest == NULL || src == NULL,
+           "vs-12305: source or destination buffer is 0 (src=%p, dest=%p)",
+           src, dest);
+    RFALSE( ! B_IS_KEYS_LEVEL (dest),
+           "vs-12310: invalid level (%z) for destination buffer. dest must be leaf",
+           dest);
+    RFALSE( n_dest < 0 || n_src < 0,
+           "vs-12315: src(%d) or dest(%d) key number < 0", n_src, n_dest);
+    RFALSE( n_dest >= B_NR_ITEMS(dest) || n_src >= B_NR_ITEMS(src),
+           "vs-12320: src(%d(%d)) or dest(%d(%d)) key number is too big",
+           n_src, B_NR_ITEMS(src), n_dest, B_NR_ITEMS(dest));
    
     if (B_IS_ITEMS_LEVEL (src))
        /* source buffer contains leaf node */
@@ -1679,11 +1538,9 @@ int get_left_neighbor_position (
 {
   int Sh_position = PATH_H_POSITION (tb->tb_path, h + 1);
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (PATH_H_PPARENT (tb->tb_path, h) == 0 || tb->FL[h] == 0)
-    reiserfs_panic (tb->tb_sb, "vs-12325: get_left_neighbor_position: FL[%d](%p) or F[%d](%p) does not exist", 
-                   h, tb->FL[h], h, PATH_H_PPARENT (tb->tb_path, h));
-#endif
+  RFALSE( PATH_H_PPARENT (tb->tb_path, h) == 0 || tb->FL[h] == 0,
+         "vs-12325: FL[%d](%p) or F[%d](%p) does not exist", 
+         h, tb->FL[h], h, PATH_H_PPARENT (tb->tb_path, h));
 
   if (Sh_position == 0)
     return B_NR_ITEMS (tb->FL[h]);
@@ -1696,11 +1553,9 @@ int get_right_neighbor_position (struct tree_balance * tb, int h)
 {
   int Sh_position = PATH_H_POSITION (tb->tb_path, h + 1);
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (PATH_H_PPARENT (tb->tb_path, h) == 0 || tb->FR[h] == 0)
-    reiserfs_panic (tb->tb_sb, "vs-12330: get_right_neighbor_position: F[%d](%p) or FR[%d](%p) does not exist", 
-                   h, PATH_H_PPARENT (tb->tb_path, h), h, tb->FR[h]);
-#endif
+  RFALSE( PATH_H_PPARENT (tb->tb_path, h) == 0 || tb->FR[h] == 0,
+         "vs-12330: F[%d](%p) or FR[%d](%p) does not exist", 
+         h, PATH_H_PPARENT (tb->tb_path, h), h, tb->FR[h]);
 
   if (Sh_position == B_NR_ITEMS (PATH_H_PPARENT (tb->tb_path, h)))
     return 0;
@@ -1717,17 +1572,14 @@ static void check_internal_node (struct super_block * s, struct buffer_head * bh
   struct disk_child * dc;
   int i;
 
-  if (!bh)
-    reiserfs_panic (s, "PAP-12336: check_internal_node: bh == 0");
+  RFALSE( !bh, "PAP-12336: bh == 0");
 
   if (!bh || !B_IS_IN_TREE (bh))
     return;
  
-  if (!buffer_dirty (bh) && 
-      !(buffer_journaled(bh) || buffer_journal_dirty(bh))) {
-    reiserfs_panic (s, "PAP-12337: check_internal_node: buffer (%b) must be dirty", bh);
-  }
-
+  RFALSE( !buffer_dirty (bh) && 
+         !(buffer_journaled(bh) || buffer_journal_dirty(bh)),
+         "PAP-12337: buffer (%b) must be dirty", bh);
   dc = B_N_CHILD (bh, 0);
 
   for (i = 0; i <= B_NR_ITEMS (bh); i ++, dc ++) {
@@ -1875,18 +1727,13 @@ static inline void do_balance_starts (struct tree_balance *tb)
 
     /* store_print_tb (tb); */
 
-#ifdef CONFIG_REISERFS_CHECK
-
     /* do not delete, just comment it out */
 /*    print_tb(flag, PATH_LAST_POSITION(tb->tb_path), tb->tb_path->pos_in_item, tb, 
             "check");*/
-
-    if (check_before_balancing (tb))
-       reiserfs_panic (tb->tb_sb, "PAP-12340: do_balance: locked buffers in TB");
-
+    RFALSE( check_before_balancing (tb), "PAP-12340: locked buffers in TB");
+#ifdef CONFIG_REISERFS_CHECK
     cur_tb = tb;
-    
-#endif /* CONFIG_REISERFS_CHECK */
+#endif
 }
 
 
index cbfc03690fa60df5bc8e94bcb5cd9dd4299c6d23..e1670e618f5a78c405acf8c345b18ccba55a333f 100644 (file)
@@ -65,19 +65,14 @@ static inline int old_item_num (int new_num, int affected_item_num, int mode)
 
   if (mode == M_INSERT) {
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (new_num == 0)
-      reiserfs_panic (0,"vs-8005: old_item_num: for INSERT mode and item number of inserted item");
-#endif
+    RFALSE( new_num == 0, 
+           "vs-8005: for INSERT mode and item number of inserted item");
 
     return new_num - 1;
   }
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (mode != M_DELETE)
-      reiserfs_panic (0, "vs-8010: old_item_num: mode must be M_DELETE (mode = \'%c\'", mode);
-#endif
-
+  RFALSE( mode != M_DELETE,
+         "vs-8010: old_item_num: mode must be M_DELETE (mode = \'%c\'", mode);
   /* delete mode */
   return new_num + 1;
 }
@@ -156,37 +151,14 @@ static void create_virtual_node (struct tree_balance * tb, int h)
     if (vn->vn_mode == M_INSERT) {
        struct virtual_item * vi = vn->vn_vi + vn->vn_affected_item_num;
       
-#ifdef CONFIG_REISERFS_CHECK
-       if (vn->vn_ins_ih == 0)
-           reiserfs_panic (0, "vs-8040: create_virtual_node: item header of inserted item is not specified");
-#endif
-
+       RFALSE( vn->vn_ins_ih == 0,
+               "vs-8040: item header of inserted item is not specified");
        vi->vi_item_len = tb->insert_size[0];
        vi->vi_ih = vn->vn_ins_ih;
        vi->vi_item = vn->vn_data;
        vi->vi_uarea = vn->vn_free_ptr;
        
        op_create_vi (vn, vi, 0/*not pasted or cut*/, tb->insert_size [0]);
-#if 0
-       switch (type/*le_key_k_type (ih_version (vn->vn_ins_ih), &(vn->vn_ins_ih->ih_key))*/) {
-       case TYPE_STAT_DATA:
-           vn->vn_vi[vn->vn_affected_item_num].vi_type |= VI_TYPE_STAT_DATA;
-           break;
-       case TYPE_DIRECT:
-           vn->vn_vi[vn->vn_affected_item_num].vi_type |= VI_TYPE_DIRECT;
-           break;
-       case TYPE_INDIRECT:
-           vn->vn_vi[vn->vn_affected_item_num].vi_type |= VI_TYPE_INDIRECT;
-           break;
-       default:
-           /* inseted item is directory (it must be item with "." and "..") */
-           vn->vn_vi[vn->vn_affected_item_num].vi_type |= 
-               (VI_TYPE_DIRECTORY | VI_TYPE_FIRST_DIRECTORY_ITEM | VI_TYPE_INSERTED_DIRECTORY_ITEM);
-      
-           /* this directory item can not be split, so do not set sizes of entries */
-           break;
-       }
-#endif
     }
   
     /* set right merge flag we take right delimiting key and check whether it is a mergeable item */
@@ -227,10 +199,7 @@ static void check_left (struct tree_balance * tb, int h, int cur_free)
     struct virtual_item * vi;
     int d_size, ih_size;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (cur_free < 0)
-       reiserfs_panic (0, "vs-8050: check_left: cur_free (%d) < 0", cur_free);
-#endif
+    RFALSE( cur_free < 0, "vs-8050: cur_free (%d) < 0", cur_free);
 
     /* internal level */
     if (h > 0) {       
@@ -247,19 +216,15 @@ static void check_left (struct tree_balance * tb, int h, int cur_free)
        return;
     }
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (!PATH_H_PPARENT (tb->tb_path, 0))
-       reiserfs_panic (0, "vs-8055: check_left: parent does not exist or invalid");
-#endif
+    RFALSE( !PATH_H_PPARENT (tb->tb_path, 0),
+           "vs-8055: parent does not exist or invalid");
 
     vi = vn->vn_vi;
     if ((unsigned int)cur_free >= (vn->vn_size - ((vi->vi_type & VI_TYPE_LEFT_MERGEABLE) ? IH_SIZE : 0))) {
        /* all contents of S[0] fits into L[0] */
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (vn->vn_mode == M_INSERT || vn->vn_mode == M_PASTE)
-           reiserfs_panic (0, "vs-8055: check_left: invalid mode or balance condition failed");
-#endif
+       RFALSE( vn->vn_mode == M_INSERT || vn->vn_mode == M_PASTE,
+               "vs-8055: invalid mode or balance condition failed");
 
        tb->lnum[0] = vn->vn_nr_item;
        tb->lbytes = -1;
@@ -313,10 +278,7 @@ static void check_right (struct tree_balance * tb, int h, int cur_free)
     struct virtual_item * vi;
     int d_size, ih_size;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (cur_free < 0)
-       reiserfs_panic (tb->tb_sb, "vs-8070: check_right: cur_free < 0");
-#endif
+    RFALSE( cur_free < 0, "vs-8070: cur_free < 0");
     
     /* internal level */
     if (h > 0) {
@@ -333,19 +295,15 @@ static void check_right (struct tree_balance * tb, int h, int cur_free)
        return;
     }
   
-#ifdef CONFIG_REISERFS_CHECK
-    if (!PATH_H_PPARENT (tb->tb_path, 0))
-       reiserfs_panic (tb->tb_sb, "vs-8075: check_right: parent does not exist or invalid");
-#endif
+    RFALSE( !PATH_H_PPARENT (tb->tb_path, 0),
+           "vs-8075: parent does not exist or invalid");
   
     vi = vn->vn_vi + vn->vn_nr_item - 1;
     if ((unsigned int)cur_free >= (vn->vn_size - ((vi->vi_type & VI_TYPE_RIGHT_MERGEABLE) ? IH_SIZE : 0))) {
        /* all contents of S[0] fits into R[0] */
        
-#ifdef CONFIG_REISERFS_CHECK
-       if (vn->vn_mode == M_INSERT || vn->vn_mode == M_PASTE)
-           reiserfs_panic (tb->tb_sb, "vs-8080: check_right: invalid mode or balance condition failed");
-#endif
+       RFALSE( vn->vn_mode == M_INSERT || vn->vn_mode == M_PASTE,
+               "vs-8080: invalid mode or balance condition failed");
 
        tb->rnum[h] = vn->vn_nr_item;
        tb->rbytes = -1;
@@ -422,14 +380,12 @@ static int get_num_ver (int mode, struct tree_balance * tb, int h,
     split_item_positions[0] = -1;
     split_item_positions[1] = -1;
 
-#ifdef CONFIG_REISERFS_CHECK
     /* We only create additional nodes if we are in insert or paste mode
        or we are in replace mode at the internal level. If h is 0 and
        the mode is M_REPLACE then in fix_nodes we change the mode to
        paste or insert before we get here in the code.  */
-    if ( tb->insert_size[h] < 0  || (mode != M_INSERT && mode != M_PASTE))
-       reiserfs_panic (0, "vs-8100: get_num_ver: insert_size < 0 in overflow");
-#endif
+    RFALSE( tb->insert_size[h] < 0  || (mode != M_INSERT && mode != M_PASTE),
+           "vs-8100: insert_size < 0 in overflow");
 
     max_node_size = MAX_CHILD_SIZE (PATH_H_PBUFFER (tb->tb_path, h));
 
@@ -469,11 +425,7 @@ static int get_num_ver (int mode, struct tree_balance * tb, int h,
        struct virtual_item * vi = vn->vn_vi + i;
        int skip_from_end = ((i == end_item) ? end_bytes : 0);
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (needed_nodes > 3) {
-           reiserfs_panic (tb->tb_sb, "vs-8105: get_num_ver: too many nodes are needed");
-       }
-#endif
+       RFALSE( needed_nodes > 3, "vs-8105: too many nodes are needed");
 
        /* get size of current item */
        current_item_size = vi->vi_item_len;
@@ -495,12 +447,10 @@ static int get_num_ver (int mode, struct tree_balance * tb, int h,
        if (current_item_size > max_node_size) {
            /* virtual item length is longer, than max size of item in
                a node. It is impossible for direct item */
-#ifdef CONFIG_REISERFS_CHECK
-           if (is_direct_le_ih (vi->vi_ih))
-               reiserfs_panic (tb->tb_sb, "vs-8110: get_num_ver: "
-                               "direct item length is %d. It can not be longer than %d", 
-                               current_item_size, max_node_size);
-#endif
+           RFALSE( is_direct_le_ih (vi->vi_ih),
+                   "vs-8110: "
+                   "direct item length is %d. It can not be longer than %d",
+                   current_item_size, max_node_size);
            /* we will try to split it */
            flow = 1;
        }
@@ -691,10 +641,8 @@ static int are_leaves_removable (struct tree_balance * tb, int lfree, int rfree)
        /* there was only one item and it will be deleted */
        struct item_head * ih;
     
-#ifdef CONFIG_REISERFS_CHECK
-    if (B_NR_ITEMS (S0) != 1)
-      reiserfs_panic (0, "vs-8125: are_leaves_removable: item number must be 1: it is %d", B_NR_ITEMS(S0));
-#endif
+    RFALSE( B_NR_ITEMS (S0) != 1,
+           "vs-8125: item number must be 1: it is %d", B_NR_ITEMS(S0));
 
     ih = B_N_PITEM_HEAD (S0, 0);
     if (tb->CFR[0] && !comp_short_le_keys (&(ih->ih_key), B_N_PDELIM_KEY (tb->CFR[0], tb->rkey[0])))
@@ -708,13 +656,11 @@ static int are_leaves_removable (struct tree_balance * tb, int lfree, int rfree)
               we can save ih_size */
            ih_size = IH_SIZE;
            
-#ifdef CONFIG_REISERFS_CHECK
            /* we might check that left neighbor exists and is of the
               same directory */
-           if (le_key_k_offset (ih_version (ih), &(ih->ih_key)) == DOT_OFFSET)
-               reiserfs_panic (tb->tb_sb, "vs-8130: are_leaves_removable: "
-                               "first directory item can not be removed until directory is not empty");
-#endif
+           RFALSE( le_key_k_offset 
+                   (ih_version (ih), &(ih->ih_key)) == DOT_OFFSET,
+                   "vs-8130: first directory item can not be removed until directory is not empty");
       }
     
   }
@@ -852,10 +798,8 @@ static int  get_empty_nodes(
   for ( p_n_blocknr = a_n_blocknrs, n_counter = 0; n_counter < n_amount_needed;
        p_n_blocknr++, n_counter++ ) { 
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( ! *p_n_blocknr )
-      reiserfs_panic(p_s_sb, "PAP-8135: get_empty_nodes: reiserfs_new_blocknrs failed when got new blocks");
-#endif
+    RFALSE( ! *p_n_blocknr,
+           "PAP-8135: reiserfs_new_blocknrs failed when got new blocks");
 
     p_s_new_bh = reiserfs_getblk(p_s_sb->s_dev, *p_n_blocknr, p_s_sb->s_blocksize);
     if (atomic_read (&(p_s_new_bh->b_count)) > 1) {
@@ -873,15 +817,13 @@ static int  get_empty_nodes(
        wait_buffer_until_released (p_s_new_bh);
       }
     }
-#ifdef CONFIG_REISERFS_CHECK
-    if (atomic_read (&(p_s_new_bh->b_count)) != 1 || buffer_dirty (p_s_new_bh)) {
-      if (atomic_read(&(p_s_new_bh->b_count)) > 2 || 
-          !(buffer_journaled(p_s_new_bh) || buffer_journal_dirty(p_s_new_bh))) {
-       reiserfs_panic(p_s_sb,"PAP-8140: get_empty_nodes: not free or dirty buffer %b for the new block",
-                    p_s_new_bh);
-      }
-    }
-#endif
+    RFALSE( (atomic_read (&(p_s_new_bh->b_count)) != 1 || 
+            buffer_dirty (p_s_new_bh)) && 
+           (atomic_read(&(p_s_new_bh->b_count)) > 2 || 
+            !(buffer_journaled(p_s_new_bh) || 
+              buffer_journal_dirty(p_s_new_bh))),
+           "PAP-8140: not free or dirty buffer %b for the new block", 
+           p_s_new_bh);
     
     /* Put empty buffers into the array. */
     if (p_s_tb->FEB[p_s_tb->cur_blknum])
@@ -958,13 +900,13 @@ static int  is_left_neighbor_in_cache(
   /* Calculate father of the node to be balanced. */
   p_s_father = PATH_H_PBUFFER(p_s_tb->tb_path, n_h + 1);
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( ! p_s_father || ! B_IS_IN_TREE (p_s_father) || ! B_IS_IN_TREE (p_s_tb->FL[n_h]) ||
-       ! buffer_uptodate (p_s_father) || ! buffer_uptodate (p_s_tb->FL[n_h]) ) {
-    reiserfs_panic (p_s_sb, "vs-8165: is_left_neighbor_in_cache: F[h] (%b) or FL[h] (%b) is invalid",
-                   p_s_father, p_s_tb->FL[n_h]);
-  }
-#endif
+  RFALSE( ! p_s_father || 
+         ! B_IS_IN_TREE (p_s_father) || 
+         ! B_IS_IN_TREE (p_s_tb->FL[n_h]) ||
+         ! buffer_uptodate (p_s_father) || 
+         ! buffer_uptodate (p_s_tb->FL[n_h]),
+         "vs-8165: F[h] (%b) or FL[h] (%b) is invalid", 
+         p_s_father, p_s_tb->FL[n_h]);
 
 
   /* Get position of the pointer to the left neighbor into the left father. */
@@ -975,12 +917,8 @@ static int  is_left_neighbor_in_cache(
   /* Look for the left neighbor in the cache. */
   if ( (left = get_hash_table(p_s_sb->s_dev, n_left_neighbor_blocknr, p_s_sb->s_blocksize)) ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( buffer_uptodate (left) && ! B_IS_IN_TREE(left) ) {
-      reiserfs_panic(p_s_sb, "vs-8170: is_left_neighbor_in_cache: left neighbor (%b %z) is not in the tree",
-                    left, left);
-    }
-#endif
+    RFALSE( buffer_uptodate (left) && ! B_IS_IN_TREE(left),
+           "vs-8170: left neighbor (%b %z) is not in the tree", left, left);
     put_bh(left) ;
     return 1;
   }
@@ -997,28 +935,6 @@ static void decrement_key (struct cpu_key * p_s_key)
 {
     // call item specific function for this key
     item_ops[cpu_key_k_type (p_s_key)]->decrement_key (p_s_key);
-    
-
-#if 0 /* this works wrong when key is key of second part of tail: it
-         sets key to be of indirect type. It looks like it makes no
-         harm but it is unclear */
-
-  unsigned long * p_n_key_field = (unsigned long *)p_s_key + REISERFS_FULL_KEY_LEN - 1;
-  int            n_counter;
-
-  for( n_counter = 0; n_counter < REISERFS_FULL_KEY_LEN; n_counter++, p_n_key_field-- ) {
-      if ( *p_n_key_field ) {
-         (*p_n_key_field)--;
-         break;
-      }
-  }
-#ifdef CONFIG_REISERFS_CHECK
-  if ( n_counter == REISERFS_FULL_KEY_LEN )
-      reiserfs_panic(NULL, "PAP-8175: decrement_key: zero key");
-#endif
-
-#endif /*0*/
-
 }
 
 
@@ -1052,10 +968,8 @@ static int  get_far_parent (struct tree_balance *   p_s_tb,
 
     n_counter = n_path_offset;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( n_counter < FIRST_PATH_ELEMENT_OFFSET )
-       reiserfs_panic(p_s_tb->tb_sb, "PAP-8180: get_far_parent: invalid path length");
-#endif
+    RFALSE( n_counter < FIRST_PATH_ELEMENT_OFFSET,
+           "PAP-8180: invalid path length");
 
   
     for ( ; n_counter > FIRST_PATH_ELEMENT_OFFSET; n_counter--  )  {
@@ -1091,11 +1005,9 @@ static int  get_far_parent (struct tree_balance *   p_s_tb,
        return REPEAT_SEARCH;
     }
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( B_LEVEL (*pp_s_com_father) <= DISK_LEAF_NODE_LEVEL ) {
-       reiserfs_panic(p_s_tb->tb_sb, "PAP-8185: get_far_parent: (%b %z) level too small", *pp_s_com_father, *pp_s_com_father);
-    }
-#endif
+    RFALSE( B_LEVEL (*pp_s_com_father) <= DISK_LEAF_NODE_LEVEL,
+           "PAP-8185: (%b %z) level too small", 
+           *pp_s_com_father, *pp_s_com_father);
 
     /* Check whether the common parent is locked. */
 
@@ -1130,15 +1042,10 @@ static int  get_far_parent (struct tree_balance *   p_s_tb,
 
     *pp_s_father = PATH_PLAST_BUFFER(&s_path_to_neighbor_father);
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( B_LEVEL (*pp_s_father) != n_h + 1 ) {
-       reiserfs_panic(p_s_tb->tb_sb, "PAP-8190: get_far_parent: (%b %z) level too small", *pp_s_father, *pp_s_father);
-    }
-  
-    if ( s_path_to_neighbor_father.path_length < FIRST_PATH_ELEMENT_OFFSET )
-       reiserfs_panic(0, "PAP-8192: get_far_parent: path length is too small");
-
-#endif
+    RFALSE( B_LEVEL (*pp_s_father) != n_h + 1,
+           "PAP-8190: (%b %z) level too small", *pp_s_father, *pp_s_father);
+    RFALSE( s_path_to_neighbor_father.path_length < FIRST_PATH_ELEMENT_OFFSET,
+           "PAP-8192: path length is too small");
 
     s_path_to_neighbor_father.path_length--;
     decrement_counters_in_path(&s_path_to_neighbor_father);
@@ -1198,11 +1105,9 @@ static int  get_parents (struct tree_balance * p_s_tb, int n_h)
     decrement_bcount(p_s_tb->CFL[n_h]);
     p_s_tb->CFL[n_h] = p_s_curcf; /* New initialization of CFL[n_h]. */
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ((p_s_curf && !B_IS_IN_TREE (p_s_curf)) || (p_s_curcf && !B_IS_IN_TREE (p_s_curcf))) {
-       reiserfs_panic (p_s_tb->tb_sb, "PAP-8195: get_parents: FL (%b) or CFL (%b) is invalid", p_s_curf, p_s_curcf);
-    }
-#endif
+    RFALSE( (p_s_curf && !B_IS_IN_TREE (p_s_curf)) || 
+           (p_s_curcf && !B_IS_IN_TREE (p_s_curcf)),
+           "PAP-8195: FL (%b) or CFL (%b) is invalid", p_s_curf, p_s_curcf);
 
 /* Get parent FR[n_h] of R[n_h]. */
 
@@ -1237,10 +1142,10 @@ static int  get_parents (struct tree_balance * p_s_tb, int n_h)
                        B_PRIGHT_DELIM_KEY (PATH_H_PBUFFER(p_s_path, n_h)), B_N_PDELIM_KEY (p_s_tb->CFR[n_h], p_s_tb->rkey[n_h]));
     }
 #endif
-    if ((p_s_curf && !B_IS_IN_TREE (p_s_curf)) || (p_s_curcf && !B_IS_IN_TREE (p_s_curcf))) {
-       reiserfs_panic (p_s_tb->tb_sb, "PAP-8205: get_parents: FR (%b) or CFR (%b) is invalid", p_s_curf, p_s_curcf);
-    }
 #endif
+    RFALSE( (p_s_curf && !B_IS_IN_TREE (p_s_curf)) || 
+           (p_s_curcf && !B_IS_IN_TREE (p_s_curcf)),
+           "PAP-8205: FR (%b) or CFR (%b) is invalid", p_s_curf, p_s_curcf);
 
     return CARRY_ON;
 }
@@ -1400,15 +1305,14 @@ static int ip_check_balance (struct tree_balance * tb, int h)
        return CARRY_ON;
     }
 
-#ifdef CONFIG_REISERFS_CHECK
     /* this checks balance condition, that any two neighboring nodes can not fit in one node */
-    if ( h && ( tb->lnum[h] >= vn->vn_nr_item + 1 || tb->rnum[h] >= vn->vn_nr_item + 1) )
-       reiserfs_panic (tb->tb_sb, "vs-8220: ip_check_balance: tree is not balanced on internal level");
-
-    if ( ! h && ((tb->lnum[h] >= vn->vn_nr_item && (tb->lbytes == -1)) ||
-                (tb->rnum[h] >= vn->vn_nr_item && (tb->rbytes == -1)) ))
-       reiserfs_panic(tb->tb_sb, "vs-8225: ip_check_balance: tree is not balanced on leaf level");
-#endif
+    RFALSE( h && 
+           ( tb->lnum[h] >= vn->vn_nr_item + 1 || 
+             tb->rnum[h] >= vn->vn_nr_item + 1),
+           "vs-8220: tree is not balanced on internal level");
+    RFALSE( ! h && ((tb->lnum[h] >= vn->vn_nr_item && (tb->lbytes == -1)) ||
+                   (tb->rnum[h] >= vn->vn_nr_item && (tb->rbytes == -1)) ),
+           "vs-8225: tree is not balanced on leaf level");
 
     /* all contents of S[0] can be moved into its neighbors
        S[0] will be removed after balancing. */
@@ -1553,10 +1457,11 @@ static int ip_check_balance (struct tree_balance * tb, int h)
        /* we can win TWO or ONE nodes by shifting in both directions */
        if (lrnver < lnver && lrnver < rnver)
        {
-#ifdef CONFIG_REISERFS_CHECK
-           if (h && (tb->lnum[h] != 1 || tb->rnum[h] != 1 || lrnver != 1 || rnver != 2 || lnver != 2 || h != 1))
-               reiserfs_panic (0, "vs-8230: check_balance: bad h");
-#endif
+           RFALSE( h && 
+                   (tb->lnum[h] != 1 || 
+                    tb->rnum[h] != 1 || 
+                    lrnver != 1 || rnver != 2 || lnver != 2 || h != 1),
+                   "vs-8230: bad h");
            if (lrset == LR_SHIFT_FLOW)
                set_parameters (tb, h, tb->lnum[h], tb->rnum[h], lrnver, snum012 + lrset,
                                tb->lbytes, tb->rbytes);
@@ -1757,10 +1662,7 @@ static int dc_check_balance_internal (struct tree_balance * tb, int h)
     }
 
   /* For internal nodes try to borrow item from a neighbor */
-#ifdef CONFIG_REISERFS_CHECK
-  if (!tb->FL[h] && !tb->FR[h])
-    reiserfs_panic (0, "vs-8235: dc_check_balance_internal: trying to borrow for root");
-#endif
+  RFALSE( !tb->FL[h] && !tb->FR[h], "vs-8235: trying to borrow for root");
 
   /* Borrow one or two items from caching neighbor */
   if (is_left_neighbor_in_cache (tb,h) || !tb->FR[h])
@@ -1818,10 +1720,8 @@ static int dc_check_balance_leaf (struct tree_balance * tb, int h)
   if ( ! F0 )
     {  /* S[0] is the root now. */
 
-#ifdef CONFIG_REISERFS_CHECK
-      if ( -levbytes >= maxsize - B_FREE_SPACE (S0) )
-       reiserfs_panic (tb->tb_sb, "vs-8240: dc_check_balance_leaf: attempt to create empty buffer tree");
-#endif
+      RFALSE( -levbytes >= maxsize - B_FREE_SPACE (S0),
+             "vs-8240: attempt to create empty buffer tree");
 
       set_parameters (tb, h, 0, 0, 1, NULL, -1, -1);
       return NO_BALANCING_NEEDED;
@@ -1853,10 +1753,7 @@ static int dc_check_balance_leaf (struct tree_balance * tb, int h)
        ((tb->rnum[0] - ((tb->rbytes == -1) ? 0 : 1)) < vn->vn_nr_item) || /* S can not be merged with R */
        !tb->FR[h]) {
       
-#ifdef CONFIG_REISERFS_CHECK
-      if (!tb->FL[h])
-       reiserfs_panic (0, "vs-8245: dc_check_balance_leaf: FL[h] must exist");
-#endif
+      RFALSE( !tb->FL[h], "vs-8245: dc_check_balance_leaf: FL[h] must exist");
 
       /* set parameter to merge S[0] with its left neighbor */
       set_parameters (tb, h, -1, 0, 0, NULL, -1, -1);
@@ -1896,11 +1793,7 @@ static int dc_check_balance_leaf (struct tree_balance * tb, int h)
  */
 static int dc_check_balance (struct tree_balance * tb, int h)
 {
-
-#ifdef CONFIG_REISERFS_CHECK
- if ( ! (PATH_H_PBUFFER (tb->tb_path, h)) )
-   reiserfs_panic(tb->tb_sb, "vs-8250: dc_check_balance: S is not initialized");
-#endif
+ RFALSE( ! (PATH_H_PBUFFER (tb->tb_path, h)), "vs-8250: S is not initialized");
 
  if ( h )
    return dc_check_balance_internal (tb, h);
@@ -1947,10 +1840,8 @@ static int check_balance (int mode,
   vn->vn_ins_ih = ins_ih;
   vn->vn_data = data;
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (mode == M_INSERT && !vn->vn_ins_ih)
-    reiserfs_panic (0, "vs-8255: check_balance: ins_ih can not be 0 in insert mode");
-#endif
+  RFALSE( mode == M_INSERT && !vn->vn_ins_ih,
+         "vs-8255: ins_ih can not be 0 in insert mode");
 
  if ( tb->insert_size[h] > 0 )
    /* Calculate balance parameters when size of node is increasing. */
@@ -1975,10 +1866,8 @@ static int  get_direct_parent(
     /* We are in the root or in the new root. */
     if ( n_path_offset <= FIRST_PATH_ELEMENT_OFFSET ) {
        
-#ifdef CONFIG_REISERFS_CHECK
-       if ( n_path_offset < FIRST_PATH_ELEMENT_OFFSET - 1 )
-           reiserfs_panic(p_s_tb->tb_sb, "PAP-8260: get_direct_parent: illegal offset in the path");
-#endif
+       RFALSE( n_path_offset < FIRST_PATH_ELEMENT_OFFSET - 1,
+               "PAP-8260: illegal offset in the path");
 
        if ( PATH_OFFSET_PBUFFER(p_s_path, FIRST_PATH_ELEMENT_OFFSET)->b_blocknr ==
             SB_ROOT_BLOCK (p_s_tb->tb_sb) ) {
@@ -2031,10 +1920,9 @@ static int  get_neighbors(
        /* We need left neighbor to balance S[n_h]. */
        p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
        
-#ifdef CONFIG_REISERFS_CHECK
-       if ( p_s_bh == p_s_tb->FL[n_h] && ! PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset) )
-           reiserfs_panic (p_s_tb->tb_sb, "PAP-8270: get_neighbors: invalid position in the parent");
-#endif
+       RFALSE( p_s_bh == p_s_tb->FL[n_h] && 
+               ! PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset),
+               "PAP-8270: invalid position in the parent");
 
        n_child_position = ( p_s_bh == p_s_tb->FL[n_h] ) ? p_s_tb->lkey[n_h] : B_NR_ITEMS (p_s_tb->FL[n_h]);
        n_son_number = B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position);
@@ -2046,16 +1934,14 @@ static int  get_neighbors(
            return REPEAT_SEARCH;
        }
        
-#ifdef CONFIG_REISERFS_CHECK
-       if ( ! B_IS_IN_TREE(p_s_tb->FL[n_h]) || n_child_position > B_NR_ITEMS(p_s_tb->FL[n_h]) ||
-            B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position) != p_s_bh->b_blocknr )
-           reiserfs_panic (p_s_tb->tb_sb, "PAP-8275: get_neighbors: invalid parent");
-       if ( ! B_IS_IN_TREE(p_s_bh) )
-           reiserfs_panic (p_s_tb->tb_sb, "PAP-8280: get_neighbors: invalid child");
-
-       if (! n_h && B_FREE_SPACE (p_s_bh) != MAX_CHILD_SIZE (p_s_bh) - B_N_CHILD (p_s_tb->FL[0],n_child_position)->dc_size)
-           reiserfs_panic (p_s_tb->tb_sb, "PAP-8290: get_neighbors: invalid child size of left neighbor");
-#endif
+       RFALSE( ! B_IS_IN_TREE(p_s_tb->FL[n_h]) || 
+               n_child_position > B_NR_ITEMS(p_s_tb->FL[n_h]) ||
+               B_N_CHILD_NUM(p_s_tb->FL[n_h], n_child_position) != 
+               p_s_bh->b_blocknr, "PAP-8275: invalid parent");
+       RFALSE( ! B_IS_IN_TREE(p_s_bh), "PAP-8280: invalid child");
+       RFALSE( ! n_h && 
+               B_FREE_SPACE (p_s_bh) != MAX_CHILD_SIZE (p_s_bh) - B_N_CHILD (p_s_tb->FL[0],n_child_position)->dc_size,
+               "PAP-8290: invalid child size of left neighbor");
 
        decrement_bcount(p_s_tb->L[n_h]);
        p_s_tb->L[n_h] = p_s_bh;
@@ -2065,10 +1951,9 @@ static int  get_neighbors(
     if ( p_s_tb->rnum[n_h] ) { /* We need right neighbor to balance S[n_path_offset]. */
        p_s_bh = PATH_OFFSET_PBUFFER(p_s_tb->tb_path, n_path_offset);
        
-#ifdef CONFIG_REISERFS_CHECK
-       if ( p_s_bh == p_s_tb->FR[n_h] && PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset) >= B_NR_ITEMS(p_s_bh) )
-           reiserfs_panic (p_s_tb->tb_sb, "PAP-8295: get_neighbors: invalid position in the parent");
-#endif
+       RFALSE( p_s_bh == p_s_tb->FR[n_h] && 
+               PATH_OFFSET_POSITION(p_s_tb->tb_path, n_path_offset) >= B_NR_ITEMS(p_s_bh),
+               "PAP-8295: invalid position in the parent");
 
        n_child_position = ( p_s_bh == p_s_tb->FR[n_h] ) ? p_s_tb->rkey[n_h] + 1 : 0;
        n_son_number = B_N_CHILD_NUM(p_s_tb->FR[n_h], n_child_position);
@@ -2082,12 +1967,10 @@ static int  get_neighbors(
        decrement_bcount(p_s_tb->R[n_h]);
        p_s_tb->R[n_h] = p_s_bh;
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (! n_h && B_FREE_SPACE (p_s_bh) != MAX_CHILD_SIZE (p_s_bh) - B_N_CHILD (p_s_tb->FR[0],n_child_position)->dc_size) {
-           reiserfs_panic (p_s_tb->tb_sb, "PAP-8300: get_neighbors: invalid child size of right neighbor (%d != %d - %d)",
-                           B_FREE_SPACE (p_s_bh), MAX_CHILD_SIZE (p_s_bh), B_N_CHILD (p_s_tb->FR[0],n_child_position)->dc_size);
-       }
-#endif
+       RFALSE( ! n_h && B_FREE_SPACE (p_s_bh) != MAX_CHILD_SIZE (p_s_bh) - B_N_CHILD (p_s_tb->FR[0],n_child_position)->dc_size,
+               "PAP-8300: invalid child size of right neighbor (%d != %d - %d)",
+               B_FREE_SPACE (p_s_bh), MAX_CHILD_SIZE (p_s_bh), 
+               B_N_CHILD (p_s_tb->FR[0],n_child_position)->dc_size);
        
     }
     return CARRY_ON;
@@ -2236,6 +2119,11 @@ static void tb_buffer_sanity_check (struct super_block * p_s_sb,
     }
   }
 }
+#else
+static void tb_buffer_sanity_check (struct super_block * p_s_sb,
+                                   struct buffer_head * p_s_bh, 
+                                   const char *descr, int level)
+{;}
 #endif
 
 static void clear_all_dirty_bits(struct super_block *s, 
@@ -2282,27 +2170,21 @@ static int wait_tb_buffers_until_unlocked (struct tree_balance * p_s_tb)
            if (p_s_tb->lnum[i] ) {
 
                if ( p_s_tb->L[i] ) {
-#ifdef CONFIG_REISERFS_CHECK
                    tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->L[i], "L", i);
-#endif
                    clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->L[i]) ;
                    if ( buffer_locked (p_s_tb->L[i]) )
                        locked = p_s_tb->L[i];
                }
 
                if ( !locked && p_s_tb->FL[i] ) {
-#ifdef CONFIG_REISERFS_CHECK
                    tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->FL[i], "FL", i);
-#endif
                    clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->FL[i]) ;
                    if ( buffer_locked (p_s_tb->FL[i]) )
                        locked = p_s_tb->FL[i];
                }
 
                if ( !locked && p_s_tb->CFL[i] ) {
-#ifdef CONFIG_REISERFS_CHECK
                    tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->CFL[i], "CFL", i);
-#endif
                    clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->CFL[i]) ;
                    if ( buffer_locked (p_s_tb->CFL[i]) )
                        locked = p_s_tb->CFL[i];
@@ -2313,9 +2195,7 @@ static int wait_tb_buffers_until_unlocked (struct tree_balance * p_s_tb)
            if ( !locked && (p_s_tb->rnum[i]) ) {
 
                if ( p_s_tb->R[i] ) {
-#ifdef CONFIG_REISERFS_CHECK
                    tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->R[i], "R", i);
-#endif
                    clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->R[i]) ;
                    if ( buffer_locked (p_s_tb->R[i]) )
                        locked = p_s_tb->R[i];
@@ -2323,18 +2203,14 @@ static int wait_tb_buffers_until_unlocked (struct tree_balance * p_s_tb)
 
        
                if ( !locked && p_s_tb->FR[i] ) {
-#ifdef CONFIG_REISERFS_CHECK
                    tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->FR[i], "FR", i);
-#endif
                    clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->FR[i]) ;
                    if ( buffer_locked (p_s_tb->FR[i]) )
                        locked = p_s_tb->FR[i];
                }
 
                if ( !locked && p_s_tb->CFR[i] ) {
-#ifdef CONFIG_REISERFS_CHECK
                    tb_buffer_sanity_check (p_s_tb->tb_sb, p_s_tb->CFR[i], "CFR", i);
-#endif
                    clear_all_dirty_bits(p_s_tb->tb_sb, p_s_tb->CFR[i]) ;
                    if ( buffer_locked (p_s_tb->CFR[i]) )
                        locked = p_s_tb->CFR[i];
@@ -2536,10 +2412,8 @@ int fix_nodes (int n_op_mode,
            /* We have a positive insert size but no nodes exist on this
               level, this means that we are creating a new root. */
 
-#ifdef CONFIG_REISERFS_CHECK
-           if ( p_s_tb->blknum[n_h] != 1 )
-               reiserfs_panic(p_s_tb->tb_sb,"PAP-8350: fix_nodes: creating new empty root");
-#endif /* CONFIG_REISERFS_CHECK */
+           RFALSE( p_s_tb->blknum[n_h] != 1,
+                   "PAP-8350: creating new empty root");
 
            if ( n_h < MAX_HEIGHT - 1 )
                p_s_tb->insert_size[n_h + 1] = 0;
@@ -2552,10 +2426,8 @@ int fix_nodes (int n_op_mode,
                       and a new node (S[n_h+1]) will be created to
                       become the root node.  */
          
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( n_h == MAX_HEIGHT - 1 )
-                       reiserfs_panic(p_s_tb->tb_sb, "PAP-8355: fix_nodes: attempt to create too high of a tree");
-#endif /* CONFIG_REISERFS_CHECK */
+                   RFALSE( n_h == MAX_HEIGHT - 1,
+                           "PAP-8355: attempt to create too high of a tree");
 
                    p_s_tb->insert_size[n_h + 1] = (DC_SIZE + KEY_SIZE) * (p_s_tb->blknum[n_h] - 1) + DC_SIZE;
                }
index 93c29b0f91d58b027324d7522534cfc096212e6d..f3a172a1a95a598a1475113b2d69102096e9e84a 100644 (file)
@@ -36,10 +36,8 @@ static void  internal_define_dest_src_infos (
                                                struct buffer_head ** cf
                                                )
 {
-#ifdef CONFIG_REISERFS_CHECK
     memset (dest_bi, 0, sizeof (struct buffer_info));
     memset (src_bi, 0, sizeof (struct buffer_info));
-#endif
     /* define dest, src, dest parent, dest position */
     switch (shift_mode) {
     case INTERNAL_SHIFT_FROM_S_TO_L:   /* used in internal_shift_left */
@@ -144,13 +142,11 @@ static void internal_insert_childs (struct buffer_info * cur_bi,
 
     nr = le16_to_cpu ((blkh = B_BLK_HEAD(cur))->blk_nr_item);
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (count > 2)
-       reiserfs_panic (0, "internal_insert_childs", "too many children (%d) are to be inserted", count);
-    if (B_FREE_SPACE (cur) < count * (KEY_SIZE + DC_SIZE))
-       reiserfs_panic (0, "internal_insert_childs", "no enough free space (%d), needed %d bytes", 
-                       B_FREE_SPACE (cur), count * (KEY_SIZE + DC_SIZE));
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( count > 2,
+           "too many children (%d) are to be inserted", count);
+    RFALSE( B_FREE_SPACE (cur) < count * (KEY_SIZE + DC_SIZE),
+           "no enough free space (%d), needed %d bytes", 
+           B_FREE_SPACE (cur), count * (KEY_SIZE + DC_SIZE));
 
     /* prepare space for count disk_child */
     dc = B_N_CHILD(cur,to+1);
@@ -213,43 +209,29 @@ static void       internal_delete_pointers_items (
   struct key * key;
   struct disk_child * dc;
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (cur == NULL)
-    reiserfs_panic (0, "internal_delete_pointers_items1: buffer is 0");
-       
-  if (del_num < 0)
-    reiserfs_panic (0, "internal_delete_pointers_items2",
-                   "negative number of items (%d) can not be deleted", del_num);
-
-  if (first_p < 0 || first_p + del_num > B_NR_ITEMS (cur) + 1 || first_i < 0)
-    reiserfs_panic (0, "internal_delete_pointers_items3",
-                   "first pointer order (%d) < 0 or "
-                   "no so many pointers (%d), only (%d) or "
-                   "first key order %d < 0", first_p, 
-                   first_p + del_num, B_NR_ITEMS (cur) + 1, first_i);
-#endif /* CONFIG_REISERFS_CHECK */
+  RFALSE( cur == NULL, "buffer is 0");
+  RFALSE( del_num < 0, 
+         "negative number of items (%d) can not be deleted", del_num);
+  RFALSE( first_p < 0 || first_p + del_num > B_NR_ITEMS (cur) + 1 || first_i < 0,
+         "first pointer order (%d) < 0 or "
+         "no so many pointers (%d), only (%d) or "
+         "first key order %d < 0", first_p, 
+         first_p + del_num, B_NR_ITEMS (cur) + 1, first_i);
   if ( del_num == 0 )
     return;
 
   nr = le16_to_cpu ((blkh = B_BLK_HEAD(cur))->blk_nr_item);
 
   if ( first_p == 0 && del_num == nr + 1 ) {
-#ifdef CONFIG_REISERFS_CHECK
-    if ( first_i != 0 )
-      reiserfs_panic (0, "internal_delete_pointers_items5",
-                     "first deleted key must have order 0, not %d", first_i);
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( first_i != 0, "1st deleted key must have order 0, not %d", first_i);
     make_empty_node (cur_bi);
     return;
   }
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (first_i + del_num > B_NR_ITEMS (cur)) {
-    printk("first_i = %d del_num = %d\n",first_i,del_num);
-    reiserfs_panic (0, "internal_delete_pointers_items4: :"
-                   "no so many keys (%d) in the node (%b)(%z)", first_i + del_num, cur, cur);
-  }
-#endif /* CONFIG_REISERFS_CHECK */
+  RFALSE( first_i + del_num > B_NR_ITEMS (cur),
+         "first_i = %d del_num = %d "
+         "no so many keys (%d) in the node (%b)(%z)", 
+         first_i, del_num, first_i + del_num, cur, cur);
 
 
   /* deleting */
@@ -315,25 +297,16 @@ static void internal_copy_pointers_items (
 
   nr_src = B_NR_ITEMS (src);
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( dest == NULL || src == NULL )
-    reiserfs_panic (0, "internal_copy_pointers_items", "src (%p) or dest (%p) buffer is 0", src, dest);
-
-  if (last_first != FIRST_TO_LAST && last_first != LAST_TO_FIRST)
-    reiserfs_panic (0, "internal_copy_pointers_items",
-                   "invalid last_first parameter (%d)", last_first);
-
-  if ( nr_src < cpy_num - 1 )
-    reiserfs_panic (0, "internal_copy_pointers_items", "no so many items (%d) in src (%d)", cpy_num, nr_src);
-
-  if ( cpy_num < 0 )
-    reiserfs_panic (0, "internal_copy_pointers_items", "cpy_num less than 0 (%d)", cpy_num);
-
-  if (cpy_num - 1 + B_NR_ITEMS(dest) > (int)MAX_NR_KEY(dest))
-    reiserfs_panic (0, "internal_copy_pointers_items",
-                   "cpy_num (%d) + item number in dest (%d) can not be more than MAX_NR_KEY(%d)",
-                   cpy_num, B_NR_ITEMS(dest), MAX_NR_KEY(dest));
-#endif
+  RFALSE( dest == NULL || src == NULL, 
+         "src (%p) or dest (%p) buffer is 0", src, dest);
+  RFALSE( last_first != FIRST_TO_LAST && last_first != LAST_TO_FIRST,
+         "invalid last_first parameter (%d)", last_first);
+  RFALSE( nr_src < cpy_num - 1, 
+         "no so many items (%d) in src (%d)", cpy_num, nr_src);
+  RFALSE( cpy_num < 0, "cpy_num less than 0 (%d)", cpy_num);
+  RFALSE( cpy_num - 1 + B_NR_ITEMS(dest) > (int)MAX_NR_KEY(dest),
+         "cpy_num (%d) + item number in dest (%d) can not be > MAX_NR_KEY(%d)",
+         cpy_num, B_NR_ITEMS(dest), MAX_NR_KEY(dest));
 
   if ( cpy_num == 0 )
     return;
@@ -427,23 +400,18 @@ static void internal_insert_key (struct buffer_info * dest_bi,
     struct block_head * blkh;
     struct key * key;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (dest == NULL || src == NULL)
-       reiserfs_panic (0, "internal_insert_key", "sourse(%p) or dest(%p) buffer is 0", src, dest);
-
-    if (dest_position_before < 0 || src_position < 0)
-       reiserfs_panic (0, "internal_insert_key", "source(%d) or dest(%d) key number less than 0", 
-                       src_position, dest_position_before);
-
-    if (dest_position_before > B_NR_ITEMS (dest) || src_position >= B_NR_ITEMS(src))
-       reiserfs_panic (0, "internal_insert_key", 
-                       "invalid position in dest (%d (key number %d)) or in src (%d (key number %d))",
-                       dest_position_before, B_NR_ITEMS (dest), src_position, B_NR_ITEMS(src));
-
-    if (B_FREE_SPACE (dest) < KEY_SIZE)
-       reiserfs_panic (0, "internal_insert_key", 
-                       "no enough free space (%d) in dest buffer", B_FREE_SPACE (dest));
-#endif
+    RFALSE( dest == NULL || src == NULL,
+           "source(%p) or dest(%p) buffer is 0", src, dest);
+    RFALSE( dest_position_before < 0 || src_position < 0,
+           "source(%d) or dest(%d) key number less than 0", 
+           src_position, dest_position_before);
+    RFALSE( dest_position_before > B_NR_ITEMS (dest) || 
+           src_position >= B_NR_ITEMS(src),
+           "invalid position in dest (%d (key number %d)) or in src (%d (key number %d))",
+           dest_position_before, B_NR_ITEMS (dest), 
+           src_position, B_NR_ITEMS(src));
+    RFALSE( B_FREE_SPACE (dest) < KEY_SIZE,
+           "no enough free space (%d) in dest buffer", B_FREE_SPACE (dest));
 
     nr = le16_to_cpu ((blkh=B_BLK_HEAD(dest))->blk_nr_item);
 
@@ -557,11 +525,10 @@ static void internal_shift_right (
     /* insert delimiting key from common father of dest and src to dest node into position 0 */
     internal_insert_key (&dest_bi, 0, cf, d_key_position);
     if (nr == pointer_amount - 1) {
-#ifdef CONFIG_REISERFS_CHECK
-      if ( src_bi.bi_bh != PATH_H_PBUFFER (tb->tb_path, h)/*tb->S[h]*/ || dest_bi.bi_bh != tb->R[h])
-       reiserfs_panic (tb->tb_sb, "internal_shift_right", "src (%p) must be == tb->S[h](%p) when it disappears",
-                       src_bi.bi_bh, PATH_H_PBUFFER (tb->tb_path, h));
-#endif
+        RFALSE( src_bi.bi_bh != PATH_H_PBUFFER (tb->tb_path, h)/*tb->S[h]*/ || 
+                dest_bi.bi_bh != tb->R[h],
+                "src (%p) must be == tb->S[h](%p) when it disappears",
+                src_bi.bi_bh, PATH_H_PBUFFER (tb->tb_path, h));
       /* when S[h] disappers replace left delemiting key as well */
       if (tb->CFL[h])
        replace_key (tb, cf, d_key_position, tb->CFL[h], tb->lkey[h]);
@@ -620,11 +587,8 @@ static void balance_internal_when_delete (struct tree_balance * tb,
 
     internal_delete_childs (&bi, child_pos, -insert_num);
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( tb->blknum[h] > 1 )
-       reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "tb->blknum[%d]=%d when insert_size < 0",
-                       h, tb->blknum[h]);
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( tb->blknum[h] > 1,
+           "tb->blknum[%d]=%d when insert_size < 0", h, tb->blknum[h]);
 
     n = B_NR_ITEMS(tbSh);
 
@@ -633,14 +597,9 @@ static void balance_internal_when_delete (struct tree_balance * tb,
            /* node S[h] (root of the tree) is empty now */
            struct buffer_head *new_root;
 
-#ifdef CONFIG_REISERFS_CHECK
-           if (n || B_FREE_SPACE (tbSh) != MAX_CHILD_SIZE(tbSh) - DC_SIZE)
-               reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "buffer must have only 0 keys (%d)",
-                               n);
-
-           if (bi.bi_parent)
-               reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "root has parent (%p)", bi.bi_parent);
-#endif /* CONFIG_REISERFS_CHECK */
+           RFALSE( n || B_FREE_SPACE (tbSh) != MAX_CHILD_SIZE(tbSh) - DC_SIZE,
+                   "buffer must have only 0 keys (%d)", n);
+           RFALSE( bi.bi_parent, "root has parent (%p)", bi.bi_parent);
                
            /* choose a new root */
            if ( ! tb->L[h-1] || ! B_NR_ITEMS(tb->L[h-1]) )
@@ -669,11 +628,9 @@ static void balance_internal_when_delete (struct tree_balance * tb,
 
     if ( tb->L[h] && tb->lnum[h] == -B_NR_ITEMS(tb->L[h]) - 1 ) { /* join S[h] with L[h] */
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( tb->rnum[h] != 0 )
-           reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "invalid tb->rnum[%d]==%d when joining S[h] with L[h]",
-                           h, tb->rnum[h]);
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE( tb->rnum[h] != 0,
+               "invalid tb->rnum[%d]==%d when joining S[h] with L[h]",
+               h, tb->rnum[h]);
 
        internal_shift_left (INTERNAL_SHIFT_FROM_S_TO_L, tb, h, n + 1);
        reiserfs_invalidate_buffer(tb, tbSh);
@@ -682,11 +639,9 @@ static void balance_internal_when_delete (struct tree_balance * tb,
     }
 
     if ( tb->R[h] &&  tb->rnum[h] == -B_NR_ITEMS(tb->R[h]) - 1 ) { /* join S[h] with R[h] */
-#ifdef CONFIG_REISERFS_CHECK
-       if ( tb->lnum[h] != 0 )
-           reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "invalid tb->lnum[%d]==%d when joining S[h] with R[h]",
-                           h, tb->lnum[h]);
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE( tb->lnum[h] != 0,
+               "invalid tb->lnum[%d]==%d when joining S[h] with R[h]",
+               h, tb->lnum[h]);
 
        internal_shift_right (INTERNAL_SHIFT_FROM_S_TO_R, tb, h, n + 1);
 
@@ -695,33 +650,25 @@ static void balance_internal_when_delete (struct tree_balance * tb,
     }
 
     if ( tb->lnum[h] < 0 ) { /* borrow from left neighbor L[h] */
-#ifdef CONFIG_REISERFS_CHECK
-       if ( tb->rnum[h] != 0 )
-           reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "invalid tb->rnum[%d]==%d when borrow from L[h]",
-                           h, tb->rnum[h]);
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE( tb->rnum[h] != 0,
+               "wrong tb->rnum[%d]==%d when borrow from L[h]", h, tb->rnum[h]);
        /*internal_shift_right (tb, h, tb->L[h], tb->CFL[h], tb->lkey[h], tb->S[h], -tb->lnum[h]);*/
        internal_shift_right (INTERNAL_SHIFT_FROM_L_TO_S, tb, h, -tb->lnum[h]);
        return;
     }
 
     if ( tb->rnum[h] < 0 ) { /* borrow from right neighbor R[h] */
-#ifdef CONFIG_REISERFS_CHECK
-       if ( tb->lnum[h] != 0 )
-           reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "invalid tb->lnum[%d]==%d when borrow from R[h]",
-                           h, tb->lnum[h]);
-#endif /* CONFIG_REISERFS_CHECK */
+        RFALSE( tb->lnum[h] != 0,
+                "invalid tb->lnum[%d]==%d when borrow from R[h]", 
+                h, tb->lnum[h]);
        internal_shift_left (INTERNAL_SHIFT_FROM_R_TO_S, tb, h, -tb->rnum[h]);/*tb->S[h], tb->CFR[h], tb->rkey[h], tb->R[h], -tb->rnum[h]);*/
        return;
     }
 
     if ( tb->lnum[h] > 0 ) { /* split S[h] into two parts and put them into neighbors */
-#ifdef CONFIG_REISERFS_CHECK
-       if ( tb->rnum[h] == 0 || tb->lnum[h] + tb->rnum[h] != n + 1 )
-           reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", 
-                           "invalid tb->lnum[%d]==%d or tb->rnum[%d]==%d when S[h](item number == %d) is split between them",
-                           h, tb->lnum[h], h, tb->rnum[h], n);
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE( tb->rnum[h] == 0 || tb->lnum[h] + tb->rnum[h] != n + 1,
+               "invalid tb->lnum[%d]==%d or tb->rnum[%d]==%d when S[h](item number == %d) is split between them",
+               h, tb->lnum[h], h, tb->rnum[h], n);
 
        internal_shift_left (INTERNAL_SHIFT_FROM_S_TO_L, tb, h, tb->lnum[h]);/*tb->L[h], tb->CFL[h], tb->lkey[h], tb->S[h], tb->lnum[h]);*/
        internal_shift_right (INTERNAL_SHIFT_FROM_S_TO_R, tb, h, tb->rnum[h]);
@@ -742,11 +689,9 @@ void       replace_lkey (
                      struct item_head * key
                      )
 {
-#ifdef CONFIG_REISERFS_CHECK
-  if (tb->L[h] == NULL || tb->CFL[h] == NULL)
-    reiserfs_panic (tb->tb_sb, "replace_lkey: 12255: "
-                   "L[h](%p) and CFL[h](%p) must exist in replace_lkey", tb->L[h], tb->CFL[h]);
-#endif
+   RFALSE( tb->L[h] == NULL || tb->CFL[h] == NULL,
+          "L[h](%p) and CFL[h](%p) must exist in replace_lkey", 
+          tb->L[h], tb->CFL[h]);
 
   if (B_NR_ITEMS(PATH_H_PBUFFER(tb->tb_path, h)) == 0)
     return;
@@ -764,15 +709,12 @@ void      replace_rkey (
                      struct item_head * key
                      )
 {
-#ifdef CONFIG_REISERFS_CHECK
-  if (tb->R[h] == NULL || tb->CFR[h] == NULL)
-    reiserfs_panic (tb->tb_sb, "replace_rkey: 12260: "
-                   "R[h](%p) and CFR[h](%p) must exist in replace_rkey", tb->R[h], tb->CFR[h]);
-
-  if (B_NR_ITEMS(tb->R[h]) == 0)
-    reiserfs_panic (tb->tb_sb, "replace_rkey: 12265: "
-                   "R[h] can not be empty if it exists (item number=%d)", B_NR_ITEMS(tb->R[h]));
-#endif
+  RFALSE( tb->R[h] == NULL || tb->CFR[h] == NULL,
+         "R[h](%p) and CFR[h](%p) must exist in replace_rkey", 
+         tb->R[h], tb->CFR[h]);
+  RFALSE( B_NR_ITEMS(tb->R[h]) == 0,
+         "R[h] can not be empty if it exists (item number=%d)", 
+         B_NR_ITEMS(tb->R[h]));
 
   memcpy (B_N_PDELIM_KEY(tb->CFR[h],tb->rkey[h]), key, KEY_SIZE);
 
@@ -810,10 +752,7 @@ int balance_internal (struct tree_balance * tb,                    /* tree_balance structure               */
     struct buffer_head * new_insert_ptr = NULL;
     struct item_head * new_insert_key_addr = insert_key;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( h < 1 )      
-       reiserfs_panic (tb->tb_sb, "balance_internal", "h (%d) can not be < 1 on internal level", h);
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( h < 1, "h (%d) can not be < 1 on internal level", h);
 
     order = ( tbSh ) ? PATH_H_POSITION (tb->tb_path, h + 1)/*tb->S[h]->b_item_order*/ : 0;
 
@@ -822,16 +761,12 @@ int balance_internal (struct tree_balance * tb,                   /* tree_balance structure               */
     insert_num = tb->insert_size[h]/((int)(KEY_SIZE + DC_SIZE));
 
     /* Check whether insert_num is proper **/
-#ifdef CONFIG_REISERFS_CHECK
-    if ( insert_num < -2  ||  insert_num > 2 )
-       reiserfs_panic (tb->tb_sb, "balance_internal",
-                       "incorrect number of items inserted to the internal node (%d)", insert_num);
-
-    if ( h > 1  && (insert_num > 1 || insert_num < -1) )
-       reiserfs_panic (tb->tb_sb, "balance_internal",
-                       "incorrect number of items (%d) inserted to the internal node on a level (h=%d) higher than last internal level", 
-                       insert_num, h);
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( insert_num < -2  ||  insert_num > 2,
+           "incorrect number of items inserted to the internal node (%d)", 
+           insert_num);
+    RFALSE( h > 1  && (insert_num > 1 || insert_num < -1),
+           "incorrect number of items (%d) inserted to the internal node on a level (h=%d) higher than last internal level", 
+           insert_num, h);
 
     /* Make balance in case insert_num < 0 */
     if ( insert_num < 0 ) {
@@ -951,19 +886,12 @@ int balance_internal (struct tree_balance * tb,                   /* tree_balance structure               */
     }
 
     /** Fill new node that appears instead of S[h] **/
-#ifdef CONFIG_REISERFS_CHECK
-    if ( tb->blknum[h] > 2 )
-       reiserfs_panic(0, "balance_internal", "blknum can not be > 2 for internal level");
-    if ( tb->blknum[h] < 0 )
-       reiserfs_panic(0, "balance_internal", "blknum can not be < 0");
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( tb->blknum[h] > 2, "blknum can not be > 2 for internal level");
+    RFALSE( tb->blknum[h] < 0, "blknum can not be < 0");
 
     if ( ! tb->blknum[h] )
     { /* node S[h] is empty now */
-#ifdef CONFIG_REISERFS_CHECK
-       if ( ! tbSh )
-           reiserfs_panic(0,"balance_internal", "S[h] is equal NULL");
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE( ! tbSh, "S[h] is equal NULL");
 
        /* do what is needed for buffer thrown from tree */
        reiserfs_invalidate_buffer(tb,tbSh);
@@ -1081,13 +1009,10 @@ int balance_internal (struct tree_balance * tb,                 /* tree_balance structure               */
        /* new_insert_ptr = node_pointer to S_new */
        new_insert_ptr = S_new;
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( buffer_locked(S_new) || atomic_read (&(S_new->b_count)) != 1)
-           if (buffer_locked(S_new) || atomic_read(&(S_new->b_count)) > 2 ||
-               !(buffer_journaled(S_new) || buffer_journal_dirty(S_new))) {
-               reiserfs_panic (tb->tb_sb, "cm-00001: balance_internal: bad S_new (%b)", S_new);
-           }
-#endif /* CONFIG_REISERFS_CHECK */
+       RFALSE(( buffer_locked(S_new) || atomic_read (&(S_new->b_count)) != 1) &&
+              (buffer_locked(S_new) || atomic_read(&(S_new->b_count)) > 2 ||
+               !(buffer_journaled(S_new) || buffer_journal_dirty(S_new))),
+              "cm-00001: bad S_new (%b)", S_new);
 
        // S_new is released in unfix_nodes
     }
index 24c4d52e3649c54681d39ab18cc6b9aa3e82dc21..6298189455a49d1c40aafa79f1569f808a2d55b9 100644 (file)
@@ -758,11 +758,8 @@ int reiserfs_get_block (struct inode * inode, long block,
            struct cpu_key tmp_key;
            struct unfm_nodeinfo un = {0, 0};
 
-#ifdef CONFIG_REISERFS_CHECK
-           if (pos_in_item != le16_to_cpu (ih->ih_item_len) / UNFM_P_SIZE)
-               reiserfs_panic (inode->i_sb, "vs-: reiserfs_get_block: "
-                               "invalid position for append");
-#endif
+           RFALSE( pos_in_item != le16_to_cpu (ih->ih_item_len) / UNFM_P_SIZE,
+                   "vs-804: invalid position for append");
            /* indirect item has to be appended, set up key of that position */
            make_cpu_key (&tmp_key, inode,
                          le_key_k_offset (version, &(ih->ih_key)) + op_bytes_number (ih, inode->i_sb->s_blocksize),
index 21c4b6b1da40158b0c504daf147a06d1d959d068..708e3c0a2fb3670726f7c94957634f2b9c5c46d7 100644 (file)
@@ -489,10 +489,8 @@ static inline int old_entry_num (int is_affected, int virtual_entry_num, int pos
     if (mode == M_CUT)
        return virtual_entry_num + 1;
 
-#ifdef CONFIG_REISERFS_CHECK  
-    if (mode != M_PASTE || virtual_entry_num == 0)
-       reiserfs_panic (0, "vs-8015: old_entry_num: mode must be M_PASTE (mode = \'%c\'", mode);
-#endif
+    RFALSE( mode != M_PASTE || virtual_entry_num == 0,
+           "vs-8015: old_entry_num: mode must be M_PASTE (mode = \'%c\'", mode);
     
     return virtual_entry_num - 1;
 }
index 2bb8bce033ae3b26dec428a64555699d0496d48e..34f3555f01bd4872444ccb71303ed47f8da9dd5d 100644 (file)
@@ -2004,12 +2004,8 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th, struct sup
   int old_trans_id  ;
 
   reiserfs_check_lock_depth("journal_begin") ;
-#ifdef CONFIG_REISERFS_CHECK
-  if (p_s_sb->s_flags & MS_RDONLY) {
-    printk("clm-2078: calling journal_begin on readonly FS\n") ;
-    BUG() ;
-  }
-#endif
+  RFALSE( p_s_sb->s_flags & MS_RDONLY, 
+         "clm-2078: calling journal_begin on readonly FS") ;
 
   if (reiserfs_dont_log(p_s_sb)) {
     th->t_super = p_s_sb ; /* others will check this for the don't log flag */
@@ -2641,12 +2637,8 @@ void reiserfs_prepare_for_journal(struct super_block *p_s_sb,
     }
     set_bit(BH_JPrepared, &bh->b_state) ;
     if (wait) {
-#ifdef CONFIG_REISERFS_CHECK
-      if (buffer_locked(bh) && cur_tb != NULL) {
-       printk("reiserfs_prepare_for_journal, waiting while do_balance was running\n") ;
-        BUG() ;
-      }
-#endif
+      RFALSE( buffer_locked(bh) && cur_tb != NULL,
+             "waiting while do_balance was running\n") ;
       wait_on_buffer(bh) ;
     }
     retry_count++ ;
index 5887ab98955f33556594b79f3b3ca9f9a2ea974d..0b9a0929797297619a8ff5fd52f846fcd92eb262 100644 (file)
@@ -37,10 +37,7 @@ static void leaf_copy_dir_entries (struct buffer_info * dest_bi, struct buffer_h
 
     ih = B_N_PITEM_HEAD (source, item_num);
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (!is_direntry_le_ih (ih))
-       reiserfs_panic(0, "vs-10000: leaf_copy_dir_entries: item must be directory item");
-#endif
+    RFALSE( !is_direntry_le_ih (ih), "vs-10000: item must be directory item");
 
     /* length of all record to be copied and first byte of the last of them */
     deh = B_I_DEH (source, ih);
@@ -126,10 +123,7 @@ static int leaf_copy_boundary_item (struct buffer_info * dest_bi, struct buffer_
       /* there is nothing to merge */
       return 0;
       
-#ifdef CONFIG_REISERFS_CHECK
-    if ( ! ih->ih_item_len )
-      reiserfs_panic (0, "vs-10010: leaf_copy_boundary_item: item can not have empty dynamic length");
-#endif
+    RFALSE( ! ih->ih_item_len, "vs-10010: item can not have empty length");
       
     if ( is_direntry_le_ih (ih) ) {
       if ( bytes_or_entries == -1 )
@@ -162,12 +156,9 @@ static int leaf_copy_boundary_item (struct buffer_info * dest_bi, struct buffer_
                          );
       
     if (is_indirect_le_ih (dih)) {
-#ifdef CONFIG_REISERFS_CHECK
-      if (get_ih_free_space (dih))
-       reiserfs_panic (0, "vs-10030: leaf_copy_boundary_item: " 
-                       "merge to left: last unformatted node of non-last indirect item %h must have zerto free space",
-                       ih);
-#endif
+      RFALSE( get_ih_free_space (dih),
+             "vs-10030: merge to left: last unformatted node of non-last indirect item %h must have zero free space", 
+             ih);
       if (bytes_or_entries == le16_to_cpu (ih->ih_item_len))
        set_ih_free_space (dih, get_ih_free_space (ih));
     }
@@ -202,21 +193,17 @@ static int leaf_copy_boundary_item (struct buffer_info * dest_bi, struct buffer_
      don't create new item header
      */
   
-#ifdef CONFIG_REISERFS_CHECK  
-  if (is_indirect_le_ih(ih) && get_ih_free_space (ih))
-    reiserfs_panic (0, "vs-10040: leaf_copy_boundary_item: " 
-                   "merge to right: last unformatted node of non-last indirect item must be filled entirely (%h)",
+  RFALSE( is_indirect_le_ih(ih) && get_ih_free_space (ih),
+         "vs-10040: merge to right: last unformatted node of non-last indirect item must be filled entirely (%h)",
                    ih);
-#endif
 
   if ( bytes_or_entries == -1 ) {
     /* bytes_or_entries = length of last item body of SOURCE */
     bytes_or_entries = ih->ih_item_len;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (le_ih_k_offset (dih) != le_ih_k_offset (ih) + op_bytes_number (ih, src->b_size))
-      reiserfs_panic (0, "vs-10050: leaf_copy_boundary_item: items %h and %h do not match", ih, dih);
-#endif
+    RFALSE( le_ih_k_offset (dih) != 
+           le_ih_k_offset (ih) + op_bytes_number (ih, src->b_size),
+           "vs-10050: items %h and %h do not match", ih, dih);
 
     /* change first item key of the DEST */
     set_le_ih_k_offset (dih, le_ih_k_offset (ih));
@@ -226,26 +213,20 @@ static int leaf_copy_boundary_item (struct buffer_info * dest_bi, struct buffer_
     set_le_ih_k_type (dih, le_ih_k_type (ih));
   } else {
     /* merge to right only part of item */
-#ifdef CONFIG_REISERFS_CHECK
-    if ( le16_to_cpu (ih->ih_item_len) <= bytes_or_entries )
-      reiserfs_panic (0, "vs-10060: leaf_copy_boundary_item: no so much bytes %lu (needed %lu)",
-                     ih->ih_item_len, bytes_or_entries);
-#endif
+    RFALSE( le16_to_cpu (ih->ih_item_len) <= bytes_or_entries,
+           "vs-10060: no so much bytes %lu (needed %lu)",
+           ih->ih_item_len, bytes_or_entries);
     
     /* change first item key of the DEST */
     if ( is_direct_le_ih (dih) ) {
-#ifdef CONFIG_REISERFS_CHECK
-      if (le_ih_k_offset (dih) <= (unsigned long)bytes_or_entries)
-       reiserfs_panic (0, "vs-10070: leaf_copy_boundary_item: dih %h, bytes_or_entries(%d)", 
-                       dih, bytes_or_entries);
-#endif
+      RFALSE( le_ih_k_offset (dih) <= (unsigned long)bytes_or_entries,
+             "vs-10070: dih %h, bytes_or_entries(%d)", dih, bytes_or_entries);
       set_le_ih_k_offset (dih, le_ih_k_offset (dih) - bytes_or_entries);
     } else {
-#ifdef CONFIG_REISERFS_CHECK
-      if (le_ih_k_offset (dih) <= (bytes_or_entries / UNFM_P_SIZE) * dest->b_size )
-       reiserfs_panic (0, "vs-10080: leaf_copy_boundary_item: dih %h, bytes_or_entries(%d)",
-                       dih, (bytes_or_entries/UNFM_P_SIZE)*dest->b_size);
-#endif
+      RFALSE( le_ih_k_offset (dih) <= 
+             (bytes_or_entries / UNFM_P_SIZE) * dest->b_size,
+             "vs-10080: dih %h, bytes_or_entries(%d)",
+             dih, (bytes_or_entries/UNFM_P_SIZE)*dest->b_size);
       set_le_ih_k_offset (dih, le_ih_k_offset (dih) - ((bytes_or_entries / UNFM_P_SIZE) * dest->b_size));
     }
   }
@@ -270,27 +251,17 @@ static void leaf_copy_items_entirely (struct buffer_info * dest_bi, struct buffe
     struct block_head * blkh;
     struct item_head * ih;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (last_first != LAST_TO_FIRST  && last_first != FIRST_TO_LAST) 
-       reiserfs_panic (0, "vs-10090: leaf_copy_items_entirely: bad last_first parameter %d", last_first);
-
-    if (B_NR_ITEMS (src) - first < cpy_num)
-       reiserfs_panic (0, "vs-10100: leaf_copy_items_entirely: too few items in source %d, required %d from %d",
-                       B_NR_ITEMS(src), cpy_num, first);
-
-    if (cpy_num < 0)
-       reiserfs_panic (0, "vs-10110: leaf_copy_items_entirely: can not copy negative amount of items");
-
-    if ( ! dest_bi )
-       reiserfs_panic (0, "vs-10120: leaf_copy_items_entirely: can not copy negative amount of items");
-#endif
+    RFALSE( last_first != LAST_TO_FIRST  && last_first != FIRST_TO_LAST,
+           "vs-10090: bad last_first parameter %d", last_first);
+    RFALSE( B_NR_ITEMS (src) - first < cpy_num,
+           "vs-10100: too few items in source %d, required %d from %d",
+           B_NR_ITEMS(src), cpy_num, first);
+    RFALSE( cpy_num < 0, "vs-10110: can not copy negative amount of items");
+    RFALSE( ! dest_bi, "vs-10120: can not copy negative amount of items");
 
     dest = dest_bi->bi_bh;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( ! dest )
-       reiserfs_panic (0, "vs-10130: leaf_copy_items_entirely: can not copy negative amount of items");
-#endif
+    RFALSE( ! dest, "vs-10130: can not copy negative amount of items");
 
     if (cpy_num == 0)
        return;
@@ -303,13 +274,9 @@ static void leaf_copy_items_entirely (struct buffer_info * dest_bi, struct buffe
     /* location of head of first new item */
     ih = B_N_PITEM_HEAD (dest, dest_before);
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (le16_to_cpu (blkh->blk_free_space) < cpy_num * IH_SIZE) {
-       reiserfs_panic (0, "vs-10140: leaf_copy_items_entirely: "
-                       "not enough free space for headers %d (needed %d)",
-                       B_FREE_SPACE (dest), cpy_num * IH_SIZE);
-    }
-#endif
+    RFALSE( le16_to_cpu (blkh->blk_free_space) < cpy_num * IH_SIZE,
+           "vs-10140: not enough free space for headers %d (needed %d)",
+           B_FREE_SPACE (dest), cpy_num * IH_SIZE);
 
     /* prepare space for headers */
     memmove (ih + cpy_num, ih, (nr-dest_before) * IH_SIZE);
@@ -330,12 +297,9 @@ static void leaf_copy_items_entirely (struct buffer_info * dest_bi, struct buffe
     last_inserted_loc = ih[cpy_num-1].ih_item_location;
 
     /* check free space */
-#ifdef CONFIG_REISERFS_CHECK
-    if (le16_to_cpu (blkh->blk_free_space) < j - last_inserted_loc) {
-       reiserfs_panic (0, "vs-10150: leaf_copy_items_entirely: not enough free space for items %d (needed %d)",
-                       le16_to_cpu (blkh->blk_free_space), j - last_inserted_loc);
-    }
-#endif
+    RFALSE( le16_to_cpu (blkh->blk_free_space) < j - last_inserted_loc,
+           "vs-10150: not enough free space for items %d (needed %d)",
+           le16_to_cpu (blkh->blk_free_space), j - last_inserted_loc);
 
     memmove (dest->b_data + last_loc,
             dest->b_data + last_loc + j - last_inserted_loc,
@@ -352,13 +316,9 @@ static void leaf_copy_items_entirely (struct buffer_info * dest_bi, struct buffe
     do_balance_mark_leaf_dirty (dest_bi->tb, dest, 0);
 
     if (dest_bi->bi_parent) {
-#ifdef CONFIG_REISERFS_CHECK
-       if (B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_block_number != dest->b_blocknr) {
-           reiserfs_panic (0, "vs-10160: leaf_copy_items_entirely: "
-                           "block number in bh does not match to field in disk_child structure %lu and %lu",
-                           dest->b_blocknr, B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_block_number);
-       }
-#endif
+       RFALSE( B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_block_number != dest->b_blocknr,
+               "vs-10160: block number in bh does not match to field in disk_child structure %lu and %lu",
+               dest->b_blocknr, B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_block_number);
        B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_size +=
            j - last_inserted_loc + IH_SIZE * cpy_num;
     
@@ -375,10 +335,7 @@ static void leaf_item_bottle (struct buffer_info * dest_bi, struct buffer_head *
     struct buffer_head * dest = dest_bi->bi_bh;
     struct item_head * ih;
   
-#ifdef CONFIG_REISERFS_CHECK  
-    if ( cpy_bytes == -1 ) 
-       reiserfs_panic (0, "vs-10170: leaf_item_bottle: bytes == - 1 means: do not split item");
-#endif
+    RFALSE( cpy_bytes == -1, "vs-10170: bytes == - 1 means: do not split item");
 
     if ( last_first == FIRST_TO_LAST ) {
        /* if ( if item in position item_num in buffer SOURCE is directory item ) */
@@ -394,19 +351,15 @@ static void leaf_item_bottle (struct buffer_info * dest_bi, struct buffer_head *
            memcpy (&n_ih, ih, IH_SIZE);
            n_ih.ih_item_len = cpu_to_le16 (cpy_bytes);
            if (is_indirect_le_ih (ih)) {
-#ifdef CONFIG_REISERFS_CHECK
-               if (cpy_bytes == le16_to_cpu (ih->ih_item_len) && get_ih_free_space (ih))
-                   reiserfs_panic (0, "vs-10180: leaf_item_bottle: " 
-                                   "when whole indirect item is bottle to left neighbor, it must have free_space==0 (not %lu)",
-                                   get_ih_free_space (ih));
-#endif
+               RFALSE( cpy_bytes == le16_to_cpu (ih->ih_item_len) && 
+                       get_ih_free_space (ih),
+                       "vs-10180: when whole indirect item is bottle to left neighbor, it must have free_space==0 (not %lu)",
+                       get_ih_free_space (ih));
                set_ih_free_space (&n_ih, 0);
            }
 
-#ifdef CONFIG_REISERFS_CHECK
-           if (op_is_left_mergeable (&(ih->ih_key), src->b_size))
-               reiserfs_panic (0, "vs-10190: leaf_item_bottle: bad mergeability of item %h", ih);
-#endif
+           RFALSE( op_is_left_mergeable (&(ih->ih_key), src->b_size),
+                   "vs-10190: bad mergeability of item %h", ih);
            n_ih.ih_version = ih->ih_version;;
            leaf_insert_into_buf (dest_bi, B_NR_ITEMS(dest), &n_ih, B_N_PITEM (src, item_num), 0);
        }
@@ -429,10 +382,8 @@ static void leaf_item_bottle (struct buffer_info * dest_bi, struct buffer_head *
                set_ih_free_space (&n_ih, MAX_US_INT);
            } else {
                /* indirect item */
-#ifdef CONFIG_REISERFS_CHECK
-               if (!cpy_bytes && get_ih_free_space (ih))
-                   reiserfs_panic (0, "vs-10200: leaf_item_bottle: ih->ih_free_space must be 0 when indirect item will be appended");
-#endif
+               RFALSE( !cpy_bytes && get_ih_free_space (ih),
+                       "vs-10200: ih->ih_free_space must be 0 when indirect item will be appended");
                set_le_ih_k_offset (&n_ih, le_ih_k_offset (ih) + (le16_to_cpu (ih->ih_item_len) - cpy_bytes) / UNFM_P_SIZE * dest->b_size);
                set_le_ih_k_type (&n_ih, TYPE_INDIRECT);
                set_ih_free_space (&n_ih, get_ih_free_space (ih));
@@ -458,19 +409,12 @@ static int leaf_copy_items (struct buffer_info * dest_bi, struct buffer_head * s
   int pos, i, src_nr_item, bytes;
 
   dest = dest_bi->bi_bh;
-#ifdef CONFIG_REISERFS_CHECK
-  if (!dest || !src)
-    reiserfs_panic (0, "vs-10210: leaf_copy_items: !dest || !src");
-  
-  if ( last_first != FIRST_TO_LAST && last_first != LAST_TO_FIRST )
-    reiserfs_panic (0, "vs-10220: leaf_copy_items: last_first != FIRST_TO_LAST && last_first != LAST_TO_FIRST");
-
-  if ( B_NR_ITEMS(src) < cpy_num )
-    reiserfs_panic (0, "vs-10230: leaf_copy_items: No enough items: %d, required %d", B_NR_ITEMS(src), cpy_num);
-
- if ( cpy_num < 0 )
-    reiserfs_panic (0, "vs-10240: leaf_copy_items: cpy_num < 0 (%d)", cpy_num);
-#endif
+  RFALSE( !dest || !src, "vs-10210: !dest || !src");
+  RFALSE( last_first != FIRST_TO_LAST && last_first != LAST_TO_FIRST,
+         "vs-10220:last_first != FIRST_TO_LAST && last_first != LAST_TO_FIRST");
+  RFALSE( B_NR_ITEMS(src) < cpy_num,
+         "vs-10230: No enough items: %d, req. %d", B_NR_ITEMS(src), cpy_num);
+  RFALSE( cpy_num < 0,"vs-10240: cpy_num < 0 (%d)", cpy_num);
 
  if ( cpy_num == 0 )
    return 0;
@@ -537,10 +481,8 @@ static void leaf_define_dest_src_infos (int shift_mode, struct tree_balance * tb
                                        struct buffer_info * src_bi, int * first_last,
                                        struct buffer_head * Snew)
 {
-#ifdef CONFIG_REISERFS_CHECK
     memset (dest_bi, 0, sizeof (struct buffer_info));
     memset (src_bi, 0, sizeof (struct buffer_info));
-#endif
 
     /* define dest, src, dest parent, dest position */
     switch (shift_mode) {
@@ -607,12 +549,9 @@ static void leaf_define_dest_src_infos (int shift_mode, struct tree_balance * tb
     default:
        reiserfs_panic (0, "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)", shift_mode);
     }
-#ifdef CONFIG_REISERFS_CHECK
-    if (src_bi->bi_bh == 0 || dest_bi->bi_bh == 0) {
-       reiserfs_panic (0, "vs-10260: leaf_define_dest_src_etc: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
-                       shift_mode, src_bi->bi_bh, dest_bi->bi_bh);
-    }
-#endif
+    RFALSE( src_bi->bi_bh == 0 || dest_bi->bi_bh == 0,
+           "vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
+           shift_mode, src_bi->bi_bh, dest_bi->bi_bh);
 }
 
 
@@ -650,10 +589,10 @@ int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes)
   if ( shift_num ) {
     if (B_NR_ITEMS (S0) == 0) { /* number of items in S[0] == 0 */
 
+      RFALSE( shift_bytes != -1,
+             "vs-10270: S0 is empty now, but shift_bytes != -1 (%d)", 
+             shift_bytes);
 #ifdef CONFIG_REISERFS_CHECK
-      if ( shift_bytes != -1 )
-       reiserfs_panic (tb->tb_sb, "vs-10270: leaf_shift_left: S0 is empty now, but shift_bytes != -1 (%d)", shift_bytes);
-
       if (tb->tb_mode == M_PASTE || tb->tb_mode == M_INSERT) {
        print_cur_tb ("vs-10275");
        reiserfs_panic (tb->tb_sb, "vs-10275: leaf_shift_left: balance condition corrupted (%c)", tb->tb_mode);
@@ -675,14 +614,11 @@ int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes)
       /* change right_delimiting_key field in L0's block header */
       copy_key (B_PRIGHT_DELIM_KEY(tb->L[0]), B_N_PKEY (S0, 0));
 #endif
-#ifdef CONFIG_REISERFS_CHECK
-      if (shift_bytes != -1 && !(is_direntry_le_ih (B_N_PITEM_HEAD (S0, 0))
-                                && !I_ENTRY_COUNT (B_N_PITEM_HEAD (S0, 0)))) {
-       if (!op_is_left_mergeable (B_N_PKEY (S0, 0), S0->b_size)) {
-         reiserfs_panic (tb->tb_sb, "vs-10280: leaf_shift_left: item must be mergeable");
-       }
-      }
-#endif
+      RFALSE( (shift_bytes != -1 && 
+              !(is_direntry_le_ih (B_N_PITEM_HEAD (S0, 0))
+                && !I_ENTRY_COUNT (B_N_PITEM_HEAD (S0, 0)))) &&
+             (!op_is_left_mergeable (B_N_PKEY (S0, 0), S0->b_size)),
+             "vs-10280: item must be mergeable");
     }
   }
   
@@ -741,17 +677,12 @@ void leaf_delete_items (struct buffer_info * cur_bi, int last_first,
     struct buffer_head * bh;
     int item_amount = B_NR_ITEMS (bh = cur_bi->bi_bh);
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( !bh )
-       reiserfs_panic (0, "leaf_delete_items: 10155: bh is not defined");
-
-    if ( del_num < 0 )
-       reiserfs_panic (0, "leaf_delete_items: 10160: del_num can not be < 0. del_num==%d", del_num);
-
-    if ( first < 0 || first + del_num > item_amount )
-       reiserfs_panic (0, "leaf_delete_items: 10165: invalid number of first item to be deleted (%d) or "
-                       "no so much items (%d) to delete (only %d)", first, first + del_num, item_amount);
-#endif
+    RFALSE( !bh, "10155: bh is not defined");
+    RFALSE( del_num < 0, "10160: del_num can not be < 0. del_num==%d", del_num);
+    RFALSE( first < 0 || first + del_num > item_amount,
+           "10165: invalid number of first item to be deleted (%d) or "
+           "no so much items (%d) to delete (only %d)", 
+           first, first + del_num, item_amount);
 
     if ( del_num == 0 )
        return;
@@ -814,16 +745,14 @@ void leaf_insert_into_buf (struct buffer_info * bi, int before,
 
     nr = le16_to_cpu ((blkh = B_BLK_HEAD (bh))->blk_nr_item);
 
-#ifdef CONFIG_REISERFS_CHECK
     /* check free space */
-    if (le16_to_cpu (blkh->blk_free_space) < le16_to_cpu (inserted_item_ih->ih_item_len) + IH_SIZE)
-       reiserfs_panic (0, "leaf_insert_into_buf: 10170: "
-                       "not enough free space in block %z, new item %h",
-                       bh, inserted_item_ih);
-    if (zeros_number > inserted_item_ih->ih_item_len)
-       reiserfs_panic (0, "vs-10172: leaf_insert_into_buf: "
-                       "zero number == %d, item length == %d", zeros_number, inserted_item_ih->ih_item_len);
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( le16_to_cpu (blkh->blk_free_space) < 
+           le16_to_cpu (inserted_item_ih->ih_item_len) + IH_SIZE,
+           "not enough free space in block %z, new item %h",
+           bh, inserted_item_ih);
+    RFALSE( zeros_number > inserted_item_ih->ih_item_len,
+           "vs-10172: zero number == %d, item length == %d", 
+           zeros_number, inserted_item_ih->ih_item_len);
 
 
     /* get item new item must be inserted before */
@@ -886,11 +815,11 @@ void leaf_paste_in_buffer (struct buffer_info * bi, int affected_item_num,
 
     nr = le16_to_cpu ((blkh = B_BLK_HEAD(bh))->blk_nr_item);
 
-#ifdef CONFIG_REISERFS_CHECK
     /* check free space */
-    if (le16_to_cpu (blkh->blk_free_space) < paste_size)
-       reiserfs_panic (0, "leaf_paste_in_buffer: 10175: not enough free space: needed %d, available %d",
-                       paste_size, le16_to_cpu (blkh->blk_free_space));
+    RFALSE( le16_to_cpu (blkh->blk_free_space) < paste_size,
+           "10175: not enough free space: needed %d, available %d",
+           paste_size, le16_to_cpu (blkh->blk_free_space));
+#ifdef CONFIG_REISERFS_CHECK
     if (zeros_number > paste_size) {
        print_cur_tb ("10177");
        reiserfs_panic (0, "vs-10177: leaf_paste_in_buffer: zero number == %d, paste_size == %d",
@@ -965,16 +894,12 @@ static int        leaf_cut_entries (
   int i;
 
 
-#ifdef CONFIG_REISERFS_CHECK
   /* make sure, that item is directory and there are enough entries to
      remove */
-  if (!is_direntry_le_ih (ih))
-    reiserfs_panic (0, "leaf_cut_entries: 10180: item is not directory item");
-
-  if (I_ENTRY_COUNT(ih) < from + del_count)
-    reiserfs_panic (0, "leaf_cut_entries: 10185: item contains not enough entries: entry_cout = %d, from = %d, to delete = %d",
-                   I_ENTRY_COUNT(ih), from, del_count);
-#endif
+  RFALSE( !is_direntry_le_ih (ih), "10180: item is not directory item");
+  RFALSE( I_ENTRY_COUNT(ih) < from + del_count,
+         "10185: item contains not enough entries: entry_cout = %d, from = %d, to delete = %d",
+         I_ENTRY_COUNT(ih), from, del_count);
 
   if (del_count == 0)
     return 0;
@@ -1042,25 +967,19 @@ void leaf_cut_from_buffer (struct buffer_info * bi, int cut_item_num,
         cut_size = leaf_cut_entries (bh, ih, pos_in_item, cut_size);
         if (pos_in_item == 0) {
                /* change key */
-#ifdef CONFIG_REISERFS_CHECK
-            if (cut_item_num)
-                reiserfs_panic (0, "leaf_cut_from_buffer: 10190: " 
+           RFALSE( cut_item_num,
                     "when 0-th enrty of item is cut, that item must be first in the node, not %d-th", cut_item_num);
-#endif
             /* change item key by key of first entry in the item */
            set_le_ih_k_offset (ih, le32_to_cpu (B_I_DEH (bh, ih)->deh_offset));
             /*memcpy (&ih->ih_key.k_offset, &(B_I_DEH (bh, ih)->deh_offset), SHORT_KEY_SIZE);*/
            }
     } else {
         /* item is direct or indirect */
-#ifdef CONFIG_REISERFS_CHECK
-        if (is_statdata_le_ih (ih))
-               reiserfs_panic (0, "leaf_cut_from_buffer: 10195: item is stat data");
-
-        if (pos_in_item && pos_in_item + cut_size != le16_to_cpu (ih->ih_item_len) )
-            reiserfs_panic (0, "cut_from_buf: 10200: invalid offset (%lu) or trunc_size (%lu) or ih_item_len (%lu)",
+       RFALSE( is_statdata_le_ih (ih), "10195: item is stat data");
+       RFALSE( pos_in_item && 
+               pos_in_item + cut_size != le16_to_cpu (ih->ih_item_len),
+               "invalid offset (%lu) or trunc_size (%lu) or ih_item_len (%lu)",
                 pos_in_item, cut_size, le16_to_cpu (ih->ih_item_len));
-#endif
 
         /* shift item body to left if cut is from the head of item */
         if (pos_in_item == 0) {
@@ -1072,10 +991,9 @@ void leaf_cut_from_buffer (struct buffer_info * bi, int cut_item_num,
                set_le_ih_k_offset (ih, le_ih_k_offset (ih) + cut_size);
             else {
                set_le_ih_k_offset (ih, le_ih_k_offset (ih) + (cut_size / UNFM_P_SIZE) * bh->b_size);
-#ifdef CONFIG_REISERFS_CHECK
-                if ( le16_to_cpu (ih->ih_item_len) == cut_size && get_ih_free_space (ih) )
-                    reiserfs_panic (0, "leaf_cut_from_buf: 10205: invalid ih_free_space (%h)", ih);
-#endif
+               RFALSE( le16_to_cpu (ih->ih_item_len) == cut_size && 
+                       get_ih_free_space (ih),
+                       "10205: invalid ih_free_space (%h)", ih);
                }
            }
     }
@@ -1130,23 +1048,16 @@ static void leaf_delete_items_entirely (struct buffer_info * bi,
     struct block_head * blkh;
     struct item_head * ih;
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (bh == NULL)
-    reiserfs_panic (0, "leaf_delete_items_entirely: 10210: buffer is 0");
-
-  if (del_num < 0)
-    reiserfs_panic (0, "leaf_delete_items_entirely: 10215: del_num less than 0 (%d)", del_num);
-#endif /* CONFIG_REISERFS_CHECK */
+  RFALSE( bh == NULL, "10210: buffer is 0");
+  RFALSE( del_num < 0, "10215: del_num less than 0 (%d)", del_num);
 
   if (del_num == 0)
     return;
 
   nr = le16_to_cpu ((blkh = B_BLK_HEAD(bh))->blk_nr_item);
 
-#ifdef CONFIG_REISERFS_CHECK
-  if (first < 0 || first + del_num > nr)
-    reiserfs_panic (0, "leaf_delete_items_entirely: 10220: first=%d, number=%d, there is %d items", first, del_num, nr);
-#endif /* CONFIG_REISERFS_CHECK */
+  RFALSE( first < 0 || first + del_num > nr,
+         "10220: first=%d, number=%d, there is %d items", first, del_num, nr);
 
   if (first == 0 && del_num == nr) {
     /* this does not work */
@@ -1213,15 +1124,11 @@ void    leaf_paste_entries (
 
     ih = B_N_PITEM_HEAD(bh, item_num);
 
-#ifdef CONFIG_REISERFS_CHECK
   /* make sure, that item is directory, and there are enough records in it */
-  if (!is_direntry_le_ih (ih))
-    reiserfs_panic (0, "leaf_paste_entries: 10225: item is not directory item");
-
-  if (I_ENTRY_COUNT (ih) < before)
-    reiserfs_panic (0, "leaf_paste_entries: 10230: there are no entry we paste entries before. entry_count = %d, before = %d",
-                   I_ENTRY_COUNT (ih), before);
-#endif
+  RFALSE( !is_direntry_le_ih (ih), "10225: item is not directory item");
+  RFALSE( I_ENTRY_COUNT (ih) < before,
+         "10230: there are no entry we paste entries before. entry_count = %d, before = %d",
+         I_ENTRY_COUNT (ih), before);
 
 
   /* first byte of dest item */
@@ -1268,13 +1175,6 @@ void    leaf_paste_entries (
   /* change item key if neccessary (when we paste before 0-th entry */
   if (!before)
     {
-#ifdef CONFIG_REISERFS_CHECK
-/*
-      if ( old_entry_num && COMP_SHORT_KEYS ((unsigned long *)&ih->ih_key.k_offset,
-                                            &(new_dehs->deh_offset)) <= 0)
-       reiserfs_panic (0, "leaf_paste_entries: 10235: new key must be less, that old key");
-*/
-#endif
        set_le_ih_k_offset (ih, le32_to_cpu (new_dehs->deh_offset));
 /*      memcpy (&ih->ih_key.k_offset, 
                       &new_dehs->deh_offset, SHORT_KEY_SIZE);*/
index c2932ea554a4a14c6d42c32081e63e2874dcee7a..ec1a9359f5a0dde11430b15852665b2fe8c40408 100644 (file)
@@ -245,10 +245,8 @@ static int linear_search_in_dir_item (struct cpu_key * key, struct reiserfs_dir_
        i --;
     }
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (de->de_deh != B_I_DEH (de->de_bh, de->de_ih))
-       reiserfs_panic (0, "vs-7010: linear_search_in_dir_item: array of entry headers not found");
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( de->de_deh != B_I_DEH (de->de_bh, de->de_ih),
+           "vs-7010: array of entry headers not found");
 
     deh += i;
 
@@ -290,11 +288,8 @@ static int linear_search_in_dir_item (struct cpu_key * key, struct reiserfs_dir_
        // so, this is a bug
        return NAME_NOT_FOUND;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if (de->de_item_num)
-       reiserfs_panic (0, "vs-7015: linear_search_in_dir_item: "
-                       "two diritems of the same directory in one node?");
-#endif /* CONFIG_REISERFS_CHECK */
+    RFALSE( de->de_item_num,
+           "vs-7015: two diritems of the same directory in one node?");
 
     return GOTO_PREVIOUS_ITEM;
 }
@@ -1149,14 +1144,9 @@ int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
            continue;
        }
 
-#ifdef CONFIG_REISERFS_CHECK
-       if (S_ISDIR(old_inode->i_mode) && 
-           (!entry_points_to_object ("..", 2, &dot_dot_de, old_dir) || 
-            !reiserfs_buffer_prepared(dot_dot_de.de_bh))) {
-           // this should be not changed
-           BUG ();
-       }
-#endif 
+       RFALSE( S_ISDIR(old_inode->i_mode) && 
+               (!entry_points_to_object ("..", 2, &dot_dot_de, old_dir) || 
+                !reiserfs_buffer_prepared(dot_dot_de.de_bh)), "" );
 
        break;
     }
index 108d391253bb2b47f08ca19880b87c97b797620b..c1450e125862bdc054a1d815fa3b866189141f59 100644 (file)
@@ -26,6 +26,9 @@ static void check_objectid_map (struct super_block * s, __u32 * map)
     // FIXME: add something else here
 }
 
+#else
+static void check_objectid_map (struct super_block * s, __u32 * map)
+{;}
 #endif
 
 
@@ -53,9 +56,7 @@ __u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th)
     __u32 unused_objectid;
 
 
-#ifdef CONFIG_REISERFS_CHECK
     check_objectid_map (s, map);
-#endif
 
     reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
                                 /* comment needed -Hans */
@@ -101,9 +102,7 @@ void reiserfs_release_objectid (struct reiserfs_transaction_handle *th,
     int i = 0;
 
     //return;
-#ifdef CONFIG_REISERFS_CHECK
     check_objectid_map (s, map);
-#endif
 
     reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
     journal_mark_dirty(th, s, SB_BUFFER_WITH_SB (s)); 
@@ -129,13 +128,10 @@ void reiserfs_release_objectid (struct reiserfs_transaction_handle *th,
                //disk_sb->s_oid_cursize -= 2;
                rs->s_oid_cursize = cpu_to_le16 (le16_to_cpu (rs->s_oid_cursize) - 2);
 
-#ifdef CONFIG_REISERFS_CHECK
-               if (le16_to_cpu (rs->s_oid_cursize) < 2 || 
-                   le16_to_cpu (rs->s_oid_cursize) > le16_to_cpu (rs->s_oid_maxsize))
-                   reiserfs_panic (s, "vs-15005: reiserfs_release_objectid: "
-                                   "objectid map corrupted cur_size == %d (max == %d)",
-                                   le16_to_cpu (rs->s_oid_cursize), le16_to_cpu (rs->s_oid_maxsize));
-#endif
+               RFALSE( le16_to_cpu (rs->s_oid_cursize) < 2 || 
+                       le16_to_cpu (rs->s_oid_cursize) > le16_to_cpu (rs->s_oid_maxsize),
+                       "vs-15005: objectid map corrupted cur_size == %d (max == %d)",
+                       le16_to_cpu (rs->s_oid_cursize), le16_to_cpu (rs->s_oid_maxsize));
            }
            return;
        }
index aef53afeecadd1ac95f6c9dd6c2cefa52595768d..596c91481f1e599966c19e02b39786748e272e11 100644 (file)
 inline int B_IS_IN_TREE (struct buffer_head * p_s_bh)
 {
 
-#ifdef CONFIG_REISERFS_CHECK
-
-  if ( B_LEVEL (p_s_bh) > MAX_HEIGHT ) {
-    reiserfs_panic(0, "PAP-1010: B_IS_IN_TREE: block (%b) has too big level (%z)",
-                  p_s_bh, p_s_bh);
-  }
-#endif
+  RFALSE( B_LEVEL (p_s_bh) > MAX_HEIGHT,
+         "PAP-1010: block (%b) has too big level (%z)", p_s_bh, p_s_bh);
 
   return ( B_LEVEL (p_s_bh) != FREE_LEVEL );
 }
@@ -312,18 +307,14 @@ inline    struct  key * get_lkey  (
   int                   n_position, n_path_offset = p_s_chk_path->path_length;
   struct buffer_head  * p_s_parent;
   
-#ifdef CONFIG_REISERFS_CHECK
-  if ( n_path_offset < FIRST_PATH_ELEMENT_OFFSET )
-    reiserfs_panic(p_s_sb,"PAP-5010: get_lkey: illegal offset in the path");
-#endif
+  RFALSE( n_path_offset < FIRST_PATH_ELEMENT_OFFSET, 
+         "PAP-5010: illegal offset in the path");
 
   /* While not higher in path than first element. */
   while ( n_path_offset-- > FIRST_PATH_ELEMENT_OFFSET ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( ! buffer_uptodate(PATH_OFFSET_PBUFFER(p_s_chk_path, n_path_offset)) )
-      reiserfs_panic(p_s_sb, "PAP-5020: get_lkey: parent is not uptodate");
-#endif
+    RFALSE( ! buffer_uptodate(PATH_OFFSET_PBUFFER(p_s_chk_path, n_path_offset)),
+           "PAP-5020: parent is not uptodate");
 
     /* Parent at the path is not in the tree now. */
     if ( ! B_IS_IN_TREE(p_s_parent = PATH_OFFSET_PBUFFER(p_s_chk_path, n_path_offset)) )
@@ -356,17 +347,13 @@ inline    struct  key * get_rkey  (
                        n_path_offset = p_s_chk_path->path_length;
   struct buffer_head  * p_s_parent;
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( n_path_offset < FIRST_PATH_ELEMENT_OFFSET )
-    reiserfs_panic(p_s_sb,"PAP-5030: get_rkey: illegal offset in the path");
-#endif
+  RFALSE( n_path_offset < FIRST_PATH_ELEMENT_OFFSET,
+         "PAP-5030: illegal offset in the path");
 
   while ( n_path_offset-- > FIRST_PATH_ELEMENT_OFFSET ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( ! buffer_uptodate(PATH_OFFSET_PBUFFER(p_s_chk_path, n_path_offset)) )
-      reiserfs_panic(p_s_sb, "PAP-5040: get_rkey: parent is not uptodate");
-#endif
+    RFALSE( ! buffer_uptodate(PATH_OFFSET_PBUFFER(p_s_chk_path, n_path_offset)),
+           "PAP-5040: parent is not uptodate");
 
     /* Parent at the path is not in the tree now. */
     if ( ! B_IS_IN_TREE(p_s_parent = PATH_OFFSET_PBUFFER(p_s_chk_path, n_path_offset)) )
@@ -401,15 +388,12 @@ static  inline  int key_in_buffer (
                       struct super_block  * p_s_sb        /* Super block pointer.           */
                      ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( ! p_s_key || p_s_chk_path->path_length < FIRST_PATH_ELEMENT_OFFSET ||
-       p_s_chk_path->path_length > MAX_HEIGHT )
-    reiserfs_panic(p_s_sb, "PAP-5050: key_in_buffer:  pointer to the key(%p) is NULL or illegal path length(%d)",
-                  p_s_key, p_s_chk_path->path_length);
-  
-  if ( PATH_PLAST_BUFFER(p_s_chk_path)->b_dev == NODEV )
-    reiserfs_panic(p_s_sb, "PAP-5060: key_in_buffer: device must not be NODEV");
-#endif
+  RFALSE( ! p_s_key || p_s_chk_path->path_length < FIRST_PATH_ELEMENT_OFFSET ||
+         p_s_chk_path->path_length > MAX_HEIGHT,
+         "PAP-5050: pointer to the key(%p) is NULL or illegal path length(%d)",
+         p_s_key, p_s_chk_path->path_length);
+  RFALSE( PATH_PLAST_BUFFER(p_s_chk_path)->b_dev == NODEV,
+         "PAP-5060: device must not be NODEV");
 
   if ( COMP_KEYS(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1 )
     /* left delimiting key is bigger, that the key we look for */
@@ -441,11 +425,9 @@ void decrement_counters_in_path (
             ) {
   int n_path_offset = p_s_search_path->path_length;
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( n_path_offset < ILLEGAL_PATH_ELEMENT_OFFSET ||
-       n_path_offset > EXTENDED_MAX_HEIGHT - 1 )
-    reiserfs_panic(NULL, "PAP-5080: decrement_counters_in_path: illegal path offset of %d", n_path_offset);
-#endif
+  RFALSE( n_path_offset < ILLEGAL_PATH_ELEMENT_OFFSET ||
+         n_path_offset > EXTENDED_MAX_HEIGHT - 1,
+         "PAP-5080: illegal path offset of %d", n_path_offset);
 
   while ( n_path_offset > ILLEGAL_PATH_ELEMENT_OFFSET ) {
     struct buffer_head * bh;
@@ -458,12 +440,8 @@ void decrement_counters_in_path (
 
 
 int reiserfs_check_path(struct path *p) {
-#ifdef CONFIG_REISERFS_CHECK 
-  if (p->path_length != ILLEGAL_PATH_ELEMENT_OFFSET) {
-    reiserfs_warning("check_path, path not properly relsed\n") ;
-    BUG() ;
-  }
-#endif
+  RFALSE( p->path_length != ILLEGAL_PATH_ELEMENT_OFFSET,
+         "path not properly relsed") ;
   return 0 ;
 }
 
@@ -479,10 +457,8 @@ void  pathrelse_and_restore (
       ) {
   int n_path_offset = p_s_search_path->path_length;
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( n_path_offset < ILLEGAL_PATH_ELEMENT_OFFSET )
-    reiserfs_panic(NULL, "clm-4000: pathrelse: illegal path offset");
-#endif
+  RFALSE( n_path_offset < ILLEGAL_PATH_ELEMENT_OFFSET, 
+         "clm-4000: illegal path offset");
   
   while ( n_path_offset > ILLEGAL_PATH_ELEMENT_OFFSET )  {
     reiserfs_restore_prepared_buffer(s, PATH_OFFSET_PBUFFER(p_s_search_path, 
@@ -498,10 +474,8 @@ void  pathrelse (
       ) {
   int n_path_offset = p_s_search_path->path_length;
 
-#ifdef CONFIG_REISERFS_CHECK
-  if ( n_path_offset < ILLEGAL_PATH_ELEMENT_OFFSET )
-    reiserfs_panic(NULL, "PAP-5090: pathrelse: illegal path offset");
-#endif
+  RFALSE( n_path_offset < ILLEGAL_PATH_ELEMENT_OFFSET,
+         "PAP-5090: illegal path offset");
   
   while ( n_path_offset > ILLEGAL_PATH_ELEMENT_OFFSET )  
     brelse(PATH_OFFSET_PBUFFER(p_s_search_path, n_path_offset--));
@@ -742,15 +716,13 @@ int search_by_key (struct super_block * p_s_sb,
            continue;
        }
 
+       RFALSE( ! key_in_buffer(p_s_search_path, p_s_key, p_s_sb),
+               "PAP-5130: key is not in the buffer");
 #ifdef CONFIG_REISERFS_CHECK
-
-       if ( ! key_in_buffer(p_s_search_path, p_s_key, p_s_sb) )
-           reiserfs_panic(p_s_sb, "PAP-5130: search_by_key: key is not in the buffer");
        if ( cur_tb ) {
            print_cur_tb ("5140");
            reiserfs_panic(p_s_sb, "PAP-5140: search_by_key: schedule occurred in do_balance!");
        }
-
 #endif
 
        // make sure, that the node contents look like a node of
@@ -765,13 +737,9 @@ int search_by_key (struct super_block * p_s_sb,
        /* ok, we have acquired next formatted node in the tree */
        n_node_level = B_LEVEL (p_s_bh);
 
-#ifdef CONFIG_REISERFS_CHECK
-
-       if (n_node_level < n_stop_level)
-           reiserfs_panic (p_s_sb, "vs-5152: search_by_key: tree level is less than stop level (%d)",
-                           n_node_level, n_stop_level);
-
-#endif
+       RFALSE( n_node_level < n_stop_level,
+               "vs-5152: tree level is less than stop level (%d)",
+               n_node_level, n_stop_level);
 
        n_retval = bin_search (p_s_key, B_N_PITEM_HEAD(p_s_bh, 0), B_NR_ITEMS(p_s_bh),
                               ( n_node_level == DISK_LEAF_NODE_LEVEL ) ? IH_SIZE : KEY_SIZE, &(p_s_last_element->pe_position));
@@ -840,20 +808,17 @@ int search_for_position_by_key (struct super_block  * p_s_sb,         /* Pointer
        return retval;
     if ( retval == ITEM_FOUND )  {
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( ! B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_search_path),
-                             PATH_LAST_POSITION(p_s_search_path))->ih_item_len )
-           reiserfs_panic(p_s_sb, "PAP-5165: search_for_position_by_key: item length equals zero");
-#endif
+       RFALSE( ! B_N_PITEM_HEAD
+               (PATH_PLAST_BUFFER(p_s_search_path),
+                PATH_LAST_POSITION(p_s_search_path))->ih_item_len,
+               "PAP-5165: item length equals zero");
 
        pos_in_item(p_s_search_path) = 0;
        return POSITION_FOUND;
     }
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( ! PATH_LAST_POSITION(p_s_search_path) )
-       reiserfs_panic(p_s_sb, "PAP-5170: search_for_position_by_key: position equals zero");
-#endif
+    RFALSE( ! PATH_LAST_POSITION(p_s_search_path), 
+           "PAP-5170: position equals zero");
 
     /* Item is not found. Set path to the previous item. */
     p_le_ih = B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_search_path), --PATH_LAST_POSITION(p_s_search_path));
@@ -863,22 +828,6 @@ int search_for_position_by_key (struct super_block  * p_s_sb,         /* Pointer
        return FILE_NOT_FOUND;
     }
 
-#if 0
-/*#ifdef CONFIG_REISERFS_CHECK*/
-
-  /* we expect to find stat data or item of the same type */
-    if ( ! is_statdata_le_ih(p_le_ih) && ((is_indirect_cpu_key(p_cpu_key) && ! is_indirect_le_ih(p_le_ih)) ||
-                                         (is_direct_cpu_key(p_cpu_key) && ! is_direct_le_ih(p_le_ih))) ) {
-       print_block (PATH_PLAST_BUFFER(p_s_search_path), PRINT_LEAF_ITEMS, 
-                    PATH_LAST_POSITION (p_s_search_path) - 2,
-                    PATH_LAST_POSITION (p_s_search_path) + 2);
-       reiserfs_panic(p_s_sb, "PAP-5190: search_for_position_by_key: "
-                      "found item %h type does not match to the expected one %k",
-                      p_le_ih, p_cpu_key);
-    }
-/*#endif*/
-#endif
-
     // FIXME: quite ugly this far
 
     item_offset = le_ih_k_offset (p_le_ih);
@@ -1006,11 +955,8 @@ static inline int prepare_for_direntry_item (struct path * path,
 {
     if (le_ih_k_offset (le_ih) == DOT_OFFSET && 
        new_file_length == max_reiserfs_offset (inode)) {
-#ifdef CONFIG_REISERFS_CHECK
-       if (ih_entry_count (le_ih) != 2)
-           reiserfs_panic(inode->i_sb,"PAP-5220: prepare_for_delete_or_cut: "
-                          "incorrect empty directory item (%h)", le_ih);
-#endif
+       RFALSE( ih_entry_count (le_ih) != 2,
+               "PAP-5220: incorrect empty directory item (%h)", le_ih);
        *cut_size = -(IH_SIZE + le16_to_cpu (le_ih->ih_item_len));
        return M_DELETE; /* Delete the directory item containing "." and ".." entry. */
     }
@@ -1054,10 +1000,8 @@ static char  prepare_for_delete_or_cut(
     /* Stat_data item. */
     if ( is_statdata_le_ih (p_le_ih) ) {
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( n_new_file_length != max_reiserfs_offset (inode) )
-           reiserfs_panic(p_s_sb, "PAP-5210: prepare_for_delete_or_cut: mode must be M_DELETE");
-#endif
+       RFALSE( n_new_file_length != max_reiserfs_offset (inode),
+               "PAP-5210: mode must be M_DELETE");
 
        *p_n_cut_size = -(IH_SIZE + le16_to_cpu (p_le_ih->ih_item_len));
        return M_DELETE;
@@ -1098,13 +1042,11 @@ static char  prepare_for_delete_or_cut(
            /* Calculate number of unformatted nodes in this item. */
            n_unfm_number = I_UNFM_NUM(&s_ih);
 
-#ifdef CONFIG_REISERFS_CHECK
-           if ( ! is_indirect_le_ih(&s_ih) || ! n_unfm_number ||
-                pos_in_item (p_s_path) + 1 !=  n_unfm_number ) {
-               printk("n_unfm_number = %d *p_n_pos_in_item = %d\n",n_unfm_number, pos_in_item (p_s_path));
-               reiserfs_panic(p_s_sb, "PAP-5240: prepare_for_delete_or_cut: illegal item %h", &s_ih);
-           }
-#endif
+           RFALSE( ! is_indirect_le_ih(&s_ih) || ! n_unfm_number ||
+                   pos_in_item (p_s_path) + 1 !=  n_unfm_number,
+                   "PAP-5240: illegal item %h "
+                   "n_unfm_number = %d *p_n_pos_in_item = %d", 
+                   &s_ih, n_unfm_number, pos_in_item (p_s_path));
 
            /* Calculate balance mode and position in the item to remove unformatted nodes. */
            if ( n_new_file_length == max_reiserfs_offset (inode) ) {/* Case of delete. */
@@ -1122,10 +1064,8 @@ static char  prepare_for_delete_or_cut(
                    /* indirect item must be truncated starting from *p_n_pos_in_item-th position */
                    pos_in_item (p_s_path) = (n_new_file_length + n_blk_size - le_ih_k_offset (&s_ih) ) >> p_s_sb->s_blocksize_bits;
 
-#ifdef CONFIG_REISERFS_CHECK
-                   if ( pos_in_item (p_s_path) > n_unfm_number ) 
-                       reiserfs_panic(p_s_sb, "PAP-5250: prepare_for_delete_or_cut: illegal position in the item");
-#endif
+                   RFALSE( pos_in_item (p_s_path) > n_unfm_number,
+                           "PAP-5250: illegal position in the item");
 
                    /* Either convert last unformatted node of indirect item to direct item or increase
                       its free space.  */
@@ -1140,10 +1080,8 @@ static char  prepare_for_delete_or_cut(
                }
            }
 
-#ifdef CONFIG_REISERFS_CHECK
-           if ( n_unfm_number <= pos_in_item (p_s_path) ) 
-               reiserfs_panic(p_s_sb, "PAP-5260: prepare_for_delete_or_cut: illegal position in the indirect item");
-#endif
+           RFALSE( n_unfm_number <= pos_in_item (p_s_path),
+                   "PAP-5260: illegal position in the indirect item");
 
            /* pointers to be cut */
            n_unfm_number -= pos_in_item (p_s_path);
@@ -1169,11 +1107,9 @@ static char  prepare_for_delete_or_cut(
                    need_research = 1 ;
                    break;
                }
-#ifdef CONFIG_REISERFS_CHECK
-               if (p_n_unfm_pointer < (__u32 *)B_I_PITEM(p_s_bh, &s_ih) ||
-                   p_n_unfm_pointer > (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1)
-                   reiserfs_panic (p_s_sb, "vs-5265: prepare_for_delete_or_cut: pointer out of range");
-#endif
+               RFALSE( p_n_unfm_pointer < (__u32 *)B_I_PITEM(p_s_bh, &s_ih) ||
+                       p_n_unfm_pointer > (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1,
+                       "vs-5265: pointer out of range");
 
                if ( ! *p_n_unfm_pointer )  { /* Hole, nothing to remove. */
                    if ( ! n_retry )
@@ -1221,13 +1157,12 @@ static char  prepare_for_delete_or_cut(
                if ( ! n_retry )
                    (*p_n_removed)++;
       
-#ifdef CONFIG_REISERFS_CHECK
-               if ( p_s_un_bh && (*p_n_unfm_pointer != p_s_un_bh->b_blocknr ))
+               RFALSE( p_s_un_bh && 
+                       (*p_n_unfm_pointer != p_s_un_bh->b_blocknr ),
                    // note: minix_truncate allows that. As truncate is
                    // protected by down (inode->i_sem), two truncates can not
                    // co-exist
-                   reiserfs_panic(p_s_sb, "PAP-5280: prepare_for_delete_or_cut: blocks numbers are different");        
-#endif
+                       "PAP-5280: blocks numbers are different");      
 
                tmp = *p_n_unfm_pointer;
                *p_n_unfm_pointer = 0;
@@ -1251,9 +1186,8 @@ static char  prepare_for_delete_or_cut(
            if ( n_retry ) {
                /* There is block in use. Wait, they should release it soon */
 
+               RFALSE( *p_n_removed >= n_unfm_number, "PAP-5290: illegal case");
 #ifdef CONFIG_REISERFS_CHECK
-               if ( *p_n_removed >= n_unfm_number )
-                   reiserfs_panic(p_s_sb, "PAP-5290: prepare_for_delete_or_cut: illegal case");
                if ( !(++n_repeat_counter % 500000) ) {
                    reiserfs_warning("PAP-5300: prepare_for_delete_or_cut: (pid %u): "
                                     "could not delete item %k in (%d) iterations. New file length %Lu. (inode %Ld), Still trying\n",
@@ -1275,15 +1209,10 @@ static char  prepare_for_delete_or_cut(
        } while ( (*p_n_removed < n_unfm_number || need_research) &&
                  search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) == POSITION_FOUND );
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( *p_n_removed < n_unfm_number )
-           reiserfs_panic(p_s_sb, "PAP-5310: prepare_for_delete_or_cut: indirect item is not found");
-
-       if (item_moved (&s_ih, p_s_path) ) {
-           printk("prepare_for_delete_or_cut: after while, comp failed, retry\n") ;
-           BUG ();
-       }
-#endif
+       RFALSE( *p_n_removed < n_unfm_number, 
+               "PAP-5310: indirect item is not found");
+       RFALSE( item_moved (&s_ih, p_s_path), 
+               "after while, comp failed, retry") ;
 
        if (c_mode == M_CUT)
            pos_in_item (p_s_path) *= UNFM_P_SIZE;
@@ -1375,10 +1304,7 @@ int reiserfs_delete_item (struct reiserfs_transaction_handle *th,
 #endif
            prepare_for_delete_or_cut(th, p_s_inode, p_s_path, p_s_item_key, &n_removed, &n_del_size, max_reiserfs_offset (p_s_inode));
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( c_mode != M_DELETE )
-           reiserfs_panic(p_s_sb, "PAP-5320: reiserfs_delete_item: mode must be M_DELETE");
-#endif
+       RFALSE( c_mode != M_DELETE, "PAP-5320: mode must be M_DELETE");
 
        copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
        s_del_balance.insert_size[0] = n_del_size;
@@ -1597,19 +1523,14 @@ static void indirect_to_direct_roll_back (struct reiserfs_transaction_handle *th
        /* look for the last byte of the tail */
        if (search_for_position_by_key (inode->i_sb, &tail_key, path) == POSITION_NOT_FOUND)
            reiserfs_panic (inode->i_sb, "vs-5615: indirect_to_direct_roll_back: found invalid item");
-#ifdef CONFIG_REISERFS_CHECK
-       if (path->pos_in_item != PATH_PITEM_HEAD (path)->ih_item_len - 1)
-           reiserfs_panic (inode->i_sb, "vs-5616: indirect_to_direct_roll_back: appended bytes found");
-#endif
+       RFALSE( path->pos_in_item != PATH_PITEM_HEAD (path)->ih_item_len - 1,
+               "vs-5616: appended bytes found");
        PATH_LAST_POSITION (path) --;
        
        removed = reiserfs_delete_item (th, path, &tail_key, inode, 0/*unbh not needed*/);
-#ifdef CONFIG_REISERFS_CHECK
-       if (removed <= 0 || removed > tail_len)
-           reiserfs_panic (inode->i_sb, "vs-5617: indirect_to_direct_roll_back: "
-                           "there was tail %d bytes, removed item length %d bytes",
-                           tail_len, removed);
-#endif
+       RFALSE( removed <= 0 || removed > tail_len,
+               "vs-5617: there was tail %d bytes, removed item length %d bytes",
+               tail_len, removed);
        tail_len -= removed;
        set_cpu_key_k_offset (&tail_key, cpu_key_k_offset (&tail_key) - removed);
     }
@@ -1657,10 +1578,7 @@ int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th,
        if ( c_mode == M_CONVERT )  {
            /* convert last unformatted node to direct item or leave
                tail in the unformatted node */
-#ifdef CONFIG_REISERFS_CHECK
-           if ( n_ret_value != CARRY_ON )
-               reiserfs_panic (p_s_sb, "PAP-5570: reiserfs_cut_from_item: can not convert twice");
-#endif
+           RFALSE( n_ret_value != CARRY_ON, "PAP-5570: can not convert twice");
 
            n_ret_value = maybe_indirect_to_direct (th, p_s_inode, page, p_s_path, p_s_item_key,
                                                    n_new_file_size, &c_mode);
@@ -1724,10 +1642,7 @@ int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th,
 
     /* go ahead and perform balancing */
     
-#ifdef CONFIG_REISERFS_CHECK
-    if ( c_mode == M_PASTE || c_mode == M_INSERT )
-       reiserfs_panic (p_s_sb, "PAP-5640: reiserfs_cut_from_item: illegal mode");
-#endif
+    RFALSE( c_mode == M_PASTE || c_mode == M_INSERT, "illegal mode");
 
     /* Calculate number of bytes that need to be cut from the item. */
     if (retval2 == -1)
@@ -1880,13 +1795,9 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
            return;
        }
 
-#ifdef CONFIG_REISERFS_CHECK
-       if ( n_deleted > n_file_size ){
-           reiserfs_panic (p_s_inode->i_sb, "PAP-5670: reiserfs_truncate_file: "
-                           "reiserfs_truncate_file returns too big number: deleted %d, file_size %lu, item_key %k",
-                           n_deleted, n_file_size, &s_item_key);
-       }
-#endif
+       RFALSE( n_deleted > n_file_size,
+               "PAP-5670: reiserfs_truncate_file returns too big number: deleted %d, file_size %lu, item_key %k",
+               n_deleted, n_file_size, &s_item_key);
 
        /* Change key to search the last file item. */
        n_file_size -= n_deleted;
@@ -1918,12 +1829,9 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
     } while ( n_file_size > ROUND_UP (n_new_file_size) &&
              search_for_position_by_key(p_s_inode->i_sb, &s_item_key, &s_search_path) == POSITION_FOUND )  ;
 
-#ifdef CONFIG_REISERFS_CHECK
-    if ( n_file_size > ROUND_UP (n_new_file_size) )
-       reiserfs_panic (p_s_inode->i_sb, "PAP-5680: reiserfs_truncate_file: "
-                       "truncate did not finish: new_file_size %Ld, current %Ld, oid %d\n",
-                       n_new_file_size, n_file_size, s_item_key.on_disk_key.k_objectid);
-#endif
+    RFALSE( n_file_size > ROUND_UP (n_new_file_size),
+           "PAP-5680: truncate did not finish: new_file_size %Ld, current %Ld, oid %d\n",
+           n_new_file_size, n_file_size, s_item_key.on_disk_key.k_objectid);
 
     if (update_timestamps) {
        // this is truncate, not file closing
index bfcf09e808379e4ba74f8ddf5dc86d2d87c9658a..28681544b534fbc83a9b1b5d4d714b3e281061c6 100644 (file)
@@ -92,12 +92,9 @@ int direct2indirect (struct reiserfs_transaction_handle *th, struct inode * inod
            reiserfs_panic (sb, "PAP-14050: direct2indirect: "
                            "direct item (%k) not found", &end_key);
        p_le_ih = PATH_PITEM_HEAD (path);
-#ifdef CONFIG_REISERFS_CHECK
-       if (!is_direct_le_ih (p_le_ih))
-           reiserfs_panic (sb, "vs-14055: direct2indirect: "
-                           "direct item expected(%k), found %h", 
-                               &end_key, p_le_ih);
-#endif
+       RFALSE( !is_direct_le_ih (p_le_ih),
+               "vs-14055: direct item expected(%k), found %h", 
+               &end_key, p_le_ih);
        tail_size = (le_ih_k_offset (p_le_ih) & (n_blk_size - 1))
            + ih_item_len(p_le_ih) - 1;
 
index 27ec4c40a70b59b89b4c04a998f44f9f388c0645..36b992c1924959219fedd995e3f252c8ffb29f8f 100644 (file)
@@ -548,17 +548,17 @@ smb_errno(struct smb_sb_info *server)
                        return -EDEADLK;
                case ERRfilexists:
                        return -EEXIST;
-               case ERRinvalidparam:
+               case ERROR_INVALID_PARAMETER:
                        return -EINVAL;
-               case ERRdiskfull:
+               case ERROR_DISK_FULL:
                        return -ENOSPC;
-               case ERRinvalidname:
+               case ERROR_INVALID_NAME:
                        return -ENOENT;
-               case ERRdirnotempty:
+               case ERROR_DIR_NOT_EMPTY:
                        return -ENOTEMPTY;
-               case ERRnotlocked:
+               case ERROR_NOT_LOCKED:
                        return -ENOLCK;
-               case ERRexists:
+               case ERROR_ALREADY_EXISTS:
                        return -EEXIST;
                default:
                        class = "ERRDOS";
@@ -603,6 +603,8 @@ smb_errno(struct smb_sb_info *server)
                        return -ETXTBSY;
                case ERRlock:
                        return -EDEADLK;
+               case ERRdiskfull:
+                       return -ENOSPC;
                default:
                        class = "ERRHRD";
                        goto err_unknown;
index c00c224fb55c7bd306cb6f98abb3067dd65e8f53..86b07d5467596848d34a5962a7312a5a0583d0aa 100644 (file)
 
 #include <asm/system.h>
 
+/* We use generic_ffs so get it; include guards resolve the possible
+   mutually inclusion.  */
+#include <linux/bitops.h>
+
 /*
  * Some hacks to defeat gcc over-optimizations..
  */
@@ -214,34 +218,63 @@ static __inline__ int test_bit(int nr, const void *addr)
  * Find-bit routines..
  */
 
+/*
+ * Helper functions for the core of the ff[sz] functions, wrapping the
+ * syntactically awkward asms.  The asms compute the number of leading
+ * zeroes of a bits-in-byte and byte-in-word and word-in-dword-swapped
+ * number.  They differ in that the first function also inverts all bits
+ * in the input.
+ */
+static __inline__ unsigned long cris_swapnwbrlz(unsigned long w)
+{
+       /* Let's just say we return the result in the same register as the
+          input.  Saying we clobber the input but can return the result
+          in another register:
+          !  __asm__ ("swapnwbr %2\n\tlz %2,%0"
+          !          : "=r,r" (res), "=r,X" (dummy) : "1,0" (w));
+          confuses gcc (sched.c, gcc from cris-dist-1.14).  */
+
+       unsigned long res;
+       __asm__ ("swapnwbr %0 \n\t"
+                "lz %0,%0"
+                : "=r" (res) : "0" (w));
+       return res;
+}
+
+static __inline__ unsigned long cris_swapwbrlz(unsigned long w)
+{
+       unsigned res;
+       __asm__ ("swapwbr %0 \n\t"
+                "lz %0,%0"
+                : "=r" (res)
+                : "0" (w));
+       return res;
+}
+
 /*
  * ffz = Find First Zero in word. Undefined if no zero exists,
  * so code should check against ~0UL first..
  */
-static __inline__ unsigned long ffz(unsigned long word)
+static __inline__ unsigned long ffz(unsigned long w)
 {
-       unsigned long result = 0;
-       
-       while(word & 1) {
-               result++;
-               word >>= 1;
-       }
-       return result;
+       /* The generic_ffs function is used to avoid the asm when the
+          argument is a constant.  */
+       return __builtin_constant_p (w)
+               ? (~w ? (unsigned long) generic_ffs ((int) ~w) - 1 : 32)
+               : cris_swapnwbrlz (w);
 }
 
 /*
- * Find first one in word. Undefined if no one exists,
- * so code should check against 0UL first..
+ * Somewhat like ffz but the equivalent of generic_ffs: in contrast to
+ * ffz we return the first one-bit *plus one*.
  */
-static __inline__ unsigned long find_first_one(unsigned long word)
+static __inline__ unsigned long ffs(unsigned long w)
 {
-       unsigned long result = 0;
-       
-       while(!(word & 1)) {
-               result++;
-               word >>= 1;
-       }
-       return result;
+       /* The generic_ffs function is used to avoid the asm when the
+          argument is a constant.  */
+       return __builtin_constant_p (w)
+               ? (unsigned long) generic_ffs ((int) w)
+               : w ? cris_swapwbrlz (w) + 1 : 0;
 }
 
 /**
index 4ed0f832b19db0100a38efea23e5f5775c93e6d7..589eb323eba3d245ac6e5f725b7e84c805b29b53 100644 (file)
@@ -1,4 +1,3 @@
-/* $Id: checksum.h,v 1.4 2001/06/28 03:58:36 hp Exp $ */
 /* TODO: csum_tcpudp_magic could be speeded up, and csum_fold as well */
 
 #ifndef _CRIS_CHECKSUM_H
index 6b00b86b6a9d690a5e81da264e1575fe46cdd0a8..c5cc44d537d61d72be085ecfa076c3a639c72da4 100644 (file)
@@ -6,7 +6,7 @@ struct task_struct;
 static inline struct task_struct * get_current(void)
 {
         struct task_struct *current;
-        __asm__("and.d sp,%0; ":"=r" (current) : "0" (~8191UL));
+        __asm__("and.d $sp,%0; ":"=r" (current) : "0" (~8191UL));
         return current;
  }
  
index a9a848dd3b079d7fa93e8fad895654527bdef66f..632c369c41b98869d90cf78cb8a8e926f049efa3 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id: delay.h,v 1.5 2001/06/28 04:59:25 hp Exp $ */
-
 #ifndef _CRIS_DELAY_H
 #define _CRIS_DELAY_H
 
@@ -21,12 +19,12 @@ extern void __do_delay(void);       /* Special register call calling convention */
 extern __inline__ void __delay(int loops)
 {
        __asm__ __volatile__ (
-                             "move.d %0,r9\n\t"
+                             "move.d %0,$r9\n\t"
                              "beq 2f\n\t"
-                             "subq 1,r9\n\t"
+                             "subq 1,$r9\n\t"
                              "1:\n\t"
                              "bne 1b\n\t"
-                             "subq 1,r9\n"
+                             "subq 1,$r9\n"
                              "2:"
                              : : "g" (loops) : "r9");
 }
index 01c8b1dad1d94265eb37c87c412e1ed47b38cf26..607b6291b3663f4d547b349cc2a799c4ffc31078 100644 (file)
 #ifdef CONFIG_SVINTO_SIM
   /* Let's use the ucsim interface since it lets us do write(2, ...) */
 #define SIMCOUT(s,len)                                                 \
-  asm ("moveq 4,r1     \n\t"                                           \
-       "moveq 2,r10    \n\t"                                           \
-       "move.d %0,r11  \n\t"                                           \
-       "move.d %1,r12  \n\t"                                           \
-       "push irp       \n\t"                                           \
-       "move 0f,irp    \n\t"                                           \
+  asm ("moveq 4,$r9    \n\t"                                           \
+       "moveq 2,$r10   \n\t"                                           \
+       "move.d %0,$r11 \n\t"                                           \
+       "move.d %1,$r12 \n\t"                                           \
+       "push $irp      \n\t"                                           \
+       "move 0f,$irp   \n\t"                                           \
        "jump -6809     \n"                                             \
        "0:             \n\t"                                           \
-       "pop irp"                                                       \
-       : : "rm" (s), "rm" (len) : "r1","r10","r11","r12","memory")
+       "pop $irp"                                                      \
+       : : "rm" (s), "rm" (len) : "r9","r10","r11","r12","memory")
 #define TRACE_ON() __extension__ \
  ({ int _Foofoo; __asm__ volatile ("bmod [%0],%0" : "=r" (_Foofoo) : "0" \
                               (255)); _Foofoo; })
index b7eb9c363795b8fc1e524e355793a6de73399825..b1b5ada6ff5a2a2b2b5c89cf67a578e960f6ffc7 100644 (file)
@@ -3,9 +3,6 @@
  *
  * Copyright (c) 2000, 2001 Axis Communications AB
  *
- * Authors:   Bjorn Wesen (bjornw@axis.com)
- *
- * $Id: irq.h,v 1.13 2001/07/06 18:52:08 hp Exp $
  */
 
 #ifndef _ASM_IRQ_H
@@ -101,25 +98,25 @@ void set_break_vector(int n, irqvectptr addr);
 /* SAVE_ALL saves registers so they match pt_regs */
 
 #define SAVE_ALL \
-  "move irp,[sp=sp-16]\n\t" /* push instruction pointer and fake SBFS struct */ \
-  "push srp\n\t"       /* push subroutine return pointer */ \
-  "push dccr\n\t"      /* push condition codes */ \
-  "push mof\n\t"       /* push multiply overflow reg */ \
+  "move $irp,[$sp=$sp-16]\n\t" /* push instruction pointer and fake SBFS struct */ \
+  "push $srp\n\t"       /* push subroutine return pointer */ \
+  "push $dccr\n\t"      /* push condition codes */ \
+  "push $mof\n\t"       /* push multiply overflow reg */ \
   "di\n\t"             /* need to disable irq's at this point */\
-  "subq 14*4,sp\n\t"   /* make room for r0-r13 */ \
-  "movem r13,[sp]\n\t" /* push the r0-r13 registers */ \
-  "push r10\n\t"       /* push orig_r10 */ \
-  "clear.d [sp=sp-4]\n\t"  /* frametype - this is a normal stackframe */
+  "subq 14*4,$sp\n\t"   /* make room for r0-r13 */ \
+  "movem $r13,[$sp]\n\t" /* push the r0-r13 registers */ \
+  "push $r10\n\t"       /* push orig_r10 */ \
+  "clear.d [$sp=$sp-4]\n\t"  /* frametype - this is a normal stackframe */
 
   /* BLOCK_IRQ and UNBLOCK_IRQ do the same as mask_irq and unmask_irq in irq.c */
 
 #define BLOCK_IRQ(mask,nr) \
-  "move.d " #mask ",r0\n\t" \
-  "move.d r0,[0xb00000d8]\n\t" 
+  "move.d " #mask ",$r0\n\t" \
+  "move.d $r0,[0xb00000d8]\n\t" 
   
 #define UNBLOCK_IRQ(mask) \
-  "move.d " #mask ",r0\n\t" \
-  "move.d r0,[0xb00000dc]\n\t" 
+  "move.d " #mask ",$r0\n\t" \
+  "move.d $r0,[0xb00000dc]\n\t" 
 
 #define IRQ_NAME2(nr) nr##_interrupt(void)
 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
@@ -137,20 +134,20 @@ void sIRQ_NAME(nr); \
 void BAD_IRQ_NAME(nr); \
 __asm__ ( \
           ".text\n\t" \
-          "_IRQ" #nr "_interrupt:\n\t" \
+          "IRQ" #nr "_interrupt:\n\t" \
          SAVE_ALL \
-         "_sIRQ" #nr "_interrupt:\n\t" /* shortcut for the multiple irq handler */ \
+         "sIRQ" #nr "_interrupt:\n\t" /* shortcut for the multiple irq handler */ \
          BLOCK_IRQ(mask,nr) /* this must be done to prevent irq loops when we ei later */ \
-         "moveq "#nr",r10\n\t" \
-         "move.d sp,r11\n\t" \
-         "jsr _do_IRQ\n\t" /* irq.c, r10 and r11 are arguments */ \
+         "moveq "#nr",$r10\n\t" \
+         "move.d $sp,$r11\n\t" \
+         "jsr do_IRQ\n\t" /* irq.c, r10 and r11 are arguments */ \
          UNBLOCK_IRQ(mask) \
-         "moveq 0,r9\n\t" /* make ret_from_intr realise we came from an irq */ \
-         "jump _ret_from_intr\n\t" \
-          "_bad_IRQ" #nr "_interrupt:\n\t" \
-         "push r0\n\t" \
+         "moveq 0,$r9\n\t" /* make ret_from_intr realise we came from an irq */ \
+         "jump ret_from_intr\n\t" \
+          "bad_IRQ" #nr "_interrupt:\n\t" \
+         "push $r0\n\t" \
          BLOCK_IRQ(mask,nr) \
-         "pop r0\n\t" \
+         "pop $r0\n\t" \
           "reti\n\t" \
           "nop\n");
 
index 0fe7e7e77fb67efbe1eb72c6c8aa496c1e92f514..5853a11d61631b46de3bb87f884d800f74c703ac 100644 (file)
@@ -7,6 +7,6 @@
 #define module_map(x)          vmalloc(x)
 #define module_unmap(x)                vfree(x)
 #define module_arch_init(x)    (0)
-#define arch_init_modules(x)   do { } while (0)
+#define arch_init_modules(x)    do { } while (0)
 
 #endif /* _ASM_CRIS_MODULE_H */
index 38cb45a278d938adf77099f71172b2b9c7a21196..afe60fc7d9e5998952497eebc59edff8c29d1aa2 100644 (file)
@@ -3,6 +3,9 @@
  * HISTORY:
  *
  * $Log: pgtable.h,v $
+ * Revision 1.12  2001/08/11 00:28:00  bjornw
+ * PAGE_CHG_MASK and PAGE_NONE had somewhat untraditional values
+ *
  * Revision 1.11  2001/04/04 14:38:36  bjornw
  * Removed bad_pagetable handling and the _kernel functions
  *
@@ -215,9 +218,9 @@ static inline void flush_tlb(void)
 #define __WRITEABLE     (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
 
 #define _PAGE_TABLE     (_PAGE_PRESENT | __READABLE | __WRITEABLE)
-#define _PAGE_CHG_MASK  (PAGE_MASK | _PAGE_ACCESSED | _PAGE_SILENT_WRITE)
+#define _PAGE_CHG_MASK  (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED)
 
-#define PAGE_NONE       __pgprot(_PAGE_PRESENT | __READABLE)
+#define PAGE_NONE       __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
 #define PAGE_SHARED     __pgprot(_PAGE_PRESENT | __READABLE | _PAGE_WRITE | \
                                 _PAGE_ACCESSED)
 #define PAGE_COPY       __pgprot(_PAGE_PRESENT | __READABLE)  // | _PAGE_COW
index dec7e2cefc7d7e40c3c6dd28add86baee4887c9b..a9b11b89eced3ef75262b03114f6977cd32e80fa 100644 (file)
 
 #include <linux/config.h>
 #include <asm/system.h>
+#include <asm/page.h>
 #include <asm/ptrace.h>
 
 /*
  * Default implementation of macro that returns current
  * instruction pointer ("program counter").
  */
-#define current_text_addr() ({void *pc; __asm__ ("move.d pc,%0" : "=rm" (pc)); pc; })
+#define current_text_addr() ({void *pc; __asm__ ("move.d $pc,%0" : "=rm" (pc)); pc; })
 
 /* CRIS has no problems with write protection */
 
index 8c5b38977603258ad682dd3beb7f758958d1ecf6..95c6c4198da58df5f96aa3a02308bd3c4d0fa98c 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id: system.h,v 1.4 2001/03/20 19:46:00 bjornw Exp $ */
-
 #ifndef __ASM_CRIS_SYSTEM_H
 #define __ASM_CRIS_SYSTEM_H
 
@@ -16,22 +14,30 @@ extern struct task_struct *resume(struct task_struct *prev, struct task_struct *
 #define switch_to(prev,next,last) last = resume(prev,next, \
                                         (int)&((struct task_struct *)0)->thread)
 
+/* read the CPU version register */
+
+static inline unsigned long rdvr(void) { 
+       unsigned long vr;
+       __asm__ volatile ("move $vr,%0" : "=rm" (vr));
+       return vr;
+}
+
 /* read/write the user-mode stackpointer */
 
-extern inline unsigned long rdusp(void) {
+static inline unsigned long rdusp(void) {
        unsigned long usp;
-       __asm__ __volatile__("move usp,%0" : "=rm" (usp));
+       __asm__ __volatile__("move $usp,%0" : "=rm" (usp));
        return usp;
 }
 
 #define wrusp(usp) \
-       __asm__ __volatile__("move %0,usp" : /* no outputs */ : "rm" (usp))
+       __asm__ __volatile__("move %0,$usp" : /* no outputs */ : "rm" (usp))
 
 /* read the current stackpointer */
 
-extern inline unsigned long rdsp(void) {
+static inline unsigned long rdsp(void) {
        unsigned long sp;
-       __asm__ __volatile__("move.d sp,%0" : "=rm" (sp));
+       __asm__ __volatile__("move.d $sp,%0" : "=rm" (sp));
        return sp;
 }
 
@@ -51,18 +57,18 @@ struct __xchg_dummy { unsigned long a[100]; };
 #if 0
 /* use these and an oscilloscope to see the fraction of time we're running with IRQ's disabled */
 /* it assumes the LED's are on port 0x90000000 of course. */
-#define sti() __asm__ __volatile__ ( "ei\n\tpush r0\n\tmoveq 0,r0\n\tmove.d r0,[0x90000000]\n\tpop r0" );
-#define cli() __asm__ __volatile__ ( "di\n\tpush r0\n\tmove.d 0x40000,r0\n\tmove.d r0,[0x90000000]\n\tpop r0");
-#define save_flags(x) __asm__ __volatile__ ("move ccr,%0" : "=rm" (x) : : "memory");
-#define restore_flags(x) __asm__ __volatile__ ("move %0,ccr\n\tbtstq 5,%0\n\tbpl 1f\n\tnop\n\tpush r0\n\tmoveq 0,r0\n\tmove.d r0,[0x90000000]\n\tpop r0\n1:\n" : : "r" (x) : "memory");
+#define sti() __asm__ __volatile__ ( "ei\n\tpush $r0\n\tmoveq 0,$r0\n\tmove.d $r0,[0x90000000]\n\tpop $r0" );
+#define cli() __asm__ __volatile__ ( "di\n\tpush $r0\n\tmove.d 0x40000,$r0\n\tmove.d $r0,[0x90000000]\n\tpop $r0");
+#define save_flags(x) __asm__ __volatile__ ("move $ccr,%0" : "=rm" (x) : : "memory");
+#define restore_flags(x) __asm__ __volatile__ ("move %0,$ccr\n\tbtstq 5,%0\n\tbpl 1f\n\tnop\n\tpush $r0\n\tmoveq 0,$r0\n\tmove.d $r0,[0x90000000]\n\tpop $r0\n1:\n" : : "r" (x) : "memory");
 #else
 #define __cli() __asm__ __volatile__ ( "di");
 #define __sti() __asm__ __volatile__ ( "ei" );
-#define __save_flags(x) __asm__ __volatile__ ("move ccr,%0" : "=rm" (x) : : "memory");
-#define __restore_flags(x) __asm__ __volatile__ ("move %0,ccr" : : "rm" (x) : "memory");
+#define __save_flags(x) __asm__ __volatile__ ("move $ccr,%0" : "=rm" (x) : : "memory");
+#define __restore_flags(x) __asm__ __volatile__ ("move %0,$ccr" : : "rm" (x) : "memory");
 
 /* For spinlocks etc */
-#define local_irq_save(x) __asm__ __volatile__ ("move ccr,%0\n\tdi" : "=rm" (x) : : "memory"); 
+#define local_irq_save(x) __asm__ __volatile__ ("move $ccr,%0\n\tdi" : "=rm" (x) : : "memory"); 
 #define local_irq_restore(x) restore_flags(x)
 
 #define local_irq_disable()  cli()
diff --git a/include/asm-cris/tlb.h b/include/asm-cris/tlb.h
new file mode 100644 (file)
index 0000000..69c0faa
--- /dev/null
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
index d506983b11f7b2fb5d18ddade3a3ba5249495857..8cc79775254c35c04719ae4b84cd72ab97cd95cd 100644 (file)
@@ -3,6 +3,12 @@
  *            Hans-Peter Nilsson (hp@axis.com)
  *
  * $Log: uaccess.h,v $
+ * Revision 1.7  2001/10/02 12:44:52  hp
+ * Add support for 64-bit put_user/get_user
+ *
+ * Revision 1.6  2001/10/01 14:51:17  bjornw
+ * Added register prefixes and removed underscores
+ *
  * Revision 1.5  2000/10/25 03:33:21  hp
  * - Provide implementation for everything else but get_user and put_user;
  *   copying inline to/from user for constant length 0..16, 20, 24, and
@@ -36,7 +42,7 @@
 
    Check regularly...
 
-   Register r9 is chosen for temporaries, being a call-clobbered register
+   Register $r9 is chosen for temporaries, being a call-clobbered register
    first in line to be used (notably for local blocks), not colliding with
    parameter registers.  */
 
@@ -182,6 +188,7 @@ do {                                                                \
          case 1: __put_user_asm(x,ptr,retval,"move.b"); break; \
          case 2: __put_user_asm(x,ptr,retval,"move.w"); break; \
          case 4: __put_user_asm(x,ptr,retval,"move.d"); break; \
+         case 8: __put_user_asm_64(x,ptr,retval); break;       \
          default: __put_user_bad();                            \
        }                                                       \
 } while (0)
@@ -211,6 +218,22 @@ struct __large_struct { unsigned long buf[100]; };
                : "=r" (err)                                    \
                : "r" (x), "r" (addr), "g" (-EFAULT), "0" (err))
 
+#define __put_user_asm_64(x, addr, err)                                \
+       __asm__ __volatile__(                                   \
+               "       move.d %M1,[%2]\n"                      \
+               "2:     move.d %H1,[%2+4]\n"                    \
+               "4:\n"                                          \
+               "       .section .fixup,\"ax\"\n"               \
+               "3:     move.d %3,%0\n"                         \
+               "       jump 4b\n"                              \
+               "       .previous\n"                            \
+               "       .section __ex_table,\"a\"\n"            \
+               "       .dword 2b,3b\n"                         \
+               "       .dword 4b,3b\n"                         \
+               "       .previous\n"                            \
+               : "=r" (err)                                    \
+               : "r" (x), "r" (addr), "g" (-EFAULT), "0" (err))
+
 
 #define __get_user_nocheck(x,ptr,size)                         \
 ({                                                             \
@@ -239,6 +262,7 @@ do {                                                                \
          case 1: __get_user_asm(x,ptr,retval,"move.b"); break; \
          case 2: __get_user_asm(x,ptr,retval,"move.w"); break; \
          case 4: __get_user_asm(x,ptr,retval,"move.d"); break; \
+         case 8: __get_user_asm_64(x,ptr,retval); break;       \
          default: (x) = __get_user_bad();                      \
        }                                                       \
 } while (0)
@@ -260,6 +284,23 @@ do {                                                               \
                : "=r" (err), "=r" (x)                  \
                : "r" (addr), "g" (-EFAULT), "0" (err))
 
+#define __get_user_asm_64(x, addr, err)                        \
+       __asm__ __volatile__(                           \
+               "       move.d [%2],%M1\n"              \
+               "2:     move.d [%2+4],%H1\n"            \
+               "4:\n"                                  \
+               "       .section .fixup,\"ax\"\n"       \
+               "3:     move.d %3,%0\n"                 \
+               "       moveq 0,%1\n"                   \
+               "       jump 4b\n"                      \
+               "       .previous\n"                    \
+               "       .section __ex_table,\"a\"\n"    \
+               "       .dword 2b,3b\n"                 \
+               "       .dword 4b,3b\n"                 \
+               "       .previous\n"                    \
+               : "=r" (err), "=r" (x)                  \
+               : "r" (addr), "g" (-EFAULT), "0" (err))
+
 /* More complex functions.  Most are inline, but some call functions that
    live in lib/usercopy.c  */
 
@@ -305,13 +346,13 @@ __do_strncpy_from_user(char *dst, const char *src, long count)
 
        __asm__ __volatile__ (
                "       move.d %3,%0\n"
-               "       move.b [%2+],r9\n"
+               "       move.b [%2+],$r9\n"
                "1:     beq 2f\n"
-               "       move.b r9,[%1+]\n"
+               "       move.b $r9,[%1+]\n"
 
                "       subq 1,%0\n"
                "       bne 1b\n"
-               "       move.b [%2+],r9\n"
+               "       move.b [%2+],$r9\n"
 
                "2:     sub.d %3,%0\n"
                "       neg.d %0,%0\n"
@@ -399,16 +440,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_1(to, from, ret) \
        __asm_copy_user_cont(to, from, ret,     \
-               "       move.b [%1+],r9\n"      \
-               "2:     move.b r9,[%0+]\n",     \
+               "       move.b [%1+],$r9\n"     \
+               "2:     move.b $r9,[%0+]\n",    \
                "3:     addq 1,%2\n"            \
                "       clear.b [%0+]\n",       \
                "       .dword 2b,3b\n")
 
 #define __asm_copy_from_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_user_cont(to, from, ret,             \
-               "       move.w [%1+],r9\n"              \
-               "2:     move.w r9,[%0+]\n" COPY,        \
+               "       move.w [%1+],$r9\n"             \
+               "2:     move.w $r9,[%0+]\n" COPY,       \
                "3:     addq 2,%2\n"                    \
                "       clear.w [%0+]\n" FIXUP,         \
                "       .dword 2b,3b\n" TENTRY)
@@ -418,16 +459,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_3(to, from, ret)          \
        __asm_copy_from_user_2x_cont(to, from, ret,     \
-               "       move.b [%1+],r9\n"              \
-               "4:     move.b r9,[%0+]\n",             \
+               "       move.b [%1+],$r9\n"             \
+               "4:     move.b $r9,[%0+]\n",            \
                "5:     addq 1,%2\n"                    \
                "       clear.b [%0+]\n",               \
                "       .dword 4b,5b\n")
 
 #define __asm_copy_from_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_user_cont(to, from, ret,             \
-               "       move.d [%1+],r9\n"              \
-               "2:     move.d r9,[%0+]\n" COPY,        \
+               "       move.d [%1+],$r9\n"             \
+               "2:     move.d $r9,[%0+]\n" COPY,       \
                "3:     addq 4,%2\n"                    \
                "       clear.d [%0+]\n" FIXUP,         \
                "       .dword 2b,3b\n" TENTRY)
@@ -437,16 +478,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_5(to, from, ret) \
        __asm_copy_from_user_4x_cont(to, from, ret,     \
-               "       move.b [%1+],r9\n"              \
-               "4:     move.b r9,[%0+]\n",             \
+               "       move.b [%1+],$r9\n"             \
+               "4:     move.b $r9,[%0+]\n",            \
                "5:     addq 1,%2\n"                    \
                "       clear.b [%0+]\n",               \
                "       .dword 4b,5b\n")
 
 #define __asm_copy_from_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_4x_cont(to, from, ret,     \
-               "       move.w [%1+],r9\n"              \
-               "4:     move.w r9,[%0+]\n" COPY,        \
+               "       move.w [%1+],$r9\n"             \
+               "4:     move.w $r9,[%0+]\n" COPY,       \
                "5:     addq 2,%2\n"                    \
                "       clear.w [%0+]\n" FIXUP,         \
                "       .dword 4b,5b\n" TENTRY)
@@ -456,16 +497,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_7(to, from, ret) \
        __asm_copy_from_user_6x_cont(to, from, ret,     \
-               "       move.b [%1+],r9\n"              \
-               "6:     move.b r9,[%0+]\n",             \
+               "       move.b [%1+],$r9\n"             \
+               "6:     move.b $r9,[%0+]\n",            \
                "7:     addq 1,%2\n"                    \
                "       clear.b [%0+]\n",               \
                "       .dword 6b,7b\n")
 
 #define __asm_copy_from_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_4x_cont(to, from, ret,     \
-               "       move.d [%1+],r9\n"              \
-               "4:     move.d r9,[%0+]\n" COPY,        \
+               "       move.d [%1+],$r9\n"             \
+               "4:     move.d $r9,[%0+]\n" COPY,       \
                "5:     addq 4,%2\n"                    \
                "       clear.d [%0+]\n" FIXUP,         \
                "       .dword 4b,5b\n" TENTRY)
@@ -475,16 +516,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_9(to, from, ret) \
        __asm_copy_from_user_8x_cont(to, from, ret,     \
-               "       move.b [%1+],r9\n"              \
-               "6:     move.b r9,[%0+]\n",             \
+               "       move.b [%1+],$r9\n"             \
+               "6:     move.b $r9,[%0+]\n",            \
                "7:     addq 1,%2\n"                    \
                "       clear.b [%0+]\n",               \
                "       .dword 6b,7b\n")
 
 #define __asm_copy_from_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_8x_cont(to, from, ret,     \
-               "       move.w [%1+],r9\n"              \
-               "6:     move.w r9,[%0+]\n" COPY,        \
+               "       move.w [%1+],$r9\n"             \
+               "6:     move.w $r9,[%0+]\n" COPY,       \
                "7:     addq 2,%2\n"                    \
                "       clear.w [%0+]\n" FIXUP,         \
                "       .dword 6b,7b\n" TENTRY)
@@ -494,16 +535,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_11(to, from, ret)         \
        __asm_copy_from_user_10x_cont(to, from, ret,    \
-               "       move.b [%1+],r9\n"              \
-               "8:     move.b r9,[%0+]\n",             \
+               "       move.b [%1+],$r9\n"             \
+               "8:     move.b $r9,[%0+]\n",            \
                "9:     addq 1,%2\n"                    \
                "       clear.b [%0+]\n",               \
                "       .dword 8b,9b\n")
 
 #define __asm_copy_from_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_8x_cont(to, from, ret,     \
-               "       move.d [%1+],r9\n"              \
-               "6:     move.d r9,[%0+]\n" COPY,        \
+               "       move.d [%1+],$r9\n"             \
+               "6:     move.d $r9,[%0+]\n" COPY,       \
                "7:     addq 4,%2\n"                    \
                "       clear.d [%0+]\n" FIXUP,         \
                "       .dword 6b,7b\n" TENTRY)
@@ -513,16 +554,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_13(to, from, ret) \
        __asm_copy_from_user_12x_cont(to, from, ret,    \
-               "       move.b [%1+],r9\n"              \
-               "8:     move.b r9,[%0+]\n",             \
+               "       move.b [%1+],$r9\n"             \
+               "8:     move.b $r9,[%0+]\n",            \
                "9:     addq 1,%2\n"                    \
                "       clear.b [%0+]\n",               \
                "       .dword 8b,9b\n")
 
 #define __asm_copy_from_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_12x_cont(to, from, ret,    \
-               "       move.w [%1+],r9\n"              \
-               "8:     move.w r9,[%0+]\n" COPY,        \
+               "       move.w [%1+],$r9\n"             \
+               "8:     move.w $r9,[%0+]\n" COPY,       \
                "9:     addq 2,%2\n"                    \
                "       clear.w [%0+]\n" FIXUP,         \
                "       .dword 8b,9b\n" TENTRY)
@@ -532,16 +573,16 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_15(to, from, ret) \
        __asm_copy_from_user_14x_cont(to, from, ret,    \
-               "       move.b [%1+],r9\n"              \
-               "10:    move.b r9,[%0+]\n",             \
+               "       move.b [%1+],$r9\n"             \
+               "10:    move.b $r9,[%0+]\n",            \
                "11:    addq 1,%2\n"                    \
                "       clear.b [%0+]\n",               \
                "       .dword 10b,11b\n")
 
 #define __asm_copy_from_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_12x_cont(to, from, ret,    \
-               "       move.d [%1+],r9\n"              \
-               "8:     move.d r9,[%0+]\n" COPY,        \
+               "       move.d [%1+],$r9\n"             \
+               "8:     move.d $r9,[%0+]\n" COPY,       \
                "9:     addq 4,%2\n"                    \
                "       clear.d [%0+]\n" FIXUP,         \
                "       .dword 8b,9b\n" TENTRY)
@@ -551,8 +592,8 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_20x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_16x_cont(to, from, ret,    \
-               "       move.d [%1+],r9\n"              \
-               "10:    move.d r9,[%0+]\n" COPY,        \
+               "       move.d [%1+],$r9\n"             \
+               "10:    move.d $r9,[%0+]\n" COPY,       \
                "11:    addq 4,%2\n"                    \
                "       clear.d [%0+]\n" FIXUP,         \
                "       .dword 10b,11b\n" TENTRY)
@@ -562,8 +603,8 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_from_user_24x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_from_user_20x_cont(to, from, ret,    \
-               "       move.d [%1+],r9\n"              \
-               "12:    move.d r9,[%0+]\n" COPY,        \
+               "       move.d [%1+],$r9\n"             \
+               "12:    move.d $r9,[%0+]\n" COPY,       \
                "13:    addq 4,%2\n"                    \
                "       clear.d [%0+]\n" FIXUP,         \
                "       .dword 12b,13b\n" TENTRY)
@@ -575,15 +616,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_1(to, from, ret)    \
        __asm_copy_user_cont(to, from, ret,     \
-               "       move.b [%1+],r9\n"      \
-               "       move.b r9,[%0+]\n2:\n", \
+               "       move.b [%1+],$r9\n"     \
+               "       move.b $r9,[%0+]\n2:\n",        \
                "3:     addq 1,%2\n",           \
                "       .dword 2b,3b\n")
 
 #define __asm_copy_to_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_user_cont(to, from, ret,             \
-               "       move.w [%1+],r9\n"              \
-               "       move.w r9,[%0+]\n2:\n" COPY,    \
+               "       move.w [%1+],$r9\n"             \
+               "       move.w $r9,[%0+]\n2:\n" COPY,   \
                "3:     addq 2,%2\n" FIXUP,             \
                "       .dword 2b,3b\n" TENTRY)
 
@@ -592,15 +633,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_3(to, from, ret) \
        __asm_copy_to_user_2x_cont(to, from, ret,       \
-               "       move.b [%1+],r9\n"              \
-               "       move.b r9,[%0+]\n4:\n",         \
+               "       move.b [%1+],$r9\n"             \
+               "       move.b $r9,[%0+]\n4:\n",                \
                "5:     addq 1,%2\n",                   \
                "       .dword 4b,5b\n")
 
 #define __asm_copy_to_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_user_cont(to, from, ret,             \
-               "       move.d [%1+],r9\n"              \
-               "       move.d r9,[%0+]\n2:\n" COPY,    \
+               "       move.d [%1+],$r9\n"             \
+               "       move.d $r9,[%0+]\n2:\n" COPY,   \
                "3:     addq 4,%2\n" FIXUP,             \
                "       .dword 2b,3b\n" TENTRY)
 
@@ -609,15 +650,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_5(to, from, ret) \
        __asm_copy_to_user_4x_cont(to, from, ret,       \
-               "       move.b [%1+],r9\n"              \
-               "       move.b r9,[%0+]\n4:\n",         \
+               "       move.b [%1+],$r9\n"             \
+               "       move.b $r9,[%0+]\n4:\n",                \
                "5:     addq 1,%2\n",                   \
                "       .dword 4b,5b\n")
 
 #define __asm_copy_to_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_to_user_4x_cont(to, from, ret,       \
-               "       move.w [%1+],r9\n"              \
-               "       move.w r9,[%0+]\n4:\n" COPY,    \
+               "       move.w [%1+],$r9\n"             \
+               "       move.w $r9,[%0+]\n4:\n" COPY,   \
                "5:     addq 2,%2\n" FIXUP,             \
                "       .dword 4b,5b\n" TENTRY)
 
@@ -626,15 +667,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_7(to, from, ret) \
        __asm_copy_to_user_6x_cont(to, from, ret,       \
-               "       move.b [%1+],r9\n"              \
-               "       move.b r9,[%0+]\n6:\n",         \
+               "       move.b [%1+],$r9\n"             \
+               "       move.b $r9,[%0+]\n6:\n",                \
                "7:     addq 1,%2\n",                   \
                "       .dword 6b,7b\n")
 
 #define __asm_copy_to_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_to_user_4x_cont(to, from, ret,       \
-               "       move.d [%1+],r9\n"              \
-               "       move.d r9,[%0+]\n4:\n" COPY,    \
+               "       move.d [%1+],$r9\n"             \
+               "       move.d $r9,[%0+]\n4:\n" COPY,   \
                "5:     addq 4,%2\n"  FIXUP,            \
                "       .dword 4b,5b\n" TENTRY)
 
@@ -643,15 +684,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_9(to, from, ret) \
        __asm_copy_to_user_8x_cont(to, from, ret,       \
-               "       move.b [%1+],r9\n"              \
-               "       move.b r9,[%0+]\n6:\n",         \
+               "       move.b [%1+],$r9\n"             \
+               "       move.b $r9,[%0+]\n6:\n",                \
                "7:     addq 1,%2\n",                   \
                "       .dword 6b,7b\n")
 
 #define __asm_copy_to_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_to_user_8x_cont(to, from, ret,       \
-               "       move.w [%1+],r9\n"              \
-               "       move.w r9,[%0+]\n6:\n" COPY,    \
+               "       move.w [%1+],$r9\n"             \
+               "       move.w $r9,[%0+]\n6:\n" COPY,   \
                "7:     addq 2,%2\n" FIXUP,             \
                "       .dword 6b,7b\n" TENTRY)
 
@@ -660,15 +701,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_11(to, from, ret) \
        __asm_copy_to_user_10x_cont(to, from, ret,      \
-               "       move.b [%1+],r9\n"              \
-               "       move.b r9,[%0+]\n8:\n",         \
+               "       move.b [%1+],$r9\n"             \
+               "       move.b $r9,[%0+]\n8:\n",                \
                "9:     addq 1,%2\n",                   \
                "       .dword 8b,9b\n")
 
 #define __asm_copy_to_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_to_user_8x_cont(to, from, ret,       \
-               "       move.d [%1+],r9\n"              \
-               "       move.d r9,[%0+]\n6:\n" COPY,    \
+               "       move.d [%1+],$r9\n"             \
+               "       move.d $r9,[%0+]\n6:\n" COPY,   \
                "7:     addq 4,%2\n" FIXUP,             \
                "       .dword 6b,7b\n" TENTRY)
 
@@ -677,15 +718,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_13(to, from, ret) \
        __asm_copy_to_user_12x_cont(to, from, ret,      \
-               "       move.b [%1+],r9\n"              \
-               "       move.b r9,[%0+]\n8:\n",         \
+               "       move.b [%1+],$r9\n"             \
+               "       move.b $r9,[%0+]\n8:\n",                \
                "9:     addq 1,%2\n",                   \
                "       .dword 8b,9b\n")
 
 #define __asm_copy_to_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_to_user_12x_cont(to, from, ret,      \
-               "       move.w [%1+],r9\n"              \
-               "       move.w r9,[%0+]\n8:\n" COPY,    \
+               "       move.w [%1+],$r9\n"             \
+               "       move.w $r9,[%0+]\n8:\n" COPY,   \
                "9:     addq 2,%2\n" FIXUP,             \
                "       .dword 8b,9b\n" TENTRY)
 
@@ -694,15 +735,15 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_15(to, from, ret) \
        __asm_copy_to_user_14x_cont(to, from, ret,      \
-               "       move.b [%1+],r9\n"              \
-               "       move.b r9,[%0+]\n10:\n",                \
+               "       move.b [%1+],$r9\n"             \
+               "       move.b $r9,[%0+]\n10:\n",               \
                "11:    addq 1,%2\n",                   \
                "       .dword 10b,11b\n")
 
 #define __asm_copy_to_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_to_user_12x_cont(to, from, ret,      \
-               "       move.d [%1+],r9\n"              \
-               "       move.d r9,[%0+]\n8:\n" COPY,    \
+               "       move.d [%1+],$r9\n"             \
+               "       move.d $r9,[%0+]\n8:\n" COPY,   \
                "9:     addq 4,%2\n" FIXUP,             \
                "       .dword 8b,9b\n" TENTRY)
 
@@ -711,8 +752,8 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_20x_cont(to, from, ret, COPY, FIXUP, TENTRY) \
        __asm_copy_to_user_16x_cont(to, from, ret,      \
-               "       move.d [%1+],r9\n"              \
-               "       move.d r9,[%0+]\n10:\n" COPY,   \
+               "       move.d [%1+],$r9\n"             \
+               "       move.d $r9,[%0+]\n10:\n" COPY,  \
                "11:    addq 4,%2\n" FIXUP,             \
                "       .dword 10b,11b\n" TENTRY)
 
@@ -721,8 +762,8 @@ strncpy_from_user(char *dst, const char *src, long count)
 
 #define __asm_copy_to_user_24x_cont(to, from, ret, COPY, FIXUP, TENTRY)        \
        __asm_copy_to_user_20x_cont(to, from, ret,      \
-               "       move.d [%1+],r9\n"              \
-               "       move.d r9,[%0+]\n12:\n" COPY,   \
+               "       move.d [%1+],$r9\n"             \
+               "       move.d $r9,[%0+]\n12:\n" COPY,  \
                "13:    addq 4,%2\n" FIXUP,             \
                "       .dword 12b,13b\n" TENTRY)
 
@@ -1034,17 +1075,17 @@ strnlen_user(const char *s, long n)
         */
 
        __asm__ __volatile__ (
-               "       move.d %1,r9\n"
+               "       move.d %1,$r9\n"
                "0:\n"
                "       ble 1f\n"
-               "       subq 1,r9\n"
+               "       subq 1,$r9\n"
 
                "       test.b [%0+]\n"
                "       bne 0b\n"
-               "       test.d r9\n"
+               "       test.d $r9\n"
                "1:\n"
                "       move.d %1,%0\n"
-               "       sub.d r9,%0\n"
+               "       sub.d $r9,%0\n"
                "2:\n"
                "       .section .fixup,\"ax\"\n"
 
index 77df81dec51397759e84cf7fb69d5cb44ac42bcc..ebd216dd490d5195415f7220704ba723e3113883 100644 (file)
 #define __NR_getdents64                220
 #define __NR_fcntl64           221
 #define __NR_security          223     /* syscall for security modules */
+#define __NR_gettid            224
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 
diff --git a/include/asm-ppc/commproc.h b/include/asm-ppc/commproc.h
new file mode 100644 (file)
index 0000000..46284e9
--- /dev/null
@@ -0,0 +1,796 @@
+/*
+ * BK Id: SCCS/s.commproc.h 1.16 09/27/01 12:41:09 trini
+ */
+
+/*
+ * MPC8xx Communication Processor Module.
+ * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
+ *
+ * This file contains structures and information for the communication
+ * processor channels.  Some CPM control and status is available
+ * throught the MPC8xx internal memory map.  See immap.h for details.
+ * This file only contains what I need for the moment, not the total
+ * CPM capabilities.  I (or someone else) will add definitions as they
+ * are needed.  -- Dan
+ *
+ * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
+ * bytes of the DP RAM and relocates the I2C parameter area to the
+ * IDMA1 space.  The remaining DP RAM is available for buffer descriptors
+ * or other use.
+ */
+#ifndef __CPM_8XX__
+#define __CPM_8XX__
+
+#include <linux/config.h>
+#include <asm/8xx_immap.h>
+
+/* CPM Command register.
+*/
+#define CPM_CR_RST     ((ushort)0x8000)
+#define CPM_CR_OPCODE  ((ushort)0x0f00)
+#define CPM_CR_CHAN    ((ushort)0x00f0)
+#define CPM_CR_FLG     ((ushort)0x0001)
+
+/* Some commands (there are more...later)
+*/
+#define CPM_CR_INIT_TRX                ((ushort)0x0000)
+#define CPM_CR_INIT_RX         ((ushort)0x0001)
+#define CPM_CR_INIT_TX         ((ushort)0x0002)
+#define CPM_CR_HUNT_MODE       ((ushort)0x0003)
+#define CPM_CR_STOP_TX         ((ushort)0x0004)
+#define CPM_CR_RESTART_TX      ((ushort)0x0006)
+#define CPM_CR_SET_GADDR       ((ushort)0x0008)
+
+/* Channel numbers.
+*/
+#define CPM_CR_CH_SCC1 ((ushort)0x0000)
+#define CPM_CR_CH_I2C  ((ushort)0x0001)        /* I2C and IDMA1 */
+#define CPM_CR_CH_SCC2 ((ushort)0x0004)
+#define CPM_CR_CH_SPI  ((ushort)0x0005)        /* SPI / IDMA2 / Timers */
+#define CPM_CR_CH_SCC3 ((ushort)0x0008)
+#define CPM_CR_CH_SMC1 ((ushort)0x0009)        /* SMC1 / DSP1 */
+#define CPM_CR_CH_SCC4 ((ushort)0x000c)
+#define CPM_CR_CH_SMC2 ((ushort)0x000d)        /* SMC2 / DSP2 */
+
+#define mk_cr_cmd(CH, CMD)     ((CMD << 8) | (CH << 4))
+
+/* The dual ported RAM is multi-functional.  Some areas can be (and are
+ * being) used for microcode.  There is an area that can only be used
+ * as data ram for buffer descriptors, which is all we use right now.
+ * Currently the first 512 and last 256 bytes are used for microcode.
+ */
+#define CPM_DATAONLY_BASE      ((uint)0x0800)
+#define CPM_DATAONLY_SIZE      ((uint)0x0700)
+#define CPM_DP_NOSPACE         ((uint)0x7fffffff)
+
+/* Export the base address of the communication processor registers
+ * and dual port ram.
+ */
+extern cpm8xx_t        *cpmp;          /* Pointer to comm processor */
+uint           m8xx_cpm_dpalloc(uint size);
+uint           m8xx_cpm_hostalloc(uint size);
+void           m8xx_cpm_setbrg(uint brg, uint rate);
+
+/* Buffer descriptors used by many of the CPM protocols.
+*/
+typedef struct cpm_buf_desc {
+       ushort  cbd_sc;         /* Status and Control */
+       ushort  cbd_datlen;     /* Data length in buffer */
+       uint    cbd_bufaddr;    /* Buffer address in host memory */
+} cbd_t;
+
+#define BD_SC_EMPTY    ((ushort)0x8000)        /* Receive is empty */
+#define BD_SC_READY    ((ushort)0x8000)        /* Transmit is ready */
+#define BD_SC_WRAP     ((ushort)0x2000)        /* Last buffer descriptor */
+#define BD_SC_INTRPT   ((ushort)0x1000)        /* Interrupt on change */
+#define BD_SC_LAST     ((ushort)0x0800)        /* Last buffer in frame */
+#define BD_SC_CM       ((ushort)0x0200)        /* Continous mode */
+#define BD_SC_ID       ((ushort)0x0100)        /* Rec'd too many idles */
+#define BD_SC_P                ((ushort)0x0100)        /* xmt preamble */
+#define BD_SC_BR       ((ushort)0x0020)        /* Break received */
+#define BD_SC_FR       ((ushort)0x0010)        /* Framing error */
+#define BD_SC_PR       ((ushort)0x0008)        /* Parity error */
+#define BD_SC_OV       ((ushort)0x0002)        /* Overrun */
+#define BD_SC_CD       ((ushort)0x0001)        /* ?? */
+
+/* Parameter RAM offsets.
+*/
+#define PROFF_SCC1     ((uint)0x0000)
+#define PROFF_IIC      ((uint)0x0080)
+#define PROFF_SCC2     ((uint)0x0100)
+#define PROFF_SCC3     ((uint)0x0200)
+#define PROFF_SMC1     ((uint)0x0280)
+#define PROFF_SCC4     ((uint)0x0300)
+#define PROFF_SMC2     ((uint)0x0380)
+
+/* Define enough so I can at least use the serial port as a UART.
+ * The MBX uses SMC1 as the host serial port.
+ */
+typedef struct smc_uart {
+       ushort  smc_rbase;      /* Rx Buffer descriptor base address */
+       ushort  smc_tbase;      /* Tx Buffer descriptor base address */
+       u_char  smc_rfcr;       /* Rx function code */
+       u_char  smc_tfcr;       /* Tx function code */
+       ushort  smc_mrblr;      /* Max receive buffer length */
+       uint    smc_rstate;     /* Internal */
+       uint    smc_idp;        /* Internal */
+       ushort  smc_rbptr;      /* Internal */
+       ushort  smc_ibc;        /* Internal */
+       uint    smc_rxtmp;      /* Internal */
+       uint    smc_tstate;     /* Internal */
+       uint    smc_tdp;        /* Internal */
+       ushort  smc_tbptr;      /* Internal */
+       ushort  smc_tbc;        /* Internal */
+       uint    smc_txtmp;      /* Internal */
+       ushort  smc_maxidl;     /* Maximum idle characters */
+       ushort  smc_tmpidl;     /* Temporary idle counter */
+       ushort  smc_brklen;     /* Last received break length */
+       ushort  smc_brkec;      /* rcv'd break condition counter */
+       ushort  smc_brkcr;      /* xmt break count register */
+       ushort  smc_rmask;      /* Temporary bit mask */
+} smc_uart_t;
+
+/* Function code bits.
+*/
+#define SMC_EB ((u_char)0x10)  /* Set big endian byte order */
+
+/* SMC uart mode register.
+*/
+#define        SMCMR_REN       ((ushort)0x0001)
+#define SMCMR_TEN      ((ushort)0x0002)
+#define SMCMR_DM       ((ushort)0x000c)
+#define SMCMR_SM_GCI   ((ushort)0x0000)
+#define SMCMR_SM_UART  ((ushort)0x0020)
+#define SMCMR_SM_TRANS ((ushort)0x0030)
+#define SMCMR_SM_MASK  ((ushort)0x0030)
+#define SMCMR_PM_EVEN  ((ushort)0x0100)        /* Even parity, else odd */
+#define SMCMR_REVD     SMCMR_PM_EVEN
+#define SMCMR_PEN      ((ushort)0x0200)        /* Parity enable */
+#define SMCMR_BS       SMCMR_PEN
+#define SMCMR_SL       ((ushort)0x0400)        /* Two stops, else one */
+#define SMCR_CLEN_MASK ((ushort)0x7800)        /* Character length */
+#define smcr_mk_clen(C)        (((C) << 11) & SMCR_CLEN_MASK)
+
+/* SMC2 as Centronics parallel printer.  It is half duplex, in that
+ * it can only receive or transmit.  The parameter ram values for
+ * each direction are either unique or properly overlap, so we can
+ * include them in one structure.
+ */
+typedef struct smc_centronics {
+       ushort  scent_rbase;
+       ushort  scent_tbase;
+       u_char  scent_cfcr;
+       u_char  scent_smask;
+       ushort  scent_mrblr;
+       uint    scent_rstate;
+       uint    scent_r_ptr;
+       ushort  scent_rbptr;
+       ushort  scent_r_cnt;
+       uint    scent_rtemp;
+       uint    scent_tstate;
+       uint    scent_t_ptr;
+       ushort  scent_tbptr;
+       ushort  scent_t_cnt;
+       uint    scent_ttemp;
+       ushort  scent_max_sl;
+       ushort  scent_sl_cnt;
+       ushort  scent_character1;
+       ushort  scent_character2;
+       ushort  scent_character3;
+       ushort  scent_character4;
+       ushort  scent_character5;
+       ushort  scent_character6;
+       ushort  scent_character7;
+       ushort  scent_character8;
+       ushort  scent_rccm;
+       ushort  scent_rccr;
+} smc_cent_t;
+
+/* Centronics Status Mask Register.
+*/
+#define SMC_CENT_F     ((u_char)0x08)
+#define SMC_CENT_PE    ((u_char)0x04)
+#define SMC_CENT_S     ((u_char)0x02)
+
+/* SMC Event and Mask register.
+*/
+#define        SMCM_BRKE       ((unsigned char)0x40)   /* When in UART Mode */
+#define        SMCM_BRK        ((unsigned char)0x10)   /* When in UART Mode */
+#define        SMCM_TXE        ((unsigned char)0x10)   /* When in Transparent Mode */
+#define        SMCM_BSY        ((unsigned char)0x04)
+#define        SMCM_TX         ((unsigned char)0x02)
+#define        SMCM_RX         ((unsigned char)0x01)
+
+/* Baud rate generators.
+*/
+#define CPM_BRG_RST            ((uint)0x00020000)
+#define CPM_BRG_EN             ((uint)0x00010000)
+#define CPM_BRG_EXTC_INT       ((uint)0x00000000)
+#define CPM_BRG_EXTC_CLK2      ((uint)0x00004000)
+#define CPM_BRG_EXTC_CLK6      ((uint)0x00008000)
+#define CPM_BRG_ATB            ((uint)0x00002000)
+#define CPM_BRG_CD_MASK                ((uint)0x00001ffe)
+#define CPM_BRG_DIV16          ((uint)0x00000001)
+
+/* SCCs.
+*/
+#define SCC_GSMRH_IRP          ((uint)0x00040000)
+#define SCC_GSMRH_GDE          ((uint)0x00010000)
+#define SCC_GSMRH_TCRC_CCITT   ((uint)0x00008000)
+#define SCC_GSMRH_TCRC_BISYNC  ((uint)0x00004000)
+#define SCC_GSMRH_TCRC_HDLC    ((uint)0x00000000)
+#define SCC_GSMRH_REVD         ((uint)0x00002000)
+#define SCC_GSMRH_TRX          ((uint)0x00001000)
+#define SCC_GSMRH_TTX          ((uint)0x00000800)
+#define SCC_GSMRH_CDP          ((uint)0x00000400)
+#define SCC_GSMRH_CTSP         ((uint)0x00000200)
+#define SCC_GSMRH_CDS          ((uint)0x00000100)
+#define SCC_GSMRH_CTSS         ((uint)0x00000080)
+#define SCC_GSMRH_TFL          ((uint)0x00000040)
+#define SCC_GSMRH_RFW          ((uint)0x00000020)
+#define SCC_GSMRH_TXSY         ((uint)0x00000010)
+#define SCC_GSMRH_SYNL16       ((uint)0x0000000c)
+#define SCC_GSMRH_SYNL8                ((uint)0x00000008)
+#define SCC_GSMRH_SYNL4                ((uint)0x00000004)
+#define SCC_GSMRH_RTSM         ((uint)0x00000002)
+#define SCC_GSMRH_RSYN         ((uint)0x00000001)
+
+#define SCC_GSMRL_SIR          ((uint)0x80000000)      /* SCC2 only */
+#define SCC_GSMRL_EDGE_NONE    ((uint)0x60000000)
+#define SCC_GSMRL_EDGE_NEG     ((uint)0x40000000)
+#define SCC_GSMRL_EDGE_POS     ((uint)0x20000000)
+#define SCC_GSMRL_EDGE_BOTH    ((uint)0x00000000)
+#define SCC_GSMRL_TCI          ((uint)0x10000000)
+#define SCC_GSMRL_TSNC_3       ((uint)0x0c000000)
+#define SCC_GSMRL_TSNC_4       ((uint)0x08000000)
+#define SCC_GSMRL_TSNC_14      ((uint)0x04000000)
+#define SCC_GSMRL_TSNC_INF     ((uint)0x00000000)
+#define SCC_GSMRL_RINV         ((uint)0x02000000)
+#define SCC_GSMRL_TINV         ((uint)0x01000000)
+#define SCC_GSMRL_TPL_128      ((uint)0x00c00000)
+#define SCC_GSMRL_TPL_64       ((uint)0x00a00000)
+#define SCC_GSMRL_TPL_48       ((uint)0x00800000)
+#define SCC_GSMRL_TPL_32       ((uint)0x00600000)
+#define SCC_GSMRL_TPL_16       ((uint)0x00400000)
+#define SCC_GSMRL_TPL_8                ((uint)0x00200000)
+#define SCC_GSMRL_TPL_NONE     ((uint)0x00000000)
+#define SCC_GSMRL_TPP_ALL1     ((uint)0x00180000)
+#define SCC_GSMRL_TPP_01       ((uint)0x00100000)
+#define SCC_GSMRL_TPP_10       ((uint)0x00080000)
+#define SCC_GSMRL_TPP_ZEROS    ((uint)0x00000000)
+#define SCC_GSMRL_TEND         ((uint)0x00040000)
+#define SCC_GSMRL_TDCR_32      ((uint)0x00030000)
+#define SCC_GSMRL_TDCR_16      ((uint)0x00020000)
+#define SCC_GSMRL_TDCR_8       ((uint)0x00010000)
+#define SCC_GSMRL_TDCR_1       ((uint)0x00000000)
+#define SCC_GSMRL_RDCR_32      ((uint)0x0000c000)
+#define SCC_GSMRL_RDCR_16      ((uint)0x00008000)
+#define SCC_GSMRL_RDCR_8       ((uint)0x00004000)
+#define SCC_GSMRL_RDCR_1       ((uint)0x00000000)
+#define SCC_GSMRL_RENC_DFMAN   ((uint)0x00003000)
+#define SCC_GSMRL_RENC_MANCH   ((uint)0x00002000)
+#define SCC_GSMRL_RENC_FM0     ((uint)0x00001000)
+#define SCC_GSMRL_RENC_NRZI    ((uint)0x00000800)
+#define SCC_GSMRL_RENC_NRZ     ((uint)0x00000000)
+#define SCC_GSMRL_TENC_DFMAN   ((uint)0x00000600)
+#define SCC_GSMRL_TENC_MANCH   ((uint)0x00000400)
+#define SCC_GSMRL_TENC_FM0     ((uint)0x00000200)
+#define SCC_GSMRL_TENC_NRZI    ((uint)0x00000100)
+#define SCC_GSMRL_TENC_NRZ     ((uint)0x00000000)
+#define SCC_GSMRL_DIAG_LE      ((uint)0x000000c0)      /* Loop and echo */
+#define SCC_GSMRL_DIAG_ECHO    ((uint)0x00000080)
+#define SCC_GSMRL_DIAG_LOOP    ((uint)0x00000040)
+#define SCC_GSMRL_DIAG_NORM    ((uint)0x00000000)
+#define SCC_GSMRL_ENR          ((uint)0x00000020)
+#define SCC_GSMRL_ENT          ((uint)0x00000010)
+#define SCC_GSMRL_MODE_ENET    ((uint)0x0000000c)
+#define SCC_GSMRL_MODE_DDCMP   ((uint)0x00000009)
+#define SCC_GSMRL_MODE_BISYNC  ((uint)0x00000008)
+#define SCC_GSMRL_MODE_V14     ((uint)0x00000007)
+#define SCC_GSMRL_MODE_AHDLC   ((uint)0x00000006)
+#define SCC_GSMRL_MODE_PROFIBUS        ((uint)0x00000005)
+#define SCC_GSMRL_MODE_UART    ((uint)0x00000004)
+#define SCC_GSMRL_MODE_SS7     ((uint)0x00000003)
+#define SCC_GSMRL_MODE_ATALK   ((uint)0x00000002)
+#define SCC_GSMRL_MODE_HDLC    ((uint)0x00000000)
+
+#define SCC_TODR_TOD           ((ushort)0x8000)
+
+/* SCC Event and Mask register.
+*/
+#define        SCCM_TXE        ((unsigned char)0x10)
+#define        SCCM_BSY        ((unsigned char)0x04)
+#define        SCCM_TX         ((unsigned char)0x02)
+#define        SCCM_RX         ((unsigned char)0x01)
+
+typedef struct scc_param {
+       ushort  scc_rbase;      /* Rx Buffer descriptor base address */
+       ushort  scc_tbase;      /* Tx Buffer descriptor base address */
+       u_char  scc_rfcr;       /* Rx function code */
+       u_char  scc_tfcr;       /* Tx function code */
+       ushort  scc_mrblr;      /* Max receive buffer length */
+       uint    scc_rstate;     /* Internal */
+       uint    scc_idp;        /* Internal */
+       ushort  scc_rbptr;      /* Internal */
+       ushort  scc_ibc;        /* Internal */
+       uint    scc_rxtmp;      /* Internal */
+       uint    scc_tstate;     /* Internal */
+       uint    scc_tdp;        /* Internal */
+       ushort  scc_tbptr;      /* Internal */
+       ushort  scc_tbc;        /* Internal */
+       uint    scc_txtmp;      /* Internal */
+       uint    scc_rcrc;       /* Internal */
+       uint    scc_tcrc;       /* Internal */
+} sccp_t;
+
+/* Function code bits.
+*/
+#define SCC_EB ((u_char)0x10)  /* Set big endian byte order */
+
+/* CPM Ethernet through SCCx.
+ */
+typedef struct scc_enet {
+       sccp_t  sen_genscc;
+       uint    sen_cpres;      /* Preset CRC */
+       uint    sen_cmask;      /* Constant mask for CRC */
+       uint    sen_crcec;      /* CRC Error counter */
+       uint    sen_alec;       /* alignment error counter */
+       uint    sen_disfc;      /* discard frame counter */
+       ushort  sen_pads;       /* Tx short frame pad character */
+       ushort  sen_retlim;     /* Retry limit threshold */
+       ushort  sen_retcnt;     /* Retry limit counter */
+       ushort  sen_maxflr;     /* maximum frame length register */
+       ushort  sen_minflr;     /* minimum frame length register */
+       ushort  sen_maxd1;      /* maximum DMA1 length */
+       ushort  sen_maxd2;      /* maximum DMA2 length */
+       ushort  sen_maxd;       /* Rx max DMA */
+       ushort  sen_dmacnt;     /* Rx DMA counter */
+       ushort  sen_maxb;       /* Max BD byte count */
+       ushort  sen_gaddr1;     /* Group address filter */
+       ushort  sen_gaddr2;
+       ushort  sen_gaddr3;
+       ushort  sen_gaddr4;
+       uint    sen_tbuf0data0; /* Save area 0 - current frame */
+       uint    sen_tbuf0data1; /* Save area 1 - current frame */
+       uint    sen_tbuf0rba;   /* Internal */
+       uint    sen_tbuf0crc;   /* Internal */
+       ushort  sen_tbuf0bcnt;  /* Internal */
+       ushort  sen_paddrh;     /* physical address (MSB) */
+       ushort  sen_paddrm;
+       ushort  sen_paddrl;     /* physical address (LSB) */
+       ushort  sen_pper;       /* persistence */
+       ushort  sen_rfbdptr;    /* Rx first BD pointer */
+       ushort  sen_tfbdptr;    /* Tx first BD pointer */
+       ushort  sen_tlbdptr;    /* Tx last BD pointer */
+       uint    sen_tbuf1data0; /* Save area 0 - current frame */
+       uint    sen_tbuf1data1; /* Save area 1 - current frame */
+       uint    sen_tbuf1rba;   /* Internal */
+       uint    sen_tbuf1crc;   /* Internal */
+       ushort  sen_tbuf1bcnt;  /* Internal */
+       ushort  sen_txlen;      /* Tx Frame length counter */
+       ushort  sen_iaddr1;     /* Individual address filter */
+       ushort  sen_iaddr2;
+       ushort  sen_iaddr3;
+       ushort  sen_iaddr4;
+       ushort  sen_boffcnt;    /* Backoff counter */
+
+       /* NOTE: Some versions of the manual have the following items
+        * incorrectly documented.  Below is the proper order.
+        */
+       ushort  sen_taddrh;     /* temp address (MSB) */
+       ushort  sen_taddrm;
+       ushort  sen_taddrl;     /* temp address (LSB) */
+} scc_enet_t;
+
+/***  MBX  ************************************************************/
+
+#ifdef CONFIG_MBX
+/* Bits in parallel I/O port registers that have to be set/cleared
+ * to configure the pins for SCC1 use.  The TCLK and RCLK seem unique
+ * to the MBX860 board.  Any two of the four available clocks could be
+ * used, and the MPC860 cookbook manual has an example using different
+ * clock pins.
+ */
+#define PA_ENET_RXD    ((ushort)0x0001)
+#define PA_ENET_TXD    ((ushort)0x0002)
+#define PA_ENET_TCLK   ((ushort)0x0200)
+#define PA_ENET_RCLK   ((ushort)0x0800)
+#define PC_ENET_TENA   ((ushort)0x0001)
+#define PC_ENET_CLSN   ((ushort)0x0010)
+#define PC_ENET_RENA   ((ushort)0x0020)
+
+/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
+ * SCC1.  Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
+ */
+#define SICR_ENET_MASK ((uint)0x000000ff)
+#define SICR_ENET_CLKRT        ((uint)0x0000003d)
+#endif /* CONFIG_MBX */
+
+/***  RPXLITE  ********************************************************/
+
+#ifdef CONFIG_RPXLITE
+/* This ENET stuff is for the MPC850 with ethernet on SCC2.  Some of
+ * this may be unique to the RPX-Lite configuration.
+ * Note TENA is on Port B.
+ */
+#define PA_ENET_RXD    ((ushort)0x0004)
+#define PA_ENET_TXD    ((ushort)0x0008)
+#define PA_ENET_TCLK   ((ushort)0x0200)
+#define PA_ENET_RCLK   ((ushort)0x0800)
+#define PB_ENET_TENA   ((uint)0x00002000)
+#define PC_ENET_CLSN   ((ushort)0x0040)
+#define PC_ENET_RENA   ((ushort)0x0080)
+
+#define SICR_ENET_MASK ((uint)0x0000ff00)
+#define SICR_ENET_CLKRT        ((uint)0x00003d00)
+#endif /* CONFIG_RPXLITE */
+
+/***  BSEIP  **********************************************************/
+
+#ifdef CONFIG_BSEIP
+/* This ENET stuff is for the MPC823 with ethernet on SCC2.
+ * This is unique to the BSE ip-Engine board.
+ */
+#define PA_ENET_RXD    ((ushort)0x0004)
+#define PA_ENET_TXD    ((ushort)0x0008)
+#define PA_ENET_TCLK   ((ushort)0x0100)
+#define PA_ENET_RCLK   ((ushort)0x0200)
+#define PB_ENET_TENA   ((uint)0x00002000)
+#define PC_ENET_CLSN   ((ushort)0x0040)
+#define PC_ENET_RENA   ((ushort)0x0080)
+
+/* BSE uses port B and C bits for PHY control also.
+*/
+#define PB_BSE_POWERUP ((uint)0x00000004)
+#define PB_BSE_FDXDIS  ((uint)0x00008000)
+#define PC_BSE_LOOPBACK        ((ushort)0x0800)
+
+#define SICR_ENET_MASK ((uint)0x0000ff00)
+#define SICR_ENET_CLKRT        ((uint)0x00002c00)
+#endif /* CONFIG_BSEIP */
+
+/***  RPXCLASSIC  *****************************************************/
+
+#ifdef CONFIG_RPXCLASSIC
+/* Bits in parallel I/O port registers that have to be set/cleared
+ * to configure the pins for SCC1 use.
+ */
+#define PA_ENET_RXD    ((ushort)0x0001)
+#define PA_ENET_TXD    ((ushort)0x0002)
+#define PA_ENET_TCLK   ((ushort)0x0200)
+#define PA_ENET_RCLK   ((ushort)0x0800)
+#define PB_ENET_TENA   ((uint)0x00001000)
+#define PC_ENET_CLSN   ((ushort)0x0010)
+#define PC_ENET_RENA   ((ushort)0x0020)
+
+/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
+ * SCC1.  Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
+ */
+#define SICR_ENET_MASK ((uint)0x000000ff)
+#define SICR_ENET_CLKRT        ((uint)0x0000003d)
+#endif /* CONFIG_RPXCLASSIC */
+
+/***  TQM823L, TQM850L  ***********************************************/
+
+#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L)
+/* Bits in parallel I/O port registers that have to be set/cleared
+ * to configure the pins for SCC1 use.
+ */
+#define PA_ENET_RXD    ((ushort)0x0004)        /* PA 13 */
+#define PA_ENET_TXD    ((ushort)0x0008)        /* PA 12 */
+#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
+#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
+
+#define PB_ENET_TENA   ((uint)0x00002000)      /* PB 18 */
+
+#define PC_ENET_CLSN   ((ushort)0x0040)        /* PC  9 */
+#define PC_ENET_RENA   ((ushort)0x0080)        /* PC  8 */
+
+/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
+ * SCC2.  Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
+ */
+#define SICR_ENET_MASK ((uint)0x0000ff00)
+#define SICR_ENET_CLKRT        ((uint)0x00002600)
+#endif /* CONFIG_TQM823L, CONFIG_TQM850L */
+
+/***  FPS850L  *********************************************************/
+
+#ifdef CONFIG_FPS850L
+/* Bits in parallel I/O port registers that have to be set/cleared
+ * to configure the pins for SCC1 use.
+ */
+#define PA_ENET_RXD    ((ushort)0x0004)        /* PA 13 */
+#define PA_ENET_TXD    ((ushort)0x0008)        /* PA 12 */
+#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
+#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
+
+#define PC_ENET_TENA   ((ushort)0x0002)        /* PC 14 */
+#define PC_ENET_CLSN   ((ushort)0x0040)        /* PC  9 */
+#define PC_ENET_RENA   ((ushort)0x0080)        /* PC  8 */
+
+/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
+ * SCC2.  Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
+ */
+#define SICR_ENET_MASK ((uint)0x0000ff00)
+#define SICR_ENET_CLKRT        ((uint)0x00002600)
+#endif /* CONFIG_FPS850L */
+
+/***  TQM860L  ********************************************************/
+
+#ifdef CONFIG_TQM860L
+/* Bits in parallel I/O port registers that have to be set/cleared
+ * to configure the pins for SCC1 use.
+ */
+#define PA_ENET_RXD    ((ushort)0x0001)        /* PA 15 */
+#define PA_ENET_TXD    ((ushort)0x0002)        /* PA 14 */
+#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
+#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
+
+#define PC_ENET_TENA   ((ushort)0x0001)        /* PC 15 */
+#define PC_ENET_CLSN   ((ushort)0x0010)        /* PC 11 */
+#define PC_ENET_RENA   ((ushort)0x0020)        /* PC 10 */
+
+/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
+ * SCC1.  Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
+ */
+#define SICR_ENET_MASK ((uint)0x000000ff)
+#define SICR_ENET_CLKRT        ((uint)0x00000026)
+#endif /* CONFIG_TQM860L */
+
+/***  SPD823TS  *******************************************************/
+
+#ifdef CONFIG_SPD823TS
+/* Bits in parallel I/O port registers that have to be set/cleared
+ * to configure the pins for SCC2 use.
+ */
+#define PA_ENET_MDC    ((ushort)0x0001)        /* PA 15 !!! */
+#define PA_ENET_MDIO   ((ushort)0x0002)        /* PA 14 !!! */
+#define PA_ENET_RXD    ((ushort)0x0004)        /* PA 13 */
+#define PA_ENET_TXD    ((ushort)0x0008)        /* PA 12 */
+#define PA_ENET_RCLK   ((ushort)0x0200)        /* PA  6 */
+#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
+
+#define PB_ENET_TENA   ((uint)0x00002000)      /* PB 18 */
+
+#define PC_ENET_CLSN   ((ushort)0x0040)        /* PC  9 */
+#define PC_ENET_RENA   ((ushort)0x0080)        /* PC  8 */
+#define        PC_ENET_RESET   ((ushort)0x0100)        /* PC  7 !!! */
+
+/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK2) to
+ * SCC2.  Also, make sure GR2 (bit 16) and SC2 (bit 17) are zero.
+ */
+#define SICR_ENET_MASK ((uint)0x0000ff00)
+#define SICR_ENET_CLKRT        ((uint)0x00002E00)
+#endif /* CONFIG_SPD823TS */
+
+
+/***  SM850  *********************************************************/
+
+/* The SM850 Service Module uses SCC2 for IrDA and SCC3 for Ethernet */
+
+#ifdef CONFIG_SM850
+#define PB_ENET_RXD    ((uint)0x00000004)      /* PB 29 */
+#define PB_ENET_TXD    ((uint)0x00000002)      /* PB 30 */
+#define PA_ENET_RCLK   ((ushort)0x0100)        /* PA  7 */
+#define PA_ENET_TCLK   ((ushort)0x0400)        /* PA  5 */
+
+#define PC_ENET_LBK    ((ushort)0x0008)        /* PC 12 */
+#define PC_ENET_TENA   ((ushort)0x0004)        /* PC 13 */
+
+#define PC_ENET_RENA   ((ushort)0x0800)        /* PC  4 */
+#define PC_ENET_CLSN   ((ushort)0x0400)        /* PC  5 */
+
+/* Control bits in the SICR to route TCLK (CLK3) and RCLK (CLK1) to
+ * SCC3.  Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero.
+ */
+#define SICR_ENET_MASK ((uint)0x00FF0000)
+#define SICR_ENET_CLKRT        ((uint)0x00260000)
+#endif /* CONFIG_SM850 */
+
+/*********************************************************************/
+
+/* SCC Event register as used by Ethernet.
+*/
+#define SCCE_ENET_GRA  ((ushort)0x0080)        /* Graceful stop complete */
+#define SCCE_ENET_TXE  ((ushort)0x0010)        /* Transmit Error */
+#define SCCE_ENET_RXF  ((ushort)0x0008)        /* Full frame received */
+#define SCCE_ENET_BSY  ((ushort)0x0004)        /* All incoming buffers full */
+#define SCCE_ENET_TXB  ((ushort)0x0002)        /* A buffer was transmitted */
+#define SCCE_ENET_RXB  ((ushort)0x0001)        /* A buffer was received */
+
+/* SCC Mode Register (PMSR) as used by Ethernet.
+*/
+#define SCC_PMSR_HBC   ((ushort)0x8000)        /* Enable heartbeat */
+#define SCC_PMSR_FC    ((ushort)0x4000)        /* Force collision */
+#define SCC_PMSR_RSH   ((ushort)0x2000)        /* Receive short frames */
+#define SCC_PMSR_IAM   ((ushort)0x1000)        /* Check individual hash */
+#define SCC_PMSR_ENCRC ((ushort)0x0800)        /* Ethernet CRC mode */
+#define SCC_PMSR_PRO   ((ushort)0x0200)        /* Promiscuous mode */
+#define SCC_PMSR_BRO   ((ushort)0x0100)        /* Catch broadcast pkts */
+#define SCC_PMSR_SBT   ((ushort)0x0080)        /* Special backoff timer */
+#define SCC_PMSR_LPB   ((ushort)0x0040)        /* Set Loopback mode */
+#define SCC_PMSR_SIP   ((ushort)0x0020)        /* Sample Input Pins */
+#define SCC_PMSR_LCW   ((ushort)0x0010)        /* Late collision window */
+#define SCC_PMSR_NIB22 ((ushort)0x000a)        /* Start frame search */
+#define SCC_PMSR_FDE   ((ushort)0x0001)        /* Full duplex enable */
+
+/* Buffer descriptor control/status used by Ethernet receive.
+*/
+#define BD_ENET_RX_EMPTY       ((ushort)0x8000)
+#define BD_ENET_RX_WRAP                ((ushort)0x2000)
+#define BD_ENET_RX_INTR                ((ushort)0x1000)
+#define BD_ENET_RX_LAST                ((ushort)0x0800)
+#define BD_ENET_RX_FIRST       ((ushort)0x0400)
+#define BD_ENET_RX_MISS                ((ushort)0x0100)
+#define BD_ENET_RX_LG          ((ushort)0x0020)
+#define BD_ENET_RX_NO          ((ushort)0x0010)
+#define BD_ENET_RX_SH          ((ushort)0x0008)
+#define BD_ENET_RX_CR          ((ushort)0x0004)
+#define BD_ENET_RX_OV          ((ushort)0x0002)
+#define BD_ENET_RX_CL          ((ushort)0x0001)
+#define BD_ENET_RX_STATS       ((ushort)0x013f)        /* All status bits */
+
+/* Buffer descriptor control/status used by Ethernet transmit.
+*/
+#define BD_ENET_TX_READY       ((ushort)0x8000)
+#define BD_ENET_TX_PAD         ((ushort)0x4000)
+#define BD_ENET_TX_WRAP                ((ushort)0x2000)
+#define BD_ENET_TX_INTR                ((ushort)0x1000)
+#define BD_ENET_TX_LAST                ((ushort)0x0800)
+#define BD_ENET_TX_TC          ((ushort)0x0400)
+#define BD_ENET_TX_DEF         ((ushort)0x0200)
+#define BD_ENET_TX_HB          ((ushort)0x0100)
+#define BD_ENET_TX_LC          ((ushort)0x0080)
+#define BD_ENET_TX_RL          ((ushort)0x0040)
+#define BD_ENET_TX_RCMASK      ((ushort)0x003c)
+#define BD_ENET_TX_UN          ((ushort)0x0002)
+#define BD_ENET_TX_CSL         ((ushort)0x0001)
+#define BD_ENET_TX_STATS       ((ushort)0x03ff)        /* All status bits */
+
+/* SCC as UART
+*/
+typedef struct scc_uart {
+       sccp_t  scc_genscc;
+       uint    scc_res1;       /* Reserved */
+       uint    scc_res2;       /* Reserved */
+       ushort  scc_maxidl;     /* Maximum idle chars */
+       ushort  scc_idlc;       /* temp idle counter */
+       ushort  scc_brkcr;      /* Break count register */
+       ushort  scc_parec;      /* receive parity error counter */
+       ushort  scc_frmec;      /* receive framing error counter */
+       ushort  scc_nosec;      /* receive noise counter */
+       ushort  scc_brkec;      /* receive break condition counter */
+       ushort  scc_brkln;      /* last received break length */
+       ushort  scc_uaddr1;     /* UART address character 1 */
+       ushort  scc_uaddr2;     /* UART address character 2 */
+       ushort  scc_rtemp;      /* Temp storage */
+       ushort  scc_toseq;      /* Transmit out of sequence char */
+       ushort  scc_char1;      /* control character 1 */
+       ushort  scc_char2;      /* control character 2 */
+       ushort  scc_char3;      /* control character 3 */
+       ushort  scc_char4;      /* control character 4 */
+       ushort  scc_char5;      /* control character 5 */
+       ushort  scc_char6;      /* control character 6 */
+       ushort  scc_char7;      /* control character 7 */
+       ushort  scc_char8;      /* control character 8 */
+       ushort  scc_rccm;       /* receive control character mask */
+       ushort  scc_rccr;       /* receive control character register */
+       ushort  scc_rlbc;       /* receive last break character */
+} scc_uart_t;
+
+/* SCC Event and Mask registers when it is used as a UART.
+*/
+#define UART_SCCM_GLR          ((ushort)0x1000)
+#define UART_SCCM_GLT          ((ushort)0x0800)
+#define UART_SCCM_AB           ((ushort)0x0200)
+#define UART_SCCM_IDL          ((ushort)0x0100)
+#define UART_SCCM_GRA          ((ushort)0x0080)
+#define UART_SCCM_BRKE         ((ushort)0x0040)
+#define UART_SCCM_BRKS         ((ushort)0x0020)
+#define UART_SCCM_CCR          ((ushort)0x0008)
+#define UART_SCCM_BSY          ((ushort)0x0004)
+#define UART_SCCM_TX           ((ushort)0x0002)
+#define UART_SCCM_RX           ((ushort)0x0001)
+
+/* The SCC PMSR when used as a UART.
+*/
+#define SCU_PMSR_FLC           ((ushort)0x8000)
+#define SCU_PMSR_SL            ((ushort)0x4000)
+#define SCU_PMSR_CL            ((ushort)0x3000)
+#define SCU_PMSR_UM            ((ushort)0x0c00)
+#define SCU_PMSR_FRZ           ((ushort)0x0200)
+#define SCU_PMSR_RZS           ((ushort)0x0100)
+#define SCU_PMSR_SYN           ((ushort)0x0080)
+#define SCU_PMSR_DRT           ((ushort)0x0040)
+#define SCU_PMSR_PEN           ((ushort)0x0010)
+#define SCU_PMSR_RPM           ((ushort)0x000c)
+#define SCU_PMSR_REVP          ((ushort)0x0008)
+#define SCU_PMSR_TPM           ((ushort)0x0003)
+#define SCU_PMSR_TEVP          ((ushort)0x0002)
+
+/* CPM Transparent mode SCC.
+ */
+typedef struct scc_trans {
+       sccp_t  st_genscc;
+       uint    st_cpres;       /* Preset CRC */
+       uint    st_cmask;       /* Constant mask for CRC */
+} scc_trans_t;
+
+#define BD_SCC_TX_LAST         ((ushort)0x0800)
+
+/* IIC parameter RAM.
+*/
+typedef struct iic {
+       ushort  iic_rbase;      /* Rx Buffer descriptor base address */
+       ushort  iic_tbase;      /* Tx Buffer descriptor base address */
+       u_char  iic_rfcr;       /* Rx function code */
+       u_char  iic_tfcr;       /* Tx function code */
+       ushort  iic_mrblr;      /* Max receive buffer length */
+       uint    iic_rstate;     /* Internal */
+       uint    iic_rdp;        /* Internal */
+       ushort  iic_rbptr;      /* Internal */
+       ushort  iic_rbc;        /* Internal */
+       uint    iic_rxtmp;      /* Internal */
+       uint    iic_tstate;     /* Internal */
+       uint    iic_tdp;        /* Internal */
+       ushort  iic_tbptr;      /* Internal */
+       ushort  iic_tbc;        /* Internal */
+       uint    iic_txtmp;      /* Internal */
+} iic_t;
+
+#define BD_IIC_START           ((ushort)0x0400)
+
+/* CPM interrupts.  There are nearly 32 interrupts generated by CPM
+ * channels or devices.  All of these are presented to the PPC core
+ * as a single interrupt.  The CPM interrupt handler dispatches its
+ * own handlers, in a similar fashion to the PPC core handler.  We
+ * use the table as defined in the manuals (i.e. no special high
+ * priority and SCC1 == SCCa, etc...).
+ */
+#define CPMVEC_NR              32
+#define        CPMVEC_PIO_PC15         ((ushort)0x1f)
+#define        CPMVEC_SCC1             ((ushort)0x1e)
+#define        CPMVEC_SCC2             ((ushort)0x1d)
+#define        CPMVEC_SCC3             ((ushort)0x1c)
+#define        CPMVEC_SCC4             ((ushort)0x1b)
+#define        CPMVEC_PIO_PC14         ((ushort)0x1a)
+#define        CPMVEC_TIMER1           ((ushort)0x19)
+#define        CPMVEC_PIO_PC13         ((ushort)0x18)
+#define        CPMVEC_PIO_PC12         ((ushort)0x17)
+#define        CPMVEC_SDMA_CB_ERR      ((ushort)0x16)
+#define CPMVEC_IDMA1           ((ushort)0x15)
+#define CPMVEC_IDMA2           ((ushort)0x14)
+#define CPMVEC_TIMER2          ((ushort)0x12)
+#define CPMVEC_RISCTIMER       ((ushort)0x11)
+#define CPMVEC_I2C             ((ushort)0x10)
+#define        CPMVEC_PIO_PC11         ((ushort)0x0f)
+#define        CPMVEC_PIO_PC10         ((ushort)0x0e)
+#define CPMVEC_TIMER3          ((ushort)0x0c)
+#define        CPMVEC_PIO_PC9          ((ushort)0x0b)
+#define        CPMVEC_PIO_PC8          ((ushort)0x0a)
+#define        CPMVEC_PIO_PC7          ((ushort)0x09)
+#define CPMVEC_TIMER4          ((ushort)0x07)
+#define        CPMVEC_PIO_PC6          ((ushort)0x06)
+#define        CPMVEC_SPI              ((ushort)0x05)
+#define        CPMVEC_SMC1             ((ushort)0x04)
+#define        CPMVEC_SMC2             ((ushort)0x03)
+#define        CPMVEC_PIO_PC5          ((ushort)0x02)
+#define        CPMVEC_PIO_PC4          ((ushort)0x01)
+#define        CPMVEC_ERROR            ((ushort)0x00)
+
+/* CPM interrupt configuration vector.
+*/
+#define        CICR_SCD_SCC4           ((uint)0x00c00000)      /* SCC4 @ SCCd */
+#define        CICR_SCC_SCC3           ((uint)0x00200000)      /* SCC3 @ SCCc */
+#define        CICR_SCB_SCC2           ((uint)0x00040000)      /* SCC2 @ SCCb */
+#define        CICR_SCA_SCC1           ((uint)0x00000000)      /* SCC1 @ SCCa */
+#define CICR_IRL_MASK          ((uint)0x0000e000)      /* Core interrrupt */
+#define CICR_HP_MASK           ((uint)0x00001f00)      /* Hi-pri int. */
+#define CICR_IEN               ((uint)0x00000080)      /* Int. enable */
+#define CICR_SPS               ((uint)0x00000001)      /* SCC Spread */
+
+extern void cpm_install_handler(int vec, 
+               void (*handler)(void *, struct pt_regs *regs), void *dev_id);
+extern void cpm_free_handler(int vec);
+
+#endif /* __CPM_8XX__ */
index c211ba0387b1a5b7b4d331abefdcd4ff725a230e..bff070ea28a532c71f8a25dbbeb49a8834e3b7fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.ide.h 1.13 08/20/01 15:25:16 paulus
+ * BK Id: SCCS/s.ide.h 1.16 09/28/01 07:54:24 trini
  */
 /*
  *  linux/include/asm-ppc/ide.h
@@ -17,6 +17,7 @@
 
 #include <linux/sched.h>
 #include <asm/processor.h>
+#include <asm/mpc8xx.h>
 
 #ifndef MAX_HWIFS
 #define MAX_HWIFS      8
@@ -138,8 +139,9 @@ typedef union {
 
 /*
  * The following are not needed for the non-m68k ports
+ * unless direct IDE on 8xx
  */
-#ifdef CONFIG_APUS
+#if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE )
 #define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1)
 #else
 #define ide_ack_intr(hwif)             (1)
index 9c370dbdc715602e5f2281ec8f558df355dd7113..1bea6f4f20073881bac55357cc95b2d2b8cd30d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.oak.h 1.7 05/17/01 18:14:25 cort
+ * BK Id: SCCS/s.oak.h 1.10 09/14/01 17:37:56 trini
  */
 /*
  *
 
 #include <asm/irq.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define _IO_BASE       0
 #define _ISA_MEM_BASE  0
 #define PCI_DRAM_OFFSET        0
@@ -48,6 +43,7 @@ extern "C" {
 #define        OAKNET_INT              AIC_INT27
 #define        OAKSERIAL_INT           AIC_INT28
 
+#ifndef __ASSEMBLY__
 /*
  * Data structure defining board information maintained by the boot
  * ROM on IBM's "Oak" evaluation board. An effort has been made to
@@ -64,15 +60,6 @@ typedef struct board_info {
        unsigned int     bi_busfreq;            /* Bus speed, in Hz */
 } bd_t;
 
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Generic 4xx type
-*/
-#define _MACH_4xx (_MACH_oak)
-
-
+#endif /* !__ASSEMBLY__ */
 #endif /* __OAK_H__ */
 #endif /* __KERNEL__ */
index 7e6418c1ba438be2d9835a868de2677de003012e..c8c3c0dd79ed175b351746a807cc5ee5ce38e0ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.spd8xx.h 1.5 05/17/01 18:14:25 cort
+ * BK Id: SCCS/s.spd8xx.h 1.6 09/14/01 17:37:56 trini
  */
 /*
  * A collection of structures, addresses, and values associated with
@@ -101,8 +101,4 @@ typedef struct bd_info {
 */
 #define NR_8259_INTS   0
 
-/* Generic 8xx type
-*/
-#define _MACH_8xx (_MACH_spd8xx)
-
 #endif /* __MACH_SPD8xx_DEFS */
index 70d56741a1b1414aba8c0b819d16e7bae4bf24e3..088e6ec9dc8c8948bc24a48190e33ffae5da90b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.walnut.h 1.7 05/17/01 18:14:26 cort
+ * BK Id: SCCS/s.walnut.h 1.10 09/14/01 17:37:56 trini
  */
 /*
  *
 #ifndef        __WALNUT_H__
 #define        __WALNUT_H__
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef __ASSEMBLY__
 /*
  * Data structure defining board information maintained by the boot
  * ROM on IBM's "Walnut" evaluation board. An effort has been made to
@@ -49,19 +46,13 @@ typedef struct board_info {
        unsigned int     bi_pci_busfreq;        /* PCI Bus speed, in Hz */
 } bd_t;
 
+#endif /* !__ASSEMBLY__ */
+
 /* Memory map for the IBM "Walnut" 405GP evaluation board.
  * Generic 4xx plus RTC.
  */
 #define WALNUT_RTC_ADDR                ((uint)0xf0001000)
 #define WALNUT_RTC_SIZE                ((uint)4*1024)
 
-#ifdef __cplusplus
-}
-#endif
-
-/* Generic 4xx type
-*/
-#define _MACH_4xx (_MACH_walnut)
-
 #endif /* __WALNUT_H__ */
 #endif /* __KERNEL__ */
index 018e766f8fce30c0802c7011a6394eea81f871b7..9efd6da5d3fffd0894dae643649cceb26edf9c7e 100644 (file)
@@ -348,13 +348,6 @@ extern struct module *module_list;
 #define EXPORT_SYMBOL_NOVERS(var)  error config_must_be_included_before_module
 #define EXPORT_SYMBOL_GPL(var)  error config_must_be_included_before_module
 
-#elif !defined(EXPORT_SYMTAB)
-
-#define __EXPORT_SYMBOL(sym,str)   error this_object_must_be_defined_as_export_objs_in_the_Makefile
-#define EXPORT_SYMBOL(var)        error this_object_must_be_defined_as_export_objs_in_the_Makefile
-#define EXPORT_SYMBOL_NOVERS(var)  error this_object_must_be_defined_as_export_objs_in_the_Makefile
-#define EXPORT_SYMBOL_GPL(var)  error this_object_must_be_defined_as_export_objs_in_the_Makefile
-
 #elif !defined(CONFIG_MODULES)
 
 #define __EXPORT_SYMBOL(sym,str)
@@ -362,6 +355,13 @@ extern struct module *module_list;
 #define EXPORT_SYMBOL_NOVERS(var)
 #define EXPORT_SYMBOL_GPL(var)
 
+#elif !defined(EXPORT_SYMTAB)
+
+#define __EXPORT_SYMBOL(sym,str)   error this_object_must_be_defined_as_export_objs_in_the_Makefile
+#define EXPORT_SYMBOL(var)        error this_object_must_be_defined_as_export_objs_in_the_Makefile
+#define EXPORT_SYMBOL_NOVERS(var)  error this_object_must_be_defined_as_export_objs_in_the_Makefile
+#define EXPORT_SYMBOL_GPL(var)  error this_object_must_be_defined_as_export_objs_in_the_Makefile
+
 #else
 
 #define __EXPORT_SYMBOL(sym, str)                      \
index 0cba3d5028d322dca7d8b5e01836c54f31fba88b..3998ff150d9da955d37c64203276e33859352740 100644 (file)
 #define PCI_DEVICE_ID_APPLE_KL_USB     0x0019
 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP  0x0020
 #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021
+#define PCI_DEVICE_ID_APPLE_UNI_N_FW2  0x0030
 
 #define PCI_VENDOR_ID_YAMAHA           0x1073
 #define PCI_DEVICE_ID_YAMAHA_724       0x0004
index 99b909989988918afada1b8ea57dd7a88faa1c34..018320e36d515a6db1d809210555e10c5e86f9e7 100644 (file)
@@ -17,6 +17,7 @@
 #ifdef __KERNEL__
 #include <linux/slab.h>
 #include <linux/tqueue.h>
+#include <asm/hardirq.h>
 #endif
 
 /*
 */
 #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ 
 
+/* assertions handling */
+
+/** always check a condition and panic if it's false. */
+#define RASSERT( cond, format, args... )                                       \
+if( !( cond ) )                                                                \
+  reiserfs_panic( 0, "reiserfs[%i]: assertion " #cond " failed at "            \
+                 __FILE__ ":%i:" __FUNCTION__ ": " format "\n",                \
+                 in_interrupt() ? -1 : current -> pid, __LINE__ , ##args )
+
+#if defined( CONFIG_REISERFS_CHECK )
+#define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args )
+#else
+#define RFALSE( cond, format, args... ) do {;} while( 0 )
+#endif
+
 /*
  * Disk Data Structures
  */
index aa5ac336c8cf0859d23cdf604dffa6ba4c6e28e1..235ab1d1ec89b8ba6af86b497d9e530103ba7c18 100644 (file)
 #define ERRbadshare 32          /* Share mode on file conflict with open mode */
 #define ERRlock 33              /* Lock request conflicts with existing lock */
 #define ERRfilexists 80         /* File in operation already exists */
-#define ERRinvalidparam 87      /* ERROR_INVALID_PARAMETER */
-#define ERRdiskfull 112         /* ERROR_DISK_FULL */
-#define ERRinvalidname 123      /* ERROR_INVALID_NAME */
-#define ERRdirnotempty 145      /* ERROR_DIR_NOT_EMPTY */
-#define ERRnotlocked 158        /* ERROR_NOT_LOCKED */
-#define ERRexists 183           /* ERROR_ALREADY_EXISTS, see also 80 */
 #define ERRbadpipe 230          /* Named pipe invalid */
 #define ERRpipebusy 231         /* All instances of pipe are busy */
 #define ERRpipeclosing 232      /* named pipe close in progress */
 #define ERRnotconnected 233     /* No process on other end of named pipe */
 #define ERRmoredata 234         /* More data to be returned */
-#define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */
-#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */
+
+#define ERROR_INVALID_PARAMETER         87
+#define ERROR_DISK_FULL                112
+#define ERROR_INVALID_NAME     123
+#define ERROR_DIR_NOT_EMPTY    145
+#define ERROR_NOT_LOCKED       158
+#define ERROR_ALREADY_EXISTS   183  /* see also 80 ? */
+#define ERROR_EAS_DIDNT_FIT    275 /* Extended attributes didn't fit */
+#define ERROR_EAS_NOT_SUPPORTED        282 /* Extended attributes not supported */
 
 /* Error codes for the ERRSRV class */
 
index 1a86dfcb5481c8ba23dd3cd91c2e7a5ad7ebd334..a6e2b0fc0eec5af51865d9fd51a9586ab383915c 100644 (file)
@@ -794,6 +794,12 @@ asmlinkage long sys_getegid(void)
 
 #endif
 
+/* Thread ID - the internal kernel "pid" */
+asmlinkage long sys_gettid(void)
+{
+       return current->pid;
+}
+
 asmlinkage long sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp)
 {
        struct timespec t;
index 2679810516a8f00b58736bfa60bb60b95948fb91..ec974923b3cf1ac05fb9837b250f033e1ac30399 100644 (file)
@@ -372,6 +372,10 @@ rebalance:
                return NULL;
        }
 
+       /* Atomic allocations - we can't balance anything */
+       if (!(gfp_mask & __GFP_WAIT))
+               return NULL;
+
        page = balance_classzone(classzone, gfp_mask, order, &freed);
        if (page)
                return page;
@@ -389,6 +393,10 @@ rebalance:
                }
        }
 
+       /* Don't let big-order allocations loop */
+       if (order)
+               return NULL;
+
        /* Yield for kswapd, and try again */
        current->policy |= SCHED_YIELD;
        __set_current_state(TASK_RUNNING);
index 05921091578dba62133a14180561b6e0b5d1c342..b4124b3f6434de3633ae0acc4ffb5ee5ddc8fd04 100644 (file)
@@ -82,7 +82,7 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry)
                INC_CACHE_INFO(exist_race);
                return -EEXIST;
        }
-       page->flags |= (1 << PG_uptodate);
+       SetPageUptodate(page);
        if (!PageLocked(page))
                BUG();
        if (!PageSwapCache(page))
index 29fecaf076f8e9bad9a8f5cae540113bba6030d2..efd19294ad754c1f2118e98f68d48d4f83a4b77b 100644 (file)
@@ -139,7 +139,6 @@ drop_pte:
        }
 
        /* No swap space left */
-       swap_list_unlock();
        set_pte(page_table, pte);
        UnlockPage(page);
        return 0;
index 068bc4ccca046a0aafcd82f56d091db0a346363a..5588c4c732000426e5d53e28b71ca8fd639b308d 100644 (file)
@@ -1401,12 +1401,6 @@ xprt_release(struct rpc_task *task)
 
        dprintk("RPC: %4d release request %p\n", task->tk_pid, req);
 
-       /* remove slot from queue of pending */
-       if (task->tk_rpcwait) {
-               printk("RPC: task of released request still queued!\n");
-               rpc_remove_wait_queue(task);
-       }
-
        spin_lock_bh(&xprt->xprt_lock);
        req->rq_next = xprt->free;
        xprt->free   = req;
index 4c02cc897fa16c31c1c169d9f767cbfaf7dd8139..3ab9fed87e285a9241957b9769a44df7b8d1bc5e 100644 (file)
@@ -188,7 +188,7 @@ int main(int argc, const char * argv [])
      * So by having an initial \n, strstr will find exact matches.
      */
 
-    fp_find = popen("find * -type f -print", "r");
+    fp_find = popen("find * -type f -name \"*.h\" -print", "r");
     if (fp_find == 0)
        ERROR_EXIT( "find" );