Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Jan 2012 20:43:57 +0000 (12:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Jan 2012 20:43:57 +0000 (12:43 -0800)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
  m68k: Fix assembler constraint to prevent overeager gcc optimisation
  mac_esp: rename irq
  mac_scsi: dont enable mac_scsi irq before requesting it
  macfb: fix black and white modes
  m68k/irq: Remove obsolete IRQ_FLG_* definitions

Fix up trivial conflict in arch/m68k/kernel/process_mm.c as per Geert.

1  2 
arch/m68k/include/asm/irq.h
arch/m68k/kernel/process_mm.c
arch/m68k/kernel/traps.c
arch/m68k/mm/cache.c
drivers/scsi/mac_scsi.c

index 0e89fa05de0e60bda81f5df2056106c49160e3e8,d3a8acd4f1fe4f544928b7ca297c11fe8fd6cc94..c1155f0e22cc2615a0e97f5745dd3c5d7d77aba9
@@@ -25,8 -25,7 +25,8 @@@
  #define NR_IRQS       0
  #endif
  
 -#ifdef CONFIG_MMU
 +#if defined(CONFIG_M68020) || defined(CONFIG_M68030) || \
 +    defined(CONFIG_M68040) || defined(CONFIG_M68060)
  
  /*
   * Interrupt source definitions
  
  #define IRQ_USER      8
  
- /*
-  * various flags for request_irq() - the Amiga now uses the standard
-  * mechanism like all other architectures - IRQF_DISABLED and
-  * IRQF_SHARED are your friends.
-  */
- #ifndef MACH_AMIGA_ONLY
- #define IRQ_FLG_LOCK  (0x0001)        /* handler is not replaceable   */
- #define IRQ_FLG_REPLACE       (0x0002)        /* replace existing handler     */
- #define IRQ_FLG_FAST  (0x0004)
- #define IRQ_FLG_SLOW  (0x0008)
- #define IRQ_FLG_STD   (0x8000)        /* internally used              */
- #endif
  struct irq_data;
  struct irq_chip;
  struct irq_desc;
@@@ -81,7 -67,7 +68,7 @@@ extern unsigned int irq_canonicalize(un
  
  #else
  #define irq_canonicalize(irq)  (irq)
 -#endif /* CONFIG_MMU */
 +#endif /* !(CONFIG_M68020 || CONFIG_M68030 || CONFIG_M68040 || CONFIG_M68060) */
  
  asmlinkage void do_IRQ(int irq, struct pt_regs *regs);
  extern atomic_t irq_err_count;
index 125f34e00bf01e8409634a1c3dbfd1d2d294f123,aa4ffb882366c01ca814ef109d4412d75ce9b777..099283ee1a8fd0810672f2a36ad038786799dc5d
  #include <asm/setup.h>
  #include <asm/pgtable.h>
  
 -/*
 - * Initial task/thread structure. Make this a per-architecture thing,
 - * because different architectures tend to have different
 - * alignment requirements and potentially different initial
 - * setup.
 - */
 -static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 -static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
 -union thread_union init_thread_union __init_task_data
 -      __attribute__((aligned(THREAD_SIZE))) =
 -              { INIT_THREAD_INFO(init_task) };
 -
 -/* initial task structure */
 -struct task_struct init_task = INIT_TASK(init_task);
 -
 -EXPORT_SYMBOL(init_task);
  
  asmlinkage void ret_from_fork(void);
  
@@@ -172,7 -188,9 +172,7 @@@ void flush_thread(void
  
        current->thread.fs = __USER_DS;
        if (!FPU_IS_EMU)
-               asm volatile ("frestore %0@" : : "a" (&zero) : "memory");
 -              asm volatile (".chip 68k/68881\n\t"
 -                            "frestore %0\n\t"
 -                            ".chip 68k" : : "m" (zero));
++              asm volatile("frestore %0": :"m" (zero));
  }
  
  /*
@@@ -246,28 -264,11 +246,28 @@@ int copy_thread(unsigned long clone_fla
                /* Copy the current fpu state */
                asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory");
  
 -              if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2])
 -                asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t"
 -                              "fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
 -                              : : "m" (p->thread.fp[0]), "m" (p->thread.fpcntl[0])
 -                              : "memory");
 +              if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2]) {
 +                      if (CPU_IS_COLDFIRE) {
 +                              asm volatile ("fmovemd %/fp0-%/fp7,%0\n\t"
 +                                            "fmovel %/fpiar,%1\n\t"
 +                                            "fmovel %/fpcr,%2\n\t"
 +                                            "fmovel %/fpsr,%3"
 +                                            :
 +                                            : "m" (p->thread.fp[0]),
 +                                              "m" (p->thread.fpcntl[0]),
 +                                              "m" (p->thread.fpcntl[1]),
 +                                              "m" (p->thread.fpcntl[2])
 +                                            : "memory");
 +                      } else {
 +                              asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t"
 +                                            "fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
 +                                            :
 +                                            : "m" (p->thread.fp[0]),
 +                                              "m" (p->thread.fpcntl[0])
 +                                            : "memory");
 +                      }
 +              }
 +
                /* Restore the state in case the fpu was busy */
                asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
        }
@@@ -300,28 -301,12 +300,28 @@@ int dump_fpu (struct pt_regs *regs, str
        if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
                return 0;
  
 -      asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
 -              :: "m" (fpu->fpcntl[0])
 -              : "memory");
 -      asm volatile ("fmovemx %/fp0-%/fp7,%0"
 -              :: "m" (fpu->fpregs[0])
 -              : "memory");
 +      if (CPU_IS_COLDFIRE) {
 +              asm volatile ("fmovel %/fpiar,%0\n\t"
 +                            "fmovel %/fpcr,%1\n\t"
 +                            "fmovel %/fpsr,%2\n\t"
 +                            "fmovemd %/fp0-%/fp7,%3"
 +                            :
 +                            : "m" (fpu->fpcntl[0]),
 +                              "m" (fpu->fpcntl[1]),
 +                              "m" (fpu->fpcntl[2]),
 +                              "m" (fpu->fpregs[0])
 +                            : "memory");
 +      } else {
 +              asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
 +                            :
 +                            : "m" (fpu->fpcntl[0])
 +                            : "memory");
 +              asm volatile ("fmovemx %/fp0-%/fp7,%0"
 +                            :
 +                            : "m" (fpu->fpregs[0])
 +                            : "memory");
 +      }
 +
        return 1;
  }
  EXPORT_SYMBOL(dump_fpu);
diff --combined arch/m68k/kernel/traps.c
index a76452ca964ef6e538ee6d5181b4341c7679dd48,eb67469780837661d34804c69c166829a362e8d3..daaa9187654ca6706278e79e5502d0a9f4f44a82
@@@ -552,13 -552,13 +552,13 @@@ static inline void bus_error030 (struc
  
  #ifdef DEBUG
                asm volatile ("ptestr %3,%2@,#7,%0\n\t"
-                             "pmove %%psr,%1@"
-                             : "=a&" (desc)
-                             : "a" (&temp), "a" (addr), "d" (ssw));
+                             "pmove %%psr,%1"
+                             : "=a&" (desc), "=m" (temp)
+                             : "a" (addr), "d" (ssw));
  #else
                asm volatile ("ptestr %2,%1@,#7\n\t"
-                             "pmove %%psr,%0@"
-                             : : "a" (&temp), "a" (addr), "d" (ssw));
+                             "pmove %%psr,%0"
+                             : "=m" (temp) : "a" (addr), "d" (ssw));
  #endif
                mmusr = temp;
  
                               !(ssw & RW) ? "write" : "read", addr,
                               fp->ptregs.pc, ssw);
                        asm volatile ("ptestr #1,%1@,#0\n\t"
-                                     "pmove %%psr,%0@"
-                                     : /* no outputs */
-                                     : "a" (&temp), "a" (addr));
+                                     "pmove %%psr,%0"
+                                     : "=m" (temp)
+                                     : "a" (addr));
                        mmusr = temp;
  
                        printk ("level 0 mmusr is %#x\n", mmusr);
  #if 0
-                       asm volatile ("pmove %%tt0,%0@"
-                                     : /* no outputs */
-                                     : "a" (&tlong));
+                       asm volatile ("pmove %%tt0,%0"
+                                     : "=m" (tlong));
                        printk("tt0 is %#lx, ", tlong);
-                       asm volatile ("pmove %%tt1,%0@"
-                                     : /* no outputs */
-                                     : "a" (&tlong));
+                       asm volatile ("pmove %%tt1,%0"
+                                     : "=m" (tlong));
                        printk("tt1 is %#lx\n", tlong);
  #endif
  #ifdef DEBUG
  
  #ifdef DEBUG
        asm volatile ("ptestr #1,%2@,#7,%0\n\t"
-                     "pmove %%psr,%1@"
-                     : "=a&" (desc)
-                     : "a" (&temp), "a" (addr));
+                     "pmove %%psr,%1"
+                     : "=a&" (desc), "=m" (temp)
+                     : "a" (addr));
  #else
        asm volatile ("ptestr #1,%1@,#7\n\t"
-                     "pmove %%psr,%0@"
-                     : : "a" (&temp), "a" (addr));
+                     "pmove %%psr,%0"
+                     : "=m" (temp) : "a" (addr));
  #endif
        mmusr = temp;
  
@@@ -706,88 -704,6 +704,88 @@@ create_atc_entry
  #endif /* CPU_M68020_OR_M68030 */
  #endif /* !CONFIG_SUN3 */
  
 +#if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
 +#include <asm/mcfmmu.h>
 +
 +/*
 + *    The following table converts the FS encoding of a ColdFire
 + *    exception stack frame into the error_code value needed by
 + *    do_fault.
 +*/
 +static const unsigned char fs_err_code[] = {
 +      0,  /* 0000 */
 +      0,  /* 0001 */
 +      0,  /* 0010 */
 +      0,  /* 0011 */
 +      1,  /* 0100 */
 +      0,  /* 0101 */
 +      0,  /* 0110 */
 +      0,  /* 0111 */
 +      2,  /* 1000 */
 +      3,  /* 1001 */
 +      2,  /* 1010 */
 +      0,  /* 1011 */
 +      1,  /* 1100 */
 +      1,  /* 1101 */
 +      0,  /* 1110 */
 +      0   /* 1111 */
 +};
 +
 +static inline void access_errorcf(unsigned int fs, struct frame *fp)
 +{
 +      unsigned long mmusr, addr;
 +      unsigned int err_code;
 +      int need_page_fault;
 +
 +      mmusr = mmu_read(MMUSR);
 +      addr = mmu_read(MMUAR);
 +
 +      /*
 +       * error_code:
 +       *      bit 0 == 0 means no page found, 1 means protection fault
 +       *      bit 1 == 0 means read, 1 means write
 +       */
 +      switch (fs) {
 +      case  5:  /* 0101 TLB opword X miss */
 +              need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 0, 0);
 +              addr = fp->ptregs.pc;
 +              break;
 +      case  6:  /* 0110 TLB extension word X miss */
 +              need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 0, 1);
 +              addr = fp->ptregs.pc + sizeof(long);
 +              break;
 +      case 10:  /* 1010 TLB W miss */
 +              need_page_fault = cf_tlb_miss(&fp->ptregs, 1, 1, 0);
 +              break;
 +      case 14: /* 1110 TLB R miss */
 +              need_page_fault = cf_tlb_miss(&fp->ptregs, 0, 1, 0);
 +              break;
 +      default:
 +              /* 0000 Normal  */
 +              /* 0001 Reserved */
 +              /* 0010 Interrupt during debug service routine */
 +              /* 0011 Reserved */
 +              /* 0100 X Protection */
 +              /* 0111 IFP in emulator mode */
 +              /* 1000 W Protection*/
 +              /* 1001 Write error*/
 +              /* 1011 Reserved*/
 +              /* 1100 R Protection*/
 +              /* 1101 R Protection*/
 +              /* 1111 OEP in emulator mode*/
 +              need_page_fault = 1;
 +              break;
 +      }
 +
 +      if (need_page_fault) {
 +              err_code = fs_err_code[fs];
 +              if ((fs == 13) && (mmusr & MMUSR_WF)) /* rd-mod-wr access */
 +                      err_code |= 2; /* bit1 - write, bit0 - protection */
 +              do_page_fault(&fp->ptregs, addr, err_code);
 +      }
 +}
 +#endif /* CONFIG_COLDFIRE CONFIG_MMU */
 +
  asmlinkage void buserr_c(struct frame *fp)
  {
        /* Only set esp0 if coming from user mode */
        printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format);
  #endif
  
 +#if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
 +      if (CPU_IS_COLDFIRE) {
 +              unsigned int fs;
 +              fs = (fp->ptregs.vector & 0x3) |
 +                      ((fp->ptregs.vector & 0xc00) >> 8);
 +              switch (fs) {
 +              case 0x5:
 +              case 0x6:
 +              case 0x7:
 +              case 0x9:
 +              case 0xa:
 +              case 0xd:
 +              case 0xe:
 +              case 0xf:
 +                      access_errorcf(fs, fp);
 +                      return;
 +              default:
 +                      break;
 +              }
 +      }
 +#endif /* CONFIG_COLDFIRE && CONFIG_MMU */
 +
        switch (fp->ptregs.format) {
  #if defined (CONFIG_M68060)
        case 4:                         /* 68060 access error */
diff --combined arch/m68k/mm/cache.c
index 95d0bf66e2e22e72b272e11b48f5d41914b5be38,5550aa4fd8119b3474db30c2a76aa9238f7206cd..3d84c1f2ffb2ef8765b5adae4bd8d334b8c78b6d
@@@ -52,9 -52,9 +52,9 @@@ static unsigned long virt_to_phys_slow(
                unsigned long *descaddr;
  
                asm volatile ("ptestr %3,%2@,#7,%0\n\t"
-                             "pmove %%psr,%1@"
-                             : "=a&" (descaddr)
-                             : "a" (&mmusr), "a" (vaddr), "d" (get_fs().seg));
+                             "pmove %%psr,%1"
+                             : "=a&" (descaddr), "=m" (mmusr)
+                             : "a" (vaddr), "d" (get_fs().seg));
                if (mmusr & (MMU_I|MMU_B|MMU_L))
                        return 0;
                descaddr = phys_to_virt((unsigned long)descaddr);
  /* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
  void flush_icache_range(unsigned long address, unsigned long endaddr)
  {
 -
 -      if (CPU_IS_040_OR_060) {
 +      if (CPU_IS_COLDFIRE) {
 +              unsigned long start, end;
 +              start = address & ICACHE_SET_MASK;
 +              end = endaddr & ICACHE_SET_MASK;
 +              if (start > end) {
 +                      flush_cf_icache(0, end);
 +                      end = ICACHE_MAX_ADDR;
 +              }
 +              flush_cf_icache(start, end);
 +      } else if (CPU_IS_040_OR_060) {
                address &= PAGE_MASK;
  
                do {
@@@ -108,17 -100,7 +108,17 @@@ EXPORT_SYMBOL(flush_icache_range)
  void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
                             unsigned long addr, int len)
  {
 -      if (CPU_IS_040_OR_060) {
 +      if (CPU_IS_COLDFIRE) {
 +              unsigned long start, end;
 +              start = addr & ICACHE_SET_MASK;
 +              end = (addr + len) & ICACHE_SET_MASK;
 +              if (start > end) {
 +                      flush_cf_icache(0, end);
 +                      end = ICACHE_MAX_ADDR;
 +              }
 +              flush_cf_icache(start, end);
 +
 +      } else if (CPU_IS_040_OR_060) {
                asm volatile ("nop\n\t"
                              ".chip 68040\n\t"
                              "cpushp %%bc,(%0)\n\t"
diff --combined drivers/scsi/mac_scsi.c
index ea2bde206f7f951ee66abe3baa2b2abd94b3980e,737d526c081366e38e41d290c0d7c10669850432..2bccfbe5661e652bc24736cc572004698a7aecca
@@@ -291,7 -291,8 +291,7 @@@ int __init macscsi_detect(struct scsi_h
      ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
  
      if (instance->irq != SCSI_IRQ_NONE)
 -      if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, 
 -                      "ncr5380", instance)) {
 +      if (request_irq(instance->irq, NCR5380_intr, 0, "ncr5380", instance)) {
            printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n",
                   instance->host_no, instance->irq);
            instance->irq = SCSI_IRQ_NONE;
@@@ -339,9 -340,6 +339,6 @@@ static void mac_scsi_reset_boot(struct 
  
        printk(KERN_INFO "Macintosh SCSI: resetting the SCSI bus..." );
  
-       /* switch off SCSI IRQ - catch an interrupt without IRQ bit set else */
-       disable_irq(IRQ_MAC_SCSI);
        /* get in phase */
        NCR5380_write( TARGET_COMMAND_REG,
                      PHASE_SR_TO_TCR( NCR5380_read(STATUS_REG) ));
        for( end = jiffies + AFTER_RESET_DELAY; time_before(jiffies, end); )
                barrier();
  
-       /* switch on SCSI IRQ again */
-       enable_irq(IRQ_MAC_SCSI);
        printk(KERN_INFO " done\n" );
  }
  #endif