Merge branch 'kvm-updates/2.6.30' of git://git.kernel.org/pub/scm/virt/kvm/kvm
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 May 2009 23:32:30 +0000 (16:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 May 2009 23:32:30 +0000 (16:32 -0700)
* 'kvm-updates/2.6.30' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: SVM: Remove port 80 passthrough
  KVM: Make EFER reads safe when EFER does not exist
  KVM: Fix NX support reporting
  KVM: SVM: Fix cross vendor migration issue with unusable bit

98 files changed:
arch/alpha/include/asm/percpu.h
arch/cris/Makefile
arch/cris/arch-v10/boot/.gitignore [deleted file]
arch/cris/arch-v10/boot/Makefile [deleted file]
arch/cris/arch-v10/boot/compressed/Makefile [deleted file]
arch/cris/arch-v10/boot/compressed/README [deleted file]
arch/cris/arch-v10/boot/compressed/decompress.lds [deleted file]
arch/cris/arch-v10/boot/compressed/head.S [deleted file]
arch/cris/arch-v10/boot/compressed/misc.c [deleted file]
arch/cris/arch-v10/boot/rescue/Makefile [deleted file]
arch/cris/arch-v10/boot/rescue/head.S [deleted file]
arch/cris/arch-v10/boot/rescue/kimagerescue.S [deleted file]
arch/cris/arch-v10/boot/rescue/rescue.lds [deleted file]
arch/cris/arch-v10/boot/rescue/testrescue.S [deleted file]
arch/cris/arch-v10/boot/tools/build.c [deleted file]
arch/cris/arch-v10/kernel/entry.S
arch/cris/arch-v32/boot/Makefile [deleted file]
arch/cris/arch-v32/boot/compressed/Makefile [deleted file]
arch/cris/arch-v32/boot/compressed/README [deleted file]
arch/cris/arch-v32/boot/compressed/decompress.lds [deleted file]
arch/cris/arch-v32/boot/compressed/head.S [deleted file]
arch/cris/arch-v32/boot/compressed/misc.c [deleted file]
arch/cris/arch-v32/boot/rescue/Makefile [deleted file]
arch/cris/arch-v32/boot/rescue/head.S [deleted file]
arch/cris/arch-v32/boot/rescue/rescue.lds [deleted file]
arch/cris/arch-v32/drivers/mach-a3/gpio.c
arch/cris/arch-v32/kernel/Makefile
arch/cris/arch-v32/kernel/entry.S
arch/cris/boot/.gitignore [new file with mode: 0644]
arch/cris/boot/Makefile [new file with mode: 0644]
arch/cris/boot/compressed/Makefile [new file with mode: 0644]
arch/cris/boot/compressed/README [new file with mode: 0644]
arch/cris/boot/compressed/decompress_v10.lds [new file with mode: 0644]
arch/cris/boot/compressed/decompress_v32.lds [new file with mode: 0644]
arch/cris/boot/compressed/head_v10.S [new file with mode: 0644]
arch/cris/boot/compressed/head_v32.S [new file with mode: 0644]
arch/cris/boot/compressed/misc.c [new file with mode: 0644]
arch/cris/boot/rescue/Makefile [new file with mode: 0644]
arch/cris/boot/rescue/head_v10.S [new file with mode: 0644]
arch/cris/boot/rescue/head_v32.S [new file with mode: 0644]
arch/cris/boot/rescue/kimagerescue.S [new file with mode: 0644]
arch/cris/boot/rescue/rescue_v10.lds [new file with mode: 0644]
arch/cris/boot/rescue/rescue_v32.lds [new file with mode: 0644]
arch/cris/boot/rescue/testrescue.S [new file with mode: 0644]
arch/cris/boot/tools/build.c [new file with mode: 0644]
arch/cris/include/asm/unistd.h
drivers/ata/ata_piix.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/pata_pdc202xx_old.c
drivers/ata/sata_mv.c
drivers/dma/dmaengine.c
drivers/dma/dmatest.c
drivers/dma/ioat_dma.c
drivers/dma/ipu/ipu_idmac.c
drivers/gpu/drm/Kconfig
drivers/hid/hid-ids.h
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hid-quirks.c
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/busses/i2c-pxa.c
drivers/infiniband/hw/cxgb3/cxio_hal.c
drivers/infiniband/hw/mlx4/mlx4_ib.h
drivers/infiniband/hw/mlx4/mr.c
drivers/infiniband/hw/mlx4/qp.c
drivers/input/ff-memless.c
drivers/input/joydev.c
drivers/input/keyboard/atkbd.c
drivers/input/touchscreen/tsc2007.c
drivers/net/mlx4/en_rx.c
drivers/pci/intel-iommu.c
drivers/rtc/rtc-twl4030.c
drivers/spi/pxa2xx_spi.c
drivers/video/Kconfig
drivers/video/via/viafbdev.c
fs/eventpoll.c
fs/fcntl.c
fs/hugetlbfs/inode.c
fs/lockd/svc.c
fs/nfsd/nfs4recover.c
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c
fs/nilfs2/ioctl.c
fs/nilfs2/mdt.c
fs/nilfs2/nilfs.h
fs/nilfs2/page.c
fs/nilfs2/recovery.c
fs/nilfs2/segment.c
fs/nilfs2/segment.h
include/linux/dmaengine.h
include/linux/syscalls.h
mm/madvise.c
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
net/sunrpc/xprtrdma/svc_rdma_sendto.c
net/sunrpc/xprtrdma/svc_rdma_transport.c

index e9e0bb5a23bf5687096cbd5460b8d138ed5f5534..06c5c7a4afd3f6617440cdbcf669d70d591a0d44 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef __ALPHA_PERCPU_H
 #define __ALPHA_PERCPU_H
+
 #include <linux/compiler.h>
 #include <linux/threads.h>
+#include <linux/percpu-defs.h>
 
 /*
  * Determine the real variable name from the name visible in the
@@ -73,6 +75,28 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
 
 #endif /* SMP */
 
-#include <asm-generic/percpu.h>
+#ifdef CONFIG_SMP
+#define PER_CPU_BASE_SECTION ".data.percpu"
+#else
+#define PER_CPU_BASE_SECTION ".data"
+#endif
+
+#ifdef CONFIG_SMP
+
+#ifdef MODULE
+#define PER_CPU_SHARED_ALIGNED_SECTION ""
+#else
+#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned"
+#endif
+#define PER_CPU_FIRST_SECTION ".first"
+
+#else
+
+#define PER_CPU_SHARED_ALIGNED_SECTION ""
+#define PER_CPU_FIRST_SECTION ""
+
+#endif
+
+#define PER_CPU_ATTRIBUTES
 
 #endif /* __ALPHA_PERCPU_H */
index 3662cfb7b61dd7ca48be36bdd62a65e9d6eb2c34..71e17d3eeddba6d8119378e414a4bc742a26a5d9 100644 (file)
@@ -70,7 +70,7 @@ SRC_ARCH              = $(srctree)/arch/cris
 # cris object files path
 OBJ_ARCH              = $(objtree)/arch/cris
 
-boot := arch/cris/$(SARCH)/boot
+boot := arch/cris/boot
 MACHINE := arch/cris/$(SARCH)
 
 all: zImage
@@ -81,15 +81,15 @@ zImage Image: vmlinux
 archprepare:
 
 archclean:
-       $(Q)if [ -e arch/cris/$(SARCH)/boot ]; then \
-               $(MAKE) $(clean)=arch/cris/$(SARCH)/boot; \
+       $(Q)if [ -e arch/cris/boot ]; then \
+               $(MAKE) $(clean)=arch/cris/boot; \
        fi
 
 CLEAN_FILES += \
-       $(MACHINE)/boot/zImage \
-       $(MACHINE)/boot/compressed/decompress.bin \
-       $(MACHINE)/boot/compressed/piggy.gz \
-       $(MACHINE)/boot/rescue/rescue.bin
+       $(boot)/zImage \
+       $(boot)/compressed/decompress.bin \
+       $(boot)/compressed/piggy.gz \
+       $(boot)/rescue/rescue.bin
 
 
 # MRPROPER_FILES +=
diff --git a/arch/cris/arch-v10/boot/.gitignore b/arch/cris/arch-v10/boot/.gitignore
deleted file mode 100644 (file)
index 171a085..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Image
-zImage
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile
deleted file mode 100644 (file)
index 2172030..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# arch/cris/arch-v10/boot/Makefile
-#
-
-OBJCOPYFLAGS = -O binary --remove-section=.bss
-
-subdir- := compressed rescue
-targets := Image
-
-$(obj)/Image: vmlinux FORCE
-       $(call if_changed,objcopy)
-       @echo '  Kernel: $@ is ready'
-
-$(obj)/compressed/vmlinux: $(obj)/Image FORCE
-       $(Q)$(MAKE) $(build)=$(obj)/compressed $@
-       $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
-
-$(obj)/zImage:  $(obj)/compressed/vmlinux
-       @cp $< $@
-       @echo '  Kernel: $@ is ready'
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
deleted file mode 100644 (file)
index 6fe0ffa..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# arch/cris/arch-v10/boot/compressed/Makefile
-#
-
-asflags-y += $(LINUXINCLUDE)
-ccflags-y += -O2 $(LINUXINCLUDE)
-ldflags-y += -T $(srctree)/$(src)/decompress.lds
-OBJECTS = $(obj)/head.o $(obj)/misc.o
-OBJCOPYFLAGS = -O binary --remove-section=.bss
-
-quiet_cmd_image = BUILD   $@
-cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
-
-targets := vmlinux piggy.gz decompress.o decompress.bin
-
-$(obj)/decompress.o: $(OBJECTS) FORCE
-       $(call if_changed,ld)
-
-$(obj)/decompress.bin: $(obj)/decompress.o FORCE
-       $(call if_changed,objcopy)
-
-$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
-       $(call if_changed,image)
-
-$(obj)/piggy.gz: $(obj)/../Image FORCE
-       $(call if_changed,gzip)
-
diff --git a/arch/cris/arch-v10/boot/compressed/README b/arch/cris/arch-v10/boot/compressed/README
deleted file mode 100644 (file)
index 48b3db9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-Creation of the self-extracting compressed kernel image (vmlinuz)
------------------------------------------------------------------
-$Id: README,v 1.1 2001/12/17 13:59:27 bjornw Exp $
-
-This can be slightly confusing because it's a process with many steps.
-
-The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
-by that makefile into text and data binary files, vmlinux.text and 
-vmlinux.data.
-
-Those files together with a ROM filesystem can be catted together and
-burned into a flash or executed directly at the DRAM origin.
-
-They can also be catted together and compressed with gzip, which is what
-happens in this makefile. Together they make up piggy.img. 
-
-The decompressor is built into the file decompress.o. It is turned into
-the binary file decompress.bin, which is catted together with piggy.img
-into the file vmlinuz. It can be executed in an arbitrary place in flash.
-
-Be careful - it assumes some things about free locations in DRAM. It
-assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
-so it puts its code at 0x40700000, and initial stack at 0x40800000.
-
--Bjorn
diff --git a/arch/cris/arch-v10/boot/compressed/decompress.lds b/arch/cris/arch-v10/boot/compressed/decompress.lds
deleted file mode 100644 (file)
index e80f459..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* OUTPUT_FORMAT(elf32-us-cris) */
-OUTPUT_FORMAT(elf32-cris)
-
-MEMORY 
-       {
-       dram : ORIGIN = 0x40700000,
-              LENGTH = 0x00100000
-       }
-
-SECTIONS
-{
-       .text :
-       {
-               _stext = . ;
-               *(.text)
-               *(.rodata)
-               *(.rodata.*)
-               _etext = . ;
-       } > dram
-       .data :
-       {
-               *(.data)
-               _edata = . ;
-       } > dram
-       .bss :
-       {
-               *(.bss)
-               _end = ALIGN( 0x10 ) ;
-       } > dram
-}
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S
deleted file mode 100644 (file)
index 0bb4dcc..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  arch/cris/boot/compressed/head.S
- *
- *  Copyright (C) 1999, 2001 Axis Communications AB
- *
- *  Code that sets up the DRAM registers, calls the
- *  decompressor to unpack the piggybacked kernel, and jumps.
- *
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
-#define RAM_INIT_MAGIC 0x56902387
-#define COMMAND_LINE_MAGIC 0x87109563
-
-       ;; Exported symbols
-
-       .globl  input_data
-
-
-       .text
-
-       nop
-       di
-
-;; We need to initialze DRAM registers before we start using the DRAM
-
-       cmp.d   RAM_INIT_MAGIC, $r8     ; Already initialized?
-       beq     dram_init_finished
-       nop
-
-#include "../../lib/dram_init.S"
-
-dram_init_finished:
-
-       ;; Initiate the PA and PB ports
-
-       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_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]
-
-       ;; Setup the stack to a suitably high address.
-       ;; 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
-
-       ;; Figure out where the compressed piggyback image is
-       ;; in the flash (since we wont try to copy it to DRAM
-       ;; before unpacking). It is at _edata, but in flash.
-       ;; Use (_edata - basse) as offset to the current PC.
-
-basse: move.d  $pc, $r5
-       and.d   0x7fffffff, $r5 ; strip any non-cache bit
-       subq    2, $r5          ; compensate for the move.d $pc instr
-       move.d  $r5, $r0                ; save for later - flash address of 'basse'
-       add.d   _edata, $r5
-       sub.d   basse, $r5      ; $r5 = flash address of '_edata'
-
-       ;; Copy text+data to DRAM
-
-       move.d  basse, $r1      ; destination
-       move.d  _edata, $r2     ; end destination
-1:     move.w  [$r0+], $r3
-       move.w  $r3, [$r1+]
-       cmp.d   $r2, $r1
-       bcs     1b
-       nop
-
-       move.d  $r5, [input_data] ; for the decompressor
-
-
-       ;; Clear the decompressors BSS (between _edata and _end)
-
-       moveq   0, $r0
-       move.d  _edata, $r1
-       move.d  _end, $r2
-1:     move.w  $r0, [$r1+]
-       cmp.d   $r2, $r1
-       bcs     1b
-       nop
-
-       ;;  Save command line magic and address.
-       move.d  _cmd_line_magic, $r12
-       move.d  $r10, [$r12]
-       move.d  _cmd_line_addr, $r12
-       move.d  $r11, [$r12]
-
-       ;; Do the decompression and save compressed size in inptr
-
-       jsr     decompress_kernel
-
-       ;; Put start address of root partition in $r9 so the kernel can use it
-       ;; when mounting from flash
-
-       move.d  [input_data], $r9       ; flash address of compressed kernel
-       add.d   [inptr], $r9            ; size of compressed kernel
-
-       ;; Restore command line magic and address.
-       move.d  _cmd_line_magic, $r10
-       move.d  [$r10], $r10
-       move.d  _cmd_line_addr, $r11
-       move.d  [$r11], $r11
-
-       ;; Enter the decompressed kernel
-       move.d  RAM_INIT_MAGIC, $r8     ; Tell kernel that DRAM is initialized
-       jump    0x40004000      ; kernel is linked to this address
-
-       .data
-
-input_data:
-       .dword  0               ; used by the decompressor
-_cmd_line_magic:
-       .dword 0
-_cmd_line_addr:
-       .dword 0
-#include "../../lib/hw_settings.S"
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
deleted file mode 100644 (file)
index a4db150..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * misc.c
- *
- * This is a collection of several routines from gzip-1.0.3
- * adapted for Linux.
- *
- * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
- * puts by Nick Holloway 1993, better puts by Martin Mares 1995
- * adaptation for Linux/CRIS Axis Communications AB, 1999
- *
- */
-
-/* where the piggybacked kernel image expects itself to live.
- * it is the same address we use when we network load an uncompressed
- * image into DRAM, and it is the address the kernel is linked to live
- * at by vmlinux.lds.S
- */
-
-#define KERNEL_LOAD_ADR 0x40004000
-
-
-#include <linux/types.h>
-#include <arch/svinto.h>
-
-/*
- * gzip declarations
- */
-
-#define OF(args)  args
-#define STATIC static
-
-void *memset(void *s, int c, size_t n);
-void *memcpy(void *__dest, __const void *__src, size_t __n);
-
-#define memzero(s, n)     memset((s), 0, (n))
-
-typedef unsigned char  uch;
-typedef unsigned short ush;
-typedef unsigned long  ulg;
-
-#define WSIZE 0x8000           /* Window size must be at least 32k, */
-                               /* and a power of two */
-
-static uch *inbuf;          /* input buffer */
-static uch window[WSIZE];    /* Sliding window buffer */
-
-unsigned inptr = 0;    /* index of next byte to be processed in inbuf
-                        * After decompression it will contain the
-                        * compressed size, and head.S will read it.
-                        */
-
-static unsigned outcnt = 0;  /* bytes in output buffer */
-
-/* gzip flag byte */
-#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
-#define COMMENT      0x10 /* bit 4 set: file comment present */
-#define ENCRYPTED    0x20 /* bit 5 set: file is encrypted */
-#define RESERVED     0xC0 /* bit 6,7:   reserved */
-
-#define get_byte() (inbuf[inptr++])
-
-/* Diagnostic functions */
-#ifdef DEBUG
-#  define Assert(cond, msg) do { \
-               if (!(cond)) \
-                       error(msg); \
-       } while (0)
-#  define Trace(x) fprintf x
-#  define Tracev(x) do { \
-               if (verbose) \
-                       fprintf x; \
-       } while (0)
-#  define Tracevv(x) do { \
-               if (verbose > 1) \
-                       fprintf x; \
-       } while (0)
-#  define Tracec(c, x) do { \
-               if (verbose && (c)) \
-                       fprintf x; \
-       } while (0)
-#  define Tracecv(c, x) do { \
-               if (verbose > 1 && (c)) \
-                       fprintf x; \
-       } while (0)
-#else
-#  define Assert(cond, msg)
-#  define Trace(x)
-#  define Tracev(x)
-#  define Tracevv(x)
-#  define Tracec(c, x)
-#  define Tracecv(c, x)
-#endif
-
-static void flush_window(void);
-static void error(char *m);
-
-extern char *input_data;  /* lives in head.S */
-
-static long bytes_out = 0;
-static uch *output_data;
-static unsigned long output_ptr = 0;
-static void puts(const char *);
-
-/* the "heap" is put directly after the BSS ends, at end */
-
-extern int _end;
-static long free_mem_ptr = (long)&_end;
-static long free_mem_end_ptr;
-
-#include "../../../../../lib/inflate.c"
-
-/* decompressor info and error messages to serial console */
-
-static void
-puts(const char *s)
-{
-#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
-       while (*s) {
-#ifdef CONFIG_ETRAX_DEBUG_PORT0
-               while (!(*R_SERIAL0_STATUS & (1 << 5))) ;
-               *R_SERIAL0_TR_DATA = *s++;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT1
-               while (!(*R_SERIAL1_STATUS & (1 << 5))) ;
-               *R_SERIAL1_TR_DATA = *s++;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT2
-               while (!(*R_SERIAL2_STATUS & (1 << 5))) ;
-               *R_SERIAL2_TR_DATA = *s++;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT3
-               while (!(*R_SERIAL3_STATUS & (1 << 5))) ;
-               *R_SERIAL3_TR_DATA = *s++;
-#endif
-       }
-#endif
-}
-
-void *memset(void *s, int c, size_t n)
-{
-       int i;
-       char *ss = (char *)s;
-
-       for (i = 0; i < n; i++)
-               ss[i] = c;
-
-       return s;
-}
-
-void *memcpy(void *__dest, __const void *__src, size_t __n)
-{
-       int i;
-       char *d = (char *)__dest, *s = (char *)__src;
-
-       for (i = 0; i < __n; i++)
-               d[i] = s[i];
-
-       return __dest;
-}
-
-/* ===========================================================================
- * Write the output window window[0..outcnt-1] and update crc and bytes_out.
- * (Used for the decompressed data only.)
- */
-
-static void flush_window(void)
-{
-       ulg c = crc;         /* temporary variable */
-       unsigned n;
-       uch *in, *out, ch;
-
-       in = window;
-       out = &output_data[output_ptr];
-       for (n = 0; n < outcnt; n++) {
-               ch = *out = *in;
-               out++;
-               in++;
-               c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
-       }
-       crc = c;
-       bytes_out += (ulg)outcnt;
-       output_ptr += (ulg)outcnt;
-       outcnt = 0;
-}
-
-static void error(char *x)
-{
-       puts("\n\n");
-       puts(x);
-       puts("\n\n -- System halted\n");
-
-       while (1);      /* Halt */
-}
-
-void setup_normal_output_buffer(void)
-{
-       output_data = (char *)KERNEL_LOAD_ADR;
-}
-
-void decompress_kernel(void)
-{
-       char revision;
-
-       /* input_data is set in head.S */
-       inbuf = input_data;
-
-#ifdef CONFIG_ETRAX_DEBUG_PORT0
-       *R_SERIAL0_XOFF = 0;
-       *R_SERIAL0_BAUD = 0x99;
-       *R_SERIAL0_TR_CTRL = 0x40;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT1
-       *R_SERIAL1_XOFF = 0;
-       *R_SERIAL1_BAUD = 0x99;
-       *R_SERIAL1_TR_CTRL = 0x40;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT2
-       *R_GEN_CONFIG = 0x08;
-       *R_SERIAL2_XOFF = 0;
-       *R_SERIAL2_BAUD = 0x99;
-       *R_SERIAL2_TR_CTRL = 0x40;
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT3
-       *R_GEN_CONFIG = 0x100;
-       *R_SERIAL3_XOFF = 0;
-       *R_SERIAL3_BAUD = 0x99;
-       *R_SERIAL3_TR_CTRL = 0x40;
-#endif
-
-       setup_normal_output_buffer();
-
-       makecrc();
-
-       __asm__ volatile ("move $vr,%0" : "=rm" (revision));
-       if (revision < 10) {
-               puts("You need an ETRAX 100LX to run linux 2.6\n");
-               while (1);
-       }
-
-       puts("Uncompressing Linux...\n");
-       gunzip();
-       puts("Done. Now booting the kernel.\n");
-}
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
deleted file mode 100644 (file)
index 82ab59b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Makefile for rescue (bootstrap) code
-#
-
-ccflags-y += -O2 $(LINUXINCLUDE)
-asflags-y += $(LINUXINCLUDE)
-ldflags-y += -T $(srctree)/$(src)/rescue.lds
-OBJCOPYFLAGS = -O binary --remove-section=.bss
-obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
-OBJECT := $(obj)/head.o
-
-targets := rescue.o rescue.bin
-
-$(obj)/rescue.o: $(OBJECT) FORCE
-       $(call if_changed,ld)
-
-$(obj)/rescue.bin: $(obj)/rescue.o FORCE
-       $(call if_changed,objcopy)
-       cp -p $(obj)/rescue.bin $(objtree)
-
-$(obj)/testrescue.bin: $(obj)/testrescue.o
-       $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
-# Pad it to 784 bytes
-       dd if=/dev/zero of=tmp2423 bs=1 count=784
-       cat tr.bin tmp2423 >testrescue_tmp.bin
-       dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
-       rm tr.bin tmp2423 testrescue_tmp.bin
-
-$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
-       $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
-# Pad it to 784 bytes, that's what the rescue loader expects
-       dd if=/dev/zero of=tmp2423 bs=1 count=784
-       cat ktr.bin tmp2423 >kimagerescue_tmp.bin
-       dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
-       rm ktr.bin tmp2423 kimagerescue_tmp.bin
diff --git a/arch/cris/arch-v10/boot/rescue/head.S b/arch/cris/arch-v10/boot/rescue/head.S
deleted file mode 100644 (file)
index fb503d1..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Rescue code, made to reside at the beginning of the
- * flash-memory. when it starts, it checks a partition
- * table at the first sector after the rescue sector.
- * the partition table was generated by the product builder
- * script and contains offsets, lengths, types and checksums
- * for each partition that this code should check.
- *
- * If any of the checksums fail, we assume the flash is so
- * corrupt that we cant use it to boot into the ftp flash
- * loader, and instead we initialize the serial port to
- * receive a flash-loader and new flash image. we dont include
- * any flash code here, but just accept a certain amount of
- * bytes from the serial port and jump into it. the downloaded
- * code is put in the cache.
- *
- * The partitiontable is designed so that it is transparent to
- * code execution - it has a relative branch opcode in the
- * beginning that jumps over it. each entry contains extra
- * data so we can add stuff later.
- *
- * Partition table format:
- *
- *     Code transparency:
- *
- *     2 bytes    [opcode 'nop']
- *     2 bytes    [opcode 'di']
- *     4 bytes    [opcode 'ba <offset>', 8-bit or 16-bit version]
- *     2 bytes    [opcode 'nop', delay slot]
- *
- *     Table validation (at +10):
- *
- *     2 bytes    [magic/version word for partitiontable - 0xef, 0xbe]
- *     2 bytes    [length of all entries plus the end marker]
- *     4 bytes    [checksum for the partitiontable itself]
- *
- *     Entries, each with the following format, last has offset -1:
- *
- *        4 bytes    [offset in bytes, from start of flash]
- *        4 bytes    [length in bytes of partition]
- *        4 bytes    [checksum, simple longword sum]
- *        2 bytes    [partition type]
- *        2 bytes    [flags, only bit 0 used, ro/rw = 1/0]
- *        16 bytes   [reserved for future use]
- *
- *     End marker
- *
- *        4 bytes    [-1]
- *
- *      10 bytes    [0, padding]
- *
- * Bit 0 in flags signifies RW or RO. The rescue code only bothers
- * to check the checksum for RO partitions, since the others will
- * change their data without updating the checksums. A 1 in bit 0
- * means RO, 0 means RW. That way, it is possible to set a partition
- * in RO mode initially, and later mark it as RW, since you can always
- * write 0's to the flash.
- *
- * During the wait for serial input, the status LED will flash so the
- * user knows something went wrong.
- *
- * Copyright (C) 1999-2007 Axis Communications AB
- */
-
-#ifdef CONFIG_ETRAX_AXISFLASHMAP
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
-       ;; The partitiontable is looked for at the first sector after the boot
-       ;; sector. Sector size is 65536 bytes in all flashes we use.
-
-#define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR
-#define PTABLE_MAGIC 0xbeef
-
-       ;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0.
-       ;; That is not where we put our downloaded serial boot-code.
-       ;; The length is enough for downloading code that loads the rest
-       ;; of itself (after having setup the DRAM etc).
-       ;; It is the same length as the on-chip ROM loads, so the same
-       ;; host loader can be used to load a rescued product as well as
-       ;; one booted through the Etrax serial boot code.
-
-#define CODE_START 0x40000000
-#define CODE_LENGTH 784
-
-#ifdef CONFIG_ETRAX_RESCUE_SER0
-#define SERXOFF R_SERIAL0_XOFF
-#define SERBAUD R_SERIAL0_BAUD
-#define SERRECC R_SERIAL0_REC_CTRL
-#define SERRDAT R_SERIAL0_REC_DATA
-#define SERSTAT R_SERIAL0_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER1
-#define SERXOFF R_SERIAL1_XOFF
-#define SERBAUD R_SERIAL1_BAUD
-#define SERRECC R_SERIAL1_REC_CTRL
-#define SERRDAT R_SERIAL1_REC_DATA
-#define SERSTAT R_SERIAL1_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER2
-#define SERXOFF R_SERIAL2_XOFF
-#define SERBAUD R_SERIAL2_BAUD
-#define SERRECC R_SERIAL2_REC_CTRL
-#define SERRDAT R_SERIAL2_REC_DATA
-#define SERSTAT R_SERIAL2_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER3
-#define SERXOFF R_SERIAL3_XOFF
-#define SERBAUD R_SERIAL3_BAUD
-#define SERRECC R_SERIAL3_REC_CTRL
-#define SERRDAT R_SERIAL3_REC_DATA
-#define SERSTAT R_SERIAL3_STATUS
-#endif
-
-#define NOP_DI 0xf025050f
-#define RAM_INIT_MAGIC 0x56902387
-
-       .text
-
-       ;; This is the entry point of the rescue code
-       ;; 0x80000000 if loaded in flash (as it should be)
-       ;; Since etrax actually starts at address 2 when booting from flash, we
-       ;; put a nop (2 bytes) here first so we dont accidentally skip the di
-
-       nop
-       di
-
-       jump    in_cache        ; enter cached area instead
-in_cache:
-
-
-       ;; First put a jump test to give a possibility of upgrading the
-       ;; rescue code without erasing/reflashing the sector.
-       ;; We put a longword of -1 here and if it is not -1, we jump using
-       ;; the value as jump target. Since we can always 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
-       beq     no_newjump
-       nop
-
-       jump    [$r0]
-
-jumptarget:
-       .dword  0xffffffff      ; can be overwritten later to insert new code
-
-no_newjump:
-#ifdef CONFIG_ETRAX_ETHERNET
-       ;; Start MII clock to make sure it is running when tranceiver is reset
-       move.d 0x3, $r0    ; enable = on, phy = mii_clk
-       move.d $r0, [R_NETWORK_GEN_CONFIG]
-#endif
-
-       ;; We need to setup the bus registers before we start using the DRAM
-#include "../../lib/dram_init.S"
-
-       ;; 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...
-       bne     do_rescue
-       nop
-
-       ;; skip the code transparency block (10 bytes).
-
-       addq    10, $r3
-
-       ;; check for correct magic
-
-       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
-       jsr     checksum        ; r1 source, r2 length, returns in r0
-
-       cmp.d   $r0, $r4
-       bne     do_rescue       ; didn't match - trig rescue
-       nop
-
-       ;; ptable is ok. validate each entry.
-
-       moveq   -1, $r7
-
-ploop: move.d  [$r3+], $r1     ; partition offset (from ptable start)
-       bne     notfirst        ; check if it is 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
-       ba      bosse
-       nop
-notfirst:
-       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
-       bpl     ploop           ;   rw partition, skip validation
-       nop
-       btstq   17, $r4         ; check bootable flag
-       bpl     1f
-       nop
-       move.d  $r1, $r7        ; remember boot partition offset
-1:
-       add.d   PTABLE_START, $r1
-
-       jsr     checksum        ; checksum the partition
-
-       cmp.d   $r0, $r5
-       beq     ploop           ; checksums matched, go to next entry
-       nop
-
-       ;; otherwise fall through to the rescue code.
-
-do_rescue:
-       ;; setup port PA and PB default initial directions and data
-       ;; (so we can flash LEDs, and so that DTR and others are set)
-
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
-       move.b  $r0, [R_PORT_PA_DIR]
-       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
-       move.b  $r0, [R_PORT_PA_DATA]
-
-       move.b  CONFIG_ETRAX_DEF_R_PORT_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]
-
-       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]
-
-       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
-#ifndef CONFIG_ETRAX_NO_LEDS
-#ifdef CONFIG_ETRAX_PA_LEDS
-       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
-#endif
-       move.d  (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
-       btstq   16, $r1
-       bpl     1f
-       nop
-       or.d    $r0, $r2        ; set bit
-       ba      2f
-       nop
-1:     not     $r0             ; clear bit
-       and.d   $r0, $r2
-2:
-#ifdef CONFIG_ETRAX_PA_LEDS
-       move.b  $r2, [R_PORT_PA_DATA]
-#endif
-#ifdef CONFIG_ETRAX_PB_LEDS
-       move.b  $r2, [R_PORT_PB_DATA]
-#endif
-#ifdef CONFIG_ETRAX_90000000_LEDS
-       move.b  $r2, [0x90000000]
-#endif
-#endif
-
-       ;; check if we got something on the serial port
-
-       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+]
-
-       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
-       jump    CODE_START
-
-flash_ok:
-       ;; check r7, which contains either -1 or the partition to boot from
-
-       cmp.d   -1, $r7
-       bne     1f
-       nop
-       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!
-
-
-       ;; Helper subroutines
-
-       ;; Will checksum by simple addition
-       ;; r1 - source
-       ;; r2 - length in bytes
-       ;; result will be in r0
-checksum:
-       moveq   0, $r0
-       moveq   CONFIG_ETRAX_FLASH1_SIZE, $r6
-
-       ;; If the first physical flash memory is exceeded wrap to the
-       ;; second one
-       btstq   26, $r1         ; Are we addressing first flash?
-       bpl     1f
-       nop
-       clear.d $r6
-
-1:     test.d  $r6             ; 0 = no wrapping
-       beq     2f
-       nop
-       lslq    20, $r6         ; Convert MB to bytes
-       sub.d   $r1, $r6
-
-2:     addu.b  [$r1+], $r0
-       subq    1, $r6          ; Flash memory left
-       beq     3f
-       subq    1, $r2          ; Length left
-       bne     2b
-       nop
-       ret
-       nop
-
-3:     move.d  MEM_CSE1_START, $r1 ; wrap to second flash
-       ba      2b
-       nop
-
-#endif
diff --git a/arch/cris/arch-v10/boot/rescue/kimagerescue.S b/arch/cris/arch-v10/boot/rescue/kimagerescue.S
deleted file mode 100644 (file)
index 6f7b3e6..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Rescue code to be prepended on a kimage and copied to the
- * rescue serial port.
- * This is called from the rescue code, it will copy received data to
- * 4004000 and after a timeout jump to it.
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
-#define CODE_START 0x40004000
-#define CODE_LENGTH 784
-#define TIMEOUT_VALUE 1000
-
-
-#ifdef CONFIG_ETRAX_RESCUE_SER0
-#define SERXOFF R_SERIAL0_XOFF
-#define SERBAUD R_SERIAL0_BAUD
-#define SERRECC R_SERIAL0_REC_CTRL
-#define SERRDAT R_SERIAL0_REC_DATA
-#define SERSTAT R_SERIAL0_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER1
-#define SERXOFF R_SERIAL1_XOFF
-#define SERBAUD R_SERIAL1_BAUD
-#define SERRECC R_SERIAL1_REC_CTRL
-#define SERRDAT R_SERIAL1_REC_DATA
-#define SERSTAT R_SERIAL1_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER2
-#define SERXOFF R_SERIAL2_XOFF
-#define SERBAUD R_SERIAL2_BAUD
-#define SERRECC R_SERIAL2_REC_CTRL
-#define SERRDAT R_SERIAL2_REC_DATA
-#define SERSTAT R_SERIAL2_STATUS
-#endif
-#ifdef CONFIG_ETRAX_RESCUE_SER3
-#define SERXOFF R_SERIAL3_XOFF
-#define SERBAUD R_SERIAL3_BAUD
-#define SERRECC R_SERIAL3_REC_CTRL
-#define SERRDAT R_SERIAL3_REC_DATA
-#define SERSTAT R_SERIAL3_STATUS
-#endif
-
-       .text
-       ;; This is the entry point of the rescue code
-       ;; 0x80000000 if loaded in flash (as it should be)
-       ;; since etrax actually starts at address 2 when booting from flash, we
-       ;; put a nop (2 bytes) here first so we dont accidentally skip the di
-
-       nop
-       di
-#ifndef CONFIG_SVINTO_SIM
-       ;; 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_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"
-
-#endif
-       ;; Setup the stack to a suitably high address.
-       ;; 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
-
-       ;; setup the serial port at 115200 baud
-
-       moveq   0, $r0
-       move.d  $r0, [SERXOFF]
-
-       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]
-
-
-       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
-       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
-#endif
-#ifdef CONFIG_ETRAX_PB_LEDS
-       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
-       bpl     1f
-       nop
-       or.d    $r0, $r2                ; set bit
-       ba      2f
-       nop
-1:     not     $r0                     ; clear bit
-       and.d   $r0, $r2
-2:
-#ifdef CONFIG_ETRAX_PA_LEDS
-       move.b  $r2, [R_PORT_PA_DATA]
-#endif
-#ifdef CONFIG_ETRAX_PB_LEDS
-       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
-       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
-       bne     wait_ser
-       nop
-jump_start:
-       ;; jump into downloaded code
-
-       jump    CODE_START
diff --git a/arch/cris/arch-v10/boot/rescue/rescue.lds b/arch/cris/arch-v10/boot/rescue/rescue.lds
deleted file mode 100644 (file)
index 0b52a94..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-MEMORY 
-       {
-       flash : ORIGIN = 0x00000000,
-               LENGTH = 0x00100000
-       }
-
-SECTIONS
-{
-       .text :
-       {
-               stext = . ;
-               *(.text)
-               etext = . ;
-       } > flash
-       .data :
-       {
-               *(.data)
-               edata = . ;
-       } > flash
-}
diff --git a/arch/cris/arch-v10/boot/rescue/testrescue.S b/arch/cris/arch-v10/boot/rescue/testrescue.S
deleted file mode 100644 (file)
index fc7ec67..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Simple testcode to download by the rescue block.
- * Just lights some LEDs to show it was downloaded correctly.
- *
- * Copyright (C) 1999 Axis Communications AB
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <arch/sv_addr_ag.h>
-
-       .text
-
-       nop
-       nop
-       moveq   -1, $r2
-       move.b  $r2, [R_PORT_PA_DIR]
-       moveq   0, $r2
-       move.b  $r2, [R_PORT_PA_DATA]
-
-endless:
-       nop
-       ba      endless
-       nop
-
diff --git a/arch/cris/arch-v10/boot/tools/build.c b/arch/cris/arch-v10/boot/tools/build.c
deleted file mode 100644 (file)
index c8adef3..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- *  linux/tools/build.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- */
-
-/*
- * This file builds a disk-image from three different files:
- *
- * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
- * - setup: 8086 machine code, sets up system parm
- * - system: 80386 code for actual system
- *
- * It does some checking that all files are of the correct type, and
- * just writes the result to stdout, removing headers and padding to
- * the right amount. It also writes some system data to stderr.
- */
-
-/*
- * Changes by tytso to allow root device specification
- * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
- * Cross compiling fixes by Gertjan van Wingerde, July 1996
- */
-
-#include <stdio.h>     /* fprintf */
-#include <string.h>
-#include <stdlib.h>    /* contains exit */
-#include <sys/types.h> /* unistd.h needs this */
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-#include <unistd.h>    /* contains read/write */
-#include <fcntl.h>
-#include <errno.h>
-
-#define MINIX_HEADER 32
-
-#define N_MAGIC_OFFSET 1024
-#ifndef __BFD__
-static int GCC_HEADER = sizeof(struct exec);
-#endif
-
-#ifdef __BIG_KERNEL__
-#define SYS_SIZE 0xffff
-#else
-#define SYS_SIZE DEF_SYSSIZE
-#endif
-
-#define DEFAULT_MAJOR_ROOT 0
-#define DEFAULT_MINOR_ROOT 0
-
-/* max nr of sectors of setup: don't change unless you also change
- * bootsect etc */
-#define SETUP_SECTS 4
-
-#define STRINGIFY(x) #x
-
-typedef union {
-       int i;
-       long l;
-       short s[2];
-       char b[4];
-} conv;
-
-long intel_long(long l)
-{
-       conv t;
-
-       t.b[0] = l & 0xff; l >>= 8;
-       t.b[1] = l & 0xff; l >>= 8;
-       t.b[2] = l & 0xff; l >>= 8;
-       t.b[3] = l & 0xff; l >>= 8;
-       return t.l;
-}
-
-int intel_int(int i)
-{
-       conv t;
-
-       t.b[0] = i & 0xff; i >>= 8;
-        t.b[1] = i & 0xff; i >>= 8;
-        t.b[2] = i & 0xff; i >>= 8;
-        t.b[3] = i & 0xff; i >>= 8;
-        return t.i;
-}
-
-short intel_short(short l)
-{
-       conv t;
-
-       t.b[0] = l & 0xff; l >>= 8;
-       t.b[1] = l & 0xff; l >>= 8;
-       return t.s[0];
-}
-
-void die(const char * str)
-{
-       fprintf(stderr,"%s\n",str);
-       exit(1);
-}
-
-void usage(void)
-{
-       die("Usage: build bootsect setup system [rootdev] [> image]");
-}
-
-int main(int argc, char ** argv)
-{
-       int i,c,id,sz,tmp_int;
-       unsigned long sys_size, tmp_long;
-       char buf[1024];
-#ifndef __BFD__
-       struct exec *ex = (struct exec *)buf;
-#endif
-       char major_root, minor_root;
-       struct stat sb;
-       unsigned char setup_sectors;
-
-       if ((argc < 4) || (argc > 5))
-               usage();
-       if (argc > 4) {
-               if (!strcmp(argv[4], "CURRENT")) {
-                       if (stat("/", &sb)) {
-                               perror("/");
-                               die("Couldn't stat /");
-                       }
-                       major_root = major(sb.st_dev);
-                       minor_root = minor(sb.st_dev);
-               } else if (strcmp(argv[4], "FLOPPY")) {
-                       if (stat(argv[4], &sb)) {
-                               perror(argv[4]);
-                               die("Couldn't stat root device.");
-                       }
-                       major_root = major(sb.st_rdev);
-                       minor_root = minor(sb.st_rdev);
-               } else {
-                       major_root = 0;
-                       minor_root = 0;
-               }
-       } else {
-               major_root = DEFAULT_MAJOR_ROOT;
-               minor_root = DEFAULT_MINOR_ROOT;
-       }
-       fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
-       for (i=0;i<sizeof buf; i++) buf[i]=0;
-       if ((id=open(argv[1],O_RDONLY,0))<0)
-               die("Unable to open 'boot'");
-       if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
-               die("Unable to read header of 'boot'");
-       if (((long *) buf)[0]!=intel_long(0x04100301))
-               die("Non-Minix header of 'boot'");
-       if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
-               die("Non-Minix header of 'boot'");
-       if (((long *) buf)[3] != 0)
-               die("Illegal data segment in 'boot'");
-       if (((long *) buf)[4] != 0)
-               die("Illegal bss in 'boot'");
-       if (((long *) buf)[5] != 0)
-               die("Non-Minix header of 'boot'");
-       if (((long *) buf)[7] != 0)
-               die("Illegal symbol table in 'boot'");
-       i=read(id,buf,sizeof buf);
-       fprintf(stderr,"Boot sector %d bytes.\n",i);
-       if (i != 512)
-               die("Boot block must be exactly 512 bytes");
-       if ((*(unsigned short *)(buf+510)) != (unsigned short)intel_short(0xAA55))
-               die("Boot block hasn't got boot flag (0xAA55)");
-       buf[508] = (char) minor_root;
-       buf[509] = (char) major_root;   
-       i=write(1,buf,512);
-       if (i!=512)
-               die("Write call failed");
-       close (id);
-       
-       if ((id=open(argv[2],O_RDONLY,0))<0)
-               die("Unable to open 'setup'");
-       if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
-               die("Unable to read header of 'setup'");
-       if (((long *) buf)[0]!=intel_long(0x04100301))
-               die("Non-Minix header of 'setup'");
-       if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
-               die("Non-Minix header of 'setup'");
-       if (((long *) buf)[3] != 0)
-               die("Illegal data segment in 'setup'");
-       if (((long *) buf)[4] != 0)
-               die("Illegal bss in 'setup'");
-       if (((long *) buf)[5] != 0)
-               die("Non-Minix header of 'setup'");
-       if (((long *) buf)[7] != 0)
-               die("Illegal symbol table in 'setup'");
-       for (i=0 ; (c=read(id,buf,sizeof buf))>0 ; i+=c )
-#ifdef __BIG_KERNEL__
-       {
-               if (!i) {
-                       /* Working with memcpy because of alignment constraints
-                          on Sparc - Gertjan */
-                       memcpy(&tmp_long, &buf[2], sizeof(long));
-                       if (tmp_long != intel_long(0x53726448) )
-                               die("Wrong magic in loader header of 'setup'");
-                       memcpy(&tmp_int, &buf[6], sizeof(int));
-                       if (tmp_int < intel_int(0x200))
-                               die("Wrong version of loader header of 'setup'");
-                       buf[0x11] = 1; /* LOADED_HIGH */
-                       tmp_long = intel_long(0x100000);
-                       memcpy(&buf[0x14], &tmp_long, sizeof(long));  /* code32_start */
-               }
-#endif
-               if (write(1,buf,c)!=c)
-                       die("Write call failed");
-#ifdef __BIG_KERNEL__
-       }
-#endif
-       if (c != 0)
-               die("read-error on 'setup'");
-       close (id);
-       setup_sectors = (unsigned char)((i + 511) / 512);
-       /* for compatibility with LILO */
-       if (setup_sectors < SETUP_SECTS)
-               setup_sectors = SETUP_SECTS;
-       fprintf(stderr,"Setup is %d bytes.\n",i);
-       for (c=0 ; c<sizeof(buf) ; c++)
-               buf[c] = '\0';
-       while (i < setup_sectors * 512) {
-               c = setup_sectors * 512 - i;
-               if (c > sizeof(buf))
-                       c = sizeof(buf);
-               if (write(1,buf,c) != c)
-                       die("Write call failed");
-               i += c;
-       }
-       
-       if ((id=open(argv[3],O_RDONLY,0))<0)
-               die("Unable to open 'system'");
-#ifndef __BFD__
-       if (read(id,buf,GCC_HEADER) != GCC_HEADER)
-               die("Unable to read header of 'system'");
-       if (N_MAGIC(*ex) == ZMAGIC) {
-               GCC_HEADER = N_MAGIC_OFFSET;
-               lseek(id, GCC_HEADER, SEEK_SET);
-       } else if (N_MAGIC(*ex) != QMAGIC)
-               die("Non-GCC header of 'system'");
-       fprintf(stderr,"System is %d kB (%d kB code, %d kB data and %d kB bss)\n",
-               (ex->a_text+ex->a_data+ex->a_bss)/1024,
-               ex->a_text /1024,
-               ex->a_data /1024,
-               ex->a_bss  /1024);
-       sz = N_SYMOFF(*ex) - GCC_HEADER + 4;
-#else
-       if (fstat (id, &sb)) {
-         perror ("fstat");
-         die ("Unable to stat 'system'");
-       }
-       sz = sb.st_size;
-       fprintf (stderr, "System is %d kB\n", sz/1024);
-#endif
-       sys_size = (sz + 15) / 16;
-       if (sys_size > SYS_SIZE)
-               die("System is too big");
-       while (sz > 0) {
-               int l, n;
-
-               l = sz;
-               if (l > sizeof(buf))
-                       l = sizeof(buf);
-               if ((n=read(id, buf, l)) != l) {
-                       if (n == -1) 
-                               perror(argv[1]);
-                       else
-                               fprintf(stderr, "Unexpected EOF\n");
-                       die("Can't read 'system'");
-               }
-               if (write(1, buf, l) != l)
-                       die("Write failed");
-               sz -= l;
-       }
-       close(id);
-       if (lseek(1, 497, 0) == 497) {
-               if (write(1, &setup_sectors, 1) != 1)
-                       die("Write of setup sectors failed");
-       }
-       if (lseek(1,500,0) == 500) {
-               buf[0] = (sys_size & 0xff);
-               buf[1] = ((sys_size >> 8) & 0xff);
-               if (write(1, buf, 2) != 2)
-                       die("Write failed");
-       }
-       return(0);
-}
index 72f5cd319b975802abb94eae94e2e0b7b4326a23..2c18d08cd9131fc3f290e4f2c3f885075c031bad 100644 (file)
@@ -536,10 +536,10 @@ multiple_interrupt:
        movem   $r13, [$sp]
        push    $r10            ; push orig_r10
        clear.d [$sp=$sp-4]     ; frametype == 0, normal frame
-       
+
        move.d  $sp, $r10
        jsr     do_multiple_IRQ
-       
+
        jump    ret_from_intr
 
 do_sigtrap:
@@ -585,7 +585,7 @@ _ugdb_handle_breakpoint:
        pop     $r0                     ; Restore r0. 
        ba      do_sigtrap              ; SIGTRAP the offending process. 
        pop     $dccr                   ; Restore dccr in delay slot.
-       
+
        .global kernel_execve
 kernel_execve:
        move.d __NR_execve, $r9
@@ -929,6 +929,14 @@ sys_call_table:
        .long sys_fallocate
        .long sys_timerfd_settime       /* 325 */
        .long sys_timerfd_gettime
+       .long sys_signalfd4
+       .long sys_eventfd2
+       .long sys_epoll_create1
+       .long sys_dup3                  /* 330 */
+       .long sys_pipe2
+       .long sys_inotify_init1
+       .long sys_preadv
+       .long sys_pwritev
 
         /*
          * NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v32/boot/Makefile b/arch/cris/arch-v32/boot/Makefile
deleted file mode 100644 (file)
index 99896ad..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# arch/cris/arch-v32/boot/Makefile
-#
-
-OBJCOPYFLAGS = -O binary -R .note -R .comment
-
-subdir- := compressed rescue
-targets := Image
-
-$(obj)/Image: vmlinux FORCE
-       $(call if_changed,objcopy)
-       @echo '  Kernel: $@ is ready'
-
-$(obj)/compressed/vmlinux: $(obj)/Image FORCE
-       $(Q)$(MAKE) $(build)=$(obj)/compressed $@
-       $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
-
-$(obj)/zImage:  $(obj)/compressed/vmlinux
-       @cp $< $@
-       @echo '  Kernel: $@ is ready'
diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
deleted file mode 100644 (file)
index e176b8b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# arch/cris/arch-v32/boot/compressed/Makefile
-#
-
-asflags-y += -I$(srctree)/include/asm/mach/ -I$(srctree)/include/asm/arch
-ccflags-y += -O2 -I$(srctree)/include/asm/mach/ -I$(srctree)/include/asm/arch
-ldflags-y += -T$(srctree)/$(src)/decompress.lds
-OBJECTS = $(obj)/head.o $(obj)/misc.o
-OBJCOPYFLAGS = -O binary --remove-section=.bss
-
-quiet_cmd_image = BUILD   $@
-cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
-
-targets := vmlinux piggy.gz decompress.o decompress.bin
-
-$(obj)/decompress.o: $(OBJECTS) FORCE
-       $(call if_changed,ld)
-
-$(obj)/decompress.bin: $(obj)/decompress.o FORCE
-       $(call if_changed,objcopy)
-
-$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
-       $(call if_changed,image)
-
-$(obj)/piggy.gz: $(obj)/../Image FORCE
-       $(call if_changed,gzip)
diff --git a/arch/cris/arch-v32/boot/compressed/README b/arch/cris/arch-v32/boot/compressed/README
deleted file mode 100644 (file)
index 182c5d7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-Creation of the self-extracting compressed kernel image (vmlinuz)
------------------------------------------------------------------
-
-This can be slightly confusing because it's a process with many steps.
-
-The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
-by that makefile into text and data binary files, vmlinux.text and
-vmlinux.data.
-
-Those files together with a ROM filesystem can be catted together and
-burned into a flash or executed directly at the DRAM origin.
-
-They can also be catted together and compressed with gzip, which is what
-happens in this makefile. Together they make up piggy.img.
-
-The decompressor is built into the file decompress.o. It is turned into
-the binary file decompress.bin, which is catted together with piggy.img
-into the file vmlinuz. It can be executed in an arbitrary place in flash.
-
-Be careful - it assumes some things about free locations in DRAM. It
-assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
-so it puts its code at 0x40700000, and initial stack at 0x40800000.
-
--Bjorn
diff --git a/arch/cris/arch-v32/boot/compressed/decompress.lds b/arch/cris/arch-v32/boot/compressed/decompress.lds
deleted file mode 100644 (file)
index 3c837fe..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*#OUTPUT_FORMAT(elf32-us-cris) */
-OUTPUT_ARCH (crisv32)
-
-MEMORY
-       {
-       dram : ORIGIN = 0x40700000,
-              LENGTH = 0x00100000
-       }
-
-SECTIONS
-{
-       .text :
-       {
-               _stext = . ;
-               *(.text)
-               *(.rodata)
-               *(.rodata.*)
-               _etext = . ;
-       } > dram
-       .data :
-       {
-               *(.data)
-               _edata = . ;
-       } > dram
-       .bss :
-       {
-               *(.bss)
-               _end = ALIGN( 0x10 ) ;
-       } > dram
-}
diff --git a/arch/cris/arch-v32/boot/compressed/head.S b/arch/cris/arch-v32/boot/compressed/head.S
deleted file mode 100644 (file)
index a4a65c5..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *  Code that sets up the DRAM registers, calls the
- *  decompressor to unpack the piggybacked kernel, and jumps.
- *
- *  Copyright (C) 1999 - 2006, Axis Communications AB
- */
-
-#define ASSEMBLER_MACROS_ONLY
-#include <hwregs/asm/reg_map_asm.h>
-#include <mach/startup.inc>
-
-#define RAM_INIT_MAGIC 0x56902387
-#define COMMAND_LINE_MAGIC 0x87109563
-
-       ;; Exported symbols
-
-       .globl  input_data
-
-       .text
-_start:
-       di
-
-       ;; Start clocks for used blocks.
-       START_CLOCKS
-
-       ;; Initialize the DRAM registers.
-       cmp.d   RAM_INIT_MAGIC, $r8     ; Already initialized?
-       beq     dram_init_finished
-       nop
-
-#if defined CONFIG_ETRAXFS
-#include "../../mach-fs/dram_init.S"
-#elif defined CONFIG_CRIS_MACH_ARTPEC3
-#include "../../mach-a3/dram_init.S"
-#else
-#error Only ETRAXFS and ARTPEC-3 supported!
-#endif
-
-dram_init_finished:
-
-       GIO_INIT
-       ;; Setup the stack to a suitably high address.
-       ;; We assume 8 MB is the minimum DRAM and put
-       ;; the SP at the top for now.
-
-       move.d  0x40800000, $sp
-
-       ;; Figure out where the compressed piggyback image is.
-       ;; It is either in [NOR] flash (we don't want to copy it
-       ;; to DRAM before unpacking), or copied to DRAM
-       ;; by the [NAND] flash boot loader.
-       ;; The piggyback image is at _edata, but relative to where the
-       ;; image is actually located in memory, not where it is linked
-       ;; (the decompressor is linked at 0x40700000+ and runs there).
-       ;; Use (_edata - herami) as offset to the current PC.
-
-hereami:
-       lapcq   ., $r5          ; get PC
-       and.d   0x7fffffff, $r5 ; strip any non-cache bit
-       move.d  $r5, $r0        ; source address of 'herami'
-       add.d   _edata, $r5
-       sub.d   hereami, $r5    ; r5 = flash address of '_edata'
-       move.d  hereami, $r1    ; destination
-
-       ;; Copy text+data to DRAM
-
-       move.d  _edata, $r2     ; end destination
-1:     move.w  [$r0+], $r3     ; from herami+ source
-       move.w  $r3, [$r1+]     ; to hereami+ destination (linked address)
-       cmp.d   $r2, $r1        ; finish when destination == _edata
-       bcs     1b
-       nop
-       move.d  input_data, $r0 ; for the decompressor
-       move.d  $r5, [$r0]      ; for the decompressor
-
-       ;; Clear the decompressors BSS (between _edata and _end)
-
-       moveq   0, $r0
-       move.d  _edata, $r1
-       move.d  _end, $r2
-1:     move.w  $r0, [$r1+]
-       cmp.d   $r2, $r1
-       bcs     1b
-       nop
-
-       ;;  Save command line magic and address.
-       move.d  _cmd_line_magic, $r0
-       move.d  $r10, [$r0]
-       move.d  _cmd_line_addr, $r0
-       move.d  $r11, [$r0]
-
-       ;;  Save boot source indicator
-       move.d  _boot_source, $r0
-       move.d  $r12, [$r0]
-
-       ;; Do the decompression and save compressed size in _inptr
-
-       jsr     decompress_kernel
-       nop
-
-       ;; Restore boot source indicator
-       move.d  _boot_source, $r12
-       move.d  [$r12], $r12
-
-       ;; Restore command line magic and address.
-       move.d  _cmd_line_magic, $r10
-       move.d  [$r10], $r10
-       move.d  _cmd_line_addr, $r11
-       move.d  [$r11], $r11
-
-       ;; Put start address of root partition in r9 so the kernel can use it
-       ;; when mounting from flash
-       move.d  input_data, $r0
-       move.d  [$r0], $r9              ; flash address of compressed kernel
-       move.d  inptr, $r0
-       add.d   [$r0], $r9              ; size of compressed kernel
-       cmp.d   0x40000000, $r9         ; image in DRAM ?
-       blo     enter_kernel            ; no, must be [NOR] flash, jump
-       nop                             ; delay slot
-       and.d   0x001fffff, $r9         ; assume compressed kernel was < 2M
-
-enter_kernel:
-       ;; Enter the decompressed kernel
-       move.d  RAM_INIT_MAGIC, $r8     ; Tell kernel that DRAM is initialized
-       jump    0x40004000      ; kernel is linked to this address
-       nop
-
-       .data
-
-input_data:
-       .dword  0               ; used by the decompressor
-_cmd_line_magic:
-       .dword 0
-_cmd_line_addr:
-       .dword 0
-_boot_source:
-       .dword 0
-
-#if defined CONFIG_ETRAXFS
-#include "../../mach-fs/hw_settings.S"
-#elif defined CONFIG_CRIS_MACH_ARTPEC3
-#include "../../mach-a3/hw_settings.S"
-#else
-#error Only ETRAXFS and ARTPEC-3 supported!
-#endif
diff --git a/arch/cris/arch-v32/boot/compressed/misc.c b/arch/cris/arch-v32/boot/compressed/misc.c
deleted file mode 100644 (file)
index 3595e16..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * misc.c
- *
- * This is a collection of several routines from gzip-1.0.3
- * adapted for Linux.
- *
- * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
- * puts by Nick Holloway 1993, better puts by Martin Mares 1995
- * adaptation for Linux/CRIS Axis Communications AB, 1999
- *
- */
-
-/* where the piggybacked kernel image expects itself to live.
- * it is the same address we use when we network load an uncompressed
- * image into DRAM, and it is the address the kernel is linked to live
- * at by vmlinux.lds.S
- */
-
-#define KERNEL_LOAD_ADR 0x40004000
-
-
-#include <linux/types.h>
-#include <hwregs/reg_rdwr.h>
-#include <hwregs/reg_map.h>
-#include <hwregs/ser_defs.h>
-#include <hwregs/pinmux_defs.h>
-#ifdef CONFIG_CRIS_MACH_ARTPEC3
-#include <hwregs/clkgen_defs.h>
-#endif
-
-/*
- * gzip declarations
- */
-
-#define OF(args)  args
-#define STATIC static
-
-void* memset(void* s, int c, size_t n);
-void* memcpy(void* __dest, __const void* __src,
-            size_t __n);
-
-#define memzero(s, n)     memset ((s), 0, (n))
-
-
-typedef unsigned char  uch;
-typedef unsigned short ush;
-typedef unsigned long  ulg;
-
-#define WSIZE 0x8000           /* Window size must be at least 32k, */
-                               /* and a power of two */
-
-static uch *inbuf;          /* input buffer */
-static uch window[WSIZE];    /* Sliding window buffer */
-
-unsigned inptr = 0;    /* index of next byte to be processed in inbuf
-                        * After decompression it will contain the
-                        * compressed size, and head.S will read it.
-                        */
-
-static unsigned outcnt = 0;  /* bytes in output buffer */
-
-/* gzip flag byte */
-#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
-#define COMMENT      0x10 /* bit 4 set: file comment present */
-#define ENCRYPTED    0x20 /* bit 5 set: file is encrypted */
-#define RESERVED     0xC0 /* bit 6,7:   reserved */
-
-#define get_byte() inbuf[inptr++]
-
-/* Diagnostic functions */
-#ifdef DEBUG
-#  define Assert(cond,msg) {if(!(cond)) error(msg);}
-#  define Trace(x) fprintf x
-#  define Tracev(x) {if (verbose) fprintf x ;}
-#  define Tracevv(x) {if (verbose>1) fprintf x ;}
-#  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
-#  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
-#else
-#  define Assert(cond,msg)
-#  define Trace(x)
-#  define Tracev(x)
-#  define Tracevv(x)
-#  define Tracec(c,x)
-#  define Tracecv(c,x)
-#endif
-
-static void flush_window(void);
-static void error(char *m);
-
-extern char *input_data;  /* lives in head.S */
-
-static long bytes_out;
-static uch *output_data;
-static unsigned long output_ptr;
-
-static void error(char *m);
-
-static void puts(const char *);
-
-/* the "heap" is put directly after the BSS ends, at end */
-
-extern int _end;
-static long free_mem_ptr = (long)&_end;
-static long free_mem_end_ptr;
-
-#include "../../../../../lib/inflate.c"
-
-/* decompressor info and error messages to serial console */
-
-static inline void
-serout(const char *s, reg_scope_instances regi_ser)
-{
-       reg_ser_rs_stat_din rs;
-       reg_ser_rw_dout dout = {.data = *s};
-
-       do {
-               rs = REG_RD(ser, regi_ser, rs_stat_din);
-       }
-       while (!rs.tr_rdy);/* Wait for transceiver. */
-
-       REG_WR(ser, regi_ser, rw_dout, dout);
-}
-
-static void
-puts(const char *s)
-{
-#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
-       while (*s) {
-#ifdef CONFIG_ETRAX_DEBUG_PORT0
-               serout(s, regi_ser0);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT1
-               serout(s, regi_ser1);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT2
-               serout(s, regi_ser2);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT3
-               serout(s, regi_ser3);
-#endif
-               *s++;
-       }
-/* CONFIG_ETRAX_DEBUG_PORT_NULL */
-#endif
-}
-
-void*
-memset(void* s, int c, size_t n)
-{
-       int i;
-       char *ss = (char*)s;
-
-       for (i=0;i<n;i++) ss[i] = c;
-
-       return s;
-}
-
-void*
-memcpy(void* __dest, __const void* __src,
-                           size_t __n)
-{
-       int i;
-       char *d = (char *)__dest, *s = (char *)__src;
-
-       for (i=0;i<__n;i++) d[i] = s[i];
-
-       return __dest;
-}
-
-/* ===========================================================================
- * Write the output window window[0..outcnt-1] and update crc and bytes_out.
- * (Used for the decompressed data only.)
- */
-
-static void
-flush_window()
-{
-    ulg c = crc;         /* temporary variable */
-    unsigned n;
-    uch *in, *out, ch;
-
-    in = window;
-    out = &output_data[output_ptr];
-    for (n = 0; n < outcnt; n++) {
-           ch = *out++ = *in++;
-           c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
-    }
-    crc = c;
-    bytes_out += (ulg)outcnt;
-    output_ptr += (ulg)outcnt;
-    outcnt = 0;
-}
-
-static void
-error(char *x)
-{
-       puts("\r\n\n");
-       puts(x);
-       puts("\r\n\n -- System halted\n");
-
-       while(1);       /* Halt */
-}
-
-void
-setup_normal_output_buffer(void)
-{
-       output_data = (char *)KERNEL_LOAD_ADR;
-}
-
-static inline void
-serial_setup(reg_scope_instances regi_ser)
-{
-       reg_ser_rw_xoff xoff;
-       reg_ser_rw_tr_ctrl tr_ctrl;
-       reg_ser_rw_rec_ctrl rec_ctrl;
-       reg_ser_rw_tr_baud_div tr_baud;
-       reg_ser_rw_rec_baud_div rec_baud;
-
-       /* Turn off XOFF. */
-       xoff = REG_RD(ser, regi_ser, rw_xoff);
-
-       xoff.chr = 0;
-       xoff.automatic = regk_ser_no;
-
-       REG_WR(ser, regi_ser, rw_xoff, xoff);
-
-       /* Set baudrate and stopbits. */
-       tr_ctrl = REG_RD(ser, regi_ser, rw_tr_ctrl);
-       rec_ctrl = REG_RD(ser, regi_ser, rw_rec_ctrl);
-       tr_baud = REG_RD(ser, regi_ser, rw_tr_baud_div);
-       rec_baud = REG_RD(ser, regi_ser, rw_rec_baud_div);
-
-       tr_ctrl.stop_bits = 1;  /* 2 stop bits. */
-       tr_ctrl.en = 1; /* enable transmitter */
-       rec_ctrl.en = 1; /* enabler receiver */
-
-       /*
-        * The baudrate setup used to be a bit fishy, but now transmitter and
-        * receiver are both set to the intended baud rate, 115200.
-        * The magic value is 29.493 MHz.
-        */
-       tr_ctrl.base_freq = regk_ser_f29_493;
-       rec_ctrl.base_freq = regk_ser_f29_493;
-       tr_baud.div = (29493000 / 8) / 115200;
-       rec_baud.div = (29493000 / 8) / 115200;
-
-       REG_WR(ser, regi_ser, rw_tr_ctrl, tr_ctrl);
-       REG_WR(ser, regi_ser, rw_tr_baud_div, tr_baud);
-       REG_WR(ser, regi_ser, rw_rec_ctrl, rec_ctrl);
-       REG_WR(ser, regi_ser, rw_rec_baud_div, rec_baud);
-}
-
-void
-decompress_kernel(void)
-{
-       char revision;
-
-#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
-    defined(CONFIG_ETRAX_DEBUG_PORT2) || \
-    defined(CONFIG_ETRAX_DEBUG_PORT3)
-       reg_pinmux_rw_hwprot hwprot;
-
-#ifdef CONFIG_CRIS_MACH_ARTPEC3
-       reg_clkgen_rw_clk_ctrl clk_ctrl;
-
-       /* Enable corresponding clock region when serial 1..3 selected */
-
-       clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl);
-       clk_ctrl.sser_ser_dma6_7 = regk_clkgen_yes;
-       REG_WR(clkgen, regi_clkgen, rw_clk_ctrl, clk_ctrl);
-#endif
-
-       /* pinmux setup for ports 1..3 */
-       hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
-#endif
-
-#ifdef CONFIG_ETRAX_DEBUG_PORT0
-       serial_setup(regi_ser0);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT1
-       hwprot.ser1 = regk_pinmux_yes;
-       serial_setup(regi_ser1);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT2
-       hwprot.ser2 = regk_pinmux_yes;
-       serial_setup(regi_ser2);
-#endif
-#ifdef CONFIG_ETRAX_DEBUG_PORT3
-       hwprot.ser3 = regk_pinmux_yes;
-       serial_setup(regi_ser3);
-#endif
-#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
-    defined(CONFIG_ETRAX_DEBUG_PORT2) || \
-    defined(CONFIG_ETRAX_DEBUG_PORT3)
-       REG_WR(pinmux, regi_pinmux, rw_hwprot, hwprot);
-#endif
-
-       /* input_data is set in head.S */
-       inbuf = input_data;
-
-       setup_normal_output_buffer();
-
-       makecrc();
-
-       __asm__ volatile ("move $vr,%0" : "=rm" (revision));
-       if (revision < 32)
-       {
-               puts("You need an ETRAX FS to run Linux 2.6/crisv32.\r\n");
-               while(1);
-       }
-
-       puts("Uncompressing Linux...\r\n");
-       gunzip();
-       puts("Done. Now booting the kernel.\r\n");
-}
diff --git a/arch/cris/arch-v32/boot/rescue/Makefile b/arch/cris/arch-v32/boot/rescue/Makefile
deleted file mode 100644 (file)
index 566aac6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Makefile for rescue (bootstrap) code
-#
-
-CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
-ccflags-y += -O2 -I $(srctree)/include/asm/arch/mach/ \
-               -I $(srctree)/include/asm/arch
-asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
-LD = gcc-cris -mlinux -march=v32 -nostdlib
-ldflags-y += -T $(srctree)/$(src)/rescue.lds
-LDPOSTFLAGS = -lgcc
-OBJCOPYFLAGS = -O binary --remove-section=.bss
-obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
-OBJECT := $(obj)/head.o
-
-targets := rescue.o rescue.bin
-
-quiet_cmd_ldlibgcc = LD      $@
-cmd_ldlibgcc = $(LD) $(LDFLAGS) $(filter-out FORCE,$^) $(LDPOSTFLAGS) -o $@
-
-$(obj)/rescue.o: $(OBJECTS) FORCE
-       $(call if_changed,ldlibgcc)
-
-$(obj)/rescue.bin: $(obj)/rescue.o FORCE
-       $(call if_changed,objcopy)
-       cp -p $(obj)/rescue.bin $(objtree)
diff --git a/arch/cris/arch-v32/boot/rescue/head.S b/arch/cris/arch-v32/boot/rescue/head.S
deleted file mode 100644 (file)
index 5f846b7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Just get started by jumping to CONFIG_ETRAX_PTABLE_SECTOR to start
- * kernel decompressor.
- *
- * In practice, this only works for NOR flash (or some convoluted RAM boot)
- * and hence is not really useful for Artpec-3, so it's Etrax FS / NOR only.
- *
- */
-
-#include <mach/startup.inc>
-
-#ifdef CONFIG_ETRAX_AXISFLASHMAP
-
-;; Code
-
-       .text
-start:
-
-       ;; Start clocks for used blocks.
-       START_CLOCKS
-
-       move.d  CONFIG_ETRAX_PTABLE_SECTOR, $r10
-       jump    $r10                    ; Jump to decompressor
-       nop
-
-#endif
diff --git a/arch/cris/arch-v32/boot/rescue/rescue.lds b/arch/cris/arch-v32/boot/rescue/rescue.lds
deleted file mode 100644 (file)
index 8ac646b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*#OUTPUT_FORMAT(elf32-us-cris) */
-OUTPUT_ARCH (crisv32)
-/* Now that NAND support has been stripped, this file could be simplified,
- * but it doesn't do any harm on the other hand so why bother. */
-
-MEMORY
-       {
-       bootblk : ORIGIN = 0x38000000,
-                 LENGTH = 0x00004000
-       intmem  : ORIGIN = 0x38004000,
-                 LENGTH = 0x00005000
-       }
-
-SECTIONS
-{
-       .text :
-       {
-               _stext = . ;
-               *(.text)
-               *(.init.text)
-               *(.rodata)
-               *(.rodata.*)
-               _etext = . ;
-       } > bootblk
-       .data :
-       {
-               *(.data)
-               _edata = . ;
-       } > bootblk
-       .bss :
-       {
-               _bss = . ;
-               *(.bss)
-               _end = ALIGN( 0x10 ) ;
-       } > intmem
-
-       /* Get rid of stuff from EXPORT_SYMBOL(foo). */
-       /DISCARD/ :
-       {
-               *(__ksymtab_strings)
-               *(__ksymtab)
-       }
-}
index 7a87bc0ae2e83858efbbb2cf9830171935e8fb71..97357cfd17bbc90a0f72da1f732d00c47af67079 100644 (file)
@@ -681,7 +681,7 @@ static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
                shadow |= ~readl(dir_oe[priv->minor]) |
                        (arg & changeable_bits[priv->minor]);
                i2c_write(VIRT_I2C_ADDR, (void *)&shadow, sizeof(shadow));
-               spin_lock_irqrestore(&gpio_lock, flags);
+               spin_unlock_irqrestore(&gpio_lock, flags);
                break;
        case IO_CLRBITS:
                spin_lock_irqsave(&gpio_lock, flags);
@@ -690,7 +690,7 @@ static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
                shadow |= ~readl(dir_oe[priv->minor]) &
                        ~(arg & changeable_bits[priv->minor]);
                i2c_write(VIRT_I2C_ADDR, (void *)&shadow, sizeof(shadow));
-               spin_lock_irqrestore(&gpio_lock, flags);
+               spin_unlock_irqrestore(&gpio_lock, flags);
                break;
        case IO_HIGHALARM:
                /* Set alarm when bits with 1 in arg go high. */
index 993d987b007899cb210589074535baf7b1dd4ee9..40358355d0cbb96e8c61339605845f2ba06c4f6c 100644 (file)
@@ -9,8 +9,6 @@ obj-y   := entry.o traps.o irq.o debugport.o \
           process.o ptrace.o setup.o signal.o traps.o time.o \
           cache.o cacheflush.o
 
-obj-$(CONFIG_ETRAXFS_SIM) += vcs_hook.o
-
 obj-$(CONFIG_SMP) += smp.o
 obj-$(CONFIG_ETRAX_KGDB) += kgdb.o kgdb_asm.o
 obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o
index 5e674c8f7c513348006be197758f082ec1bb19ce..435b9671bd4b75b4a92884fc008a05171672c1db 100644 (file)
@@ -852,6 +852,14 @@ sys_call_table:
        .long sys_fallocate
        .long sys_timerfd_settime       /* 325 */
        .long sys_timerfd_gettime
+       .long sys_signalfd4
+       .long sys_eventfd2
+       .long sys_epoll_create1
+       .long sys_dup3                  /* 330 */
+       .long sys_pipe2
+       .long sys_inotify_init1
+       .long sys_preadv
+       .long sys_pwritev
 
         /*
          * NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/boot/.gitignore b/arch/cris/boot/.gitignore
new file mode 100644 (file)
index 0000000..171a085
--- /dev/null
@@ -0,0 +1,2 @@
+Image
+zImage
diff --git a/arch/cris/boot/Makefile b/arch/cris/boot/Makefile
new file mode 100644 (file)
index 0000000..144f3af
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# arch/cris/boot/Makefile
+#
+
+objcopyflags-$(CONFIG_ETRAX_ARCH_V10) += -R .note -R .comment
+objcopyflags-$(CONFIG_ETRAX_ARCH_V32) += --remove-section=.bss
+
+OBJCOPYFLAGS = -O binary $(objcopyflags-y)
+
+
+subdir- := compressed rescue
+targets := Image
+
+$(obj)/Image: vmlinux FORCE
+       $(call if_changed,objcopy)
+       @echo '  Kernel: $@ is ready'
+
+$(obj)/compressed/vmlinux: $(obj)/Image FORCE
+       $(Q)$(MAKE) $(build)=$(obj)/compressed $@
+       $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
+
+$(obj)/zImage:  $(obj)/compressed/vmlinux
+       @cp $< $@
+       @echo '  Kernel: $@ is ready'
diff --git a/arch/cris/boot/compressed/Makefile b/arch/cris/boot/compressed/Makefile
new file mode 100644 (file)
index 0000000..8fe9338
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# arch/cris/boot/compressed/Makefile
+#
+
+asflags-y += $(LINUXINCLUDE)
+ccflags-y += -O2 $(LINUXINCLUDE)
+
+# asflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/mach \
+#                                  -I$(srctree)/include/asm/arch
+# ccflags-$(CONFIG_ETRAX_ARCH_V32) += -O2 -I$(srctree)/include/asm/mach
+#                                      -I$(srctree)/include/asm/arch
+
+arch-$(CONFIG_ETRAX_ARCH_V10) = v10
+arch-$(CONFIG_ETRAX_ARCH_V32) = v32
+
+ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds
+
+OBJECTS-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o
+OBJECTS-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o
+OBJECTS= $(OBJECTS-y) $(obj)/misc.o
+OBJCOPYFLAGS = -O binary --remove-section=.bss
+
+quiet_cmd_image = BUILD   $@
+cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
+
+targets := vmlinux piggy.gz decompress.o decompress.bin
+
+$(obj)/decompress.o: $(OBJECTS) FORCE
+       $(call if_changed,ld)
+
+$(obj)/decompress.bin: $(obj)/decompress.o FORCE
+       $(call if_changed,objcopy)
+
+$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
+       $(call if_changed,image)
+
+$(obj)/piggy.gz: $(obj)/../Image FORCE
+       $(call if_changed,gzip)
diff --git a/arch/cris/boot/compressed/README b/arch/cris/boot/compressed/README
new file mode 100644 (file)
index 0000000..182c5d7
--- /dev/null
@@ -0,0 +1,24 @@
+Creation of the self-extracting compressed kernel image (vmlinuz)
+-----------------------------------------------------------------
+
+This can be slightly confusing because it's a process with many steps.
+
+The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
+by that makefile into text and data binary files, vmlinux.text and
+vmlinux.data.
+
+Those files together with a ROM filesystem can be catted together and
+burned into a flash or executed directly at the DRAM origin.
+
+They can also be catted together and compressed with gzip, which is what
+happens in this makefile. Together they make up piggy.img.
+
+The decompressor is built into the file decompress.o. It is turned into
+the binary file decompress.bin, which is catted together with piggy.img
+into the file vmlinuz. It can be executed in an arbitrary place in flash.
+
+Be careful - it assumes some things about free locations in DRAM. It
+assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
+so it puts its code at 0x40700000, and initial stack at 0x40800000.
+
+-Bjorn
diff --git a/arch/cris/boot/compressed/decompress_v10.lds b/arch/cris/boot/compressed/decompress_v10.lds
new file mode 100644 (file)
index 0000000..e80f459
--- /dev/null
@@ -0,0 +1,30 @@
+/* OUTPUT_FORMAT(elf32-us-cris) */
+OUTPUT_FORMAT(elf32-cris)
+
+MEMORY 
+       {
+       dram : ORIGIN = 0x40700000,
+              LENGTH = 0x00100000
+       }
+
+SECTIONS
+{
+       .text :
+       {
+               _stext = . ;
+               *(.text)
+               *(.rodata)
+               *(.rodata.*)
+               _etext = . ;
+       } > dram
+       .data :
+       {
+               *(.data)
+               _edata = . ;
+       } > dram
+       .bss :
+       {
+               *(.bss)
+               _end = ALIGN( 0x10 ) ;
+       } > dram
+}
diff --git a/arch/cris/boot/compressed/decompress_v32.lds b/arch/cris/boot/compressed/decompress_v32.lds
new file mode 100644 (file)
index 0000000..3c837fe
--- /dev/null
@@ -0,0 +1,30 @@
+/*#OUTPUT_FORMAT(elf32-us-cris) */
+OUTPUT_ARCH (crisv32)
+
+MEMORY
+       {
+       dram : ORIGIN = 0x40700000,
+              LENGTH = 0x00100000
+       }
+
+SECTIONS
+{
+       .text :
+       {
+               _stext = . ;
+               *(.text)
+               *(.rodata)
+               *(.rodata.*)
+               _etext = . ;
+       } > dram
+       .data :
+       {
+               *(.data)
+               _edata = . ;
+       } > dram
+       .bss :
+       {
+               *(.bss)
+               _end = ALIGN( 0x10 ) ;
+       } > dram
+}
diff --git a/arch/cris/boot/compressed/head_v10.S b/arch/cris/boot/compressed/head_v10.S
new file mode 100644 (file)
index 0000000..9edb8ad
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ *  arch/cris/boot/compressed/head.S
+ *
+ *  Copyright (C) 1999, 2001 Axis Communications AB
+ *
+ *  Code that sets up the DRAM registers, calls the
+ *  decompressor to unpack the piggybacked kernel, and jumps.
+ *
+ */
+
+#define ASSEMBLER_MACROS_ONLY
+#include <arch/sv_addr_ag.h>
+
+#define RAM_INIT_MAGIC 0x56902387
+#define COMMAND_LINE_MAGIC 0x87109563
+
+       ;; Exported symbols
+
+       .globl  input_data
+
+
+       .text
+
+       nop
+       di
+
+;; We need to initialze DRAM registers before we start using the DRAM
+
+       cmp.d   RAM_INIT_MAGIC, $r8     ; Already initialized?
+       beq     dram_init_finished
+       nop
+
+#include "../../arch-v10/lib/dram_init.S"
+
+dram_init_finished:
+
+       ;; Initiate the PA and PB ports
+
+       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_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]
+
+       ;; Setup the stack to a suitably high address.
+       ;; 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
+
+       ;; Figure out where the compressed piggyback image is
+       ;; in the flash (since we wont try to copy it to DRAM
+       ;; before unpacking). It is at _edata, but in flash.
+       ;; Use (_edata - basse) as offset to the current PC.
+
+basse: move.d  $pc, $r5
+       and.d   0x7fffffff, $r5 ; strip any non-cache bit
+       subq    2, $r5          ; compensate for the move.d $pc instr
+       move.d  $r5, $r0                ; save for later - flash address of 'basse'
+       add.d   _edata, $r5
+       sub.d   basse, $r5      ; $r5 = flash address of '_edata'
+
+       ;; Copy text+data to DRAM
+
+       move.d  basse, $r1      ; destination
+       move.d  _edata, $r2     ; end destination
+1:     move.w  [$r0+], $r3
+       move.w  $r3, [$r1+]
+       cmp.d   $r2, $r1
+       bcs     1b
+       nop
+
+       move.d  $r5, [input_data] ; for the decompressor
+
+
+       ;; Clear the decompressors BSS (between _edata and _end)
+
+       moveq   0, $r0
+       move.d  _edata, $r1
+       move.d  _end, $r2
+1:     move.w  $r0, [$r1+]
+       cmp.d   $r2, $r1
+       bcs     1b
+       nop
+
+       ;;  Save command line magic and address.
+       move.d  _cmd_line_magic, $r12
+       move.d  $r10, [$r12]
+       move.d  _cmd_line_addr, $r12
+       move.d  $r11, [$r12]
+
+       ;; Do the decompression and save compressed size in inptr
+
+       jsr     decompress_kernel
+
+       ;; Put start address of root partition in $r9 so the kernel can use it
+       ;; when mounting from flash
+
+       move.d  [input_data], $r9       ; flash address of compressed kernel
+       add.d   [inptr], $r9            ; size of compressed kernel
+
+       ;; Restore command line magic and address.
+       move.d  _cmd_line_magic, $r10
+       move.d  [$r10], $r10
+       move.d  _cmd_line_addr, $r11
+       move.d  [$r11], $r11
+
+       ;; Enter the decompressed kernel
+       move.d  RAM_INIT_MAGIC, $r8     ; Tell kernel that DRAM is initialized
+       jump    0x40004000      ; kernel is linked to this address
+
+       .data
+
+input_data:
+       .dword  0               ; used by the decompressor
+_cmd_line_magic:
+       .dword 0
+_cmd_line_addr:
+       .dword 0
+#include "../../arch-v10/lib/hw_settings.S"
diff --git a/arch/cris/boot/compressed/head_v32.S b/arch/cris/boot/compressed/head_v32.S
new file mode 100644 (file)
index 0000000..f483005
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ *  Code that sets up the DRAM registers, calls the
+ *  decompressor to unpack the piggybacked kernel, and jumps.
+ *
+ *  Copyright (C) 1999 - 2006, Axis Communications AB
+ */
+
+#define ASSEMBLER_MACROS_ONLY
+#include <hwregs/asm/reg_map_asm.h>
+#include <mach/startup.inc>
+
+#define RAM_INIT_MAGIC 0x56902387
+#define COMMAND_LINE_MAGIC 0x87109563
+
+       ;; Exported symbols
+
+       .globl  input_data
+
+       .text
+start:
+       di
+
+       ;; Start clocks for used blocks.
+       START_CLOCKS
+
+       ;; Initialize the DRAM registers.
+       cmp.d   RAM_INIT_MAGIC, $r8     ; Already initialized?
+       beq     dram_init_finished
+       nop
+
+#if defined CONFIG_ETRAXFS
+#include "../../arch-v32/mach-fs/dram_init.S"
+#elif defined CONFIG_CRIS_MACH_ARTPEC3
+#include "../../arch-v32/mach-a3/dram_init.S"
+#else
+#error Only ETRAXFS and ARTPEC-3 supported!
+#endif
+
+dram_init_finished:
+
+       GIO_INIT
+       ;; Setup the stack to a suitably high address.
+       ;; We assume 8 MB is the minimum DRAM and put
+       ;; the SP at the top for now.
+
+       move.d  0x40800000, $sp
+
+       ;; Figure out where the compressed piggyback image is.
+       ;; It is either in [NOR] flash (we don't want to copy it
+       ;; to DRAM before unpacking), or copied to DRAM
+       ;; by the [NAND] flash boot loader.
+       ;; The piggyback image is at _edata, but relative to where the
+       ;; image is actually located in memory, not where it is linked
+       ;; (the decompressor is linked at 0x40700000+ and runs there).
+       ;; Use (_edata - herami) as offset to the current PC.
+
+hereami:
+       lapcq   ., $r5          ; get PC
+       and.d   0x7fffffff, $r5 ; strip any non-cache bit
+       move.d  $r5, $r0        ; source address of 'herami'
+       add.d   _edata, $r5
+       sub.d   hereami, $r5    ; r5 = flash address of '_edata'
+       move.d  hereami, $r1    ; destination
+
+       ;; Copy text+data to DRAM
+
+       move.d  _edata, $r2     ; end destination
+1:     move.w  [$r0+], $r3     ; from herami+ source
+       move.w  $r3, [$r1+]     ; to hereami+ destination (linked address)
+       cmp.d   $r2, $r1        ; finish when destination == _edata
+       bcs     1b
+       nop
+       move.d  input_data, $r0 ; for the decompressor
+       move.d  $r5, [$r0]      ; for the decompressor
+
+       ;; Clear the decompressors BSS (between _edata and _end)
+
+       moveq   0, $r0
+       move.d  _edata, $r1
+       move.d  _end, $r2
+1:     move.w  $r0, [$r1+]
+       cmp.d   $r2, $r1
+       bcs     1b
+       nop
+
+       ;;  Save command line magic and address.
+       move.d  _cmd_line_magic, $r0
+       move.d  $r10, [$r0]
+       move.d  _cmd_line_addr, $r0
+       move.d  $r11, [$r0]
+
+       ;;  Save boot source indicator
+       move.d  _boot_source, $r0
+       move.d  $r12, [$r0]
+
+       ;; Do the decompression and save compressed size in _inptr
+
+       jsr     decompress_kernel
+       nop
+
+       ;; Restore boot source indicator
+       move.d  _boot_source, $r12
+       move.d  [$r12], $r12
+
+       ;; Restore command line magic and address.
+       move.d  _cmd_line_magic, $r10
+       move.d  [$r10], $r10
+       move.d  _cmd_line_addr, $r11
+       move.d  [$r11], $r11
+
+       ;; Put start address of root partition in r9 so the kernel can use it
+       ;; when mounting from flash
+       move.d  input_data, $r0
+       move.d  [$r0], $r9              ; flash address of compressed kernel
+       move.d  inptr, $r0
+       add.d   [$r0], $r9              ; size of compressed kernel
+       cmp.d   0x40000000, $r9         ; image in DRAM ?
+       blo     enter_kernel            ; no, must be [NOR] flash, jump
+       nop                             ; delay slot
+       and.d   0x001fffff, $r9         ; assume compressed kernel was < 2M
+
+enter_kernel:
+       ;; Enter the decompressed kernel
+       move.d  RAM_INIT_MAGIC, $r8     ; Tell kernel that DRAM is initialized
+       jump    0x40004000      ; kernel is linked to this address
+       nop
+
+       .data
+
+input_data:
+       .dword  0               ; used by the decompressor
+_cmd_line_magic:
+       .dword 0
+_cmd_line_addr:
+       .dword 0
+_boot_source:
+       .dword 0
+
+#if defined CONFIG_ETRAXFS
+#include "../../arch-v32/mach-fs/hw_settings.S"
+#elif defined CONFIG_CRIS_MACH_ARTPEC3
+#include "../../arch-v32/mach-a3/hw_settings.S"
+#else
+#error Only ETRAXFS and ARTPEC-3 supported!
+#endif
diff --git a/arch/cris/boot/compressed/misc.c b/arch/cris/boot/compressed/misc.c
new file mode 100644 (file)
index 0000000..47bc190
--- /dev/null
@@ -0,0 +1,391 @@
+/*
+ * misc.c
+ *
+ * This is a collection of several routines from gzip-1.0.3
+ * adapted for Linux.
+ *
+ * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
+ * puts by Nick Holloway 1993, better puts by Martin Mares 1995
+ * adaptation for Linux/CRIS Axis Communications AB, 1999
+ *
+ */
+
+/* where the piggybacked kernel image expects itself to live.
+ * it is the same address we use when we network load an uncompressed
+ * image into DRAM, and it is the address the kernel is linked to live
+ * at by vmlinux.lds.S
+ */
+
+#define KERNEL_LOAD_ADR 0x40004000
+
+#include <linux/types.h>
+
+#ifdef CONFIG_ETRAX_ARCH_V32
+#include <hwregs/reg_rdwr.h>
+#include <hwregs/reg_map.h>
+#include <hwregs/ser_defs.h>
+#include <hwregs/pinmux_defs.h>
+#ifdef CONFIG_CRIS_MACH_ARTPEC3
+#include <hwregs/clkgen_defs.h>
+#endif
+#else
+#include <arch/svinto.h>
+#endif
+
+/*
+ * gzip declarations
+ */
+
+#define OF(args)  args
+#define STATIC static
+
+void *memset(void *s, int c, size_t n);
+void *memcpy(void *__dest, __const void *__src, size_t __n);
+
+#define memzero(s, n)     memset((s), 0, (n))
+
+typedef unsigned char  uch;
+typedef unsigned short ush;
+typedef unsigned long  ulg;
+
+#define WSIZE 0x8000           /* Window size must be at least 32k, */
+                               /* and a power of two */
+
+static uch *inbuf;          /* input buffer */
+static uch window[WSIZE];    /* Sliding window buffer */
+
+unsigned inptr = 0;    /* index of next byte to be processed in inbuf
+                        * After decompression it will contain the
+                        * compressed size, and head.S will read it.
+                        */
+
+static unsigned outcnt = 0;  /* bytes in output buffer */
+
+/* gzip flag byte */
+#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
+#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
+#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
+#define COMMENT      0x10 /* bit 4 set: file comment present */
+#define ENCRYPTED    0x20 /* bit 5 set: file is encrypted */
+#define RESERVED     0xC0 /* bit 6,7:   reserved */
+
+#define get_byte() (inbuf[inptr++])
+
+/* Diagnostic functions */
+#ifdef DEBUG
+#  define Assert(cond, msg) do { \
+               if (!(cond)) \
+                       error(msg); \
+       } while (0)
+#  define Trace(x) fprintf x
+#  define Tracev(x) do { \
+               if (verbose) \
+                       fprintf x; \
+       } while (0)
+#  define Tracevv(x) do { \
+               if (verbose > 1) \
+                       fprintf x; \
+       } while (0)
+#  define Tracec(c, x) do { \
+               if (verbose && (c)) \
+                       fprintf x; \
+       } while (0)
+#  define Tracecv(c, x) do { \
+               if (verbose > 1 && (c)) \
+                       fprintf x; \
+       } while (0)
+#else
+#  define Assert(cond, msg)
+#  define Trace(x)
+#  define Tracev(x)
+#  define Tracevv(x)
+#  define Tracec(c, x)
+#  define Tracecv(c, x)
+#endif
+
+static void flush_window(void);
+static void error(char *m);
+static void puts(const char *);
+
+extern char *input_data;  /* lives in head.S */
+
+static long bytes_out;
+static uch *output_data;
+static unsigned long output_ptr;
+
+/* the "heap" is put directly after the BSS ends, at end */
+
+extern int _end;
+static long free_mem_ptr = (long)&_end;
+static long free_mem_end_ptr;
+
+#include "../../../../../lib/inflate.c"
+
+/* decompressor info and error messages to serial console */
+
+#ifdef CONFIG_ETRAX_ARCH_V32
+static inline void serout(const char *s, reg_scope_instances regi_ser)
+{
+       reg_ser_rs_stat_din rs;
+       reg_ser_rw_dout dout = {.data = *s};
+
+       do {
+               rs = REG_RD(ser, regi_ser, rs_stat_din);
+       }
+       while (!rs.tr_rdy);/* Wait for transceiver. */
+
+       REG_WR(ser, regi_ser, rw_dout, dout);
+}
+#endif
+
+static void puts(const char *s)
+{
+#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
+       while (*s) {
+#ifdef CONFIG_ETRAX_DEBUG_PORT0
+#ifdef CONFIG_ETRAX_ARCH_V32
+               serout(s, regi_ser0);
+#else
+               while (!(*R_SERIAL0_STATUS & (1 << 5)))
+                       ;
+               *R_SERIAL0_TR_DATA = *s++;
+#endif
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT1
+#ifdef CONFIG_ETRAX_ARCH_V32
+               serout(s, regi_ser1);
+#else
+               while (!(*R_SERIAL1_STATUS & (1 << 5)))
+                       ;
+               *R_SERIAL1_TR_DATA = *s++;
+#endif
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT2
+#ifdef CONFIG_ETRAX_ARCH_V32
+               serout(s, regi_ser2);
+#else
+               while (!(*R_SERIAL2_STATUS & (1 << 5)))
+                       ;
+               *R_SERIAL2_TR_DATA = *s++;
+#endif
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT3
+#ifdef CONFIG_ETRAX_ARCH_V32
+               serout(s, regi_ser3);
+#else
+               while (!(*R_SERIAL3_STATUS & (1 << 5)))
+                       ;
+               *R_SERIAL3_TR_DATA = *s++;
+#endif
+#endif
+               *s++;
+       }
+/* CONFIG_ETRAX_DEBUG_PORT_NULL */
+#endif
+}
+
+void *memset(void *s, int c, size_t n)
+{
+       int i;
+       char *ss = (char*)s;
+
+       for (i=0;i<n;i++) ss[i] = c;
+
+       return s;
+}
+
+void *memcpy(void *__dest, __const void *__src, size_t __n)
+{
+       int i;
+       char *d = (char *)__dest, *s = (char *)__src;
+
+       for (i = 0; i < __n; i++)
+               d[i] = s[i];
+
+       return __dest;
+}
+
+/* ===========================================================================
+ * Write the output window window[0..outcnt-1] and update crc and bytes_out.
+ * (Used for the decompressed data only.)
+ */
+
+static void flush_window(void)
+{
+       ulg c = crc;         /* temporary variable */
+       unsigned n;
+       uch *in, *out, ch;
+
+       in = window;
+       out = &output_data[output_ptr];
+       for (n = 0; n < outcnt; n++) {
+               ch = *out = *in;
+               out++;
+               in++;
+               c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
+       }
+       crc = c;
+       bytes_out += (ulg)outcnt;
+       output_ptr += (ulg)outcnt;
+       outcnt = 0;
+}
+
+static void error(char *x)
+{
+       puts("\n\n");
+       puts(x);
+       puts("\n\n -- System halted\n");
+
+       while(1);       /* Halt */
+}
+
+void setup_normal_output_buffer(void)
+{
+       output_data = (char *)KERNEL_LOAD_ADR;
+}
+
+#ifdef CONFIG_ETRAX_ARCH_V32
+static inline void serial_setup(reg_scope_instances regi_ser)
+{
+       reg_ser_rw_xoff xoff;
+       reg_ser_rw_tr_ctrl tr_ctrl;
+       reg_ser_rw_rec_ctrl rec_ctrl;
+       reg_ser_rw_tr_baud_div tr_baud;
+       reg_ser_rw_rec_baud_div rec_baud;
+
+       /* Turn off XOFF. */
+       xoff = REG_RD(ser, regi_ser, rw_xoff);
+
+       xoff.chr = 0;
+       xoff.automatic = regk_ser_no;
+
+       REG_WR(ser, regi_ser, rw_xoff, xoff);
+
+       /* Set baudrate and stopbits. */
+       tr_ctrl = REG_RD(ser, regi_ser, rw_tr_ctrl);
+       rec_ctrl = REG_RD(ser, regi_ser, rw_rec_ctrl);
+       tr_baud = REG_RD(ser, regi_ser, rw_tr_baud_div);
+       rec_baud = REG_RD(ser, regi_ser, rw_rec_baud_div);
+
+       tr_ctrl.stop_bits = 1;  /* 2 stop bits. */
+       tr_ctrl.en = 1; /* enable transmitter */
+       rec_ctrl.en = 1; /* enabler receiver */
+
+       /*
+        * The baudrate setup used to be a bit fishy, but now transmitter and
+        * receiver are both set to the intended baud rate, 115200.
+        * The magic value is 29.493 MHz.
+        */
+       tr_ctrl.base_freq = regk_ser_f29_493;
+       rec_ctrl.base_freq = regk_ser_f29_493;
+       tr_baud.div = (29493000 / 8) / 115200;
+       rec_baud.div = (29493000 / 8) / 115200;
+
+       REG_WR(ser, regi_ser, rw_tr_ctrl, tr_ctrl);
+       REG_WR(ser, regi_ser, rw_tr_baud_div, tr_baud);
+       REG_WR(ser, regi_ser, rw_rec_ctrl, rec_ctrl);
+       REG_WR(ser, regi_ser, rw_rec_baud_div, rec_baud);
+}
+#endif
+
+void decompress_kernel(void)
+{
+       char revision;
+       char compile_rev;
+
+#ifdef CONFIG_ETRAX_ARCH_V32
+       /* Need at least a CRISv32 to run. */
+       compile_rev = 32;
+#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
+    defined(CONFIG_ETRAX_DEBUG_PORT2) || \
+    defined(CONFIG_ETRAX_DEBUG_PORT3)
+       reg_pinmux_rw_hwprot hwprot;
+
+#ifdef CONFIG_CRIS_MACH_ARTPEC3
+       reg_clkgen_rw_clk_ctrl clk_ctrl;
+
+       /* Enable corresponding clock region when serial 1..3 selected */
+
+       clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl);
+       clk_ctrl.sser_ser_dma6_7 = regk_clkgen_yes;
+       REG_WR(clkgen, regi_clkgen, rw_clk_ctrl, clk_ctrl);
+#endif
+
+       /* pinmux setup for ports 1..3 */
+       hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
+#endif
+
+
+#ifdef CONFIG_ETRAX_DEBUG_PORT0
+       serial_setup(regi_ser0);
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT1
+       hwprot.ser1 = regk_pinmux_yes;
+       serial_setup(regi_ser1);
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT2
+       hwprot.ser2 = regk_pinmux_yes;
+       serial_setup(regi_ser2);
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT3
+       hwprot.ser3 = regk_pinmux_yes;
+       serial_setup(regi_ser3);
+#endif
+#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
+    defined(CONFIG_ETRAX_DEBUG_PORT2) || \
+    defined(CONFIG_ETRAX_DEBUG_PORT3)
+       REG_WR(pinmux, regi_pinmux, rw_hwprot, hwprot);
+#endif
+
+       /* input_data is set in head.S */
+       inbuf = input_data;
+#else /* CRISv10 */
+       /* Need at least a crisv10 to run. */
+       compile_rev = 10;
+
+       /* input_data is set in head.S */
+       inbuf = input_data;
+
+#ifdef CONFIG_ETRAX_DEBUG_PORT0
+       *R_SERIAL0_XOFF = 0;
+       *R_SERIAL0_BAUD = 0x99;
+       *R_SERIAL0_TR_CTRL = 0x40;
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT1
+       *R_SERIAL1_XOFF = 0;
+       *R_SERIAL1_BAUD = 0x99;
+       *R_SERIAL1_TR_CTRL = 0x40;
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT2
+       *R_GEN_CONFIG = 0x08;
+       *R_SERIAL2_XOFF = 0;
+       *R_SERIAL2_BAUD = 0x99;
+       *R_SERIAL2_TR_CTRL = 0x40;
+#endif
+#ifdef CONFIG_ETRAX_DEBUG_PORT3
+       *R_GEN_CONFIG = 0x100;
+       *R_SERIAL3_XOFF = 0;
+       *R_SERIAL3_BAUD = 0x99;
+       *R_SERIAL3_TR_CTRL = 0x40;
+#endif
+#endif
+
+       setup_normal_output_buffer();
+
+       makecrc();
+
+       __asm__ volatile ("move $vr,%0" : "=rm" (revision));
+       if (revision < compile_rev) {
+#ifdef CONFIG_ETRAX_ARCH_V32
+               puts("You need an ETRAX FS to run Linux 2.6/crisv32\n");
+#else
+               puts("You need an ETRAX 100LX to run linux 2.6\n");
+#endif
+               while(1);
+       }
+
+       puts("Uncompressing Linux...\n");
+       gunzip();
+       puts("Done. Now booting the kernel\n");
+}
diff --git a/arch/cris/boot/rescue/Makefile b/arch/cris/boot/rescue/Makefile
new file mode 100644 (file)
index 0000000..52bd0bd
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Makefile for rescue (bootstrap) code
+#
+
+# CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
+# ccflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/arch/mach/ \
+#                                  -I$(srctree)/include/asm/arch
+# asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
+# LD = gcc-cris -mlinux -march=v32 -nostdlib
+
+asflags-y += $(LINUXINCLUDE)
+ccflags-y += -O2 $(LINUXINCLUDE)
+arch-$(CONFIG_ETRAX_ARCH_V10) = v10
+arch-$(CONFIG_ETRAX_ARCH_V32) = v32
+
+ldflags-y += -T $(srctree)/$(src)/rescue_$(arch-y).lds
+OBJCOPYFLAGS = -O binary --remove-section=.bss
+obj-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o
+obj-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o
+OBJECTS := $(obj-y)
+
+targets := rescue.o rescue.bin
+
+$(obj)/rescue.o: $(OBJECTS) FORCE
+       $(call if_changed,ld)
+
+$(obj)/rescue.bin: $(obj)/rescue.o FORCE
+       $(call if_changed,objcopy)
+       cp -p $(obj)/rescue.bin $(objtree)
+
+$(obj)/testrescue.bin: $(obj)/testrescue.o
+       $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
+# Pad it to 784 bytes
+       dd if=/dev/zero of=tmp2423 bs=1 count=784
+       cat tr.bin tmp2423 >testrescue_tmp.bin
+       dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
+       rm tr.bin tmp2423 testrescue_tmp.bin
+
+
+$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
+       $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
+# Pad it to 784 bytes, that's what the rescue loader expects
+       dd if=/dev/zero of=tmp2423 bs=1 count=784
+       cat ktr.bin tmp2423 >kimagerescue_tmp.bin
+       dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
+       rm ktr.bin tmp2423 kimagerescue_tmp.bin
+
diff --git a/arch/cris/boot/rescue/head_v10.S b/arch/cris/boot/rescue/head_v10.S
new file mode 100644 (file)
index 0000000..2fafe24
--- /dev/null
@@ -0,0 +1,360 @@
+/*
+ * Rescue code, made to reside at the beginning of the
+ * flash-memory. when it starts, it checks a partition
+ * table at the first sector after the rescue sector.
+ * the partition table was generated by the product builder
+ * script and contains offsets, lengths, types and checksums
+ * for each partition that this code should check.
+ *
+ * If any of the checksums fail, we assume the flash is so
+ * corrupt that we cant use it to boot into the ftp flash
+ * loader, and instead we initialize the serial port to
+ * receive a flash-loader and new flash image. we dont include
+ * any flash code here, but just accept a certain amount of
+ * bytes from the serial port and jump into it. the downloaded
+ * code is put in the cache.
+ *
+ * The partitiontable is designed so that it is transparent to
+ * code execution - it has a relative branch opcode in the
+ * beginning that jumps over it. each entry contains extra
+ * data so we can add stuff later.
+ *
+ * Partition table format:
+ *
+ *     Code transparency:
+ *
+ *     2 bytes    [opcode 'nop']
+ *     2 bytes    [opcode 'di']
+ *     4 bytes    [opcode 'ba <offset>', 8-bit or 16-bit version]
+ *     2 bytes    [opcode 'nop', delay slot]
+ *
+ *     Table validation (at +10):
+ *
+ *     2 bytes    [magic/version word for partitiontable - 0xef, 0xbe]
+ *     2 bytes    [length of all entries plus the end marker]
+ *     4 bytes    [checksum for the partitiontable itself]
+ *
+ *     Entries, each with the following format, last has offset -1:
+ *
+ *        4 bytes    [offset in bytes, from start of flash]
+ *        4 bytes    [length in bytes of partition]
+ *        4 bytes    [checksum, simple longword sum]
+ *        2 bytes    [partition type]
+ *        2 bytes    [flags, only bit 0 used, ro/rw = 1/0]
+ *        16 bytes   [reserved for future use]
+ *
+ *     End marker
+ *
+ *        4 bytes    [-1]
+ *
+ *      10 bytes    [0, padding]
+ *
+ * Bit 0 in flags signifies RW or RO. The rescue code only bothers
+ * to check the checksum for RO partitions, since the others will
+ * change their data without updating the checksums. A 1 in bit 0
+ * means RO, 0 means RW. That way, it is possible to set a partition
+ * in RO mode initially, and later mark it as RW, since you can always
+ * write 0's to the flash.
+ *
+ * During the wait for serial input, the status LED will flash so the
+ * user knows something went wrong.
+ *
+ * Copyright (C) 1999-2007 Axis Communications AB
+ */
+
+#ifdef CONFIG_ETRAX_AXISFLASHMAP
+
+#define ASSEMBLER_MACROS_ONLY
+#include <arch/sv_addr_ag.h>
+
+       ;; The partitiontable is looked for at the first sector after the boot
+       ;; sector. Sector size is 65536 bytes in all flashes we use.
+
+#define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR
+#define PTABLE_MAGIC 0xbeef
+
+       ;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0.
+       ;; That is not where we put our downloaded serial boot-code.
+       ;; The length is enough for downloading code that loads the rest
+       ;; of itself (after having setup the DRAM etc).
+       ;; It is the same length as the on-chip ROM loads, so the same
+       ;; host loader can be used to load a rescued product as well as
+       ;; one booted through the Etrax serial boot code.
+
+#define CODE_START 0x40000000
+#define CODE_LENGTH 784
+
+#ifdef CONFIG_ETRAX_RESCUE_SER0
+#define SERXOFF R_SERIAL0_XOFF
+#define SERBAUD R_SERIAL0_BAUD
+#define SERRECC R_SERIAL0_REC_CTRL
+#define SERRDAT R_SERIAL0_REC_DATA
+#define SERSTAT R_SERIAL0_STATUS
+#endif
+#ifdef CONFIG_ETRAX_RESCUE_SER1
+#define SERXOFF R_SERIAL1_XOFF
+#define SERBAUD R_SERIAL1_BAUD
+#define SERRECC R_SERIAL1_REC_CTRL
+#define SERRDAT R_SERIAL1_REC_DATA
+#define SERSTAT R_SERIAL1_STATUS
+#endif
+#ifdef CONFIG_ETRAX_RESCUE_SER2
+#define SERXOFF R_SERIAL2_XOFF
+#define SERBAUD R_SERIAL2_BAUD
+#define SERRECC R_SERIAL2_REC_CTRL
+#define SERRDAT R_SERIAL2_REC_DATA
+#define SERSTAT R_SERIAL2_STATUS
+#endif
+#ifdef CONFIG_ETRAX_RESCUE_SER3
+#define SERXOFF R_SERIAL3_XOFF
+#define SERBAUD R_SERIAL3_BAUD
+#define SERRECC R_SERIAL3_REC_CTRL
+#define SERRDAT R_SERIAL3_REC_DATA
+#define SERSTAT R_SERIAL3_STATUS
+#endif
+
+#define NOP_DI 0xf025050f
+#define RAM_INIT_MAGIC 0x56902387
+
+       .text
+
+       ;; This is the entry point of the rescue code
+       ;; 0x80000000 if loaded in flash (as it should be)
+       ;; Since etrax actually starts at address 2 when booting from flash, we
+       ;; put a nop (2 bytes) here first so we dont accidentally skip the di
+
+       nop
+       di
+
+       jump    in_cache        ; enter cached area instead
+in_cache:
+
+
+       ;; First put a jump test to give a possibility of upgrading the
+       ;; rescue code without erasing/reflashing the sector.
+       ;; We put a longword of -1 here and if it is not -1, we jump using
+       ;; the value as jump target. Since we can always 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
+       beq     no_newjump
+       nop
+
+       jump    [$r0]
+
+jumptarget:
+       .dword  0xffffffff      ; can be overwritten later to insert new code
+
+no_newjump:
+#ifdef CONFIG_ETRAX_ETHERNET
+       ;; Start MII clock to make sure it is running when tranceiver is reset
+       move.d 0x3, $r0    ; enable = on, phy = mii_clk
+       move.d $r0, [R_NETWORK_GEN_CONFIG]
+#endif
+
+       ;; We need to setup the bus registers before we start using the DRAM
+#include "../../../arch-v10/lib/dram_init.S"
+
+       ;; 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...
+       bne     do_rescue
+       nop
+
+       ;; skip the code transparency block (10 bytes).
+
+       addq    10, $r3
+
+       ;; check for correct magic
+
+       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
+       jsr     checksum        ; r1 source, r2 length, returns in r0
+
+       cmp.d   $r0, $r4
+       bne     do_rescue       ; didn't match - trig rescue
+       nop
+
+       ;; ptable is ok. validate each entry.
+
+       moveq   -1, $r7
+
+ploop: move.d  [$r3+], $r1     ; partition offset (from ptable start)
+       bne     notfirst        ; check if it is 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
+       ba      bosse
+       nop
+notfirst:
+       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
+       bpl     ploop           ;   rw partition, skip validation
+       nop
+       btstq   17, $r4         ; check bootable flag
+       bpl     1f
+       nop
+       move.d  $r1, $r7        ; remember boot partition offset
+1:
+       add.d   PTABLE_START, $r1
+
+       jsr     checksum        ; checksum the partition
+
+       cmp.d   $r0, $r5
+       beq     ploop           ; checksums matched, go to next entry
+       nop
+
+       ;; otherwise fall through to the rescue code.
+
+do_rescue:
+       ;; setup port PA and PB default initial directions and data
+       ;; (so we can flash LEDs, and so that DTR and others are set)
+
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
+       move.b  $r0, [R_PORT_PA_DIR]
+       move.b  CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
+       move.b  $r0, [R_PORT_PA_DATA]
+
+       move.b  CONFIG_ETRAX_DEF_R_PORT_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]
+
+       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]
+
+       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
+#ifndef CONFIG_ETRAX_NO_LEDS
+#ifdef CONFIG_ETRAX_PA_LEDS
+       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
+#endif
+       move.d  (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
+       btstq   16, $r1
+       bpl     1f
+       nop
+       or.d    $r0, $r2        ; set bit
+       ba      2f
+       nop
+1:     not     $r0             ; clear bit
+       and.d   $r0, $r2
+2:
+#ifdef CONFIG_ETRAX_PA_LEDS
+       move.b  $r2, [R_PORT_PA_DATA]
+#endif
+#ifdef CONFIG_ETRAX_PB_LEDS
+       move.b  $r2, [R_PORT_PB_DATA]
+#endif
+#ifdef CONFIG_ETRAX_90000000_LEDS
+       move.b  $r2, [0x90000000]
+#endif
+#endif
+
+       ;; check if we got something on the serial port
+
+       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+]
+
+       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
+       jump    CODE_START
+
+flash_ok:
+       ;; check r7, which contains either -1 or the partition to boot from
+
+       cmp.d   -1, $r7
+       bne     1f
+       nop
+       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!
+
+
+       ;; Helper subroutines
+
+       ;; Will checksum by simple addition
+       ;; r1 - source
+       ;; r2 - length in bytes
+       ;; result will be in r0
+checksum:
+       moveq   0, $r0
+       moveq   CONFIG_ETRAX_FLASH1_SIZE, $r6
+
+       ;; If the first physical flash memory is exceeded wrap to the
+       ;; second one
+       btstq   26, $r1         ; Are we addressing first flash?
+       bpl     1f
+       nop
+       clear.d $r6
+
+1:     test.d  $r6             ; 0 = no wrapping
+       beq     2f
+       nop
+       lslq    20, $r6         ; Convert MB to bytes
+       sub.d   $r1, $r6
+
+2:     addu.b  [$r1+], $r0
+       subq    1, $r6          ; Flash memory left
+       beq     3f
+       subq    1, $r2          ; Length left
+       bne     2b
+       nop
+       ret
+       nop
+
+3:     move.d  MEM_CSE1_START, $r1 ; wrap to second flash
+       ba      2b
+       nop
+
+#endif
diff --git a/arch/cris/boot/rescue/head_v32.S b/arch/cris/boot/rescue/head_v32.S
new file mode 100644 (file)
index 0000000..5f846b7
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Just get started by jumping to CONFIG_ETRAX_PTABLE_SECTOR to start
+ * kernel decompressor.
+ *
+ * In practice, this only works for NOR flash (or some convoluted RAM boot)
+ * and hence is not really useful for Artpec-3, so it's Etrax FS / NOR only.
+ *
+ */
+
+#include <mach/startup.inc>
+
+#ifdef CONFIG_ETRAX_AXISFLASHMAP
+
+;; Code
+
+       .text
+start:
+
+       ;; Start clocks for used blocks.
+       START_CLOCKS
+
+       move.d  CONFIG_ETRAX_PTABLE_SECTOR, $r10
+       jump    $r10                    ; Jump to decompressor
+       nop
+
+#endif
diff --git a/arch/cris/boot/rescue/kimagerescue.S b/arch/cris/boot/rescue/kimagerescue.S
new file mode 100644 (file)
index 0000000..6f7b3e6
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * Rescue code to be prepended on a kimage and copied to the
+ * rescue serial port.
+ * This is called from the rescue code, it will copy received data to
+ * 4004000 and after a timeout jump to it.
+ */
+
+#define ASSEMBLER_MACROS_ONLY
+#include <arch/sv_addr_ag.h>
+
+#define CODE_START 0x40004000
+#define CODE_LENGTH 784
+#define TIMEOUT_VALUE 1000
+
+
+#ifdef CONFIG_ETRAX_RESCUE_SER0
+#define SERXOFF R_SERIAL0_XOFF
+#define SERBAUD R_SERIAL0_BAUD
+#define SERRECC R_SERIAL0_REC_CTRL
+#define SERRDAT R_SERIAL0_REC_DATA
+#define SERSTAT R_SERIAL0_STATUS
+#endif
+#ifdef CONFIG_ETRAX_RESCUE_SER1
+#define SERXOFF R_SERIAL1_XOFF
+#define SERBAUD R_SERIAL1_BAUD
+#define SERRECC R_SERIAL1_REC_CTRL
+#define SERRDAT R_SERIAL1_REC_DATA
+#define SERSTAT R_SERIAL1_STATUS
+#endif
+#ifdef CONFIG_ETRAX_RESCUE_SER2
+#define SERXOFF R_SERIAL2_XOFF
+#define SERBAUD R_SERIAL2_BAUD
+#define SERRECC R_SERIAL2_REC_CTRL
+#define SERRDAT R_SERIAL2_REC_DATA
+#define SERSTAT R_SERIAL2_STATUS
+#endif
+#ifdef CONFIG_ETRAX_RESCUE_SER3
+#define SERXOFF R_SERIAL3_XOFF
+#define SERBAUD R_SERIAL3_BAUD
+#define SERRECC R_SERIAL3_REC_CTRL
+#define SERRDAT R_SERIAL3_REC_DATA
+#define SERSTAT R_SERIAL3_STATUS
+#endif
+
+       .text
+       ;; This is the entry point of the rescue code
+       ;; 0x80000000 if loaded in flash (as it should be)
+       ;; since etrax actually starts at address 2 when booting from flash, we
+       ;; put a nop (2 bytes) here first so we dont accidentally skip the di
+
+       nop
+       di
+#ifndef CONFIG_SVINTO_SIM
+       ;; 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_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"
+
+#endif
+       ;; Setup the stack to a suitably high address.
+       ;; 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
+
+       ;; setup the serial port at 115200 baud
+
+       moveq   0, $r0
+       move.d  $r0, [SERXOFF]
+
+       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]
+
+
+       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
+       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
+#endif
+#ifdef CONFIG_ETRAX_PB_LEDS
+       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
+       bpl     1f
+       nop
+       or.d    $r0, $r2                ; set bit
+       ba      2f
+       nop
+1:     not     $r0                     ; clear bit
+       and.d   $r0, $r2
+2:
+#ifdef CONFIG_ETRAX_PA_LEDS
+       move.b  $r2, [R_PORT_PA_DATA]
+#endif
+#ifdef CONFIG_ETRAX_PB_LEDS
+       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
+       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
+       bne     wait_ser
+       nop
+jump_start:
+       ;; jump into downloaded code
+
+       jump    CODE_START
diff --git a/arch/cris/boot/rescue/rescue_v10.lds b/arch/cris/boot/rescue/rescue_v10.lds
new file mode 100644 (file)
index 0000000..0b52a94
--- /dev/null
@@ -0,0 +1,20 @@
+MEMORY 
+       {
+       flash : ORIGIN = 0x00000000,
+               LENGTH = 0x00100000
+       }
+
+SECTIONS
+{
+       .text :
+       {
+               stext = . ;
+               *(.text)
+               etext = . ;
+       } > flash
+       .data :
+       {
+               *(.data)
+               edata = . ;
+       } > flash
+}
diff --git a/arch/cris/boot/rescue/rescue_v32.lds b/arch/cris/boot/rescue/rescue_v32.lds
new file mode 100644 (file)
index 0000000..8ac646b
--- /dev/null
@@ -0,0 +1,43 @@
+/*#OUTPUT_FORMAT(elf32-us-cris) */
+OUTPUT_ARCH (crisv32)
+/* Now that NAND support has been stripped, this file could be simplified,
+ * but it doesn't do any harm on the other hand so why bother. */
+
+MEMORY
+       {
+       bootblk : ORIGIN = 0x38000000,
+                 LENGTH = 0x00004000
+       intmem  : ORIGIN = 0x38004000,
+                 LENGTH = 0x00005000
+       }
+
+SECTIONS
+{
+       .text :
+       {
+               _stext = . ;
+               *(.text)
+               *(.init.text)
+               *(.rodata)
+               *(.rodata.*)
+               _etext = . ;
+       } > bootblk
+       .data :
+       {
+               *(.data)
+               _edata = . ;
+       } > bootblk
+       .bss :
+       {
+               _bss = . ;
+               *(.bss)
+               _end = ALIGN( 0x10 ) ;
+       } > intmem
+
+       /* Get rid of stuff from EXPORT_SYMBOL(foo). */
+       /DISCARD/ :
+       {
+               *(__ksymtab_strings)
+               *(__ksymtab)
+       }
+}
diff --git a/arch/cris/boot/rescue/testrescue.S b/arch/cris/boot/rescue/testrescue.S
new file mode 100644 (file)
index 0000000..fc7ec67
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Simple testcode to download by the rescue block.
+ * Just lights some LEDs to show it was downloaded correctly.
+ *
+ * Copyright (C) 1999 Axis Communications AB
+ */
+
+#define ASSEMBLER_MACROS_ONLY
+#include <arch/sv_addr_ag.h>
+
+       .text
+
+       nop
+       nop
+       moveq   -1, $r2
+       move.b  $r2, [R_PORT_PA_DIR]
+       moveq   0, $r2
+       move.b  $r2, [R_PORT_PA_DATA]
+
+endless:
+       nop
+       ba      endless
+       nop
+
diff --git a/arch/cris/boot/tools/build.c b/arch/cris/boot/tools/build.c
new file mode 100644 (file)
index 0000000..c8adef3
--- /dev/null
@@ -0,0 +1,287 @@
+/*
+ *  linux/tools/build.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+/*
+ * This file builds a disk-image from three different files:
+ *
+ * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
+ * - setup: 8086 machine code, sets up system parm
+ * - system: 80386 code for actual system
+ *
+ * It does some checking that all files are of the correct type, and
+ * just writes the result to stdout, removing headers and padding to
+ * the right amount. It also writes some system data to stderr.
+ */
+
+/*
+ * Changes by tytso to allow root device specification
+ * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
+ * Cross compiling fixes by Gertjan van Wingerde, July 1996
+ */
+
+#include <stdio.h>     /* fprintf */
+#include <string.h>
+#include <stdlib.h>    /* contains exit */
+#include <sys/types.h> /* unistd.h needs this */
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <unistd.h>    /* contains read/write */
+#include <fcntl.h>
+#include <errno.h>
+
+#define MINIX_HEADER 32
+
+#define N_MAGIC_OFFSET 1024
+#ifndef __BFD__
+static int GCC_HEADER = sizeof(struct exec);
+#endif
+
+#ifdef __BIG_KERNEL__
+#define SYS_SIZE 0xffff
+#else
+#define SYS_SIZE DEF_SYSSIZE
+#endif
+
+#define DEFAULT_MAJOR_ROOT 0
+#define DEFAULT_MINOR_ROOT 0
+
+/* max nr of sectors of setup: don't change unless you also change
+ * bootsect etc */
+#define SETUP_SECTS 4
+
+#define STRINGIFY(x) #x
+
+typedef union {
+       int i;
+       long l;
+       short s[2];
+       char b[4];
+} conv;
+
+long intel_long(long l)
+{
+       conv t;
+
+       t.b[0] = l & 0xff; l >>= 8;
+       t.b[1] = l & 0xff; l >>= 8;
+       t.b[2] = l & 0xff; l >>= 8;
+       t.b[3] = l & 0xff; l >>= 8;
+       return t.l;
+}
+
+int intel_int(int i)
+{
+       conv t;
+
+       t.b[0] = i & 0xff; i >>= 8;
+        t.b[1] = i & 0xff; i >>= 8;
+        t.b[2] = i & 0xff; i >>= 8;
+        t.b[3] = i & 0xff; i >>= 8;
+        return t.i;
+}
+
+short intel_short(short l)
+{
+       conv t;
+
+       t.b[0] = l & 0xff; l >>= 8;
+       t.b[1] = l & 0xff; l >>= 8;
+       return t.s[0];
+}
+
+void die(const char * str)
+{
+       fprintf(stderr,"%s\n",str);
+       exit(1);
+}
+
+void usage(void)
+{
+       die("Usage: build bootsect setup system [rootdev] [> image]");
+}
+
+int main(int argc, char ** argv)
+{
+       int i,c,id,sz,tmp_int;
+       unsigned long sys_size, tmp_long;
+       char buf[1024];
+#ifndef __BFD__
+       struct exec *ex = (struct exec *)buf;
+#endif
+       char major_root, minor_root;
+       struct stat sb;
+       unsigned char setup_sectors;
+
+       if ((argc < 4) || (argc > 5))
+               usage();
+       if (argc > 4) {
+               if (!strcmp(argv[4], "CURRENT")) {
+                       if (stat("/", &sb)) {
+                               perror("/");
+                               die("Couldn't stat /");
+                       }
+                       major_root = major(sb.st_dev);
+                       minor_root = minor(sb.st_dev);
+               } else if (strcmp(argv[4], "FLOPPY")) {
+                       if (stat(argv[4], &sb)) {
+                               perror(argv[4]);
+                               die("Couldn't stat root device.");
+                       }
+                       major_root = major(sb.st_rdev);
+                       minor_root = minor(sb.st_rdev);
+               } else {
+                       major_root = 0;
+                       minor_root = 0;
+               }
+       } else {
+               major_root = DEFAULT_MAJOR_ROOT;
+               minor_root = DEFAULT_MINOR_ROOT;
+       }
+       fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
+       for (i=0;i<sizeof buf; i++) buf[i]=0;
+       if ((id=open(argv[1],O_RDONLY,0))<0)
+               die("Unable to open 'boot'");
+       if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
+               die("Unable to read header of 'boot'");
+       if (((long *) buf)[0]!=intel_long(0x04100301))
+               die("Non-Minix header of 'boot'");
+       if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
+               die("Non-Minix header of 'boot'");
+       if (((long *) buf)[3] != 0)
+               die("Illegal data segment in 'boot'");
+       if (((long *) buf)[4] != 0)
+               die("Illegal bss in 'boot'");
+       if (((long *) buf)[5] != 0)
+               die("Non-Minix header of 'boot'");
+       if (((long *) buf)[7] != 0)
+               die("Illegal symbol table in 'boot'");
+       i=read(id,buf,sizeof buf);
+       fprintf(stderr,"Boot sector %d bytes.\n",i);
+       if (i != 512)
+               die("Boot block must be exactly 512 bytes");
+       if ((*(unsigned short *)(buf+510)) != (unsigned short)intel_short(0xAA55))
+               die("Boot block hasn't got boot flag (0xAA55)");
+       buf[508] = (char) minor_root;
+       buf[509] = (char) major_root;   
+       i=write(1,buf,512);
+       if (i!=512)
+               die("Write call failed");
+       close (id);
+       
+       if ((id=open(argv[2],O_RDONLY,0))<0)
+               die("Unable to open 'setup'");
+       if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
+               die("Unable to read header of 'setup'");
+       if (((long *) buf)[0]!=intel_long(0x04100301))
+               die("Non-Minix header of 'setup'");
+       if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
+               die("Non-Minix header of 'setup'");
+       if (((long *) buf)[3] != 0)
+               die("Illegal data segment in 'setup'");
+       if (((long *) buf)[4] != 0)
+               die("Illegal bss in 'setup'");
+       if (((long *) buf)[5] != 0)
+               die("Non-Minix header of 'setup'");
+       if (((long *) buf)[7] != 0)
+               die("Illegal symbol table in 'setup'");
+       for (i=0 ; (c=read(id,buf,sizeof buf))>0 ; i+=c )
+#ifdef __BIG_KERNEL__
+       {
+               if (!i) {
+                       /* Working with memcpy because of alignment constraints
+                          on Sparc - Gertjan */
+                       memcpy(&tmp_long, &buf[2], sizeof(long));
+                       if (tmp_long != intel_long(0x53726448) )
+                               die("Wrong magic in loader header of 'setup'");
+                       memcpy(&tmp_int, &buf[6], sizeof(int));
+                       if (tmp_int < intel_int(0x200))
+                               die("Wrong version of loader header of 'setup'");
+                       buf[0x11] = 1; /* LOADED_HIGH */
+                       tmp_long = intel_long(0x100000);
+                       memcpy(&buf[0x14], &tmp_long, sizeof(long));  /* code32_start */
+               }
+#endif
+               if (write(1,buf,c)!=c)
+                       die("Write call failed");
+#ifdef __BIG_KERNEL__
+       }
+#endif
+       if (c != 0)
+               die("read-error on 'setup'");
+       close (id);
+       setup_sectors = (unsigned char)((i + 511) / 512);
+       /* for compatibility with LILO */
+       if (setup_sectors < SETUP_SECTS)
+               setup_sectors = SETUP_SECTS;
+       fprintf(stderr,"Setup is %d bytes.\n",i);
+       for (c=0 ; c<sizeof(buf) ; c++)
+               buf[c] = '\0';
+       while (i < setup_sectors * 512) {
+               c = setup_sectors * 512 - i;
+               if (c > sizeof(buf))
+                       c = sizeof(buf);
+               if (write(1,buf,c) != c)
+                       die("Write call failed");
+               i += c;
+       }
+       
+       if ((id=open(argv[3],O_RDONLY,0))<0)
+               die("Unable to open 'system'");
+#ifndef __BFD__
+       if (read(id,buf,GCC_HEADER) != GCC_HEADER)
+               die("Unable to read header of 'system'");
+       if (N_MAGIC(*ex) == ZMAGIC) {
+               GCC_HEADER = N_MAGIC_OFFSET;
+               lseek(id, GCC_HEADER, SEEK_SET);
+       } else if (N_MAGIC(*ex) != QMAGIC)
+               die("Non-GCC header of 'system'");
+       fprintf(stderr,"System is %d kB (%d kB code, %d kB data and %d kB bss)\n",
+               (ex->a_text+ex->a_data+ex->a_bss)/1024,
+               ex->a_text /1024,
+               ex->a_data /1024,
+               ex->a_bss  /1024);
+       sz = N_SYMOFF(*ex) - GCC_HEADER + 4;
+#else
+       if (fstat (id, &sb)) {
+         perror ("fstat");
+         die ("Unable to stat 'system'");
+       }
+       sz = sb.st_size;
+       fprintf (stderr, "System is %d kB\n", sz/1024);
+#endif
+       sys_size = (sz + 15) / 16;
+       if (sys_size > SYS_SIZE)
+               die("System is too big");
+       while (sz > 0) {
+               int l, n;
+
+               l = sz;
+               if (l > sizeof(buf))
+                       l = sizeof(buf);
+               if ((n=read(id, buf, l)) != l) {
+                       if (n == -1) 
+                               perror(argv[1]);
+                       else
+                               fprintf(stderr, "Unexpected EOF\n");
+                       die("Can't read 'system'");
+               }
+               if (write(1, buf, l) != l)
+                       die("Write failed");
+               sz -= l;
+       }
+       close(id);
+       if (lseek(1, 497, 0) == 497) {
+               if (write(1, &setup_sectors, 1) != 1)
+                       die("Write of setup sectors failed");
+       }
+       if (lseek(1,500,0) == 500) {
+               buf[0] = (sys_size & 0xff);
+               buf[1] = ((sys_size >> 8) & 0xff);
+               if (write(1, buf, 2) != 2)
+                       die("Write failed");
+       }
+       return(0);
+}
index 235d076379d5c75dc821e46ade86934c697ebee2..c17079388bb909c8a9ab09ddb6533dab47e94ff4 100644 (file)
 #define __NR_mbind             274
 #define __NR_get_mempolicy     275
 #define __NR_set_mempolicy     276
-#define __NR_mq_open           277
+#define __NR_mq_open           277
 #define __NR_mq_unlink         (__NR_mq_open+1)
 #define __NR_mq_timedsend      (__NR_mq_open+2)
 #define __NR_mq_timedreceive   (__NR_mq_open+3)
 #define __NR_fallocate         324
 #define __NR_timerfd_settime   325
 #define __NR_timerfd_gettime   326
+#define __NR_signalfd4         327
+#define __NR_eventfd2          328
+#define __NR_epoll_create1     329
+#define __NR_dup3              330
+#define __NR_pipe2             331
+#define __NR_inotify_init1     332
+#define __NR_preadv            333
+#define __NR_pwritev           334
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 327
+#define NR_syscalls 335
 
 #include <arch/unistd.h>
 
index 942d14ac87924973c0574b502d4d3dffbc0bd3e0..d51a17c0f59b2fa369616bc3c948988ed57d3d26 100644 (file)
@@ -72,6 +72,7 @@
  *     ICH2    spec c #20      - IDE PRD must not cross a 64K boundary
  *                               and must be dword aligned
  *     ICH2    spec c #24      - UDMA mode 4,5 t85/86 should be 6ns not 3.3
+ *     ICH7    errata #16      - MWDMA1 timings are incorrect
  *
  * Should have been BIOS fixed:
  *     450NX:  errata #19      - DMA hangs on old 450NX
@@ -94,7 +95,7 @@
 #include <linux/dmi.h>
 
 #define DRV_NAME       "ata_piix"
-#define DRV_VERSION    "2.12"
+#define DRV_VERSION    "2.13"
 
 enum {
        PIIX_IOCFG              = 0x54, /* IDE I/O configuration register */
@@ -136,6 +137,7 @@ enum piix_controller_ids {
        ich_pata_33,            /* ICH up to UDMA 33 only */
        ich_pata_66,            /* ICH up to 66 Mhz */
        ich_pata_100,           /* ICH up to UDMA 100 */
+       ich_pata_100_nomwdma1,  /* ICH up to UDMA 100 but with no MWDMA1*/
        ich5_sata,
        ich6_sata,
        ich6m_sata,
@@ -216,8 +218,8 @@ static const struct pci_device_id piix_pci_tbl[] = {
        /* ICH6 (and 6) (i915) UDMA 100 */
        { 0x8086, 0x266F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
        /* ICH7/7-R (i945, i975) UDMA 100*/
-       { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
-       { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
+       { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100_nomwdma1 },
+       { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100_nomwdma1 },
        /* ICH8 Mobile PATA Controller */
        { 0x8086, 0x2850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
 
@@ -487,6 +489,15 @@ static struct ata_port_info piix_port_info[] = {
                .port_ops       = &ich_pata_ops,
        },
 
+       [ich_pata_100_nomwdma1] =
+       {
+               .flags          = PIIX_PATA_FLAGS | PIIX_FLAG_CHECKINTR,
+               .pio_mask       = ATA_PIO4,
+               .mwdma_mask     = ATA_MWDMA2_ONLY,
+               .udma_mask      = ATA_UDMA5,
+               .port_ops       = &ich_pata_ops,
+       },
+
        [ich5_sata] =
        {
                .flags          = PIIX_SATA_FLAGS,
@@ -594,6 +605,7 @@ static const struct ich_laptop ich_laptop[] = {
        { 0x24CA, 0x1025, 0x003d },     /* ICH4 on ACER TM290 */
        { 0x266F, 0x1025, 0x0066 },     /* ICH6 on ACER Aspire 1694WLMi */
        { 0x2653, 0x1043, 0x82D8 },     /* ICH6M on Asus Eee 701 */
+       { 0x27df, 0x104d, 0x900e },     /* ICH7 on Sony TZ-90 */
        /* end marker */
        { 0, }
 };
index 17c5d48a75d2f14f048b39ad751ae757ca9ceaed..c9242301cfa1425c3f16a659117c8516aa43f294 100644 (file)
@@ -4091,7 +4091,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
 
        /* fail early if !ATA && !ATAPI to avoid issuing [P]IDENTIFY to PMP */
        if (ata_class_enabled(new_class) &&
-           new_class != ATA_DEV_ATA && new_class != ATA_DEV_ATAPI) {
+           new_class != ATA_DEV_ATA &&
+           new_class != ATA_DEV_ATAPI &&
+           new_class != ATA_DEV_SEMB) {
                ata_dev_printk(dev, KERN_INFO, "class mismatch %u != %u\n",
                               dev->class, new_class);
                rc = -ENODEV;
index 01831312c3607e3bc8aa98cfb42604e14cc3eba1..94919ad03df12ddd7845870b9ea7346827400b98 100644 (file)
@@ -2783,6 +2783,12 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
                } else if (dev->class == ATA_DEV_UNKNOWN &&
                           ehc->tries[dev->devno] &&
                           ata_class_enabled(ehc->classes[dev->devno])) {
+                       /* Temporarily set dev->class, it will be
+                        * permanently set once all configurations are
+                        * complete.  This is necessary because new
+                        * device configuration is done in two
+                        * separate loops.
+                        */
                        dev->class = ehc->classes[dev->devno];
 
                        if (dev->class == ATA_DEV_PMP)
@@ -2790,6 +2796,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
                        else
                                rc = ata_dev_read_id(dev, &dev->class,
                                                     readid_flags, dev->id);
+
+                       /* read_id might have changed class, store and reset */
+                       ehc->classes[dev->devno] = dev->class;
+                       dev->class = ATA_DEV_UNKNOWN;
+
                        switch (rc) {
                        case 0:
                                /* clear error info accumulated during probe */
@@ -2799,13 +2810,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
                        case -ENOENT:
                                /* IDENTIFY was issued to non-existent
                                 * device.  No need to reset.  Just
-                                * thaw and kill the device.
+                                * thaw and ignore the device.
                                 */
                                ata_eh_thaw_port(ap);
-                               dev->class = ATA_DEV_UNKNOWN;
                                break;
                        default:
-                               dev->class = ATA_DEV_UNKNOWN;
                                goto err;
                        }
                }
@@ -2826,11 +2835,15 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
                    dev->class == ATA_DEV_PMP)
                        continue;
 
+               dev->class = ehc->classes[dev->devno];
+
                ehc->i.flags |= ATA_EHI_PRINTINFO;
                rc = ata_dev_configure(dev);
                ehc->i.flags &= ~ATA_EHI_PRINTINFO;
-               if (rc)
+               if (rc) {
+                       dev->class = ATA_DEV_UNKNOWN;
                        goto err;
+               }
 
                spin_lock_irqsave(ap->lock, flags);
                ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
@@ -3494,6 +3507,8 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
  */
 static void ata_eh_handle_port_resume(struct ata_port *ap)
 {
+       struct ata_link *link;
+       struct ata_device *dev;
        unsigned long flags;
        int rc = 0;
 
@@ -3508,6 +3523,17 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
 
        WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED));
 
+       /*
+        * Error timestamps are in jiffies which doesn't run while
+        * suspended and PHY events during resume isn't too uncommon.
+        * When the two are combined, it can lead to unnecessary speed
+        * downs if the machine is suspended and resumed repeatedly.
+        * Clear error history.
+        */
+       ata_for_each_link(link, ap, HOST_FIRST)
+               ata_for_each_dev(dev, link, ALL)
+                       ata_ering_clear(&dev->ering);
+
        ata_acpi_set_state(ap, PMSG_ON);
 
        if (ap->ops->port_resume)
index 2733b0c90b751182f6c5b57879debb8918ccca11..68d9132d8f6f10c62947d6365647269daa7cc20a 100644 (file)
@@ -313,7 +313,7 @@ ata_scsi_em_message_show(struct device *dev, struct device_attribute *attr,
                return ap->ops->em_show(ap, buf);
        return -EINVAL;
 }
-DEVICE_ATTR(em_message, S_IRUGO | S_IWUGO,
+DEVICE_ATTR(em_message, S_IRUGO | S_IWUSR,
                ata_scsi_em_message_show, ata_scsi_em_message_store);
 EXPORT_SYMBOL_GPL(dev_attr_em_message);
 
@@ -366,7 +366,7 @@ ata_scsi_activity_store(struct device *dev, struct device_attribute *attr,
        }
        return -EINVAL;
 }
-DEVICE_ATTR(sw_activity, S_IWUGO | S_IRUGO, ata_scsi_activity_show,
+DEVICE_ATTR(sw_activity, S_IWUSR | S_IRUGO, ata_scsi_activity_show,
                        ata_scsi_activity_store);
 EXPORT_SYMBOL_GPL(dev_attr_sw_activity);
 
index 5fedb3d4032ba2b89656403c92efae71d10f83c3..2f3c9bed63d99925a02d20b2e93e780340508877 100644 (file)
@@ -2,7 +2,7 @@
  * pata_pdc202xx_old.c         - Promise PDC202xx PATA for new ATA layer
  *                       (C) 2005 Red Hat Inc
  *                       Alan Cox <alan@lxorguk.ukuu.org.uk>
- *                       (C) 2007 Bartlomiej Zolnierkiewicz
+ *                       (C) 2007,2009 Bartlomiej Zolnierkiewicz
  *
  * Based in part on linux/drivers/ide/pci/pdc202xx_old.c
  *
@@ -158,7 +158,7 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
        u32 len;
 
        /* Check we keep host level locking here */
-       if (adev->dma_mode >= XFER_UDMA_2)
+       if (adev->dma_mode > XFER_UDMA_2)
                iowrite8(ioread8(clock) | sel66, clock);
        else
                iowrite8(ioread8(clock) & ~sel66, clock);
@@ -212,7 +212,7 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
                iowrite8(ioread8(clock) & ~sel66, clock);
        }
        /* Flip back to 33Mhz for PIO */
-       if (adev->dma_mode >= XFER_UDMA_2)
+       if (adev->dma_mode > XFER_UDMA_2)
                iowrite8(ioread8(clock) & ~sel66, clock);
        ata_bmdma_stop(qc);
        pdc202xx_set_piomode(ap, adev);
index 870dcfd82357c1fb968b4b73844b2603a1a40665..23714aefb8256d742c56858b9a57e9614ecfb8c1 100644 (file)
@@ -293,6 +293,10 @@ enum {
        FISCFG_WAIT_DEV_ERR     = (1 << 8),     /* wait for host on DevErr */
        FISCFG_SINGLE_SYNC      = (1 << 16),    /* SYNC on DMA activation */
 
+       PHY_MODE9_GEN2          = 0x398,
+       PHY_MODE9_GEN1          = 0x39c,
+       PHYCFG_OFS              = 0x3a0,        /* only in 65n devices */
+
        MV5_PHY_MODE            = 0x74,
        MV5_LTMODE              = 0x30,
        MV5_PHY_CTL             = 0x0C,
@@ -609,6 +613,8 @@ static int mv_soc_reset_hc(struct mv_host_priv *hpriv,
 static void mv_soc_reset_flash(struct mv_host_priv *hpriv,
                                      void __iomem *mmio);
 static void mv_soc_reset_bus(struct ata_host *host, void __iomem *mmio);
+static void mv_soc_65n_phy_errata(struct mv_host_priv *hpriv,
+                                 void __iomem *mmio, unsigned int port);
 static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio);
 static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio,
                             unsigned int port_no);
@@ -807,6 +813,14 @@ static const struct mv_hw_ops mv_soc_ops = {
        .reset_bus              = mv_soc_reset_bus,
 };
 
+static const struct mv_hw_ops mv_soc_65n_ops = {
+       .phy_errata             = mv_soc_65n_phy_errata,
+       .enable_leds            = mv_soc_enable_leds,
+       .reset_hc               = mv_soc_reset_hc,
+       .reset_flash            = mv_soc_reset_flash,
+       .reset_bus              = mv_soc_reset_bus,
+};
+
 /*
  * Functions
  */
@@ -3397,6 +3411,53 @@ static void mv_soc_reset_bus(struct ata_host *host, void __iomem *mmio)
        return;
 }
 
+static void mv_soc_65n_phy_errata(struct mv_host_priv *hpriv,
+                                 void __iomem *mmio, unsigned int port)
+{
+       void __iomem *port_mmio = mv_port_base(mmio, port);
+       u32     reg;
+
+       reg = readl(port_mmio + PHY_MODE3);
+       reg &= ~(0x3 << 27);    /* SELMUPF (bits 28:27) to 1 */
+       reg |= (0x1 << 27);
+       reg &= ~(0x3 << 29);    /* SELMUPI (bits 30:29) to 1 */
+       reg |= (0x1 << 29);
+       writel(reg, port_mmio + PHY_MODE3);
+
+       reg = readl(port_mmio + PHY_MODE4);
+       reg &= ~0x1;    /* SATU_OD8 (bit 0) to 0, reserved bit 16 must be set */
+       reg |= (0x1 << 16);
+       writel(reg, port_mmio + PHY_MODE4);
+
+       reg = readl(port_mmio + PHY_MODE9_GEN2);
+       reg &= ~0xf;    /* TXAMP[3:0] (bits 3:0) to 8 */
+       reg |= 0x8;
+       reg &= ~(0x1 << 14);    /* TXAMP[4] (bit 14) to 0 */
+       writel(reg, port_mmio + PHY_MODE9_GEN2);
+
+       reg = readl(port_mmio + PHY_MODE9_GEN1);
+       reg &= ~0xf;    /* TXAMP[3:0] (bits 3:0) to 8 */
+       reg |= 0x8;
+       reg &= ~(0x1 << 14);    /* TXAMP[4] (bit 14) to 0 */
+       writel(reg, port_mmio + PHY_MODE9_GEN1);
+}
+
+/**
+ *     soc_is_65 - check if the soc is 65 nano device
+ *
+ *     Detect the type of the SoC, this is done by reading the PHYCFG_OFS
+ *     register, this register should contain non-zero value and it exists only
+ *     in the 65 nano devices, when reading it from older devices we get 0.
+ */
+static bool soc_is_65n(struct mv_host_priv *hpriv)
+{
+       void __iomem *port0_mmio = mv_port_base(hpriv->base, 0);
+
+       if (readl(port0_mmio + PHYCFG_OFS))
+               return true;
+       return false;
+}
+
 static void mv_setup_ifcfg(void __iomem *port_mmio, int want_gen2i)
 {
        u32 ifcfg = readl(port_mmio + SATA_IFCFG);
@@ -3737,7 +3798,10 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
                }
                break;
        case chip_soc:
-               hpriv->ops = &mv_soc_ops;
+               if (soc_is_65n(hpriv))
+                       hpriv->ops = &mv_soc_65n_ops;
+               else
+                       hpriv->ops = &mv_soc_ops;
                hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE |
                        MV_HP_ERRATA_60X1C0;
                break;
@@ -3800,7 +3864,8 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
        n_hc = mv_get_hc_count(host->ports[0]->flags);
 
        for (port = 0; port < host->n_ports; port++)
-               hpriv->ops->read_preamp(hpriv, port, mmio);
+               if (hpriv->ops->read_preamp)
+                       hpriv->ops->read_preamp(hpriv, port, mmio);
 
        rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc);
        if (rc)
index 92438e9dacc35887bd2d8b493ea3d93ac3bc20f7..5a87384ea4ff5cf58c77b64200a621b8fe616b76 100644 (file)
@@ -804,11 +804,14 @@ dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest,
        dma_addr_t dma_dest, dma_src;
        dma_cookie_t cookie;
        int cpu;
+       unsigned long flags;
 
        dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE);
        dma_dest = dma_map_single(dev->dev, dest, len, DMA_FROM_DEVICE);
-       tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len,
-                                        DMA_CTRL_ACK);
+       flags = DMA_CTRL_ACK |
+               DMA_COMPL_SRC_UNMAP_SINGLE |
+               DMA_COMPL_DEST_UNMAP_SINGLE;
+       tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
 
        if (!tx) {
                dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
@@ -850,11 +853,12 @@ dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page,
        dma_addr_t dma_dest, dma_src;
        dma_cookie_t cookie;
        int cpu;
+       unsigned long flags;
 
        dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE);
        dma_dest = dma_map_page(dev->dev, page, offset, len, DMA_FROM_DEVICE);
-       tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len,
-                                        DMA_CTRL_ACK);
+       flags = DMA_CTRL_ACK | DMA_COMPL_SRC_UNMAP_SINGLE;
+       tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
 
        if (!tx) {
                dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
@@ -898,12 +902,13 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg,
        dma_addr_t dma_dest, dma_src;
        dma_cookie_t cookie;
        int cpu;
+       unsigned long flags;
 
        dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE);
        dma_dest = dma_map_page(dev->dev, dest_pg, dest_off, len,
                                DMA_FROM_DEVICE);
-       tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len,
-                                        DMA_CTRL_ACK);
+       flags = DMA_CTRL_ACK;
+       tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
 
        if (!tx) {
                dma_unmap_page(dev->dev, dma_src, len, DMA_TO_DEVICE);
index a27c0fb1bc11f17b6b8c56bdc383aee5a710b051..fb7da5141e96b2052fae826f816909c2598035d9 100644 (file)
@@ -531,9 +531,7 @@ static int __init dmatest_init(void)
                chan = dma_request_channel(mask, filter, NULL);
                if (chan) {
                        err = dmatest_add_channel(chan);
-                       if (err == 0)
-                               continue;
-                       else {
+                       if (err) {
                                dma_release_channel(chan);
                                break; /* add_channel failed, punt */
                        }
index e4fc33c1c32f89fc99711ca2c759f15e79eeaa62..1955ee8d6d2019df1e3b9182b6abb54a2823f587 100644 (file)
@@ -1063,22 +1063,31 @@ static void ioat_dma_cleanup_tasklet(unsigned long data)
 static void
 ioat_dma_unmap(struct ioat_dma_chan *ioat_chan, struct ioat_desc_sw *desc)
 {
-       /*
-        * yes we are unmapping both _page and _single
-        * alloc'd regions with unmap_page. Is this
-        * *really* that bad?
-        */
-       if (!(desc->async_tx.flags & DMA_COMPL_SKIP_DEST_UNMAP))
-               pci_unmap_page(ioat_chan->device->pdev,
-                               pci_unmap_addr(desc, dst),
-                               pci_unmap_len(desc, len),
-                               PCI_DMA_FROMDEVICE);
-
-       if (!(desc->async_tx.flags & DMA_COMPL_SKIP_SRC_UNMAP))
-               pci_unmap_page(ioat_chan->device->pdev,
-                               pci_unmap_addr(desc, src),
-                               pci_unmap_len(desc, len),
-                               PCI_DMA_TODEVICE);
+       if (!(desc->async_tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
+               if (desc->async_tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE)
+                       pci_unmap_single(ioat_chan->device->pdev,
+                                        pci_unmap_addr(desc, dst),
+                                        pci_unmap_len(desc, len),
+                                        PCI_DMA_FROMDEVICE);
+               else
+                       pci_unmap_page(ioat_chan->device->pdev,
+                                      pci_unmap_addr(desc, dst),
+                                      pci_unmap_len(desc, len),
+                                      PCI_DMA_FROMDEVICE);
+       }
+
+       if (!(desc->async_tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
+               if (desc->async_tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE)
+                       pci_unmap_single(ioat_chan->device->pdev,
+                                        pci_unmap_addr(desc, src),
+                                        pci_unmap_len(desc, len),
+                                        PCI_DMA_TODEVICE);
+               else
+                       pci_unmap_page(ioat_chan->device->pdev,
+                                      pci_unmap_addr(desc, src),
+                                      pci_unmap_len(desc, len),
+                                      PCI_DMA_TODEVICE);
+       }
 }
 
 /**
@@ -1363,6 +1372,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
        int err = 0;
        struct completion cmp;
        unsigned long tmo;
+       unsigned long flags;
 
        src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
        if (!src)
@@ -1392,8 +1402,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
                                 DMA_TO_DEVICE);
        dma_dest = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE,
                                  DMA_FROM_DEVICE);
+       flags = DMA_COMPL_SRC_UNMAP_SINGLE | DMA_COMPL_DEST_UNMAP_SINGLE;
        tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src,
-                                                  IOAT_TEST_SIZE, 0);
+                                                  IOAT_TEST_SIZE, flags);
        if (!tx) {
                dev_err(&device->pdev->dev,
                        "Self-test prep failed, disabling\n");
index e202a6ce55735bf3d6fdb456f718fade1301ba32..9a5bc1a7389e61abc82e78aee287934f13c2eef7 100644 (file)
@@ -1272,7 +1272,8 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
        /* Other interrupts do not interfere with this channel */
        spin_lock(&ichan->lock);
        if (unlikely(chan_id != IDMAC_SDC_0 && chan_id != IDMAC_SDC_1 &&
-                    ((curbuf >> chan_id) & 1) == ichan->active_buffer)) {
+                    ((curbuf >> chan_id) & 1) == ichan->active_buffer &&
+                    !list_is_last(ichan->queue.next, &ichan->queue))) {
                int i = 100;
 
                /* This doesn't help. See comment in ipu_disable_channel() */
@@ -1547,7 +1548,7 @@ static irqreturn_t ic_sof_irq(int irq, void *dev_id)
        struct idmac_channel *ichan = dev_id;
        printk(KERN_DEBUG "Got SOF IRQ %d on Channel %d\n",
               irq, ichan->dma_chan.chan_id);
-       disable_irq(irq);
+       disable_irq_nosync(irq);
        return IRQ_HANDLED;
 }
 
@@ -1556,7 +1557,7 @@ static irqreturn_t ic_eof_irq(int irq, void *dev_id)
        struct idmac_channel *ichan = dev_id;
        printk(KERN_DEBUG "Got EOF IRQ %d on Channel %d\n",
               irq, ichan->dma_chan.chan_id);
-       disable_irq(irq);
+       disable_irq_nosync(irq);
        return IRQ_HANDLED;
 }
 
index 3a22eb9be3783ac890514980e4ea7939c0a38e31..17b24c580c099367bdad506bacffa076eb9b1806 100644 (file)
@@ -71,6 +71,7 @@ config DRM_I915
        select FB_CFB_COPYAREA
        select FB_CFB_IMAGEBLIT
        select FB
+       select FRAMEBUFFER_CONSOLE if !EMBEDDED
        tristate "i915 driver"
        help
          Choose this option if you have a system that has Intel 830M, 845G,
index aa1b995dd0332cdc0d8e4e8496cf776238599c48..4d5ee2bbc62b693aaf97467b2ff689596efe6278 100644 (file)
 #define USB_VENDOR_ID_BERKSHIRE                0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD   0x1140
 
+#define USB_VENDOR_ID_CH               0x068e
+#define USB_DEVICE_ID_CH_PRO_PEDALS    0x00f2
+#define USB_DEVICE_ID_CH_COMBATSTICK   0x00f4
+#define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE       0x00ff
+
 #define USB_VENDOR_ID_CHERRY           0x046a
 #define USB_DEVICE_ID_CHERRY_CYMOTION  0x0023
 
index 900ce18dd5490a4982e2f495693a9da8684e96e5..ac8049b5f1e934a658f3127457efc7626794c7e8 100644 (file)
@@ -898,7 +898,7 @@ static int usbhid_parse(struct hid_device *hid)
                goto err;
        }
 
-       hid->quirks = quirks;
+       hid->quirks |= quirks;
 
        return 0;
 err:
index 4391717d25197f83c93e00946d5bd20580fdcba7..d8f7423f363eb39004926b7f2accfe7f604b2b7c 100644 (file)
@@ -50,6 +50,9 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
index a48c8aee0218087691236241c782eac8f918759a..f1c6ca7e285235bd2033831929bec4d22e259672 100644 (file)
@@ -467,7 +467,7 @@ config I2C_PXA_SLAVE
 
 config I2C_S3C2410
        tristate "S3C2410 I2C Driver"
-       depends on ARCH_S3C2410
+       depends on ARCH_S3C2410 || ARCH_S3C64XX
        help
          Say Y here to include support for I2C controller in the
          Samsung S3C2410 based System-on-Chip devices.
index 3fcf78e906db185187d10c87466786fb3c3280c2..b5db8b8836159bf4667157654f53a5f518e901e9 100644 (file)
@@ -531,16 +531,16 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
        rbdf = cpm->rbase;
 
        for (i = 0; i < CPM_MAXBD; i++) {
-               cpm->rxbuf[i] = dma_alloc_coherent(
-                       NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL);
+               cpm->rxbuf[i] = dma_alloc_coherent(&cpm->ofdev->dev,
+                                                  CPM_MAX_READ + 1,
+                                                  &cpm->rxdma[i], GFP_KERNEL);
                if (!cpm->rxbuf[i]) {
                        ret = -ENOMEM;
                        goto out_muram;
                }
                out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1));
 
-               cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(
-                       NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
+               cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
                if (!cpm->txbuf[i]) {
                        ret = -ENOMEM;
                        goto out_muram;
@@ -585,10 +585,10 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
 out_muram:
        for (i = 0; i < CPM_MAXBD; i++) {
                if (cpm->rxbuf[i])
-                       dma_free_coherent(NULL, CPM_MAX_READ + 1,
+                       dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
                                cpm->rxbuf[i], cpm->rxdma[i]);
                if (cpm->txbuf[i])
-                       dma_free_coherent(NULL, CPM_MAX_READ + 1,
+                       dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
                                cpm->txbuf[i], cpm->txdma[i]);
        }
        cpm_muram_free(cpm->dp_addr);
@@ -619,9 +619,9 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
 
        /* Free all memory */
        for (i = 0; i < CPM_MAXBD; i++) {
-               dma_free_coherent(NULL, CPM_MAX_READ + 1,
+               dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
                        cpm->rxbuf[i], cpm->rxdma[i]);
-               dma_free_coherent(NULL, CPM_MAX_READ + 1,
+               dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
                        cpm->txbuf[i], cpm->txdma[i]);
        }
 
index 4af5c09f0e8fe3def51810746652f6d70da52717..dd778d7ae047a35d7626e083dacf34e1d72d0552 100644 (file)
@@ -164,7 +164,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
        return 0;
 }
 
-#ifdef CONFIG_PPC_52xx
+#ifdef CONFIG_PPC_MPC52xx
 static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
        {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
        {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02},
@@ -188,7 +188,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
 
 int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler)
 {
-       const struct mpc52xx_i2c_divider *div = NULL;
+       const struct mpc_i2c_divider *div = NULL;
        unsigned int pvr = mfspr(SPRN_PVR);
        u32 divider;
        int i;
@@ -203,7 +203,7 @@ int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler)
         * We want to choose an FDR/DFSR that generates an I2C bus speed that
         * is equal to or lower than the requested speed.
         */
-       for (i = 0; i < ARRAY_SIZE(mpc52xx_i2c_dividers); i++) {
+       for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) {
                div = &mpc_i2c_dividers_52xx[i];
                /* Old MPC5200 rev A CPUs do not support the high bits */
                if (div->fdr & 0xc0 && pvr == 0x80822011)
@@ -219,20 +219,23 @@ static void mpc_i2c_setclock_52xx(struct device_node *node,
                                  struct mpc_i2c *i2c,
                                  u32 clock, u32 prescaler)
 {
-       int fdr = mpc52xx_i2c_get_fdr(node, clock, prescaler);
+       int ret, fdr;
+
+       ret = mpc_i2c_get_fdr_52xx(node, clock, prescaler);
+       fdr = (ret >= 0) ? ret : 0x3f; /* backward compatibility */
 
-       if (fdr < 0)
-               fdr = 0x3f; /* backward compatibility */
        writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
-       dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr);
+
+       if (ret >= 0)
+               dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr);
 }
-#else /* !CONFIG_PPC_52xx */
+#else /* !CONFIG_PPC_MPC52xx */
 static void mpc_i2c_setclock_52xx(struct device_node *node,
                                  struct mpc_i2c *i2c,
                                  u32 clock, u32 prescaler)
 {
 }
-#endif /* CONFIG_PPC_52xx*/
+#endif /* CONFIG_PPC_MPC52xx*/
 
 #ifdef CONFIG_FSL_SOC
 static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = {
@@ -321,14 +324,17 @@ static void mpc_i2c_setclock_8xxx(struct device_node *node,
                                  struct mpc_i2c *i2c,
                                  u32 clock, u32 prescaler)
 {
-       int fdr = mpc_i2c_get_fdr_8xxx(node, clock, prescaler);
+       int ret, fdr;
+
+       ret = mpc_i2c_get_fdr_8xxx(node, clock, prescaler);
+       fdr = (ret >= 0) ? ret : 0x1031; /* backward compatibility */
 
-       if (fdr < 0)
-               fdr = 0x1031; /* backward compatibility */
        writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
        writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR);
-       dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n",
-                clock, fdr >> 8, fdr & 0xff);
+
+       if (ret >= 0)
+               dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n",
+                        clock, fdr >> 8, fdr & 0xff);
 }
 
 #else /* !CONFIG_FSL_SOC */
index c1405c8f6ba5645a163519a5d5cbbd7ac2021f6a..acc7143d96550b1e7880f5f03e13f828271546fa 100644 (file)
@@ -265,10 +265,10 @@ static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
                show_state(i2c);
        }
 
-       if (timeout <= 0)
+       if (timeout < 0)
                show_state(i2c);
 
-       return timeout <= 0 ? I2C_RETRY : 0;
+       return timeout < 0 ? I2C_RETRY : 0;
 }
 
 static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
@@ -612,7 +612,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c)
                show_state(i2c);
        }
 
-       if (timeout <= 0) {
+       if (timeout < 0) {
                show_state(i2c);
                dev_err(&i2c->adap.dev,
                        "i2c_pxa: timeout waiting for bus free\n");
index 8d71086f5a1c2b8c0e55bb6168ee0cdb474de520..62f9cf2f94ec647756dcd5f2ae06c9f01a9eafac 100644 (file)
@@ -410,6 +410,7 @@ int cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count)
        ptr = wq->sq_rptr + count;
        sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2);
        while (ptr != wq->sq_wptr) {
+               sqp->signaled = 0;
                insert_sq_cqe(wq, cq, sqp);
                ptr++;
                sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2);
index 9974e886b8dec23e7789be0889cbbc658e97c51b..8a7dd6795fa0a2117f3f21311c9a1a4eccdf4c9c 100644 (file)
@@ -86,6 +86,7 @@ struct mlx4_ib_mr {
 
 struct mlx4_ib_fast_reg_page_list {
        struct ib_fast_reg_page_list    ibfrpl;
+       __be64                         *mapped_page_list;
        dma_addr_t                      map;
 };
 
index 8e4d26d56a95f7e0571133915f35476e1860b541..8f3666b20ea43991d2f6f742d70161490b2851c8 100644 (file)
@@ -231,7 +231,11 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device
        if (!mfrpl)
                return ERR_PTR(-ENOMEM);
 
-       mfrpl->ibfrpl.page_list = dma_alloc_coherent(&dev->dev->pdev->dev,
+       mfrpl->ibfrpl.page_list = kmalloc(size, GFP_KERNEL);
+       if (!mfrpl->ibfrpl.page_list)
+               goto err_free;
+
+       mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->pdev->dev,
                                                     size, &mfrpl->map,
                                                     GFP_KERNEL);
        if (!mfrpl->ibfrpl.page_list)
@@ -242,6 +246,7 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device
        return &mfrpl->ibfrpl;
 
 err_free:
+       kfree(mfrpl->ibfrpl.page_list);
        kfree(mfrpl);
        return ERR_PTR(-ENOMEM);
 }
@@ -252,8 +257,9 @@ void mlx4_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list)
        struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list);
        int size = page_list->max_page_list_len * sizeof (u64);
 
-       dma_free_coherent(&dev->dev->pdev->dev, size, page_list->page_list,
+       dma_free_coherent(&dev->dev->pdev->dev, size, mfrpl->mapped_page_list,
                          mfrpl->map);
+       kfree(mfrpl->ibfrpl.page_list);
        kfree(mfrpl);
 }
 
index f385a24d31d28816aca661f647631e35ce45e09b..20724aee76f4766d80a9884da1e98f38d924ed50 100644 (file)
@@ -1365,7 +1365,7 @@ static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr)
        int i;
 
        for (i = 0; i < wr->wr.fast_reg.page_list_len; ++i)
-               wr->wr.fast_reg.page_list->page_list[i] =
+               mfrpl->mapped_page_list[i] =
                        cpu_to_be64(wr->wr.fast_reg.page_list->page_list[i] |
                                    MLX4_MTT_FLAG_PRESENT);
 
index bc4e40f3ede7303d97816a6cbf8588c8f22118d2..2d1415e1683467ae55de53ba3fb273996ba7a795 100644 (file)
@@ -226,7 +226,7 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
  */
 static void ml_combine_effects(struct ff_effect *effect,
                               struct ml_effect_state *state,
-                              int gain)
+                              unsigned int gain)
 {
        struct ff_effect *new = state->effect;
        unsigned int strong, weak, i;
index 4224f0112849cb8b7b48935c96060502d01a2a7d..012a5e753991a65156a0916cbeb3e43dbfa084bd 100644 (file)
@@ -843,7 +843,13 @@ static const struct input_device_id joydev_blacklist[] = {
                                INPUT_DEVICE_ID_MATCH_KEYBIT,
                .evbit = { BIT_MASK(EV_KEY) },
                .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
-       },      /* Avoid itouchpads, touchscreens and tablets */
+       },      /* Avoid itouchpads and touchscreens */
+       {
+               .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
+                               INPUT_DEVICE_ID_MATCH_KEYBIT,
+               .evbit = { BIT_MASK(EV_KEY) },
+               .keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) },
+       },      /* Avoid tablets, digitisers and similar devices */
        { }     /* Terminating entry */
 };
 
index 444dec07e5d82f4ee97550f7473104f710e6a176..df3f8aa68115c48109739f84df30eee651a8ef4e 100644 (file)
@@ -894,6 +894,13 @@ static unsigned int atkbd_amilo_pa1510_forced_release_keys[] = {
        0xb0, 0xae, -1U
 };
 
+/*
+ * Amilo Xi 3650 key release for light touch bar not working
+ */
+static unsigned int atkbd_amilo_xi3650_forced_release_keys[] = {
+       0x67, 0xed, 0x90, 0xa2, 0x99, 0xa4, 0xae, 0xb0, -1U
+};
+
 /*
  * atkbd_set_keycode_table() initializes keyboard's keycode table
  * according to the selected scancode set
@@ -1560,6 +1567,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
                .callback = atkbd_setup_forced_release,
                .driver_data = atkbd_amilo_pa1510_forced_release_keys,
        },
+       {
+               .ident = "Fujitsu Amilo Xi 3650",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 3650"),
+               },
+               .callback = atkbd_setup_forced_release,
+               .driver_data = atkbd_amilo_xi3650_forced_release_keys,
+       },
        { }
 };
 
index 536668fbda227158beaeb0c7eec9478be72f4d56..948e167557f18fce7e73528283e5d56c953adbb6 100644 (file)
@@ -200,8 +200,9 @@ static int tsc2007_read_values(struct tsc2007 *tsc)
 static enum hrtimer_restart tsc2007_timer(struct hrtimer *handle)
 {
        struct tsc2007 *ts = container_of(handle, struct tsc2007, timer);
+       unsigned long flags;
 
-       spin_lock_irq(&ts->lock);
+       spin_lock_irqsave(&ts->lock, flags);
 
        if (unlikely(!ts->get_pendown_state() && ts->pendown)) {
                struct input_dev *input = ts->input;
@@ -222,7 +223,7 @@ static enum hrtimer_restart tsc2007_timer(struct hrtimer *handle)
                tsc2007_send_event(ts);
        }
 
-       spin_unlock_irq(&ts->lock);
+       spin_unlock_irqrestore(&ts->lock, flags);
 
        return HRTIMER_NORESTART;
 }
index 7942c4d3cd8835dd2bf29d6522e4a1f2ab92a099..9ee873e872b34a2c02db98ab59e3b5c3f2616b13 100644 (file)
@@ -951,7 +951,6 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv,
        if (err) {
                mlx4_err(mdev, "Failed to allocate qp #%d\n", qpn);
                goto out;
-               return err;
        }
        qp->event = mlx4_en_sqp_event;
 
index 001b328adf804e1e75d9c561df9e704b424b5468..a563fbe559d0505b90d1f736beb3a8e8bf197717 100644 (file)
 #define DMA_32BIT_PFN          IOVA_PFN(DMA_BIT_MASK(32))
 #define DMA_64BIT_PFN          IOVA_PFN(DMA_BIT_MASK(64))
 
+#ifndef PHYSICAL_PAGE_MASK
+#define PHYSICAL_PAGE_MASK PAGE_MASK
+#endif
+
 /* global iommu list, set NULL for ignored DMAR units */
 static struct intel_iommu **g_iommus;
 
@@ -1216,7 +1220,7 @@ static void dmar_init_reserved_ranges(void)
                        if (!r->flags || !(r->flags & IORESOURCE_MEM))
                                continue;
                        addr = r->start;
-                       addr &= PAGE_MASK;
+                       addr &= PHYSICAL_PAGE_MASK;
                        size = r->end - addr;
                        size = PAGE_ALIGN(size);
                        iova = reserve_iova(&reserved_iova_list, IOVA_PFN(addr),
@@ -2173,7 +2177,8 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
         * is not a big problem
         */
        ret = domain_page_mapping(domain, start_paddr,
-               ((u64)paddr) & PAGE_MASK, size, prot);
+                                 ((u64)paddr) & PHYSICAL_PAGE_MASK,
+                                 size, prot);
        if (ret)
                goto error;
 
@@ -2463,8 +2468,8 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne
                addr = page_to_phys(sg_page(sg)) + sg->offset;
                size = aligned_size((u64)addr, sg->length);
                ret = domain_page_mapping(domain, start_addr + offset,
-                       ((u64)addr) & PAGE_MASK,
-                       size, prot);
+                                         ((u64)addr) & PHYSICAL_PAGE_MASK,
+                                         size, prot);
                if (ret) {
                        /*  clear the page */
                        dma_pte_clear_range(domain, start_addr,
index a6341e4f9a0ff9e489c017fe8ea6e7e81474dc35..9c8c70c497dcc6a515b44d71035bd313d3955116 100644 (file)
@@ -495,9 +495,7 @@ static int twl4030_rtc_suspend(struct platform_device *pdev, pm_message_t state)
 {
        irqstat = rtc_irq_bits;
 
-       /* REVISIT alarm may need to wake us from sleep */
-       mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M |
-                        BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+       mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
        return 0;
 }
 
index 885194a07418f85e94f733b3ecf2953d11d0e4ce..3f3c08c6ba4e1c60ce2305b7a0fe0247d5151fb8 100644 (file)
@@ -1373,6 +1373,9 @@ static void cleanup(struct spi_device *spi)
 {
        struct chip_data *chip = spi_get_ctldata(spi);
 
+       if (!chip)
+               return;
+
        if (gpio_is_valid(chip->gpio_cs))
                gpio_free(chip->gpio_cs);
 
index 7826bdce4bbe307042e4459398ff1b6ba87bd3ca..0048f1185a60eebb0e393390b50b944665904be8 100644 (file)
@@ -1128,13 +1128,6 @@ config FB_INTEL
           830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets.
           Say Y if you have and plan to use such a board.
 
-         If you say Y here and want DDC/I2C support you must first say Y to
-         "I2C support" and "I2C bit-banging support" in the character devices
-         section.
-
-         If you say M here then "I2C support" and "I2C bit-banging support"
-         can be build either as modules or built-in.
-
          To compile this driver as a module, choose M here: the
          module will be called intelfb.
 
@@ -1207,11 +1200,10 @@ config FB_MATROX_G
          pixel and 32 bpp packed pixel. You can also use font widths
          different from 8.
 
-         If you need support for G400 secondary head, you must first say Y to
-         "I2C support" in the character devices section, and then to
-         "Matrox I2C support" and "G400 second head support" here in the
-         framebuffer section. G450/G550 secondary head and digital output
-         are supported without additional modules.
+         If you need support for G400 secondary head, you must say Y to
+         "Matrox I2C support" and "G400 second head support" right below.
+         G450/G550 secondary head and digital output are supported without
+         additional modules.
 
          The driver starts in monitor mode. You must use the matroxset tool 
          (available at <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to 
@@ -1310,13 +1302,6 @@ config FB_RADEON
          a framebuffer device.  There are both PCI and AGP versions.  You
          don't need to choose this to run the Radeon in plain VGA mode.
 
-         If you say Y here and want DDC/I2C support you must first say Y to
-         "I2C support" and "I2C bit-banging support" in the character devices
-         section.
-
-         If you say M here then "I2C support" and "I2C bit-banging support" 
-         can be build either as modules or built-in.
-
          There is a product page at
          http://apps.ati.com/ATIcompare/
 
index e327b84820d28fdb96c6eab1d74b2a08e78e67ab..a0fec298216ea26f86695e6253d774c3a0e23729 100644 (file)
@@ -2103,7 +2103,7 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
 
 static int __devinit via_pci_probe(void)
 {
-       unsigned int default_xres, default_yres;
+       unsigned long default_xres, default_yres;
        char *tmpc, *tmpm;
        char *tmpc_sec, *tmpm_sec;
        int vmode_index;
@@ -2196,8 +2196,8 @@ static int __devinit via_pci_probe(void)
        viafb_FB_MM = viaparinfo->fbmem_virt;
        tmpm = viafb_mode;
        tmpc = strsep(&tmpm, "x");
-       strict_strtoul(tmpc, 0, (unsigned long *)&default_xres);
-       strict_strtoul(tmpm, 0, (unsigned long *)&default_yres);
+       strict_strtoul(tmpc, 0, &default_xres);
+       strict_strtoul(tmpm, 0, &default_yres);
 
        vmode_index = viafb_get_mode_index(default_xres, default_yres, 0);
        DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index);
index a89f370fadb5d72666b87c4b16bfaa9c3833788a..5458e80fc55841d136227f7ce0d7ee97f8ba0f38 100644 (file)
@@ -1212,7 +1212,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
 
 SYSCALL_DEFINE1(epoll_create, int, size)
 {
-       if (size < 0)
+       if (size <= 0)
                return -EINVAL;
 
        return sys_epoll_create1(0);
index cc8e4de2fee5f0caefa6c5e00ea4e1abf33359b8..1ad703150dee08d9bec6c481f480b99ae7b149d5 100644 (file)
@@ -117,11 +117,13 @@ SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
 {
        if (unlikely(newfd == oldfd)) { /* corner case */
                struct files_struct *files = current->files;
+               int retval = oldfd;
+
                rcu_read_lock();
                if (!fcheck_files(files, oldfd))
-                       oldfd = -EBADF;
+                       retval = -EBADF;
                rcu_read_unlock();
-               return oldfd;
+               return retval;
        }
        return sys_dup3(oldfd, newfd, 0);
 }
index 153d9681192b6dcc5f2d29094d4582ac75e94ff6..c1462d43e7217de23f046852d9fd466af0617e65 100644 (file)
@@ -312,16 +312,6 @@ out:
        return retval;
 }
 
-/*
- * Read a page. Again trivial. If it didn't already exist
- * in the page cache, it is zero-filled.
- */
-static int hugetlbfs_readpage(struct file *file, struct page * page)
-{
-       unlock_page(page);
-       return -EINVAL;
-}
-
 static int hugetlbfs_write_begin(struct file *file,
                        struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned flags,
@@ -701,7 +691,6 @@ static void hugetlbfs_destroy_inode(struct inode *inode)
 }
 
 static const struct address_space_operations hugetlbfs_aops = {
-       .readpage       = hugetlbfs_readpage,
        .write_begin    = hugetlbfs_write_begin,
        .write_end      = hugetlbfs_write_end,
        .set_page_dirty = hugetlbfs_set_page_dirty,
index abf83881f68a762f736b1a99faa16aff669256af..1a54ae14a192d551ff02d57a559c109709903c57 100644 (file)
@@ -104,6 +104,16 @@ static void set_grace_period(void)
        schedule_delayed_work(&grace_period_end, grace_period);
 }
 
+static void restart_grace(void)
+{
+       if (nlmsvc_ops) {
+               cancel_delayed_work_sync(&grace_period_end);
+               locks_end_grace(&lockd_manager);
+               nlmsvc_invalidate_all();
+               set_grace_period();
+       }
+}
+
 /*
  * This is the lockd kernel thread
  */
@@ -149,10 +159,7 @@ lockd(void *vrqstp)
 
                if (signalled()) {
                        flush_signals(current);
-                       if (nlmsvc_ops) {
-                               nlmsvc_invalidate_all();
-                               set_grace_period();
-                       }
+                       restart_grace();
                        continue;
                }
 
index 5275097a75651db2303f777c0213cae4a04fcb7e..b5348405046b5e2831cdcc9cd32a7f0c3d2e6f8f 100644 (file)
@@ -229,7 +229,7 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
                goto out;
        status = vfs_readdir(filp, nfsd4_build_namelist, &names);
        fput(filp);
-       mutex_lock(&dir->d_inode->i_mutex);
+       mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
        while (!list_empty(&names)) {
                entry = list_entry(names.next, struct name_list, list);
 
@@ -264,7 +264,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
 
        dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
 
-       mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
+       mutex_lock_nested(&rec_dir.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
        dentry = lookup_one_len(name, rec_dir.dentry, namlen);
        if (IS_ERR(dentry)) {
                status = PTR_ERR(dentry);
index c65a27b76a9dd48f83f16de8452bfe0338094cb9..3b711f5147a75c5fb8bb04be8477fe5c7d866ff4 100644 (file)
@@ -580,7 +580,6 @@ free_session(struct kref *kref)
                struct nfsd4_cache_entry *e = &ses->se_slots[i].sl_cache_entry;
                nfsd4_release_respages(e->ce_respages, e->ce_resused);
        }
-       kfree(ses->se_slots);
        kfree(ses);
 }
 
index b820c311931c8e7d73218f6aae5cbcfe2bbe4993..b73549d293bef81e7f82bbbde7ef175ed419e137 100644 (file)
@@ -2214,6 +2214,15 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
        dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
        if (IS_ERR(dentry))
                return nfserrno(PTR_ERR(dentry));
+       if (!dentry->d_inode) {
+               /*
+                * nfsd_buffered_readdir drops the i_mutex between
+                * readdir and calling this callback, leaving a window
+                * where this directory entry could have gone away.
+                */
+               dput(dentry);
+               return nfserr_noent;
+       }
 
        exp_get(exp);
        /*
@@ -2276,6 +2285,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
        struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
        int buflen;
        __be32 *p = cd->buffer;
+       __be32 *cookiep;
        __be32 nfserr = nfserr_toosmall;
 
        /* In nfsv4, "." and ".." never make it onto the wire.. */
@@ -2292,7 +2302,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
                goto fail;
 
        *p++ = xdr_one;                             /* mark entry present */
-       cd->offset = p;                             /* remember pointer */
+       cookiep = p;
        p = xdr_encode_hyper(p, NFS_OFFSET_MAX);    /* offset of next entry */
        p = xdr_encode_array(p, name, namlen);      /* name length & name */
 
@@ -2306,6 +2316,8 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
                goto fail;
        case nfserr_dropit:
                goto fail;
+       case nfserr_noent:
+               goto skip_entry;
        default:
                /*
                 * If the client requested the RDATTR_ERROR attribute,
@@ -2324,6 +2336,8 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
        }
        cd->buflen -= (p - cd->buffer);
        cd->buffer = p;
+       cd->offset = cookiep;
+skip_entry:
        cd->common.err = nfs_ok;
        return 0;
 fail:
index 108d281ebca5b98bd1cdc53adb41066d2feead7f..50ff3f2cdf24de8450340efca40acf6235aee23d 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/smp_lock.h>    /* lock_kernel(), unlock_kernel() */
 #include <linux/capability.h>  /* capable() */
 #include <linux/uaccess.h>     /* copy_from_user(), copy_to_user() */
+#include <linux/vmalloc.h>
 #include <linux/nilfs2_fs.h>
 #include "nilfs.h"
 #include "segment.h"
@@ -147,29 +148,12 @@ static ssize_t
 nilfs_ioctl_do_get_cpinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
                          void *buf, size_t size, size_t nmembs)
 {
-       return nilfs_cpfile_get_cpinfo(nilfs->ns_cpfile, posp, flags, buf,
-                                      nmembs);
-}
-
-static int nilfs_ioctl_get_cpinfo(struct inode *inode, struct file *filp,
-                                 unsigned int cmd, void __user *argp)
-{
-       struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs;
-       struct nilfs_argv argv;
        int ret;
 
-       if (copy_from_user(&argv, argp, sizeof(argv)))
-               return -EFAULT;
-
        down_read(&nilfs->ns_segctor_sem);
-       ret = nilfs_ioctl_wrap_copy(nilfs, &argv, _IOC_DIR(cmd),
-                                   nilfs_ioctl_do_get_cpinfo);
+       ret = nilfs_cpfile_get_cpinfo(nilfs->ns_cpfile, posp, flags, buf,
+                                     nmembs);
        up_read(&nilfs->ns_segctor_sem);
-       if (ret < 0)
-               return ret;
-
-       if (copy_to_user(argp, &argv, sizeof(argv)))
-               ret = -EFAULT;
        return ret;
 }
 
@@ -195,28 +179,11 @@ static ssize_t
 nilfs_ioctl_do_get_suinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
                          void *buf, size_t size, size_t nmembs)
 {
-       return nilfs_sufile_get_suinfo(nilfs->ns_sufile, *posp, buf, nmembs);
-}
-
-static int nilfs_ioctl_get_suinfo(struct inode *inode, struct file *filp,
-                                 unsigned int cmd, void __user *argp)
-{
-       struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs;
-       struct nilfs_argv argv;
        int ret;
 
-       if (copy_from_user(&argv, argp, sizeof(argv)))
-               return -EFAULT;
-
        down_read(&nilfs->ns_segctor_sem);
-       ret = nilfs_ioctl_wrap_copy(nilfs, &argv, _IOC_DIR(cmd),
-                                   nilfs_ioctl_do_get_suinfo);
+       ret = nilfs_sufile_get_suinfo(nilfs->ns_sufile, *posp, buf, nmembs);
        up_read(&nilfs->ns_segctor_sem);
-       if (ret < 0)
-               return ret;
-
-       if (copy_to_user(argp, &argv, sizeof(argv)))
-               ret = -EFAULT;
        return ret;
 }
 
@@ -242,28 +209,11 @@ static ssize_t
 nilfs_ioctl_do_get_vinfo(struct the_nilfs *nilfs, __u64 *posp, int flags,
                         void *buf, size_t size, size_t nmembs)
 {
-       return nilfs_dat_get_vinfo(nilfs_dat_inode(nilfs), buf, nmembs);
-}
-
-static int nilfs_ioctl_get_vinfo(struct inode *inode, struct file *filp,
-                                unsigned int cmd, void __user *argp)
-{
-       struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs;
-       struct nilfs_argv argv;
        int ret;
 
-       if (copy_from_user(&argv, argp, sizeof(argv)))
-               return -EFAULT;
-
        down_read(&nilfs->ns_segctor_sem);
-       ret = nilfs_ioctl_wrap_copy(nilfs, &argv, _IOC_DIR(cmd),
-                                   nilfs_ioctl_do_get_vinfo);
+       ret = nilfs_dat_get_vinfo(nilfs_dat_inode(nilfs), buf, nmembs);
        up_read(&nilfs->ns_segctor_sem);
-       if (ret < 0)
-               return ret;
-
-       if (copy_to_user(argp, &argv, sizeof(argv)))
-               ret = -EFAULT;
        return ret;
 }
 
@@ -276,17 +226,21 @@ nilfs_ioctl_do_get_bdescs(struct the_nilfs *nilfs, __u64 *posp, int flags,
        struct nilfs_bdesc *bdescs = buf;
        int ret, i;
 
+       down_read(&nilfs->ns_segctor_sem);
        for (i = 0; i < nmembs; i++) {
                ret = nilfs_bmap_lookup_at_level(bmap,
                                                 bdescs[i].bd_offset,
                                                 bdescs[i].bd_level + 1,
                                                 &bdescs[i].bd_blocknr);
                if (ret < 0) {
-                       if (ret != -ENOENT)
+                       if (ret != -ENOENT) {
+                               up_read(&nilfs->ns_segctor_sem);
                                return ret;
+                       }
                        bdescs[i].bd_blocknr = 0;
                }
        }
+       up_read(&nilfs->ns_segctor_sem);
        return nmembs;
 }
 
@@ -300,10 +254,11 @@ static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp,
        if (copy_from_user(&argv, argp, sizeof(argv)))
                return -EFAULT;
 
-       down_read(&nilfs->ns_segctor_sem);
+       if (argv.v_size != sizeof(struct nilfs_bdesc))
+               return -EINVAL;
+
        ret = nilfs_ioctl_wrap_copy(nilfs, &argv, _IOC_DIR(cmd),
                                    nilfs_ioctl_do_get_bdescs);
-       up_read(&nilfs->ns_segctor_sem);
        if (ret < 0)
                return ret;
 
@@ -346,10 +301,10 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,
        return 0;
 }
 
-static ssize_t
-nilfs_ioctl_do_move_blocks(struct the_nilfs *nilfs, __u64 *posp, int flags,
-                          void *buf, size_t size, size_t nmembs)
+static int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs,
+                                  struct nilfs_argv *argv, void *buf)
 {
+       size_t nmembs = argv->v_nmembs;
        struct inode *inode;
        struct nilfs_vdesc *vdesc;
        struct buffer_head *bh, *n;
@@ -410,19 +365,10 @@ nilfs_ioctl_do_move_blocks(struct the_nilfs *nilfs, __u64 *posp, int flags,
        return ret;
 }
 
-static inline int nilfs_ioctl_move_blocks(struct the_nilfs *nilfs,
-                                         struct nilfs_argv *argv,
-                                         int dir)
-{
-       return nilfs_ioctl_wrap_copy(nilfs, argv, dir,
-                                    nilfs_ioctl_do_move_blocks);
-}
-
-static ssize_t
-nilfs_ioctl_do_delete_checkpoints(struct the_nilfs *nilfs, __u64 *posp,
-                                 int flags, void *buf, size_t size,
-                                 size_t nmembs)
+static int nilfs_ioctl_delete_checkpoints(struct the_nilfs *nilfs,
+                                         struct nilfs_argv *argv, void *buf)
 {
+       size_t nmembs = argv->v_nmembs;
        struct inode *cpfile = nilfs->ns_cpfile;
        struct nilfs_period *periods = buf;
        int ret, i;
@@ -436,36 +382,21 @@ nilfs_ioctl_do_delete_checkpoints(struct the_nilfs *nilfs, __u64 *posp,
        return nmembs;
 }
 
-static inline int nilfs_ioctl_delete_checkpoints(struct the_nilfs *nilfs,
-                                                struct nilfs_argv *argv,
-                                                int dir)
+static int nilfs_ioctl_free_vblocknrs(struct the_nilfs *nilfs,
+                                     struct nilfs_argv *argv, void *buf)
 {
-       return nilfs_ioctl_wrap_copy(nilfs, argv, dir,
-                                    nilfs_ioctl_do_delete_checkpoints);
-}
+       size_t nmembs = argv->v_nmembs;
+       int ret;
 
-static ssize_t
-nilfs_ioctl_do_free_vblocknrs(struct the_nilfs *nilfs, __u64 *posp, int flags,
-                             void *buf, size_t size, size_t nmembs)
-{
-       int ret = nilfs_dat_freev(nilfs_dat_inode(nilfs), buf, nmembs);
+       ret = nilfs_dat_freev(nilfs_dat_inode(nilfs), buf, nmembs);
 
        return (ret < 0) ? ret : nmembs;
 }
 
-static inline int nilfs_ioctl_free_vblocknrs(struct the_nilfs *nilfs,
-                                            struct nilfs_argv *argv,
-                                            int dir)
-{
-       return nilfs_ioctl_wrap_copy(nilfs, argv, dir,
-                                    nilfs_ioctl_do_free_vblocknrs);
-}
-
-static ssize_t
-nilfs_ioctl_do_mark_blocks_dirty(struct the_nilfs *nilfs, __u64 *posp,
-                                int flags, void *buf, size_t size,
-                                size_t nmembs)
+static int nilfs_ioctl_mark_blocks_dirty(struct the_nilfs *nilfs,
+                                        struct nilfs_argv *argv, void *buf)
 {
+       size_t nmembs = argv->v_nmembs;
        struct inode *dat = nilfs_dat_inode(nilfs);
        struct nilfs_bmap *bmap = NILFS_I(dat)->i_bmap;
        struct nilfs_bdesc *bdescs = buf;
@@ -504,55 +435,37 @@ nilfs_ioctl_do_mark_blocks_dirty(struct the_nilfs *nilfs, __u64 *posp,
        return nmembs;
 }
 
-static inline int nilfs_ioctl_mark_blocks_dirty(struct the_nilfs *nilfs,
-                                               struct nilfs_argv *argv,
-                                               int dir)
+static int nilfs_ioctl_free_segments(struct the_nilfs *nilfs,
+                                    struct nilfs_argv *argv, void *buf)
 {
-       return nilfs_ioctl_wrap_copy(nilfs, argv, dir,
-                                    nilfs_ioctl_do_mark_blocks_dirty);
-}
-
-static ssize_t
-nilfs_ioctl_do_free_segments(struct the_nilfs *nilfs, __u64 *posp, int flags,
-                            void *buf, size_t size, size_t nmembs)
-{
-       struct nilfs_sb_info *sbi = nilfs_get_writer(nilfs);
+       size_t nmembs = argv->v_nmembs;
+       struct nilfs_sb_info *sbi = nilfs->ns_writer;
        int ret;
 
-       if (unlikely(!sbi))
+       if (unlikely(!sbi)) {
+               /* never happens because called for a writable mount */
+               WARN_ON(1);
                return -EROFS;
+       }
        ret = nilfs_segctor_add_segments_to_be_freed(
                NILFS_SC(sbi), buf, nmembs);
-       nilfs_put_writer(nilfs);
 
        return (ret < 0) ? ret : nmembs;
 }
 
-static inline int nilfs_ioctl_free_segments(struct the_nilfs *nilfs,
-                                            struct nilfs_argv *argv,
-                                            int dir)
-{
-       return nilfs_ioctl_wrap_copy(nilfs, argv, dir,
-                                    nilfs_ioctl_do_free_segments);
-}
-
 int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
-                                      void __user *argp)
+                                      struct nilfs_argv *argv, void **kbufs)
 {
-       struct nilfs_argv argv[5];
        const char *msg;
-       int dir, ret;
-
-       if (copy_from_user(argv, argp, sizeof(argv)))
-               return -EFAULT;
+       int ret;
 
-       dir = _IOC_WRITE;
-       ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], dir);
+       ret = nilfs_ioctl_move_blocks(nilfs, &argv[0], kbufs[0]);
        if (ret < 0) {
                msg = "cannot read source blocks";
                goto failed;
        }
-       ret = nilfs_ioctl_delete_checkpoints(nilfs, &argv[1], dir);
+
+       ret = nilfs_ioctl_delete_checkpoints(nilfs, &argv[1], kbufs[1]);
        if (ret < 0) {
                /*
                 * can safely abort because checkpoints can be removed
@@ -561,7 +474,7 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
                msg = "cannot delete checkpoints";
                goto failed;
        }
-       ret = nilfs_ioctl_free_vblocknrs(nilfs, &argv[2], dir);
+       ret = nilfs_ioctl_free_vblocknrs(nilfs, &argv[2], kbufs[2]);
        if (ret < 0) {
                /*
                 * can safely abort because DAT file is updated atomically
@@ -570,7 +483,7 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
                msg = "cannot delete virtual blocks from DAT file";
                goto failed;
        }
-       ret = nilfs_ioctl_mark_blocks_dirty(nilfs, &argv[3], dir);
+       ret = nilfs_ioctl_mark_blocks_dirty(nilfs, &argv[3], kbufs[3]);
        if (ret < 0) {
                /*
                 * can safely abort because the operation is nondestructive.
@@ -578,7 +491,7 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
                msg = "cannot mark copying blocks dirty";
                goto failed;
        }
-       ret = nilfs_ioctl_free_segments(nilfs, &argv[4], dir);
+       ret = nilfs_ioctl_free_segments(nilfs, &argv[4], kbufs[4]);
        if (ret < 0) {
                /*
                 * can safely abort because this operation is atomic.
@@ -598,9 +511,75 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
 static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
                                      unsigned int cmd, void __user *argp)
 {
+       struct nilfs_argv argv[5];
+       const static size_t argsz[5] = {
+               sizeof(struct nilfs_vdesc),
+               sizeof(struct nilfs_period),
+               sizeof(__u64),
+               sizeof(struct nilfs_bdesc),
+               sizeof(__u64),
+       };
+       void __user *base;
+       void *kbufs[5];
+       struct the_nilfs *nilfs;
+       size_t len, nsegs;
+       int n, ret;
+
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
-       return nilfs_clean_segments(inode->i_sb, argp);
+
+       if (copy_from_user(argv, argp, sizeof(argv)))
+               return -EFAULT;
+
+       nsegs = argv[4].v_nmembs;
+       if (argv[4].v_size != argsz[4])
+               return -EINVAL;
+       /*
+        * argv[4] points to segment numbers this ioctl cleans.  We
+        * use kmalloc() for its buffer because memory used for the
+        * segment numbers is enough small.
+        */
+       kbufs[4] = memdup_user((void __user *)(unsigned long)argv[4].v_base,
+                              nsegs * sizeof(__u64));
+       if (IS_ERR(kbufs[4]))
+               return PTR_ERR(kbufs[4]);
+
+       nilfs = NILFS_SB(inode->i_sb)->s_nilfs;
+
+       for (n = 0; n < 4; n++) {
+               ret = -EINVAL;
+               if (argv[n].v_size != argsz[n])
+                       goto out_free;
+
+               if (argv[n].v_nmembs > nsegs * nilfs->ns_blocks_per_segment)
+                       goto out_free;
+
+               len = argv[n].v_size * argv[n].v_nmembs;
+               base = (void __user *)(unsigned long)argv[n].v_base;
+               if (len == 0) {
+                       kbufs[n] = NULL;
+                       continue;
+               }
+
+               kbufs[n] = vmalloc(len);
+               if (!kbufs[n]) {
+                       ret = -ENOMEM;
+                       goto out_free;
+               }
+               if (copy_from_user(kbufs[n], base, len)) {
+                       ret = -EFAULT;
+                       vfree(kbufs[n]);
+                       goto out_free;
+               }
+       }
+
+       ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
+
+ out_free:
+       while (--n > 0)
+               vfree(kbufs[n]);
+       kfree(kbufs[4]);
+       return ret;
 }
 
 static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
@@ -621,6 +600,33 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
        return 0;
 }
 
+static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp,
+                               unsigned int cmd, void __user *argp,
+                               size_t membsz,
+                               ssize_t (*dofunc)(struct the_nilfs *,
+                                                 __u64 *, int,
+                                                 void *, size_t, size_t))
+
+{
+       struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs;
+       struct nilfs_argv argv;
+       int ret;
+
+       if (copy_from_user(&argv, argp, sizeof(argv)))
+               return -EFAULT;
+
+       if (argv.v_size != membsz)
+               return -EINVAL;
+
+       ret = nilfs_ioctl_wrap_copy(nilfs, &argv, _IOC_DIR(cmd), dofunc);
+       if (ret < 0)
+               return ret;
+
+       if (copy_to_user(argp, &argv, sizeof(argv)))
+               ret = -EFAULT;
+       return ret;
+}
+
 long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
        struct inode *inode = filp->f_dentry->d_inode;
@@ -632,16 +638,21 @@ long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        case NILFS_IOCTL_DELETE_CHECKPOINT:
                return nilfs_ioctl_delete_checkpoint(inode, filp, cmd, argp);
        case NILFS_IOCTL_GET_CPINFO:
-               return nilfs_ioctl_get_cpinfo(inode, filp, cmd, argp);
+               return nilfs_ioctl_get_info(inode, filp, cmd, argp,
+                                           sizeof(struct nilfs_cpinfo),
+                                           nilfs_ioctl_do_get_cpinfo);
        case NILFS_IOCTL_GET_CPSTAT:
                return nilfs_ioctl_get_cpstat(inode, filp, cmd, argp);
        case NILFS_IOCTL_GET_SUINFO:
-               return nilfs_ioctl_get_suinfo(inode, filp, cmd, argp);
+               return nilfs_ioctl_get_info(inode, filp, cmd, argp,
+                                           sizeof(struct nilfs_suinfo),
+                                           nilfs_ioctl_do_get_suinfo);
        case NILFS_IOCTL_GET_SUSTAT:
                return nilfs_ioctl_get_sustat(inode, filp, cmd, argp);
        case NILFS_IOCTL_GET_VINFO:
-               /* XXX: rename to ??? */
-               return nilfs_ioctl_get_vinfo(inode, filp, cmd, argp);
+               return nilfs_ioctl_get_info(inode, filp, cmd, argp,
+                                           sizeof(struct nilfs_vinfo),
+                                           nilfs_ioctl_do_get_vinfo);
        case NILFS_IOCTL_GET_BDESCS:
                return nilfs_ioctl_get_bdescs(inode, filp, cmd, argp);
        case NILFS_IOCTL_CLEAN_SEGMENTS:
index 47dd815433fd4df6b5e484b3b52cbc6a0cc5294f..bb78745a0e30d0e7bda05d4416f9f72e5b74db75 100644 (file)
@@ -77,19 +77,22 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
                                                     void *))
 {
        struct the_nilfs *nilfs = NILFS_MDT(inode)->mi_nilfs;
-       struct nilfs_sb_info *writer = NULL;
        struct super_block *sb = inode->i_sb;
        struct nilfs_transaction_info ti;
        struct buffer_head *bh;
        int err;
 
        if (!sb) {
-               writer = nilfs_get_writer(nilfs);
-               if (!writer) {
+               /*
+                * Make sure this function is not called from any
+                * read-only context.
+                */
+               if (!nilfs->ns_writer) {
+                       WARN_ON(1);
                        err = -EROFS;
                        goto out;
                }
-               sb = writer->s_super;
+               sb = nilfs->ns_writer->s_super;
        }
 
        nilfs_transaction_begin(sb, &ti, 0);
@@ -127,8 +130,6 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
                err = nilfs_transaction_commit(sb);
        else
                nilfs_transaction_abort(sb);
-       if (writer)
-               nilfs_put_writer(nilfs);
  out:
        return err;
 }
@@ -299,7 +300,7 @@ int nilfs_mdt_delete_block(struct inode *inode, unsigned long block)
        int err;
 
        err = nilfs_bmap_delete(ii->i_bmap, block);
-       if (likely(!err)) {
+       if (!err || err == -ENOENT) {
                nilfs_mdt_mark_dirty(inode);
                nilfs_mdt_forget_block(inode, block);
        }
index 3d0c18a16db101102f38fbf808eb6138f24fe06a..da6fc0bba2e5306d407538c7bc0eba94277a055a 100644 (file)
@@ -236,7 +236,8 @@ extern int nilfs_sync_file(struct file *, struct dentry *, int);
 
 /* ioctl.c */
 long nilfs_ioctl(struct file *, unsigned int, unsigned long);
-int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *, void __user *);
+int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *, struct nilfs_argv *,
+                                      void **);
 
 /* inode.c */
 extern struct inode *nilfs_new_inode(struct inode *, int);
index 1bfbba9c0e9ae3aba969e6c3341968ce24916a7d..a2692bbc7b50a510b1723b95fd7d060b74bbedb9 100644 (file)
@@ -128,7 +128,8 @@ void nilfs_forget_buffer(struct buffer_head *bh)
 
        lock_buffer(bh);
        clear_buffer_nilfs_volatile(bh);
-       if (test_clear_buffer_dirty(bh) && nilfs_page_buffers_clean(page))
+       clear_buffer_dirty(bh);
+       if (nilfs_page_buffers_clean(page))
                __nilfs_clear_page_dirty(page);
 
        clear_buffer_uptodate(bh);
index 4fc081e47d70cc66e85982640670fb5fa5168b7e..57afa9d24061c9db67db822a4392db0edde4dd4c 100644 (file)
@@ -407,6 +407,7 @@ void nilfs_dispose_segment_list(struct list_head *head)
 }
 
 static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
+                                             struct nilfs_sb_info *sbi,
                                              struct nilfs_recovery_info *ri)
 {
        struct list_head *head = &ri->ri_used_segments;
@@ -421,6 +422,7 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
        segnum[2] = ri->ri_segnum;
        segnum[3] = ri->ri_nextnum;
 
+       nilfs_attach_writer(nilfs, sbi);
        /*
         * Releasing the next segment of the latest super root.
         * The next segment is invalidated by this recovery.
@@ -459,10 +461,10 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
        nilfs->ns_pseg_offset = 0;
        nilfs->ns_seg_seq = ri->ri_seq + 2;
        nilfs->ns_nextnum = nilfs->ns_segnum = segnum[0];
-       return 0;
 
  failed:
        /* No need to recover sufile because it will be destroyed on error */
+       nilfs_detach_writer(nilfs, sbi);
        return err;
 }
 
@@ -728,7 +730,7 @@ int nilfs_recover_logical_segments(struct the_nilfs *nilfs,
                goto failed;
 
        if (ri->ri_need_recovery == NILFS_RECOVERY_ROLLFORWARD_DONE) {
-               err = nilfs_prepare_segment_for_recovery(nilfs, ri);
+               err = nilfs_prepare_segment_for_recovery(nilfs, sbi, ri);
                if (unlikely(err)) {
                        printk(KERN_ERR "NILFS: Error preparing segments for "
                               "recovery.\n");
index fb70ec3be20ea0899d34e98a4a48b9828b358052..22c7f65c2403461dddd1e62ebe230bf56aab2376 100644 (file)
@@ -2589,7 +2589,8 @@ nilfs_remove_written_gcinodes(struct the_nilfs *nilfs, struct list_head *head)
        }
 }
 
-int nilfs_clean_segments(struct super_block *sb, void __user *argp)
+int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
+                        void **kbufs)
 {
        struct nilfs_sb_info *sbi = NILFS_SB(sb);
        struct nilfs_sc_info *sci = NILFS_SC(sbi);
@@ -2606,7 +2607,7 @@ int nilfs_clean_segments(struct super_block *sb, void __user *argp)
        err = nilfs_init_gcdat_inode(nilfs);
        if (unlikely(err))
                goto out_unlock;
-       err = nilfs_ioctl_prepare_clean_segments(nilfs, argp);
+       err = nilfs_ioctl_prepare_clean_segments(nilfs, argv, kbufs);
        if (unlikely(err))
                goto out_unlock;
 
index a98fc1ed0bbb9ac4bf4e321612fe21072aedbbfe..476bdd5df5be1cede75fb57cea725e20eb6faacc 100644 (file)
@@ -222,7 +222,8 @@ extern int nilfs_construct_segment(struct super_block *);
 extern int nilfs_construct_dsync_segment(struct super_block *, struct inode *,
                                         loff_t, loff_t);
 extern void nilfs_flush_segment(struct super_block *, ino_t);
-extern int nilfs_clean_segments(struct super_block *, void __user *);
+extern int nilfs_clean_segments(struct super_block *, struct nilfs_argv *,
+                               void **);
 
 extern int nilfs_segctor_add_segments_to_be_freed(struct nilfs_sc_info *,
                                                  __u64 *, size_t);
index 2e2aa3df170cfb5f2be5f8097ee9e2324c759143..ffefba81c818ccc7424b54fade9f8af2a1eea10d 100644 (file)
@@ -78,12 +78,18 @@ enum dma_transaction_type {
  *     dependency chains
  * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
  * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s)
+ * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single
+ *     (if not set, do the source dma-unmapping as page)
+ * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single
+ *     (if not set, do the destination dma-unmapping as page)
  */
 enum dma_ctrl_flags {
        DMA_PREP_INTERRUPT = (1 << 0),
        DMA_CTRL_ACK = (1 << 1),
        DMA_COMPL_SKIP_SRC_UNMAP = (1 << 2),
        DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
+       DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4),
+       DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5),
 };
 
 /**
index 40617c1d8976eb11a0328f85f6238841e9b35eb9..30520844b8dae4de881c042d2b61d68db831681b 100644 (file)
@@ -433,6 +433,7 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
 asmlinkage long sys_fcntl64(unsigned int fd,
                                unsigned int cmd, unsigned long arg);
 #endif
+asmlinkage long sys_pipe2(int __user *fildes, int flags);
 asmlinkage long sys_dup(unsigned int fildes);
 asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
 asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
index 36d6ea2b63405a8bd682b1e225bb3f748de2eda5..b9ce574827c8a2a48b972f0261decc234edf9e27 100644 (file)
@@ -112,14 +112,6 @@ static long madvise_willneed(struct vm_area_struct * vma,
        if (!file)
                return -EBADF;
 
-       /*
-        * Page cache readahead assumes page cache pages are order-0 which
-        * is not the case for hugetlbfs. Do not give a bad return value
-        * but ignore the advice.
-        */
-       if (vma->vm_flags & VM_HUGETLB)
-               return 0;
-
        if (file->f_mapping->a_ops->get_xip_mem) {
                /* no bad return value, but ignore advice */
                return 0;
index 629a28764da9362c773050a5bcde27ecb19d0ed2..42a6f9f2028567bc91b3860bc8204b656f7e7664 100644 (file)
@@ -265,7 +265,7 @@ static int fast_reg_read_chunks(struct svcxprt_rdma *xprt,
                frmr->page_list->page_list[page_no] =
                        ib_dma_map_single(xprt->sc_cm_id->device,
                                          page_address(rqstp->rq_arg.pages[page_no]),
-                                         PAGE_SIZE, DMA_TO_DEVICE);
+                                         PAGE_SIZE, DMA_FROM_DEVICE);
                if (ib_dma_mapping_error(xprt->sc_cm_id->device,
                                         frmr->page_list->page_list[page_no]))
                        goto fatal_err;
index 6c26a675435a00903d13093481f273a7bafbbaab..8b510c5e877752e876795c326f8f6381b44c770f 100644 (file)
@@ -183,6 +183,7 @@ static int fast_reg_xdr(struct svcxprt_rdma *xprt,
 
  fatal_err:
        printk("svcrdma: Error fast registering memory for xprt %p\n", xprt);
+       vec->frmr = NULL;
        svc_rdma_put_frmr(xprt, frmr);
        return -EIO;
 }
@@ -516,6 +517,7 @@ static int send_reply(struct svcxprt_rdma *rdma,
                       "svcrdma: could not post a receive buffer, err=%d."
                       "Closing transport %p.\n", ret, rdma);
                set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
+               svc_rdma_put_frmr(rdma, vec->frmr);
                svc_rdma_put_context(ctxt, 0);
                return -ENOTCONN;
        }
@@ -606,6 +608,7 @@ static int send_reply(struct svcxprt_rdma *rdma,
        return 0;
 
  err:
+       svc_rdma_unmap_dma(ctxt);
        svc_rdma_put_frmr(rdma, vec->frmr);
        svc_rdma_put_context(ctxt, 1);
        return -EIO;
index 3d810e7df3fb70e491ef5888bcbc329a098db077..4b0c2fa15e0b6cd0526fdfd72a831cd9e42879bd 100644 (file)
@@ -520,8 +520,9 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
        svc_xprt_get(&xprt->sc_xprt);
        ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr);
        if (ret) {
-               svc_xprt_put(&xprt->sc_xprt);
+               svc_rdma_unmap_dma(ctxt);
                svc_rdma_put_context(ctxt, 1);
+               svc_xprt_put(&xprt->sc_xprt);
        }
        return ret;