From 9aa59cacdf22de9127d147de9523c1a0f832da48 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 14 Aug 2014 09:25:38 +0200 Subject: m68k/atari - stram: Add missing #include MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If CONFIG_BLOCK=n: arch/m68k/atari/stram.c:44: error: variable ‘stram_pool’ has initializer but incomplete type arch/m68k/atari/stram.c:45: error: unknown field ‘name’ specified in initializer arch/m68k/atari/stram.c:46: warning: excess elements in struct initializer arch/m68k/atari/stram.c:46: warning: (near initialization for ‘stram_pool’) arch/m68k/atari/stram.c: In function ‘atari_stram_reserve_pages’: arch/m68k/atari/stram.c:97: error: invalid use of undefined type ‘struct resource’ ... Signed-off-by: Geert Uytterhoeven --- arch/m68k/atari/stram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index 5f8cb5a234d9..c83d66442612 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3 From a000dfc2ab201ffc43fbe925a522adeebe51f6f3 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 9 Sep 2014 11:32:44 +0200 Subject: m68k: Add missing ioport_unmap() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drivers/net/ethernet/cirrus/cs89x0.c: In function ‘cs89x0_ioport_probe’: drivers/net/ethernet/cirrus/cs89x0.c:1629: error: implicit declaration of function ‘ioport_unmap’ Add the missing ioport_unmap() implementation, and convert ioport_map() from a macro to a static inline function while we're at it (both copied from asm-generic). Signed-off-by: Geert Uytterhoeven --- arch/m68k/include/asm/io_mm.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h index ffdf54f44bc6..8955b40a5dc4 100644 --- a/arch/m68k/include/asm/io_mm.h +++ b/arch/m68k/include/asm/io_mm.h @@ -510,6 +510,13 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int */ #define xlate_dev_kmem_ptr(p) p -#define ioport_map(port, nr) ((void __iomem *)(port)) +static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) +{ + return (void __iomem *) port; +} + +static inline void ioport_unmap(void __iomem *p) +{ +} #endif /* _IO_H */ -- cgit v1.2.3 From fd4d453b64d409647c92de6395494b5dd82ce224 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 9 Sep 2014 11:54:50 +0200 Subject: m68k: AMIGA_BUILTIN_SERIAL should depend on TTY If CONFIG_TTY=n: drivers/built-in.o: In function `rs_flush_buffer': amiserial.c:(.text+0x1f626): undefined reference to `tty_wakeup' drivers/built-in.o: In function `transmit_chars': amiserial.c:(.text+0x1f6c8): undefined reference to `tty_wakeup' drivers/built-in.o: In function `change_speed': amiserial.c:(.text+0x1f80a): undefined reference to `tty_termios_baud_rate' amiserial.c:(.text+0x1f88c): undefined reference to `tty_termios_baud_rate' drivers/built-in.o: In function `check_modem_status': amiserial.c:(.text+0x1faa6): undefined reference to `tty_hangup' amiserial.c:(.text+0x1faec): undefined reference to `tty_wakeup' drivers/built-in.o: In function `get_serial_info': amiserial.c:(.text+0x1fb88): undefined reference to `tty_lock' amiserial.c:(.text+0x1fbc0): undefined reference to `tty_unlock' drivers/built-in.o: In function `rs_open': amiserial.c:(.text+0x1fdc6): undefined reference to `tty_port_block_til_ready' drivers/built-in.o: In function `set_serial_info': amiserial.c:(.text+0x1fe0c): undefined reference to `tty_lock' amiserial.c:(.text+0x1fea0): undefined reference to `tty_unlock' amiserial.c:(.text+0x1fed0): undefined reference to `tty_unlock' amiserial.c:(.text+0x1ffaa): undefined reference to `tty_unlock' drivers/built-in.o: In function `receive_chars': amiserial.c:(.text+0x2005c): undefined reference to `do_SAK' amiserial.c:(.text+0x200e0): undefined reference to `tty_insert_flip_string_flags' amiserial.c:(.text+0x2013c): undefined reference to `tty_insert_flip_string_flags' amiserial.c:(.text+0x20148): undefined reference to `tty_flip_buffer_push' drivers/built-in.o: In function `rs_close': amiserial.c:(.text+0x20744): undefined reference to `tty_port_close_start' amiserial.c:(.text+0x2078a): undefined reference to `tty_ldisc_flush' amiserial.c:(.text+0x20798): undefined reference to `tty_port_close_end' drivers/built-in.o: In function `amiga_serial_probe': amiserial.c:(.init.text+0x96a): undefined reference to `__tty_alloc_driver' amiserial.c:(.init.text+0x9c0): undefined reference to `tty_std_termios' amiserial.c:(.init.text+0x9e6): undefined reference to `tty_set_operations' amiserial.c:(.init.text+0xa3e): undefined reference to `tty_port_init' amiserial.c:(.init.text+0xa5c): undefined reference to `tty_port_link_device' amiserial.c:(.init.text+0xa6c): undefined reference to `tty_register_driver' amiserial.c:(.init.text+0xb4a): undefined reference to `tty_unregister_driver' amiserial.c:(.init.text+0xb58): undefined reference to `tty_port_destroy' amiserial.c:(.init.text+0xb64): undefined reference to `put_tty_driver' Signed-off-by: Geert Uytterhoeven --- arch/m68k/Kconfig.devices | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices index d163991c5717..236193075380 100644 --- a/arch/m68k/Kconfig.devices +++ b/arch/m68k/Kconfig.devices @@ -95,7 +95,7 @@ config ATARI_DSP56K config AMIGA_BUILTIN_SERIAL tristate "Amiga builtin serial support" - depends on AMIGA + depends on AMIGA && TTY help If you want to use your Amiga's built-in serial port in Linux, answer Y. -- cgit v1.2.3 From e4dc601bf99ccd1c95b7e6eef1d3cf3c4b0d4961 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 28 Sep 2014 10:50:06 +0200 Subject: m68k: Disable/restore interrupts in hwreg_present()/hwreg_write() hwreg_present() and hwreg_write() temporarily change the VBR register to another vector table. This table contains a valid bus error handler only, all other entries point to arbitrary addresses. If an interrupt comes in while the temporary table is active, the processor will start executing at such an arbitrary address, and the kernel will crash. While most callers run early, before interrupts are enabled, or explicitly disable interrupts, Finn Thain pointed out that macsonic has one callsite that doesn't, causing intermittent boot crashes. There's another unsafe callsite in hilkbd. Fix this for good by disabling and restoring interrupts inside hwreg_present() and hwreg_write(). Explicitly disabling interrupts can be removed from the callsites later. Reported-by: Finn Thain Signed-off-by: Geert Uytterhoeven Cc: stable@vger.kernel.org --- arch/m68k/mm/hwtest.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/m68k/mm/hwtest.c b/arch/m68k/mm/hwtest.c index 2c7dde3c6430..2a5259fd23eb 100644 --- a/arch/m68k/mm/hwtest.c +++ b/arch/m68k/mm/hwtest.c @@ -28,9 +28,11 @@ int hwreg_present( volatile void *regp ) { int ret = 0; + unsigned long flags; long save_sp, save_vbr; long tmp_vectors[3]; + local_irq_save(flags); __asm__ __volatile__ ( "movec %/vbr,%2\n\t" "movel #Lberr1,%4@(8)\n\t" @@ -46,6 +48,7 @@ int hwreg_present( volatile void *regp ) : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) : "a" (regp), "a" (tmp_vectors) ); + local_irq_restore(flags); return( ret ); } @@ -58,9 +61,11 @@ EXPORT_SYMBOL(hwreg_present); int hwreg_write( volatile void *regp, unsigned short val ) { int ret; + unsigned long flags; long save_sp, save_vbr; long tmp_vectors[3]; + local_irq_save(flags); __asm__ __volatile__ ( "movec %/vbr,%2\n\t" "movel #Lberr2,%4@(8)\n\t" @@ -78,6 +83,7 @@ int hwreg_write( volatile void *regp, unsigned short val ) : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) : "a" (regp), "a" (tmp_vectors), "g" (val) ); + local_irq_restore(flags); return( ret ); } -- cgit v1.2.3 From 24cae7934cf1455c9793a95376a206ca6b965ade Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 28 Sep 2014 11:18:49 +0200 Subject: m68k: Reformat arch/m68k/mm/hwtest.c No functional changes Signed-off-by: Geert Uytterhoeven --- arch/m68k/mm/hwtest.c | 78 ++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/arch/m68k/mm/hwtest.c b/arch/m68k/mm/hwtest.c index 2a5259fd23eb..fb8be4dd38c4 100644 --- a/arch/m68k/mm/hwtest.c +++ b/arch/m68k/mm/hwtest.c @@ -25,32 +25,32 @@ #include -int hwreg_present( volatile void *regp ) +int hwreg_present(volatile void *regp) { - int ret = 0; - unsigned long flags; - long save_sp, save_vbr; - long tmp_vectors[3]; + int ret = 0; + unsigned long flags; + long save_sp, save_vbr; + long tmp_vectors[3]; - local_irq_save(flags); - __asm__ __volatile__ - ( "movec %/vbr,%2\n\t" - "movel #Lberr1,%4@(8)\n\t" - "movec %4,%/vbr\n\t" - "movel %/sp,%1\n\t" - "moveq #0,%0\n\t" - "tstb %3@\n\t" + local_irq_save(flags); + __asm__ __volatile__ ( + "movec %/vbr,%2\n\t" + "movel #Lberr1,%4@(8)\n\t" + "movec %4,%/vbr\n\t" + "movel %/sp,%1\n\t" + "moveq #0,%0\n\t" + "tstb %3@\n\t" "nop\n\t" - "moveq #1,%0\n" - "Lberr1:\n\t" - "movel %1,%/sp\n\t" - "movec %2,%/vbr" + "moveq #1,%0\n" + "Lberr1:\n\t" + "movel %1,%/sp\n\t" + "movec %2,%/vbr" : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) : "a" (regp), "a" (tmp_vectors) - ); - local_irq_restore(flags); + ); + local_irq_restore(flags); - return( ret ); + return ret; } EXPORT_SYMBOL(hwreg_present); @@ -58,34 +58,36 @@ EXPORT_SYMBOL(hwreg_present); * by a bus error handler. Returns 1 if successful, 0 otherwise. */ -int hwreg_write( volatile void *regp, unsigned short val ) +int hwreg_write(volatile void *regp, unsigned short val) { - int ret; + int ret; unsigned long flags; - long save_sp, save_vbr; - long tmp_vectors[3]; + long save_sp, save_vbr; + long tmp_vectors[3]; local_irq_save(flags); - __asm__ __volatile__ - ( "movec %/vbr,%2\n\t" - "movel #Lberr2,%4@(8)\n\t" - "movec %4,%/vbr\n\t" - "movel %/sp,%1\n\t" - "moveq #0,%0\n\t" - "movew %5,%3@\n\t" - "nop \n\t" /* If this nop isn't present, 'ret' may already be - * loaded with 1 at the time the bus error - * happens! */ - "moveq #1,%0\n" + __asm__ __volatile__ ( + "movec %/vbr,%2\n\t" + "movel #Lberr2,%4@(8)\n\t" + "movec %4,%/vbr\n\t" + "movel %/sp,%1\n\t" + "moveq #0,%0\n\t" + "movew %5,%3@\n\t" + "nop\n\t" + /* + * If this nop isn't present, 'ret' may already be loaded + * with 1 at the time the bus error happens! + */ + "moveq #1,%0\n" "Lberr2:\n\t" - "movel %1,%/sp\n\t" - "movec %2,%/vbr" + "movel %1,%/sp\n\t" + "movec %2,%/vbr" : "=&d" (ret), "=&r" (save_sp), "=&r" (save_vbr) : "a" (regp), "a" (tmp_vectors), "g" (val) ); local_irq_restore(flags); - return( ret ); + return ret; } EXPORT_SYMBOL(hwreg_write); -- cgit v1.2.3