Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/geert/linux-m68k

Pull m68k updates from Geert Uytterhoeven.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
  m68k: Setup CROSS_COMPILE at the top
  m68k: Correct the Atari ALLOWINT definition
  m68k/video: Create <asm/vga.h>
  m68k: Make sure {read,write}s[bwl]() are always defined
  m68k/mm: Port OOM changes to do_page_fault()
  scsi/atari: Make more functions static
  scsi/atari: Revive "atascsi=" setup option
  net/ariadne: Improve debug prints
  m68k/atari: Change VME irq numbers from unsigned long to unsigned int
  m68k/amiga: Use arch_initcall() for registering platform devices
  m68k/amiga: Add error checks when registering platform devices
  m68k/amiga: Mark z_dev_present() __init
  m68k: Remove unused MAX_NOINT_IPL definition
  • Loading branch information
torvalds committed May 21, 2012
2 parents e60b9a0 + f25e918 commit 881bcab
Show file tree
Hide file tree
Showing 14 changed files with 200 additions and 103 deletions.
13 changes: 7 additions & 6 deletions arch/m68k/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

KBUILD_DEFCONFIG := multi_defconfig

ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, \
m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
endif
endif

#
# Enable processor type. Ordering of these is important - we want to
# use the minimum processor type of the range we support. The logic
Expand Down Expand Up @@ -62,12 +69,6 @@ endif

LDFLAGS := -m m68kelf
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, \
m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
endif
endif

ifdef CONFIG_SUN3
LDFLAGS_vmlinux = -N
Expand Down
126 changes: 92 additions & 34 deletions arch/m68k/amiga/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* for more details.
*/

#include <linux/err.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/zorro.h>
Expand Down Expand Up @@ -46,18 +47,25 @@ static const struct resource zorro_resources[] __initconst = {

static int __init amiga_init_bus(void)
{
struct platform_device *pdev;
unsigned int n;

if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
return -ENODEV;

platform_device_register_simple("amiga-zorro", -1, zorro_resources,
AMIGAHW_PRESENT(ZORRO3) ? 4 : 2);
n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
pdev = platform_device_register_simple("amiga-zorro", -1,
zorro_resources, n);
if (IS_ERR(pdev))
return PTR_ERR(pdev);

return 0;
}

subsys_initcall(amiga_init_bus);


static int z_dev_present(zorro_id id)
static int __init z_dev_present(zorro_id id)
{
unsigned int i;

Expand Down Expand Up @@ -126,72 +134,122 @@ static const struct resource amiga_rtc_resource __initconst = {
static int __init amiga_init_devices(void)
{
struct platform_device *pdev;
int error;

if (!MACH_IS_AMIGA)
return -ENODEV;

/* video hardware */
if (AMIGAHW_PRESENT(AMI_VIDEO))
platform_device_register_simple("amiga-video", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_VIDEO)) {
pdev = platform_device_register_simple("amiga-video", -1, NULL,
0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}


/* sound hardware */
if (AMIGAHW_PRESENT(AMI_AUDIO))
platform_device_register_simple("amiga-audio", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_AUDIO)) {
pdev = platform_device_register_simple("amiga-audio", -1, NULL,
0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}


/* storage interfaces */
if (AMIGAHW_PRESENT(AMI_FLOPPY))
platform_device_register_simple("amiga-floppy", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_FLOPPY)) {
pdev = platform_device_register_simple("amiga-floppy", -1,
NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

if (AMIGAHW_PRESENT(A3000_SCSI))
platform_device_register_simple("amiga-a3000-scsi", -1,
&a3000_scsi_resource, 1);
if (AMIGAHW_PRESENT(A3000_SCSI)) {
pdev = platform_device_register_simple("amiga-a3000-scsi", -1,
&a3000_scsi_resource, 1);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

if (AMIGAHW_PRESENT(A4000_SCSI))
platform_device_register_simple("amiga-a4000t-scsi", -1,
&a4000t_scsi_resource, 1);
if (AMIGAHW_PRESENT(A4000_SCSI)) {
pdev = platform_device_register_simple("amiga-a4000t-scsi", -1,
&a4000t_scsi_resource,
1);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

if (AMIGAHW_PRESENT(A1200_IDE) ||
z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) {
pdev = platform_device_register_simple("amiga-gayle-ide", -1,
&a1200_ide_resource, 1);
platform_device_add_data(pdev, &a1200_ide_pdata,
sizeof(a1200_ide_pdata));
if (IS_ERR(pdev))
return PTR_ERR(pdev);
error = platform_device_add_data(pdev, &a1200_ide_pdata,
sizeof(a1200_ide_pdata));
if (error)
return error;
}

if (AMIGAHW_PRESENT(A4000_IDE)) {
pdev = platform_device_register_simple("amiga-gayle-ide", -1,
&a4000_ide_resource, 1);
platform_device_add_data(pdev, &a4000_ide_pdata,
sizeof(a4000_ide_pdata));
if (IS_ERR(pdev))
return PTR_ERR(pdev);
error = platform_device_add_data(pdev, &a4000_ide_pdata,
sizeof(a4000_ide_pdata));
if (error)
return error;
}


/* other I/O hardware */
if (AMIGAHW_PRESENT(AMI_KEYBOARD))
platform_device_register_simple("amiga-keyboard", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_KEYBOARD)) {
pdev = platform_device_register_simple("amiga-keyboard", -1,
NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

if (AMIGAHW_PRESENT(AMI_MOUSE))
platform_device_register_simple("amiga-mouse", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_MOUSE)) {
pdev = platform_device_register_simple("amiga-mouse", -1, NULL,
0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

if (AMIGAHW_PRESENT(AMI_SERIAL))
platform_device_register_simple("amiga-serial", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_SERIAL)) {
pdev = platform_device_register_simple("amiga-serial", -1,
NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

if (AMIGAHW_PRESENT(AMI_PARALLEL))
platform_device_register_simple("amiga-parallel", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_PARALLEL)) {
pdev = platform_device_register_simple("amiga-parallel", -1,
NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}


/* real time clocks */
if (AMIGAHW_PRESENT(A2000_CLK))
platform_device_register_simple("rtc-msm6242", -1,
&amiga_rtc_resource, 1);
if (AMIGAHW_PRESENT(A2000_CLK)) {
pdev = platform_device_register_simple("rtc-msm6242", -1,
&amiga_rtc_resource, 1);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

if (AMIGAHW_PRESENT(A3000_CLK))
platform_device_register_simple("rtc-rp5c01", -1,
&amiga_rtc_resource, 1);
if (AMIGAHW_PRESENT(A3000_CLK)) {
pdev = platform_device_register_simple("rtc-rp5c01", -1,
&amiga_rtc_resource, 1);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
}

return 0;
}

device_initcall(amiga_init_devices);
arch_initcall(amiga_init_devices);
4 changes: 2 additions & 2 deletions arch/m68k/atari/ataints.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void __init atari_init_IRQ(void)
* hardware with a programmable int vector (probably a VME board).
*/

unsigned long atari_register_vme_int(void)
unsigned int atari_register_vme_int(void)
{
int i;

Expand All @@ -223,7 +223,7 @@ unsigned long atari_register_vme_int(void)
EXPORT_SYMBOL(atari_register_vme_int);


void atari_unregister_vme_int(unsigned long irq)
void atari_unregister_vme_int(unsigned int irq)
{
if (irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) {
irq -= VME_SOURCE_BASE;
Expand Down
4 changes: 2 additions & 2 deletions arch/m68k/include/asm/atariints.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static inline int atari_irq_pending( unsigned irq )
return( get_mfp_bit( irq, MFP_PENDING ) );
}

unsigned long atari_register_vme_int( void );
void atari_unregister_vme_int( unsigned long );
unsigned int atari_register_vme_int(void);
void atari_unregister_vme_int(unsigned int);

#endif /* linux/atariints.h */
6 changes: 2 additions & 4 deletions arch/m68k/include/asm/entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@

/* the following macro is used when enabling interrupts */
#if defined(MACH_ATARI_ONLY)
/* block out HSYNC on the atari */
#define ALLOWINT (~0x400)
#define MAX_NOINT_IPL 3
/* block out HSYNC = ipl 2 on the atari */
#define ALLOWINT (~0x500)
#else
/* portable version */
#define ALLOWINT (~0x700)
#define MAX_NOINT_IPL 0
#endif /* machine compilation types */

#ifdef __ASSEMBLY__
Expand Down
7 changes: 7 additions & 0 deletions arch/m68k/include/asm/io_mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ static inline void isa_delay(void)
#define readl(addr) in_le32(addr)
#define writel(val,addr) out_le32((addr),(val))

#define readsb(port, buf, nr) raw_insb((port), (u8 *)(buf), (nr))
#define readsw(port, buf, nr) raw_insw((port), (u16 *)(buf), (nr))
#define readsl(port, buf, nr) raw_insl((port), (u32 *)(buf), (nr))
#define writesb(port, buf, nr) raw_outsb((port), (u8 *)(buf), (nr))
#define writesw(port, buf, nr) raw_outsw((port), (u16 *)(buf), (nr))
#define writesl(port, buf, nr) raw_outsl((port), (u32 *)(buf), (nr))

#define mmiowb()

static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
Expand Down
27 changes: 27 additions & 0 deletions arch/m68k/include/asm/vga.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef _ASM_M68K_VGA_H
#define _ASM_M68K_VGA_H

#include <asm/raw_io.h>

/*
* FIXME
* Ugh, we don't have PCI space, so map readb() and friends to use raw I/O
* accessors, which are identical to the z_*() Zorro bus accessors.
* This should make cirrusfb work again on Amiga
*/
#undef inb_p
#undef inw_p
#undef outb_p
#undef outw
#undef readb
#undef writeb
#undef writew
#define inb_p(port) 0
#define inw_p(port) 0
#define outb_p(port, val) do { } while (0)
#define outw(port, val) do { } while (0)
#define readb raw_inb
#define writeb raw_outb
#define writew raw_outw

#endif /* _ASM_M68K_VGA_H */
42 changes: 34 additions & 8 deletions arch/m68k/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
{
struct mm_struct *mm = current->mm;
struct vm_area_struct * vma;
int write, fault;
int fault;
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;

#ifdef DEBUG
printk ("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
Expand All @@ -87,6 +88,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
if (in_atomic() || !mm)
goto no_context;

retry:
down_read(&mm->mmap_sem);

vma = find_vma(mm, address);
Expand Down Expand Up @@ -117,14 +119,13 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
#ifdef DEBUG
printk("do_page_fault: good_area\n");
#endif
write = 0;
switch (error_code & 3) {
default: /* 3: write, present */
/* fall through */
case 2: /* write, not present */
if (!(vma->vm_flags & VM_WRITE))
goto acc_err;
write++;
flags |= FAULT_FLAG_WRITE;
break;
case 1: /* read, present */
goto acc_err;
Expand All @@ -139,21 +140,46 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
* the fault.
*/

fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
fault = handle_mm_fault(mm, vma, address, flags);
#ifdef DEBUG
printk("handle_mm_fault returns %d\n",fault);
#endif

if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
return 0;

if (unlikely(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_OOM)
goto out_of_memory;
else if (fault & VM_FAULT_SIGBUS)
goto bus_err;
BUG();
}
if (fault & VM_FAULT_MAJOR)
current->maj_flt++;
else
current->min_flt++;

/*
* Major/minor page fault accounting is only done on the
* initial attempt. If we go through a retry, it is extremely
* likely that the page will be found in page cache at that point.
*/
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_MAJOR)
current->maj_flt++;
else
current->min_flt++;
if (fault & VM_FAULT_RETRY) {
/* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
* of starvation. */
flags &= ~FAULT_FLAG_ALLOW_RETRY;

/*
* No need to up_read(&mm->mmap_sem) as we would
* have already released it in __lock_page_or_retry
* in mm/filemap.c.
*/

goto retry;
}
}

up_read(&mm->mmap_sem);
return 0;
Expand Down
Loading

0 comments on commit 881bcab

Please sign in to comment.