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
- 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)
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 11
-EXTRAVERSION =-pre5
+EXTRAVERSION =-pre6
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
/* 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);
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();
}
-# $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
-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
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
rm -f *.o *.bin
fastdep:
+
+modules:
+
+modules-install:
-/* $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
;; 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
;; 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
;; 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
;; 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
-/* $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:
{
.text :
{
- _stext = . ;
+ stext = . ;
*(.text)
- _etext = . ;
+ etext = . ;
} > flash
.data :
{
*(.data)
- _edata = . ;
+ edata = . ;
} > flash
}
-/* $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
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'
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 \
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 */
.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
. = ALIGN (8192);
}
__vmlinux_end = .; /* last address of the physical file */
- ___init_end = .;
+ __init_end = .;
__data_end = . ; /* Move to _edata ? */
__bss_start = .; /* BSS */
*(.exitcall.exit)
}
- _dram_end = _dram_start + @CONFIG_ETRAX_DRAM_SIZE_M@*1024*1024;
+ dram_end = dram_start + @CONFIG_ETRAX_DRAM_SIZE_M@*1024*1024;
}
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
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
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
* 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.
*
#define WINDOW_SIZE (128 * 1024 * 1024)
+extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* From head.S */
+
/*
* Map driver
*
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
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);
}
}
-/* $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.
*
* 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
*
}
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);
#!/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
$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;
-/* $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!
-/* $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
*
* 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>
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
};
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];
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 */
}
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. */
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 */
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
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 */
* 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);
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,
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)
/* 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;
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");
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;
*
* 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 $
*
*/
#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 ""
cli();
if (test_bit(epid, (void *)&ep_usage_bitmask)) {
+ restore_flags(flags);
+
warn("Trying to setup used epid %d", epid);
DBFEXIT;
return;
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;
(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;
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]);
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)) {
-# $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.
#
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.
-/* $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
*
* 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
;; 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
;; 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
;; 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:
;; 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.
/* 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
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)
-/* $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
*
* 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
;; 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
;; 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
;; 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) \
| 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) \
| 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) \
| 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) \
| 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) \
| 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
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) \
| 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) \
| 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"
-/* 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);
+
-/* $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
*
* 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.
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) |
* 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
*
*/
void ptrace_disable(struct task_struct *child)
{
- /* Todo - pending singlesteps? */
+ /* Todo - pending singlesteps? */
}
/* Note that this implementation of ptrace behaves differently from vanilla
-/* $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
*
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 */
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"
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);
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);
} 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)
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 */
-/* $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
;; 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
;; 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
-/* $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
*
* 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
;; 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
;; 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
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"
-/* $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
.byte 0 ; nop
.byte 1 ; mrs
.byte 0 ; nop
-sdram_commands_end:
+_sdram_commands_end:
#endif
#endif
/* 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");
{
;; 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));
;;
;; 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
;; 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));
;;
;; 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
;; 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
; 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\"
; 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
;;
;; 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
;; 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\"
;; 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
;; 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
/*
* 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,
#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;
# 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
.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)
/*
- * 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.
* 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
/*
- * 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
*/
/*
#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 */
+++ /dev/null
-/*
- * 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__ */
/*
- * 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.
* 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
#include <asm/mpc8xx.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
-#include "commproc.h"
+#include <asm/commproc.h>
/*
* Theory of Operation
* 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
/*
- * 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.
#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
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;
/*
- * 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
#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
/*
- * 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
#include <linux/types.h>
#include <asm/uaccess.h>
#include <asm/mpc8xx.h>
-#include "../../8xx_io/commproc.h"
+#include <asm/commproc.h>
/* IIC functions.
/*
- * 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
*/
#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)
-# 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
#
$(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 \
# 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
#
# 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
# 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
# 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
# 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
#
# 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
# 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
#
CONFIG_8xx_COPYBACK=y
# CONFIG_8xx_CPU6 is not set
+# CONFIG_UCODE_PATCH is not set
CONFIG_BLK_DEV_MPC8xx_IDE=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
#
#
# 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
# 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
# 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
# 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
#
# 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
# 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
# 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
# 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
#
CONFIG_8xx_COPYBACK=y
# CONFIG_8xx_CPU6 is not set
+# CONFIG_UCODE_PATCH is not set
+CONFIG_BLK_DEV_MPC8xx_IDE=y
#
# USB support
__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,
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
/*
- * 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
#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.
/*
- * 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
*
#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>
#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 */
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);
#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 */
-
/* -------------------------------------------------------------------- */
/*
#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
}
/*
- * 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>
#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 */
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);
#endif
#ifdef CONFIG_8xx
+EXPORT_SYMBOL(__res);
EXPORT_SYMBOL(request_8xxirq);
EXPORT_SYMBOL(cpm_install_handler);
EXPORT_SYMBOL(cpm_free_handler);
/*
- * 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
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
*/
/*
- * 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.
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;
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++;
/*
- * 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.
#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))
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;
}
/*
- * 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.
#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);
/*
- * 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.
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) :);
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)
if (!Page_Uptodate(page)) {
memset(kmap(page), 0, PAGE_CACHE_SIZE);
kunmap(page);
- flush_dcache_page(page);
SetPageUptodate(page);
}
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);
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
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
"$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
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 :=
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.
--- /dev/null
+/*
+ *
+ *
+ * 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;
+}
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);
}
#if 0
- if (drive->id->major_rev_num & 0x0004) printf("ATA-2 ");
+ if (drive->id->major_rev_num & 0x0004) printk("ATA-2 ");
#endif
/*
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 \
+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
} superios[NR_SUPERIOS] __devinitdata = { {0,},};
static int user_specified __devinitdata = 0;
+static int verbose_probing;
static int registered_parport;
/* frob_control, but for ECR */
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);
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,
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
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))
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)
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
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;
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;}
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);
}
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);
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);
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
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);
}
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)
}
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);
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;
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;
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;
}
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))
if (!parport_SPP_supported (p)) {
/* No port. */
kfree (priv);
+ kfree (ops);
return NULL;
}
if (priv->ecr)
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;
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)
{
enum parport_pc_pci_cards {
titan_110l = 0,
titan_210l,
- netmos_9735,
- netmos_9835,
avlab_1s1p,
avlab_1s1p_650,
avlab_1s1p_850,
} 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}, } },
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},
/* 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 },
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){}
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.
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;
{
unsigned int io_addr = uhci->io_addr;
- dbg("suspend_hc");
+ dbg("%x: suspend_hc", io_addr);
outw(USBCMD_EGSM, io_addr + USBCMD);
unsigned int io_addr = uhci->io_addr;
unsigned int status;
- dbg("wakeup_hc");
+ dbg("%x: wakeup_hc", io_addr);
outw(0, io_addr + USBCMD);
* - 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;
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);
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);
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;
#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;
}
#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 */
O_TARGET := sisfb.o
+export-objs := sis_main.o
+
obj-y := sis_main.o sis_300.o sis_301.o
obj-m := $(O_TARGET)
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"
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 */
};
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,
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 */
}
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) )
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);
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 */
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 */
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 */
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 */
#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 *);
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);
}
#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)
{
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);
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
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;
}
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
*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
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);
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;
}
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 */
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);
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))) ) {
B_N_PKEY(tbS0, 0),
tb->CFL[0] ? B_N_PDELIM_KEY(tb->CFL[0],tb->lkey[0]) : 0);
}
-#endif
-
#endif
bi.tb = tb;
}
}
-#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;
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);
} 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;
}
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);
}
/* 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);
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;
}
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
/* 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;
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] */
/* 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] */
}
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;
/* 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*/
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*/
{
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);
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);
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*/
{ /* 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*/
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*/
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);
}
);
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);
} /* 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 */
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 */
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]);
{ /* 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 */
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]);
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];
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;
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 */
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;
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);
}
} 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);
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;
{
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));
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 */
{
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]);
{
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;
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 ++) {
/* 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
}
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;
}
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 */
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) {
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;
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) {
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;
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));
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;
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;
}
/* 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])))
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");
}
}
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) {
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])
/* 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. */
/* 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;
}
{
// 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*/
-
}
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-- ) {
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. */
*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);
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]. */
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;
}
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. */
/* 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);
}
/* 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])
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;
((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);
*/
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);
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. */
/* 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) ) {
/* 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);
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;
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);
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;
}
}
}
+#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,
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];
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];
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];
/* 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;
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;
}
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 */
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);
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 */
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;
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);
/* 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]);
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);
/* 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]) )
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);
}
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);
}
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]);
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;
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);
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;
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 ) {
}
/** 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);
/* 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
}
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),
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;
}
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 */
}
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++ ;
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);
/* 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 )
);
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));
}
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));
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));
}
}
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;
/* 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);
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,
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;
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 ) */
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);
}
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));
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;
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) {
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);
}
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);
/* 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");
}
}
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;
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 */
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",
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;
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) {
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);
}
}
}
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 */
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 */
/* 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);*/
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;
// 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;
}
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;
}
// FIXME: add something else here
}
+#else
+static void check_objectid_map (struct super_block * s, __u32 * map)
+{;}
#endif
__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 */
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));
//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;
}
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 );
}
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)) )
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)) )
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 */
) {
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;
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 ;
}
) {
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,
) {
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--));
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
/* 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));
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));
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);
{
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. */
}
/* 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;
/* 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. */
/* 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. */
}
}
-#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);
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 )
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;
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",
} 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;
#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;
/* 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);
}
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);
/* 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)
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;
} 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
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;
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";
return -ETXTBSY;
case ERRlock:
return -EDEADLK;
+ case ERRdiskfull:
+ return -ENOSPC;
default:
class = "ERRHRD";
goto err_unknown;
#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..
*/
* 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;
}
/**
-/* $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
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;
}
-/* $Id: delay.h,v 1.5 2001/06/28 04:59:25 hp Exp $ */
-
#ifndef _CRIS_DELAY_H
#define _CRIS_DELAY_H
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");
}
#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; })
*
* 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
/* 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)
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");
#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 */
* 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
*
#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
#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 */
-/* $Id: system.h,v 1.4 2001/03/20 19:46:00 bjornw Exp $ */
-
#ifndef __ASM_CRIS_SYSTEM_H
#define __ASM_CRIS_SYSTEM_H
#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;
}
#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()
--- /dev/null
+#include <asm-generic/tlb.h>
* 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
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. */
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)
: "=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) \
({ \
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)
: "=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 */
__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"
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
#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)
*/
__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"
#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> */
--- /dev/null
+/*
+ * 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__ */
/*
- * 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
#include <linux/sched.h>
#include <asm/processor.h>
+#include <asm/mpc8xx.h>
#ifndef MAX_HWIFS
#define MAX_HWIFS 8
/*
* 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)
/*
- * 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
#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
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__ */
/*
- * 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
*/
#define NR_8259_INTS 0
-/* Generic 8xx type
-*/
-#define _MACH_8xx (_MACH_spd8xx)
-
#endif /* __MACH_SPD8xx_DEFS */
/*
- * 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
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__ */
#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)
#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) \
#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
#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
*/
#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 */
#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;
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;
}
}
+ /* 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);
INC_CACHE_INFO(exist_race);
return -EEXIST;
}
- page->flags |= (1 << PG_uptodate);
+ SetPageUptodate(page);
if (!PageLocked(page))
BUG();
if (!PageSwapCache(page))
}
/* No swap space left */
- swap_list_unlock();
set_pte(page_table, pte);
UnlockPage(page);
return 0;
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;
* 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" );