summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS7
-rw-r--r--arch/m68k/Kconfig81
-rw-r--r--arch/m68k/amiga/amiints.c12
-rw-r--r--arch/m68k/amiga/amisound.c5
-rw-r--r--arch/m68k/amiga/config.c3
-rw-r--r--arch/m68k/apollo/config.c10
-rw-r--r--arch/m68k/apollo/dn_ints.c29
-rw-r--r--arch/m68k/atari/Makefile2
-rw-r--r--arch/m68k/atari/ataints.c1
-rw-r--r--arch/m68k/atari/config.c3
-rw-r--r--arch/m68k/defconfig1
-rw-r--r--arch/m68k/fpsp040/bindec.S2
-rw-r--r--arch/m68k/fpsp040/binstr.S2
-rw-r--r--arch/m68k/fpsp040/bugfix.S2
-rw-r--r--arch/m68k/fpsp040/decbin.S2
-rw-r--r--arch/m68k/fpsp040/do_func.S2
-rw-r--r--arch/m68k/fpsp040/gen_except.S2
-rw-r--r--arch/m68k/fpsp040/get_op.S2
-rw-r--r--arch/m68k/fpsp040/kernel_ex.S2
-rw-r--r--arch/m68k/fpsp040/res_func.S2
-rw-r--r--arch/m68k/fpsp040/round.S2
-rw-r--r--arch/m68k/fpsp040/satan.S2
-rw-r--r--arch/m68k/fpsp040/scale.S2
-rw-r--r--arch/m68k/fpsp040/setox.S2
-rw-r--r--arch/m68k/fpsp040/sgetem.S2
-rw-r--r--arch/m68k/fpsp040/sint.S2
-rw-r--r--arch/m68k/fpsp040/skeleton.S2
-rw-r--r--arch/m68k/fpsp040/slogn.S2
-rw-r--r--arch/m68k/fpsp040/smovecr.S2
-rw-r--r--arch/m68k/fpsp040/srem_mod.S2
-rw-r--r--arch/m68k/fpsp040/ssin.S2
-rw-r--r--arch/m68k/fpsp040/stan.S2
-rw-r--r--arch/m68k/fpsp040/stanh.S2
-rw-r--r--arch/m68k/fpsp040/sto_res.S2
-rw-r--r--arch/m68k/fpsp040/stwotox.S2
-rw-r--r--arch/m68k/fpsp040/util.S2
-rw-r--r--arch/m68k/fpsp040/x_bsun.S2
-rw-r--r--arch/m68k/fpsp040/x_fline.S2
-rw-r--r--arch/m68k/fpsp040/x_operr.S2
-rw-r--r--arch/m68k/fpsp040/x_ovfl.S2
-rw-r--r--arch/m68k/fpsp040/x_snan.S2
-rw-r--r--arch/m68k/fpsp040/x_store.S2
-rw-r--r--arch/m68k/fpsp040/x_unfl.S2
-rw-r--r--arch/m68k/fpsp040/x_unimp.S2
-rw-r--r--arch/m68k/fpsp040/x_unsupp.S2
-rw-r--r--arch/m68k/hp300/Makefile2
-rw-r--r--arch/m68k/hp300/time.c18
-rw-r--r--arch/m68k/ifpsp060/fskeleton.S2
-rw-r--r--arch/m68k/ifpsp060/iskeleton.S2
-rw-r--r--arch/m68k/kernel/Makefile23
-rw-r--r--arch/m68k/kernel/entry.S15
-rw-r--r--arch/m68k/kernel/m68k_defs.c2
-rw-r--r--arch/m68k/kernel/m68k_ksyms.c4
-rw-r--r--arch/m68k/kernel/process.c10
-rw-r--r--arch/m68k/kernel/setup.c7
-rw-r--r--arch/m68k/kernel/sun3-head.S6
-rw-r--r--arch/m68k/kernel/time.c24
-rw-r--r--arch/m68k/kernel/traps.c39
-rw-r--r--arch/m68k/lib/checksum.c100
-rw-r--r--arch/m68k/mac/config.c4
-rw-r--r--arch/m68k/mac/macints.c2
-rw-r--r--arch/m68k/mm/Makefile2
-rw-r--r--arch/m68k/mm/memory.c255
-rw-r--r--arch/m68k/mm/motorola.c3
-rw-r--r--arch/m68k/mm/sun3kmap.c156
-rw-r--r--arch/m68k/mm/sun3mmu.c6
-rw-r--r--arch/m68k/mvme147/config.c5
-rw-r--r--arch/m68k/q40/config.c4
-rw-r--r--arch/m68k/q40/q40ints.c9
-rw-r--r--arch/m68k/sun3/Makefile4
-rw-r--r--arch/m68k/sun3/config.c3
-rw-r--r--arch/m68k/sun3/idprom.c4
-rw-r--r--arch/m68k/sun3/intersil.c1
-rw-r--r--arch/m68k/sun3/mmu_emu.c6
-rw-r--r--arch/m68k/sun3/sun3dvma.c89
-rw-r--r--arch/m68k/sun3/sun3ints.c49
-rw-r--r--arch/m68k/sun3x/config.c33
-rw-r--r--arch/m68k/sun3x/prom.c30
-rw-r--r--arch/m68k/sun3x/time.c2
-rw-r--r--arch/m68k/vmlinux-std.lds16
-rw-r--r--arch/m68k/vmlinux-sun3.lds14
-rw-r--r--arch/ppc/configs/apus_defconfig1
-rw-r--r--drivers/block/z2ram.c2
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/amiserial.c4
-rw-r--r--drivers/char/nvram.c2
-rw-r--r--drivers/ide/ide-lib.c2
-rw-r--r--drivers/ide/ide.c6
-rw-r--r--drivers/input/keyboard/amikbd.c2
-rw-r--r--drivers/macintosh/mac_keyb.c206
-rw-r--r--drivers/net/Makefile2
-rw-r--r--drivers/net/daynaport.c922
-rw-r--r--drivers/net/mac8390.c752
-rw-r--r--drivers/net/sun3_82586.c24
-rw-r--r--drivers/net/sun3lance.c21
-rw-r--r--drivers/nubus/nubus.c1
-rw-r--r--drivers/nubus/proc.c1
-rw-r--r--drivers/scsi/Makefile2
-rw-r--r--drivers/scsi/sun3_NCR5380.c110
-rw-r--r--drivers/scsi/sun3_scsi.c80
-rw-r--r--drivers/scsi/sun3_scsi.h92
-rw-r--r--drivers/scsi/sun3_scsi_vme.c567
-rw-r--r--drivers/scsi/sun3x_esp.c13
-rw-r--r--drivers/video/Kconfig3
-rw-r--r--drivers/video/fbcon.c2
-rw-r--r--drivers/video/hpfb.c67
-rw-r--r--drivers/zorro/proc.c2
-rw-r--r--drivers/zorro/zorro.ids10
-rw-r--r--include/asm-m68k/checksum.h4
-rw-r--r--include/asm-m68k/dvma.h5
-rw-r--r--include/asm-m68k/floppy.h2
-rw-r--r--include/asm-m68k/hardirq.h81
-rw-r--r--include/asm-m68k/io.h12
-rw-r--r--include/asm-m68k/kmap_types.h21
-rw-r--r--include/asm-m68k/nubus.h2
-rw-r--r--include/asm-m68k/page.h1
-rw-r--r--include/asm-m68k/percpu.h6
-rw-r--r--include/asm-m68k/poll.h1
-rw-r--r--include/asm-m68k/q40_master.h30
-rw-r--r--include/asm-m68k/raw_io.h13
-rw-r--r--include/asm-m68k/rtc.h30
-rw-r--r--include/asm-m68k/softirq.h19
-rw-r--r--include/asm-m68k/sun3_pgalloc.h10
-rw-r--r--include/asm-m68k/sun3ints.h8
-rw-r--r--include/asm-m68k/sun3mmu.h4
-rw-r--r--include/asm-m68k/sun3xflop.h2
-rw-r--r--include/asm-m68k/system.h74
-rw-r--r--include/asm-m68k/thread_info.h10
-rw-r--r--include/asm-m68k/virtconvert.h30
-rw-r--r--include/asm-m68k/zorro.h2
-rw-r--r--include/linux/miscdevice.h4
-rw-r--r--include/linux/sem.h1
-rw-r--r--lib/rwsem-spinlock.c4
133 files changed, 2452 insertions, 1994 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index ea4ece8d8531..f006c4f0fb92 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1584,6 +1584,13 @@ W: http://www.m17n.org/linux-sh/
W: http://www.rr.iij4u.or.jp/~kkojima/linux-sh4.html
S: Maintained
+SUN3/3X
+P: Sam Creasey
+M: sammy@sammy.net
+L: sun3-list@redhat.com
+W: http://sammy.net/sun3/
+S: Maintained
+
SVGA HANDLING
P: Martin Mares
M: mj@ucw.cz
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 979addf44f16..35438cf0abb0 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -25,10 +25,6 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM
bool
-config GENERIC_ISA_DMA
- bool
- default y
-
mainmenu "Linux/68k Kernel Configuration"
@@ -201,7 +197,8 @@ config SUN3X
help
This option enables support for the Sun 3x series of workstations.
Be warned that this support is very experimental. You will also want
- to say Y to 68020 support and N to the other processors below.
+ to say Y to 68030 support and N to the other processors below.
+ Note that Sun 3x kernels are not compatible with Sun 3 hardware.
General Linux information on the Sun 3x series (now discontinued)
is at <http://www.angelfire.com/ca2/tech68k/sun3.html>.
@@ -210,13 +207,14 @@ config SUN3X
config SUN3
bool "Sun3 support"
help
- This option enables support for the Sun 3 series of workstations.
- Currently, only the Sun 3/80 is supported within the Sun 3x family.
- You will also want to enable 68030 support. General Linux
- information on the Sun 3x series (now discontinued) is at
- <http://www.angelfire.com/ca2/tech68k/sun3.html>.
+ This option enables support for the Sun 3 series of workstations
+ (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
+ that all other hardware types must be disabled, as Sun 3 kernels
+ are incompatible with all other m68k targets (including Sun 3x!).
+ Also, you will want to say Y to 68020 support and N to the other
+ processors below.
- If you don't want to compile a kernel for a Sun 3, say N.
+ If you don't want to compile a kernel exclusively for a Sun 3, say N.
config Q40
bool "Q40/Q60 support"
@@ -638,6 +636,11 @@ config ISA
(MCA) or VESA. ISA is an older system, now being displaced by PCI;
newer boards don't support it. If you have ISA, say Y, otherwise N.
+config GENERIC_ISA_DMA
+ bool
+ depends on Q40 || AMIGA_PCMCIA || GG2
+ default y
+
source "drivers/pci/Kconfig"
source "drivers/zorro/Kconfig"
@@ -654,9 +657,7 @@ source "drivers/block/Kconfig"
source "drivers/md/Kconfig"
-if MAC
source "drivers/input/Kconfig"
-endif
menu "ATA/ATAPI/MFM/RLL device support"
@@ -1132,8 +1133,8 @@ config SUN3_SCSI
depends on SUN3 && SCSI
help
This option will enable support for the OBIO (onboard io) NCR5380
- SCSI controller found in the Sun 3/50 and 3/60. Note that this
- driver does not provide support for VME SCSI boards.
+ SCSI controller found in the Sun 3/50 and 3/60, as well as for
+ "Sun3" type VME scsi controllers also based on the NCR5380.
General Linux information on the Sun 3 series (now discontinued)
is at <http://www.angelfire.com/ca2/tech68k/sun3.html>.
@@ -1774,6 +1775,11 @@ config VT_CONSOLE
If unsure, say Y.
+config HW_CONSOLE
+ bool
+ depends on VT
+ default y
+
config NVRAM
bool
depends on ATARI
@@ -1802,51 +1808,6 @@ config NVRAM
The module will be called nvram.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
-config AMIGAMOUSE
- tristate "Amiga mouse support"
- depends on AMIGA
- help
- If you want to be able to use an Amiga mouse in Linux, say Y.
-
- This driver is also available as a module ( = code which can be
- inserted in and removed from the running kernel whenever you want).
- The module is called amigamouse.o. If you want to compile it as a
- module, say M here and read <file:Documentation/modules.txt>.
-
-config BUSMOUSE
- bool
- depends on SUN3X_ZS || ATARI && VT && ATARIMOUSE || AMIGA && AMIGAMOUSE
- default y
- ---help---
- Say Y here if your machine has a bus mouse as opposed to a serial
- mouse. Most people have a regular serial MouseSystem or
- Microsoft mouse (made by Logitech) that plugs into a COM port
- (rectangular with 9 or 25 pins). These people say N here.
-
- If you have a laptop, you either have to check the documentation or
- experiment a bit to find out whether the trackball is a serial mouse
- or not; it's best to say Y here for you.
-
- This is the generic bus mouse driver code. If you have a bus mouse,
- you will have to say Y here and also to the specific driver for your
- mouse below.
-
- This code is also available as a module ( = code which can be
- inserted in and removed from the running kernel whenever you want).
- The module will be called busmouse.o. If you want to compile it as a
- module, say M here and read <file:Documentation/modules.txt>.
-
-config ATARIMOUSE
- tristate "Atari mouse support"
- depends on ATARI && VT
- help
- If you want to be able to use an Atari mouse in Linux, say Y.
-
- This driver is also available as a module ( = code which can be
- inserted in and removed from the running kernel whenever you want).
- The module is called atarimouse.o. If you want to compile it as a
- module, say M here and read <file:Documentation/modules.txt>.
-
config ATARI_MFPSER
tristate "Atari MFP serial support"
depends on ATARI
diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index e2f993797cd2..160e3fd53834 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -128,8 +128,7 @@ static inline int amiga_insert_irq(irq_node_t **list, irq_node_t *node)
printk("%s: Warning: dev_id of %s is zero\n",
__FUNCTION__, node->devname);
- save_flags(flags);
- cli();
+ local_irq_save(flags);
cur = *list;
@@ -153,7 +152,7 @@ static inline int amiga_insert_irq(irq_node_t **list, irq_node_t *node)
node->next = cur;
*list = node;
- restore_flags(flags);
+ local_irq_restore(flags);
return 0;
}
@@ -162,19 +161,18 @@ static inline void amiga_delete_irq(irq_node_t **list, void *dev_id)
unsigned long flags;
irq_node_t *node;
- save_flags(flags);
- cli();
+ local_irq_save(flags);
for (node = *list; node; list = &node->next, node = *list) {
if (node->dev_id == dev_id) {
*list = node->next;
/* Mark it as free. */
node->handler = NULL;
- restore_flags(flags);
+ local_irq_restore(flags);
return;
}
}
- restore_flags(flags);
+ local_irq_restore(flags);
printk ("%s: tried to remove invalid irq\n", __FUNCTION__);
}
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index efec739136fe..5a2574170f67 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -71,8 +71,7 @@ void amiga_mksound( unsigned int hz, unsigned int ticks )
if (!snd_data)
return;
- save_flags(flags);
- cli();
+ local_irq_save(flags);
del_timer( &sound_timer );
if (hz > 20 && hz < 32767) {
@@ -100,7 +99,7 @@ void amiga_mksound( unsigned int hz, unsigned int ticks )
} else
nosound( 0 );
- restore_flags(flags);
+ local_irq_restore(flags);
}
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 7e6f80e68202..5abf761945ac 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -88,6 +88,7 @@ static unsigned long amiga_gettimeoffset (void);
static int a3000_hwclk (int, struct rtc_time *);
static int a2000_hwclk (int, struct rtc_time *);
static int amiga_set_clock_mmss (unsigned long);
+extern void amiga_mksound( unsigned int count, unsigned int ticks );
#ifdef CONFIG_AMIGA_FLOPPY
extern void amiga_floppy_setup(char *, int *);
#endif
@@ -408,7 +409,7 @@ void __init config_amiga(void)
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
-#ifdef CONFIG_INPUT_M68K_BEEP
+#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = amiga_mksound;
#endif
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index 4c26cad5ce01..54f4d43d1ed3 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -26,8 +26,6 @@ u_long timer_physaddr;
u_long apollo_model;
extern void dn_sched_init(void (*handler)(int,void *,struct pt_regs *));
-extern int dn_keyb_init(void);
-extern int dn_dummy_kbdrate(struct kbd_repeat *);
extern void dn_init_IRQ(void);
extern int dn_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void dn_free_irq(unsigned int irq, void *dev_id);
@@ -37,7 +35,6 @@ extern int show_dn_interrupts(struct seq_file *, void *);
extern unsigned long dn_gettimeoffset(void);
extern int dn_dummy_hwclk(int, struct rtc_time *);
extern int dn_dummy_set_clock_mmss(unsigned long);
-extern void dn_mksound(unsigned int count, unsigned int ticks);
extern void dn_dummy_reset(void);
extern void dn_dummy_waitbut(void);
extern struct fb_info *dn_fb_init(long *);
@@ -165,10 +162,6 @@ void config_apollo(void) {
dn_setup_model();
mach_sched_init=dn_sched_init; /* */
-#ifdef CONFIG_VT
- mach_keyb_init=dn_keyb_init;
- mach_kbdrate=dn_dummy_kbdrate;
-#endif
mach_init_IRQ=dn_init_IRQ;
mach_default_handler=NULL;
mach_request_irq = dn_request_irq;
@@ -189,9 +182,6 @@ void config_apollo(void) {
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
-#ifdef CONFIG_VT
- kd_mksound = dn_mksound;
-#endif
#ifdef CONFIG_HEARTBEAT
mach_heartbeat = dn_heartbeat;
#endif
diff --git a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c
index 27b9e3ce196f..e92391957e89 100644
--- a/arch/m68k/apollo/dn_ints.c
+++ b/arch/m68k/apollo/dn_ints.c
@@ -117,35 +117,6 @@ struct fb_info *dn_dummy_fb_init(long *mem_start) {
}
-#ifdef CONFIG_VT
-extern void write_keyb_cmd(u_short length, u_char *cmd);
-static char BellOnCommand[] = { 0xFF, 0x21, 0x81 },
- BellOffCommand[] = { 0xFF, 0x21, 0x82 };
-
-static void dn_nosound (unsigned long ignored) {
-
- write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
-
-}
-
-void dn_mksound( unsigned int count, unsigned int ticks ) {
-
- static struct timer_list sound_timer = { function: dn_nosound };
-
- del_timer( &sound_timer );
- if(count) {
- write_keyb_cmd(sizeof(BellOnCommand),BellOnCommand);
- if (ticks) {
- sound_timer.expires = jiffies + ticks;
- add_timer( &sound_timer );
- }
- }
- else
- write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
-}
-#endif /* CONFIG_VT */
-
-
void dn_dummy_video_setup(char *options,int *ints) {
printk("no video yet\n");
diff --git a/arch/m68k/atari/Makefile b/arch/m68k/atari/Makefile
index 88605764242c..f21ead13f671 100644
--- a/arch/m68k/atari/Makefile
+++ b/arch/m68k/atari/Makefile
@@ -7,8 +7,6 @@ export-objs := atari_ksyms.o
obj-y := config.o time.o debug.o ataints.o stdma.o \
atasound.o stram.o atari_ksyms.o
-obj-$(CONFIG_VT) += atakeyb.o joystick.o
-
ifeq ($(CONFIG_PCI),y)
obj-$(CONFIG_HADES) += hades-pci.o
endif
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 8e3676cbf377..8fc840c0bafc 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -37,7 +37,6 @@
#include <linux/types.h>
#include <linux/kernel.h>
-#include <linux/ptrace.h>
#include <linux/kernel_stat.h>
#include <linux/init.h>
#include <linux/seq_file.h>
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 856473792ff1..035bb3e264dc 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -66,6 +66,7 @@ extern void atari_free_irq (unsigned int irq, void *dev_id);
extern void atari_enable_irq (unsigned int);
extern void atari_disable_irq (unsigned int);
extern int show_atari_interrupts (struct seq_file *, void *);
+extern void atari_mksound( unsigned int count, unsigned int ticks );
#ifdef CONFIG_HEARTBEAT
static void atari_heartbeat( int on );
#endif
@@ -251,7 +252,7 @@ void __init config_atari(void)
conswitchp = &dummy_con;
#endif
mach_max_dma_address = 0xffffff;
-#ifdef CONFIG_INPUT_M68K_BEEP
+#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = atari_mksound;
#endif
#ifdef CONFIG_HEARTBEAT
diff --git a/arch/m68k/defconfig b/arch/m68k/defconfig
index cc9de1e98082..97fa49369faf 100644
--- a/arch/m68k/defconfig
+++ b/arch/m68k/defconfig
@@ -186,7 +186,6 @@ CONFIG_NETDEVICES=y
#
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
-CONFIG_AMIGAMOUSE=y
CONFIG_BUSMOUSE=y
CONFIG_AMIGA_BUILTIN_SERIAL=y
# CONFIG_GVPIOEXT is not set
diff --git a/arch/m68k/fpsp040/bindec.S b/arch/m68k/fpsp040/bindec.S
index 9fb65e320e55..b0ce37b74e53 100644
--- a/arch/m68k/fpsp040/bindec.S
+++ b/arch/m68k/fpsp040/bindec.S
@@ -137,7 +137,7 @@
|BINDEC idnt 2,1 | Motorola 040 Floating Point Software Package
- .include "fpsp.h"
+#include "fpsp.h"
|section 8
diff --git a/arch/m68k/fpsp040/binstr.S b/arch/m68k/fpsp040/binstr.S
index 58aa43ad05fa..b3816424d854 100644
--- a/arch/m68k/fpsp040/binstr.S
+++ b/arch/m68k/fpsp040/binstr.S
@@ -68,7 +68,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
.global binstr
binstr:
diff --git a/arch/m68k/fpsp040/bugfix.S b/arch/m68k/fpsp040/bugfix.S
index f0beee2299ee..654ed5a76446 100644
--- a/arch/m68k/fpsp040/bugfix.S
+++ b/arch/m68k/fpsp040/bugfix.S
@@ -160,7 +160,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref fpsp_fmt_error
diff --git a/arch/m68k/fpsp040/decbin.S b/arch/m68k/fpsp040/decbin.S
index d2bf1b641e12..1862d509aafb 100644
--- a/arch/m68k/fpsp040/decbin.S
+++ b/arch/m68k/fpsp040/decbin.S
@@ -77,7 +77,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|
| PTENRN, PTENRM, and PTENRP are arrays of powers of 10 rounded
diff --git a/arch/m68k/fpsp040/do_func.S b/arch/m68k/fpsp040/do_func.S
index 0a9c776f004a..3fa7087c486b 100644
--- a/arch/m68k/fpsp040/do_func.S
+++ b/arch/m68k/fpsp040/do_func.S
@@ -30,7 +30,7 @@ DO_FUNC: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref t_dz2
|xref t_operr
diff --git a/arch/m68k/fpsp040/gen_except.S b/arch/m68k/fpsp040/gen_except.S
index edd8108d02ec..628637b8b8a2 100644
--- a/arch/m68k/fpsp040/gen_except.S
+++ b/arch/m68k/fpsp040/gen_except.S
@@ -37,7 +37,7 @@ GEN_EXCEPT: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref real_trace
|xref fpsp_done
diff --git a/arch/m68k/fpsp040/get_op.S b/arch/m68k/fpsp040/get_op.S
index 480405d4ff30..63d238ca8cee 100644
--- a/arch/m68k/fpsp040/get_op.S
+++ b/arch/m68k/fpsp040/get_op.S
@@ -62,7 +62,7 @@ GET_OP: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
.global PIRN,PIRZRM,PIRP
.global SMALRN,SMALRZRM,SMALRP
diff --git a/arch/m68k/fpsp040/kernel_ex.S b/arch/m68k/fpsp040/kernel_ex.S
index 05f7e305d67d..2cc09767624b 100644
--- a/arch/m68k/fpsp040/kernel_ex.S
+++ b/arch/m68k/fpsp040/kernel_ex.S
@@ -20,7 +20,7 @@ KERNEL_EX: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
mns_inf: .long 0xffff0000,0x00000000,0x00000000
pls_inf: .long 0x7fff0000,0x00000000,0x00000000
diff --git a/arch/m68k/fpsp040/res_func.S b/arch/m68k/fpsp040/res_func.S
index 66e42d749278..95bac414f7db 100644
--- a/arch/m68k/fpsp040/res_func.S
+++ b/arch/m68k/fpsp040/res_func.S
@@ -24,7 +24,7 @@ RES_FUNC: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
sp_bnds: .short 0x3f81,0x407e
.short 0x3f6a,0x0000
diff --git a/arch/m68k/fpsp040/round.S b/arch/m68k/fpsp040/round.S
index b1030fde7ae0..abcbf86969bd 100644
--- a/arch/m68k/fpsp040/round.S
+++ b/arch/m68k/fpsp040/round.S
@@ -16,7 +16,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|
| round --- round result according to precision/mode
diff --git a/arch/m68k/fpsp040/satan.S b/arch/m68k/fpsp040/satan.S
index 282c462b08db..429b3c64a271 100644
--- a/arch/m68k/fpsp040/satan.S
+++ b/arch/m68k/fpsp040/satan.S
@@ -51,7 +51,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
BOUNDS1: .long 0x3FFB8000,0x4002FFFF
diff --git a/arch/m68k/fpsp040/scale.S b/arch/m68k/fpsp040/scale.S
index 1f01fb1d509c..f940f04931af 100644
--- a/arch/m68k/fpsp040/scale.S
+++ b/arch/m68k/fpsp040/scale.S
@@ -29,7 +29,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref t_ovfl2
|xref t_unfl
diff --git a/arch/m68k/fpsp040/setox.S b/arch/m68k/fpsp040/setox.S
index 01cf3d8dbbf7..cfb4ed4e38d7 100644
--- a/arch/m68k/fpsp040/setox.S
+++ b/arch/m68k/fpsp040/setox.S
@@ -339,7 +339,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
L2: .long 0x3FDC0000,0x82E30865,0x4361C4C6,0x00000000
diff --git a/arch/m68k/fpsp040/sgetem.S b/arch/m68k/fpsp040/sgetem.S
index 2fed3316f363..3308278f34ed 100644
--- a/arch/m68k/fpsp040/sgetem.S
+++ b/arch/m68k/fpsp040/sgetem.S
@@ -32,7 +32,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref nrm_set
diff --git a/arch/m68k/fpsp040/sint.S b/arch/m68k/fpsp040/sint.S
index 9ca3fb6c4d67..f04653e7177e 100644
--- a/arch/m68k/fpsp040/sint.S
+++ b/arch/m68k/fpsp040/sint.S
@@ -59,7 +59,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref dnrm_lp
|xref nrm_set
diff --git a/arch/m68k/fpsp040/skeleton.S b/arch/m68k/fpsp040/skeleton.S
index 9d239b3fecc0..4198b4ed4bb2 100644
--- a/arch/m68k/fpsp040/skeleton.S
+++ b/arch/m68k/fpsp040/skeleton.S
@@ -51,7 +51,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref b1238_fix
diff --git a/arch/m68k/fpsp040/slogn.S b/arch/m68k/fpsp040/slogn.S
index 20c5bae9f358..68bd283ff2da 100644
--- a/arch/m68k/fpsp040/slogn.S
+++ b/arch/m68k/fpsp040/slogn.S
@@ -71,7 +71,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
BOUNDS1: .long 0x3FFEF07D,0x3FFF8841
BOUNDS2: .long 0x3FFE8000,0x3FFFC000
diff --git a/arch/m68k/fpsp040/smovecr.S b/arch/m68k/fpsp040/smovecr.S
index 134959555a29..09b5c389a17a 100644
--- a/arch/m68k/fpsp040/smovecr.S
+++ b/arch/m68k/fpsp040/smovecr.S
@@ -23,7 +23,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref nrm_set
|xref round
diff --git a/arch/m68k/fpsp040/srem_mod.S b/arch/m68k/fpsp040/srem_mod.S
index 7db14a1d47d1..dd2b39266dc7 100644
--- a/arch/m68k/fpsp040/srem_mod.S
+++ b/arch/m68k/fpsp040/srem_mod.S
@@ -74,7 +74,7 @@ SREM_MOD: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
.set Mod_Flag,L_SCR3
.set SignY,FP_SCR3+4
diff --git a/arch/m68k/fpsp040/ssin.S b/arch/m68k/fpsp040/ssin.S
index 96e0e7141570..88629044040c 100644
--- a/arch/m68k/fpsp040/ssin.S
+++ b/arch/m68k/fpsp040/ssin.S
@@ -91,7 +91,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
BOUNDS1: .long 0x3FD78000,0x4004BC7E
TWOBYPI: .long 0x3FE45F30,0x6DC9C883
diff --git a/arch/m68k/fpsp040/stan.S b/arch/m68k/fpsp040/stan.S
index 6bd2dda6006a..e0b4daf91da3 100644
--- a/arch/m68k/fpsp040/stan.S
+++ b/arch/m68k/fpsp040/stan.S
@@ -58,7 +58,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
BOUNDS1: .long 0x3FD78000,0x4004BC7E
TWOBYPI: .long 0x3FE45F30,0x6DC9C883
diff --git a/arch/m68k/fpsp040/stanh.S b/arch/m68k/fpsp040/stanh.S
index 6af196f250dc..889915f9cd3a 100644
--- a/arch/m68k/fpsp040/stanh.S
+++ b/arch/m68k/fpsp040/stanh.S
@@ -57,7 +57,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
.set X,FP_SCR5
.set XDCARE,X+2
diff --git a/arch/m68k/fpsp040/sto_res.S b/arch/m68k/fpsp040/sto_res.S
index 6be6dd5ac72a..c3996adc3d09 100644
--- a/arch/m68k/fpsp040/sto_res.S
+++ b/arch/m68k/fpsp040/sto_res.S
@@ -28,7 +28,7 @@ STO_RES: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
.global sto_cos
sto_cos:
diff --git a/arch/m68k/fpsp040/stwotox.S b/arch/m68k/fpsp040/stwotox.S
index da06e31c1945..5d5d75d2fa71 100644
--- a/arch/m68k/fpsp040/stwotox.S
+++ b/arch/m68k/fpsp040/stwotox.S
@@ -84,7 +84,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
BOUNDS1: .long 0x3FB98000,0x400D80C0 | ... 2^(-70),16480
BOUNDS2: .long 0x3FB98000,0x400B9B07 | ... 2^(-70),16480 LOG2/LOG10
diff --git a/arch/m68k/fpsp040/util.S b/arch/m68k/fpsp040/util.S
index cc9ae013b038..009eeb15d349 100644
--- a/arch/m68k/fpsp040/util.S
+++ b/arch/m68k/fpsp040/util.S
@@ -24,7 +24,7 @@
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref mem_read
diff --git a/arch/m68k/fpsp040/x_bsun.S b/arch/m68k/fpsp040/x_bsun.S
index 42faf9bf08f6..751c98bf162b 100644
--- a/arch/m68k/fpsp040/x_bsun.S
+++ b/arch/m68k/fpsp040/x_bsun.S
@@ -21,7 +21,7 @@ X_BSUN: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref real_bsun
diff --git a/arch/m68k/fpsp040/x_fline.S b/arch/m68k/fpsp040/x_fline.S
index d8fdf3f06885..8eb55c8dc208 100644
--- a/arch/m68k/fpsp040/x_fline.S
+++ b/arch/m68k/fpsp040/x_fline.S
@@ -21,7 +21,7 @@ X_FLINE: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref real_fline
|xref fpsp_unimp
diff --git a/arch/m68k/fpsp040/x_operr.S b/arch/m68k/fpsp040/x_operr.S
index 99d1a843052b..526e6a3f10b0 100644
--- a/arch/m68k/fpsp040/x_operr.S
+++ b/arch/m68k/fpsp040/x_operr.S
@@ -51,7 +51,7 @@ X_OPERR: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref mem_write
|xref real_operr
diff --git a/arch/m68k/fpsp040/x_ovfl.S b/arch/m68k/fpsp040/x_ovfl.S
index e311508cac7d..61ab8cc00866 100644
--- a/arch/m68k/fpsp040/x_ovfl.S
+++ b/arch/m68k/fpsp040/x_ovfl.S
@@ -43,7 +43,7 @@ X_OVFL: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref ovf_r_x2
|xref ovf_r_x3
diff --git a/arch/m68k/fpsp040/x_snan.S b/arch/m68k/fpsp040/x_snan.S
index aaba75c1803d..29b966288c82 100644
--- a/arch/m68k/fpsp040/x_snan.S
+++ b/arch/m68k/fpsp040/x_snan.S
@@ -30,7 +30,7 @@ X_SNAN: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref get_fline
|xref mem_write
diff --git a/arch/m68k/fpsp040/x_store.S b/arch/m68k/fpsp040/x_store.S
index b3357fd658b5..4c407057a33a 100644
--- a/arch/m68k/fpsp040/x_store.S
+++ b/arch/m68k/fpsp040/x_store.S
@@ -22,7 +22,7 @@ X_STORE: |idnt 2,1 | Motorola 040 Floating Point Software Package
fpreg_mask:
.byte 0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01
- .include "fpsp.h"
+#include "fpsp.h"
|xref mem_write
|xref get_fline
diff --git a/arch/m68k/fpsp040/x_unfl.S b/arch/m68k/fpsp040/x_unfl.S
index f9bd1d0d6493..b64dd998361e 100644
--- a/arch/m68k/fpsp040/x_unfl.S
+++ b/arch/m68k/fpsp040/x_unfl.S
@@ -29,7 +29,7 @@ X_UNFL: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref denorm
|xref round
diff --git a/arch/m68k/fpsp040/x_unimp.S b/arch/m68k/fpsp040/x_unimp.S
index 36b0f7bbd2a6..6c561dfcf0b6 100644
--- a/arch/m68k/fpsp040/x_unimp.S
+++ b/arch/m68k/fpsp040/x_unimp.S
@@ -30,7 +30,7 @@ X_UNIMP: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref get_op
|xref do_func
diff --git a/arch/m68k/fpsp040/x_unsupp.S b/arch/m68k/fpsp040/x_unsupp.S
index 1d7b99f4412f..894b251daa98 100644
--- a/arch/m68k/fpsp040/x_unsupp.S
+++ b/arch/m68k/fpsp040/x_unsupp.S
@@ -31,7 +31,7 @@ X_UNSUPP: |idnt 2,1 | Motorola 040 Floating Point Software Package
|section 8
- .include "fpsp.h"
+#include "fpsp.h"
|xref get_op
|xref res_func
diff --git a/arch/m68k/hp300/Makefile b/arch/m68k/hp300/Makefile
index 466d5c2ede2b..a6ae4474216c 100644
--- a/arch/m68k/hp300/Makefile
+++ b/arch/m68k/hp300/Makefile
@@ -4,6 +4,4 @@
obj-y := ksyms.o config.o ints.o time.o reboot.o
-obj-$(CONFIG_VT) += hil.o
-
include $(TOPDIR)/Rules.make
diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c
index 1f09b30f0e6b..aa38ffc717ac 100644
--- a/arch/m68k/hp300/time.c
+++ b/arch/m68k/hp300/time.c
@@ -40,7 +40,7 @@ static void hp300_tick(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned long tmp;
void (*vector)(int, void *, struct pt_regs *) = dev_id;
- readb(CLOCKBASE + CLKSR);
+ in_8(CLOCKBASE + CLKSR);
asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
vector(irq, NULL, regs);
}
@@ -51,25 +51,25 @@ unsigned long hp300_gettimeoffset(void)
unsigned char lsb, msb1, msb2;
unsigned short ticks;
- msb1 = readb(CLOCKBASE + 5);
- lsb = readb(CLOCKBASE + 7);
- msb2 = readb(CLOCKBASE + 5);
+ msb1 = in_8(CLOCKBASE + 5);
+ lsb = in_8(CLOCKBASE + 7);
+ msb2 = in_8(CLOCKBASE + 5);
if (msb1 != msb2)
/* A carry happened while we were reading. Read it again */
- lsb = readb(CLOCKBASE + 7);
+ lsb = in_8(CLOCKBASE + 7);
ticks = INTVAL - ((msb2 << 8) | lsb);
return (USECS_PER_JIFFY * ticks) / INTVAL;
}
void __init hp300_sched_init(void (*vector)(int, void *, struct pt_regs *))
{
- writeb(0x1, CLOCKBASE + CLKCR2); /* select CR1 */
- writeb(0x1, CLOCKBASE + CLKCR1); /* reset */
+ out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */
+ out_8(CLOCKBASE + CLKCR1, 0x1); /* reset */
asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
sys_request_irq(6, hp300_tick, IRQ_FLG_STD, "timer tick", vector);
- writeb(0x1, CLOCKBASE + CLKCR2); /* select CR1 */
- writeb(0x40, CLOCKBASE + CLKCR1); /* enable irq */
+ out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */
+ out_8(CLOCKBASE + CLKCR1, 0x40); /* enable irq */
}
diff --git a/arch/m68k/ifpsp060/fskeleton.S b/arch/m68k/ifpsp060/fskeleton.S
index 9e206f4550ee..e1d9c032542c 100644
--- a/arch/m68k/ifpsp060/fskeleton.S
+++ b/arch/m68k/ifpsp060/fskeleton.S
@@ -340,4 +340,4 @@ _FP_CALL_TOP:
| 060 FPSP KERNEL PACKAGE NEEDS TO GO HERE!!!
- .include "fpsp.sa"
+#include "fpsp.sa"
diff --git a/arch/m68k/ifpsp060/iskeleton.S b/arch/m68k/ifpsp060/iskeleton.S
index 3a35c413efa2..6c72c14c9c73 100644
--- a/arch/m68k/ifpsp060/iskeleton.S
+++ b/arch/m68k/ifpsp060/iskeleton.S
@@ -304,4 +304,4 @@ _I_CALL_TOP:
|###########################################################################
| 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
- .include "isp.sa"
+#include "isp.sa"
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 47f3ce8b6963..c519447128fe 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -19,18 +19,19 @@ EXTRA_AFLAGS := -traditional
include $(TOPDIR)/Rules.make
-head.o: head.S m68k_defs.h
+$(obj)/head.o: $(obj)/head.S $(obj)/m68k_defs.h
-entry.o: entry.S m68k_defs.h
+$(obj)/entry.o: $(obj)/entry.S $(obj)/m68k_defs.h
-sun3-head.o: sun3-head.S m68k_defs.h
+$(obj)/sun3-head.o: $(obj)/sun3-head.S $(obj)/m68k_defs.h
-m68k_defs.h: m68k_defs.c m68k_defs.head
- rm -f m68k_defs.d
- SUNPRO_DEPENDENCIES="m68k_defs.d m68k_defs.h" \
- $(CC) $(filter-out -MD,$(CFLAGS)) -S m68k_defs.c
- cp m68k_defs.head m68k_defs.h
- grep '^#define' m68k_defs.s >> m68k_defs.h
- rm m68k_defs.s
--include m68k_defs.d
+$(obj)/m68k_defs.h: $(src)/m68k_defs.c $(src)/m68k_defs.head
+ rm -f $(obj)/m68k_defs.d
+ SUNPRO_DEPENDENCIES="$(obj)/m68k_defs.d $(obj)/m68k_defs.h" \
+ $(CC) $(filter-out -MD,$(CFLAGS)) -S $(src)/m68k_defs.c -o \
+ $(obj)/m68k_defs.s
+ cp $(src)/m68k_defs.head $(obj)/m68k_defs.h
+ grep '^#define' $(obj)/m68k_defs.s >> $(obj)/m68k_defs.h
+ rm $(obj)/m68k_defs.s
+-include $(obj)/m68k_defs.d
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 63c57787470b..6e371c61c727 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -222,7 +222,7 @@ ENTRY(nmi_handler)
inthandler:
SAVE_ALL_INT
GET_CURRENT(%d0)
- addql #1,irq_stat+CPUSTAT_LOCAL_IRQ_COUNT
+ addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2)
| put exception # in d0
bfextu %sp@(PT_VECTOR){#4,#10},%d0
@@ -241,18 +241,15 @@ inthandler:
3: addql #8,%sp | pop parameters off stack
ret_from_interrupt:
- subql #1,irq_stat+CPUSTAT_LOCAL_IRQ_COUNT
+ subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2)
jeq 1f
2:
RESTORE_ALL
1:
-#if 1
- bfextu %sp@(PT_SR){#5,#3},%d0 | Check for nested interrupt.
-#if MAX_NOINT_IPL > 0
- cmpiw #MAX_NOINT_IPL,%d0
-#endif
- jhi 2b
-#endif
+ moveq #(~ALLOWINT>>8)&0xff,%d0
+ andb %sp@(PT_SR),%d0
+ jne 2b
+
/* check if we need to do software interrupts */
tstl irq_stat+CPUSTAT_SOFTIRQ_PENDING
jeq ret_from_exception
diff --git a/arch/m68k/kernel/m68k_defs.c b/arch/m68k/kernel/m68k_defs.c
index 39e22b8cf916..55a386813236 100644
--- a/arch/m68k/kernel/m68k_defs.c
+++ b/arch/m68k/kernel/m68k_defs.c
@@ -71,8 +71,6 @@ int main(void)
/* offsets into the irq_cpustat_t struct */
DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
- DEFINE(CPUSTAT_LOCAL_IRQ_COUNT, offsetof(irq_cpustat_t, __local_irq_count));
- DEFINE(CPUSTAT_LOCAL_BH_COUNT, offsetof(irq_cpustat_t, __local_bh_count));
DEFINE(CPUSTAT_SYSCALL_COUNT, offsetof(irq_cpustat_t, __syscall_count));
/* offsets into the bi_record struct */
diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c
index 9465dcb734c7..15b76c74ba60 100644
--- a/arch/m68k/kernel/m68k_ksyms.c
+++ b/arch/m68k/kernel/m68k_ksyms.c
@@ -42,13 +42,15 @@ EXPORT_SYMBOL(cache_clear);
EXPORT_SYMBOL(mm_vtop);
EXPORT_SYMBOL(mm_ptov);
EXPORT_SYMBOL(mm_end_of_chunk);
+#else
+EXPORT_SYMBOL(m68k_memoffset);
#endif /* !CONFIG_SINGLE_MEMORY_CHUNK */
-EXPORT_SYMBOL(mm_vtop_fallback);
EXPORT_SYMBOL(__ioremap);
EXPORT_SYMBOL(iounmap);
EXPORT_SYMBOL(kernel_set_cachemode);
#endif /* !CONFIG_SUN3 */
EXPORT_SYMBOL(m68k_debug_device);
+EXPORT_SYMBOL(mach_hwclk);
EXPORT_SYMBOL(dump_fpu);
EXPORT_SYMBOL(dump_thread);
EXPORT_SYMBOL(strnlen);
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index d25f07126c64..5c50d1f142a2 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -41,7 +41,7 @@
*/
static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
-static struct signal_struct init_signals = INIT_SIGNALS;
+static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
struct mm_struct init_mm = INIT_MM(init_mm);
union thread_union init_thread_union
@@ -202,14 +202,14 @@ void flush_thread(void)
asmlinkage int m68k_fork(struct pt_regs *regs)
{
struct task_struct *p;
- p = do_fork(SIGCHLD, rdusp(), regs, 0);
+ p = do_fork(SIGCHLD, rdusp(), regs, 0, NULL);
return IS_ERR(p) ? PTR_ERR(p) : p->pid;
}
asmlinkage int m68k_vfork(struct pt_regs *regs)
{
struct task_struct *p;
- p = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0);
+ p = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL);
return IS_ERR(p) ? PTR_ERR(p) : p->pid;
}
@@ -218,13 +218,15 @@ asmlinkage int m68k_clone(struct pt_regs *regs)
unsigned long clone_flags;
unsigned long newsp;
struct task_struct *p;
+ int *user_tid;
/* syscall2 puts clone_flags in d1 and usp in d2 */
clone_flags = regs->d1;
newsp = regs->d2;
+ user_tid = (int *)regs->d3;
if (!newsp)
newsp = rdusp();
- p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, regs, 0);
+ p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, regs, 0, user_tid);
return IS_ERR(p) ? PTR_ERR(p) : p->pid;
}
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index d32a585e44c2..bf1d0ab11f52 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -98,7 +98,7 @@ EXPORT_SYMBOL(mach_heartbeat);
#ifdef CONFIG_M68K_L2_CACHE
void (*mach_l2_flush) (int) = NULL;
#endif
-#ifdef CONFIG_INPUT_M68K_BEEP
+#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
void (*mach_beep)(unsigned int, unsigned int) = NULL;
#endif
#if defined(CONFIG_ISA) && defined(MULTI_ISA)
@@ -537,11 +537,6 @@ void __init floppy_setup(char *str, int *ints)
#endif
-/* for "kbd-reset" cmdline param */
-void __init kbd_reset_setup(char *str, int *ints)
-{
-}
-
void check_bugs(void)
{
#ifndef CONFIG_M68KFPU_EMU
diff --git a/arch/m68k/kernel/sun3-head.S b/arch/m68k/kernel/sun3-head.S
index 015a53a80c4c..d8a095061dcd 100644
--- a/arch/m68k/kernel/sun3-head.S
+++ b/arch/m68k/kernel/sun3-head.S
@@ -16,9 +16,6 @@ SUN3_INVALID_PMEG = 255
.globl bootup_user_stack
.globl bootup_kernel_stack
.globl pg0
-.globl empty_bad_page
-.globl empty_bad_page_table
-.globl empty_zero_page
.globl swapper_pg_dir
.globl kernel_pmd_table
.globl availmem
@@ -27,10 +24,7 @@ SUN3_INVALID_PMEG = 255
| todo: all these should be in bss!
swapper_pg_dir: .skip 0x2000
pg0: .skip 0x2000
-empty_bad_page: .skip 0x2000
-empty_bad_page_table: .skip 0x2000
kernel_pmd_table: .skip 0x2000
-empty_zero_page: .skip 0x2000
.globl kernel_pg_dir
.equ kernel_pg_dir,kernel_pmd_table
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 54b8f68cf7e0..3365e229d40d 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -23,6 +23,7 @@
#include <asm/io.h>
#include <linux/timex.h>
+#include <linux/profile.h>
u64 jiffies_64;
@@ -70,15 +71,22 @@ static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
* called as close as possible to 500 ms before the new second starts.
*/
+ /*
+ * This code hopefully becomes obsolete in 2.5 or earlier
+ * Should it ever be reenabled it must be serialized with
+ * genrtc.c operation
+ */
+#if 0
if ((time_status & STA_UNSYNC) == 0 &&
xtime.tv_sec > last_rtc_update + 660 &&
- xtime.tv_usec >= 500000 - ((unsigned) tick) / 2 &&
- xtime.tv_usec <= 500000 + ((unsigned) tick) / 2) {
+ (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) tick) / 2 &&
+ (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) tick) / 2) {
if (set_rtc_mmss(xtime.tv_sec) == 0)
last_rtc_update = xtime.tv_sec;
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+#endif
#ifdef CONFIG_HEARTBEAT
/* use power LED as a heartbeat instead -- much more useful
for debugging -- based on the version for PReP by Cort */
@@ -115,7 +123,7 @@ void time_init(void)
time.tm_year += 100;
xtime.tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday,
time.tm_hour, time.tm_min, time.tm_sec);
- xtime.tv_usec = 0;
+ xtime.tv_nsec = 0;
}
mach_sched_init(timer_interrupt);
@@ -138,7 +146,7 @@ void do_gettimeofday(struct timeval *tv)
if (lost)
usec += lost * (1000000/HZ);
sec = xtime.tv_sec;
- usec += xtime.tv_usec;
+ usec += xtime.tv_nsec/1000;
read_unlock_irqrestore(&xtime_lock, flags);
while (usec >= 1000000) {
@@ -152,21 +160,25 @@ void do_gettimeofday(struct timeval *tv)
void do_settimeofday(struct timeval *tv)
{
+ extern unsigned long wall_jiffies;
+
write_lock_irq(&xtime_lock);
- /* This is revolting. We need to set the xtime.tv_usec
+ /* This is revolting. We need to set the xtime.tv_nsec
* correctly. However, the value in this location is
* is value at the last tick.
* Discover what correction gettimeofday
* would have done, and then undo it!
*/
tv->tv_usec -= mach_gettimeoffset();
+ tv->tv_usec -= (jiffies - wall_jiffies) * (1000000 / HZ);
while (tv->tv_usec < 0) {
tv->tv_usec += 1000000;
tv->tv_sec--;
}
- xtime = *tv;
+ xtime.tv_sec = tv->tv_sec;
+ xtime.tv_nsec = tv->tv_usec * 1000;
time_adjust = 0; /* stop active adjtime() */
time_status |= STA_UNSYNC;
time_maxerror = NTP_PHASE_LIMIT;
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index fa1aaca68883..4343116eef4e 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -881,9 +881,10 @@ void show_trace_task(struct task_struct *tsk)
show_trace((unsigned long *)tsk->thread.esp0);
}
-static void dump_stack(struct frame *fp)
+void show_registers(struct pt_regs *regs)
{
- unsigned long *stack, *endstack, addr;
+ struct frame *fp = (struct frame *)regs;
+ unsigned long addr;
int i;
addr = (unsigned long)&fp->un;
@@ -938,9 +939,22 @@ static void dump_stack(struct frame *fp)
default:
printk("\n");
}
+ show_stack((unsigned long *)addr);
+
+ printk("Code: ");
+ for (i = 0; i < 10; i++)
+ printk("%04x ", 0xffff & ((short *) fp->ptregs.pc)[i]);
+ printk ("\n");
+}
+
+extern void show_stack(unsigned long *stack)
+{
+ unsigned long *endstack;
+ int i;
- stack = (unsigned long *)addr;
- endstack = (unsigned long *)((addr + THREAD_SIZE - 1) & -THREAD_SIZE);
+ if (!stack)
+ stack = (unsigned long *)&stack;
+ endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
printk("Stack from %08lx:", (unsigned long)stack);
for (i = 0; i < kstack_depth_to_print; i++) {
@@ -951,12 +965,17 @@ static void dump_stack(struct frame *fp)
printk(" %08lx", *stack++);
}
printk("\n");
- show_trace((unsigned long *)addr);
+ show_trace(stack);
+}
- printk("Code: ");
- for (i = 0; i < 10; i++)
- printk("%04x ", 0xffff & ((short *) fp->ptregs.pc)[i]);
- printk ("\n");
+/*
+ * The architecture-independent backtrace generator
+ */
+void dump_stack(void)
+{
+ unsigned long stack;
+
+ show_trace(&stack);
}
void bad_super_trap (struct frame *fp)
@@ -1129,7 +1148,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
- dump_stack((struct frame *)fp);
+ show_stack((unsigned long *)fp);
do_exit(SIGSEGV);
}
diff --git a/arch/m68k/lib/checksum.c b/arch/m68k/lib/checksum.c
index 3699c5a3e635..fb7ba6defbc4 100644
--- a/arch/m68k/lib/checksum.c
+++ b/arch/m68k/lib/checksum.c
@@ -318,3 +318,103 @@ csum_partial_copy_from_user(const char *src, char *dst, int len,
return(sum);
}
+
+/*
+ * copy from kernel space while checksumming, otherwise like csum_partial
+ */
+
+unsigned int
+csum_partial_copy_nocheck(const char *src, char *dst, int len, int sum)
+{
+ unsigned long tmp1, tmp2;
+ __asm__("movel %2,%4\n\t"
+ "btst #1,%4\n\t" /* Check alignment */
+ "jeq 2f\n\t"
+ "subql #2,%1\n\t" /* buff%4==2: treat first word */
+ "jgt 1f\n\t"
+ "addql #2,%1\n\t" /* len was == 2, treat only rest */
+ "jra 4f\n"
+ "1:\t"
+ "movew %2@+,%4\n\t" /* add first word to sum */
+ "addw %4,%0\n\t"
+ "movew %4,%3@+\n\t"
+ "clrl %4\n\t"
+ "addxl %4,%0\n" /* add X bit */
+ "2:\t"
+ /* unrolled loop for the main part: do 8 longs at once */
+ "movel %1,%4\n\t" /* save len in tmp1 */
+ "lsrl #5,%1\n\t" /* len/32 */
+ "jeq 2f\n\t" /* not enough... */
+ "subql #1,%1\n"
+ "1:\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "dbra %1,1b\n\t"
+ "clrl %5\n\t"
+ "addxl %5,%0\n\t" /* add X bit */
+ "clrw %1\n\t"
+ "subql #1,%1\n\t"
+ "jcc 1b\n"
+ "2:\t"
+ "movel %4,%1\n\t" /* restore len from tmp1 */
+ "andw #0x1c,%4\n\t" /* number of rest longs */
+ "jeq 4f\n\t"
+ "lsrw #2,%4\n\t"
+ "subqw #1,%4\n"
+ "3:\t"
+ /* loop for rest longs */
+ "movel %2@+,%5\n\t"
+ "addxl %5,%0\n\t"
+ "movel %5,%3@+\n\t"
+ "dbra %4,3b\n\t"
+ "clrl %5\n\t"
+ "addxl %5,%0\n" /* add X bit */
+ "4:\t"
+ /* now check for rest bytes that do not fit into longs */
+ "andw #3,%1\n\t"
+ "jeq 7f\n\t"
+ "clrl %5\n\t" /* clear tmp2 for rest bytes */
+ "subqw #2,%1\n\t"
+ "jlt 5f\n\t"
+ "movew %2@+,%5\n\t" /* have rest >= 2: get word */
+ "movew %5,%3@+\n\t"
+ "swap %5\n\t" /* into bits 16..31 */
+ "tstw %1\n\t" /* another byte? */
+ "jeq 6f\n"
+ "5:\t"
+ "moveb %2@,%5\n\t" /* have odd rest: get byte */
+ "moveb %5,%3@+\n\t"
+ "lslw #8,%5\n" /* into bits 8..15; 16..31 untouched */
+ "6:\t"
+ "addl %5,%0\n\t" /* now add rest long to sum */
+ "clrl %5\n\t"
+ "addxl %5,%0\n" /* add X bit */
+ "7:\t"
+ : "=d" (sum), "=d" (len), "=a" (src), "=a" (dst),
+ "=&d" (tmp1), "=&d" (tmp2)
+ : "0" (sum), "1" (len), "2" (src), "3" (dst)
+ );
+ return(sum);
+}
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 835b557dffea..b30459aedb31 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -78,6 +78,8 @@ extern void oss_init(void);
extern void psc_init(void);
extern void baboon_init(void);
+extern void mac_mksound(unsigned int, unsigned int);
+
extern void nubus_sweep_video(void);
/* Mac specific debug functions (in debug.c) */
@@ -217,7 +219,7 @@ void __init config_mac(void)
#if 0
mach_debug_init = mac_debug_init;
#endif
-#ifdef CONFIG_INPUT_M68K_BEEP
+#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = mac_mksound;
#endif
#ifdef CONFIG_HEARTBEAT
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 09f459508f11..40938c05f60c 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -251,7 +251,7 @@ void mac_init_IRQ(void)
#endif /* SHUTUP_SONIC */
/*
- * Now register the handlers for the the master IRQ handlers
+ * Now register the handlers for the master IRQ handlers
* at levels 1-7. Most of the work is done elsewhere.
*/
diff --git a/arch/m68k/mm/Makefile b/arch/m68k/mm/Makefile
index 3ef3f97e3ae1..0dcc6d0f1e78 100644
--- a/arch/m68k/mm/Makefile
+++ b/arch/m68k/mm/Makefile
@@ -7,7 +7,7 @@ obj-y := init.o fault.o extable.o hwtest.o
ifndef CONFIG_SUN3
obj-y += kmap.o memory.o motorola.o
else
-obj-y += sun3mmu.o
+obj-y += sun3kmap.o sun3mmu.o
endif
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
index a7cbc1159574..760d71c79937 100644
--- a/arch/m68k/mm/memory.c
+++ b/arch/m68k/mm/memory.c
@@ -133,34 +133,6 @@ int free_pointer_table (pmd_t *ptable)
return 0;
}
-static unsigned long transp_transl_matches( unsigned long regval,
- unsigned long vaddr )
-{
- unsigned long base, mask;
-
- /* enabled? */
- if (!(regval & 0x8000))
- return( 0 );
-
- if (CPU_IS_030) {
- /* function code match? */
- base = (regval >> 4) & 7;
- mask = ~(regval & 7);
- if (((SUPER_DATA ^ base) & mask) != 0)
- return 0;
- }
- else {
- /* must not be user-only */
- if ((regval & 0x6000) == 0)
- return( 0 );
- }
-
- /* address match? */
- base = regval & 0xff000000;
- mask = ~(regval << 8) & 0xff000000;
- return (((unsigned long)vaddr ^ base) & mask) == 0;
-}
-
#if DEBUG_INVALID_PTOV
int mm_inv_cnt = 5;
#endif
@@ -190,134 +162,9 @@ unsigned long mm_vtop(unsigned long vaddr)
if (voff == 0)
return m68k_memory[i-1].addr + m68k_memory[i-1].size;
- return mm_vtop_fallback(vaddr);
-}
-#endif
-
-/* Separate function to make the common case faster (needs to save less
- registers) */
-unsigned long mm_vtop_fallback(unsigned long vaddr)
-{
- /* not in one of the memory chunks; test for applying transparent
- * translation */
-
- if (CPU_IS_030) {
- unsigned long ttreg;
-
- asm volatile( ".chip 68030\n\t"
- "pmove %/tt0,%0@\n\t"
- ".chip 68k"
- : : "a" (&ttreg) );
- if (transp_transl_matches( ttreg, vaddr ))
- return (unsigned long)vaddr;
- asm volatile( ".chip 68030\n\t"
- "pmove %/tt1,%0@\n\t"
- ".chip 68k"
- : : "a" (&ttreg) );
- if (transp_transl_matches( ttreg, vaddr ))
- return (unsigned long)vaddr;
- }
- else if (CPU_IS_040_OR_060) {
- unsigned long ttreg;
-
- asm volatile( ".chip 68040\n\t"
- "movec %%dtt0,%0\n\t"
- ".chip 68k"
- : "=d" (ttreg) );
- if (transp_transl_matches( ttreg, vaddr ))
- return (unsigned long)vaddr;
- asm volatile( ".chip 68040\n\t"
- "movec %%dtt1,%0\n\t"
- ".chip 68k"
- : "=d" (ttreg) );
- if (transp_transl_matches( ttreg, vaddr ))
- return (unsigned long)vaddr;
- }
-
- /* no match, too, so get the actual physical address from the MMU. */
-
- if (CPU_IS_060) {
- mm_segment_t fs = get_fs();
- unsigned long paddr;
-
- set_fs (MAKE_MM_SEG(SUPER_DATA));
-
- /* The PLPAR instruction causes an access error if the translation
- * is not possible. To catch this we use the same exception mechanism
- * as for user space accesses in <asm/uaccess.h>. */
- asm volatile (".chip 68060\n"
- "1: plpar (%0)\n"
- ".chip 68k\n"
- "2:\n"
- ".section .fixup,\"ax\"\n"
- " .even\n"
- "3: lea -1,%0\n"
- " jra 2b\n"
- ".previous\n"
- ".section __ex_table,\"a\"\n"
- " .align 4\n"
- " .long 1b,3b\n"
- ".previous"
- : "=a" (paddr)
- : "0" (vaddr));
- set_fs (fs);
-
- return paddr;
-
- } else if (CPU_IS_040) {
- unsigned long mmusr;
- mm_segment_t fs = get_fs();
-
- set_fs (MAKE_MM_SEG(SUPER_DATA));
-
- asm volatile (".chip 68040\n\t"
- "ptestr (%1)\n\t"
- "movec %%mmusr, %0\n\t"
- ".chip 68k"
- : "=r" (mmusr)
- : "a" (vaddr));
- set_fs (fs);
-
- if (mmusr & MMU_T_040) {
- return (unsigned long)vaddr; /* Transparent translation */
- }
- if (mmusr & MMU_R_040)
- return (mmusr & PAGE_MASK) | ((unsigned long)vaddr & (PAGE_SIZE-1));
-
- printk("VTOP040: bad virtual address %lx (%lx)", vaddr, mmusr);
- return -1;
- } else {
- volatile unsigned short temp;
- unsigned short mmusr;
- unsigned long *descaddr;
-
- asm volatile ("ptestr #5,%2@,#7,%0\n\t"
- "pmove %/psr,%1@"
- : "=a&" (descaddr)
- : "a" (&temp), "a" (vaddr));
- mmusr = temp;
-
- if (mmusr & (MMU_I|MMU_B|MMU_L))
- printk("VTOP030: bad virtual address %lx (%x)\n", vaddr, mmusr);
-
- descaddr = phys_to_virt((unsigned long)descaddr);
-
- switch (mmusr & MMU_NUM) {
- case 1:
- return (*descaddr & 0xfe000000) | ((unsigned long)vaddr & 0x01ffffff);
- case 2:
- return (*descaddr & 0xfffc0000) | ((unsigned long)vaddr & 0x0003ffff);
- case 3:
- return (*descaddr & PAGE_MASK) | ((unsigned long)vaddr & (PAGE_SIZE-1));
- default:
- printk("VTOP: bad levels (%u) for virtual address %lx\n",
- mmusr & MMU_NUM, vaddr);
- }
- }
-
- printk("VTOP: bad virtual address %lx\n", vaddr);
return -1;
}
+#endif
#ifndef CONFIG_SINGLE_MEMORY_CHUNK
unsigned long mm_ptov (unsigned long paddr)
@@ -343,74 +190,56 @@ unsigned long mm_ptov (unsigned long paddr)
paddr, __builtin_return_address(0));
}
#endif
- /*
- * assume that the kernel virtual address is the same as the
- * physical address.
- *
- * This should be reasonable in most situations:
- * 1) They shouldn't be dereferencing the virtual address
- * unless they are sure that it is valid from kernel space.
- * 2) The only usage I see so far is converting a page table
- * reference to some non-FASTMEM address space when freeing
- * mmaped "/dev/mem" pages. These addresses are just passed
- * to "free_page", which ignores addresses that aren't in
- * the memory list anyway.
- *
- */
-
-#ifdef CONFIG_AMIGA
- /*
- * if on an amiga and address is in first 16M, move it
- * to the ZTWO_VADDR range
- */
- if (MACH_IS_AMIGA && paddr < 16*1024*1024)
- return ZTWO_VADDR(paddr);
-#endif
return -1;
}
#endif
/* invalidate page in both caches */
-#define clear040(paddr) \
- __asm__ __volatile__ ("nop\n\t" \
- ".chip 68040\n\t" \
- "cinvp %%bc,(%0)\n\t" \
- ".chip 68k" \
- : : "a" (paddr))
+static inline void clear040(unsigned long paddr)
+{
+ asm volatile (
+ "nop\n\t"
+ ".chip 68040\n\t"
+ "cinvp %%bc,(%0)\n\t"
+ ".chip 68k"
+ : : "a" (paddr));
+}
/* invalidate page in i-cache */
-#define cleari040(paddr) \
- __asm__ __volatile__ ("nop\n\t" \
- ".chip 68040\n\t" \
- "cinvp %%ic,(%0)\n\t" \
- ".chip 68k" \
- : : "a" (paddr))
+static inline void cleari040(unsigned long paddr)
+{
+ asm volatile (
+ "nop\n\t"
+ ".chip 68040\n\t"
+ "cinvp %%ic,(%0)\n\t"
+ ".chip 68k"
+ : : "a" (paddr));
+}
/* push page in both caches */
-#define push040(paddr) \
- __asm__ __volatile__ ("nop\n\t" \
- ".chip 68040\n\t" \
- "cpushp %%bc,(%0)\n\t" \
- ".chip 68k" \
- : : "a" (paddr))
+/* RZ: cpush %bc DOES invalidate %ic, regardless of DPI */
+static inline void push040(unsigned long paddr)
+{
+ asm volatile (
+ "nop\n\t"
+ ".chip 68040\n\t"
+ "cpushp %%bc,(%0)\n\t"
+ ".chip 68k"
+ : : "a" (paddr));
+}
/* push and invalidate page in both caches, must disable ints
* to avoid invalidating valid data */
-#define pushcl040(paddr) \
- do { unsigned long flags; \
- save_flags(flags); \
- cli(); \
- push040(paddr); \
- if (CPU_IS_060) clear040(paddr); \
- restore_flags(flags); \
- } while(0)
-
-/* push page in both caches, invalidate in i-cache */
-/* RZ: cpush %bc DOES invalidate %ic, regardless of DPI */
-#define pushcli040(paddr) \
- do { push040(paddr); \
- } while(0)
+static inline void pushcl040(unsigned long paddr)
+{
+ unsigned long flags;
+ local_irq_save(flags);
+ push040(paddr);
+ if (CPU_IS_060)
+ clear040(paddr);
+ local_irq_restore(flags);
+}
/*
* 040: Hit every page containing an address in the range paddr..paddr+len-1.
@@ -504,7 +333,7 @@ void cache_push (unsigned long paddr, int len)
paddr &= PAGE_MASK;
do {
- pushcli040(paddr);
+ push040(paddr);
paddr += tmp;
} while ((len -= tmp) > 0);
}
@@ -530,12 +359,6 @@ void cache_push (unsigned long paddr, int len)
}
-#undef clear040
-#undef cleari040
-#undef push040
-#undef pushcl040
-#undef pushcli040
-
#ifndef CONFIG_SINGLE_MEMORY_CHUNK
int mm_end_of_chunk (unsigned long addr, int len)
{
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index b0887b8fdadc..a8ce74a1226a 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -196,9 +196,6 @@ map_chunk (unsigned long addr, long size)
return virtaddr;
}
-extern unsigned long empty_bad_page_table;
-extern unsigned long empty_bad_page;
-
/*
* paging_init() continues the virtual memory environment setup which
* was begun by the code in arch/head.S.
diff --git a/arch/m68k/mm/sun3kmap.c b/arch/m68k/mm/sun3kmap.c
new file mode 100644
index 000000000000..e8498b209597
--- /dev/null
+++ b/arch/m68k/mm/sun3kmap.c
@@ -0,0 +1,156 @@
+/*
+ * linux/arch/m68k/mm/sun3kmap.c
+ *
+ * Copyright (C) 2002 Sam Creasey <sammy@sammy.net>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
+
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/io.h>
+#include <asm/sun3mmu.h>
+
+#undef SUN3_KMAP_DEBUG
+
+#ifdef SUN3_KMAP_DEBUG
+extern void print_pte_vaddr(unsigned long vaddr);
+#endif
+
+extern void mmu_emu_map_pmeg (int context, int vaddr);
+
+static inline void do_page_mapin(unsigned long phys, unsigned long virt,
+ unsigned long type)
+{
+ unsigned long pte;
+ pte_t ptep;
+
+ ptep = pfn_pte(phys >> PAGE_SHIFT, PAGE_KERNEL);
+ pte = pte_val(ptep);
+ pte |= type;
+
+ sun3_put_pte(virt, pte);
+
+#ifdef SUN3_KMAP_DEBUG
+ print_pte_vaddr(virt);
+#endif
+
+}
+
+static inline void do_pmeg_mapin(unsigned long phys, unsigned long virt,
+ unsigned long type, int pages)
+{
+
+ if(sun3_get_segmap(virt & ~SUN3_PMEG_MASK) == SUN3_INVALID_PMEG)
+ mmu_emu_map_pmeg(sun3_get_context(), virt);
+
+ while(pages) {
+ do_page_mapin(phys, virt, type);
+ phys += PAGE_SIZE;
+ virt += PAGE_SIZE;
+ pages--;
+ }
+}
+
+void *sun3_ioremap(unsigned long phys, unsigned long size,
+ unsigned long type)
+{
+ struct vm_struct *area;
+ unsigned long offset, virt, ret;
+ int pages;
+
+ if(!size)
+ return NULL;
+
+ /* page align */
+ offset = phys & (PAGE_SIZE-1);
+ phys &= ~(PAGE_SIZE-1);
+
+ size += offset;
+ size = PAGE_ALIGN(size);
+ if((area = get_vm_area(size, VM_IOREMAP)) == NULL)
+ return NULL;
+
+#ifdef SUN3_KMAP_DEBUG
+ printk("ioremap: got virt %p size %lx(%lx)\n",
+ area->addr, size, area->size);
+#endif
+
+ pages = size / PAGE_SIZE;
+ virt = (unsigned long)area->addr;
+ ret = virt + offset;
+
+ while(pages) {
+ int seg_pages;
+
+ seg_pages = (SUN3_PMEG_SIZE - (virt & SUN3_PMEG_MASK)) / PAGE_SIZE;
+ if(seg_pages > pages)
+ seg_pages = pages;
+
+ do_pmeg_mapin(phys, virt, type, seg_pages);
+
+ pages -= seg_pages;
+ phys += seg_pages * PAGE_SIZE;
+ virt += seg_pages * PAGE_SIZE;
+ }
+
+ return (void *)ret;
+
+}
+
+
+void *__ioremap(unsigned long phys, unsigned long size, int cache)
+{
+
+ return sun3_ioremap(phys, size, SUN3_PAGE_TYPE_IO);
+
+}
+
+void iounmap(void *addr)
+{
+ vfree((void *)(PAGE_MASK & (unsigned long)addr));
+}
+
+/* sun3_map_test(addr, val) -- Reads a byte from addr, storing to val,
+ * trapping the potential read fault. Returns 0 if the access faulted,
+ * 1 on success.
+ *
+ * This function is primarily used to check addresses on the VME bus.
+ *
+ * Mucking with the page fault handler seems a little hackish to me, but
+ * SunOS, NetBSD, and Mach all implemented this check in such a manner,
+ * so I figure we're allowed.
+ */
+int sun3_map_test(unsigned long addr, char *val)
+{
+ int ret = 0;
+
+ __asm__ __volatile__
+ (".globl _sun3_map_test_start\n"
+ "_sun3_map_test_start:\n"
+ "1: moveb (%2), (%0)\n"
+ " moveq #1, %1\n"
+ "2:\n"
+ ".section .fixup,\"ax\"\n"
+ ".even\n"
+ "3: moveq #0, %1\n"
+ " jmp 2b\n"
+ ".previous\n"
+ ".section __ex_table,\"a\"\n"
+ ".align 4\n"
+ ".long 1b,3b\n"
+ ".previous\n"
+ ".globl _sun3_map_test_end\n"
+ "_sun3_map_test_end:\n"
+ : "=a"(val), "=r"(ret)
+ : "a"(addr));
+
+ return ret;
+}
diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
index e0a82c31a4ec..dd3411170472 100644
--- a/arch/m68k/mm/sun3mmu.c
+++ b/arch/m68k/mm/sun3mmu.c
@@ -33,8 +33,6 @@ extern void mmu_emu_init (unsigned long bootmem_end);
const char bad_pmd_string[] = "Bad pmd in pte_alloc: %08lx\n";
-extern unsigned long empty_bad_page_table;
-extern unsigned long empty_bad_page;
extern unsigned long num_pages;
void free_initmem(void)
@@ -59,8 +57,8 @@ void __init paging_init(void)
#ifdef TEST_VERIFY_AREA
wp_works_ok = 0;
#endif
- empty_zero_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
- memset((void *)empty_zero_page, 0, PAGE_SIZE);
+ empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
+ memset(empty_zero_page, 0, PAGE_SIZE);
address = PAGE_OFFSET;
pg_dir = swapper_pg_dir;
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index 9221299b08bd..25c324c036f4 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -181,11 +181,6 @@ int mvme147_set_clock_mmss (unsigned long nowtime)
return 0;
}
-int mvme147_keyb_init (void)
-{
- return 0;
-}
-
/*------------------- Serial console stuff ------------------------*/
static void scc_delay (void)
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index e05e9614d6ad..eed9bed584f7 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -59,6 +59,8 @@ void q40_halt(void);
extern void q40_waitbut(void);
void q40_set_vectors (void);
+extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/ );
+
extern char *saved_command_line;
extern char m68k_debug_device[];
static void q40_mem_console_write(struct console *co, const char *b,
@@ -181,7 +183,7 @@ void __init config_q40(void)
mach_get_model = q40_get_model;
mach_get_hardware_list = q40_get_hardware_list;
-#ifdef CONFIG_INPUT_M68K_BEEP
+#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = q40_mksound;
#endif
#ifdef CONFIG_HEARTBEAT
diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
index 1fe6de7ddd9d..54fe9303cbd4 100644
--- a/arch/m68k/q40/q40ints.c
+++ b/arch/m68k/q40/q40ints.c
@@ -204,8 +204,9 @@ void q40_process_int (int level, struct pt_regs *fp)
* this stuff doesn't really belong here..
*/
-int ql_ticks=0; /* 200Hz ticks since last jiffie */
-static int sound_ticks=0;
+int ql_ticks; /* 200Hz ticks since last jiffie */
+static int sound_ticks;
+short q40rtc_oldsecs;
#define SVOL 45
@@ -242,9 +243,9 @@ static void q40_timer_int (int irq, void * dev, struct pt_regs * regs)
*DAC_RIGHT=sval;
}
#if defined(CONFIG_Q40RTC) || defined(CONFIG_GEN_RTC)
- if (gen_rtc_irq_ctrl && (q40rtc_oldsecs != RTC_SECS))
+ if (gen_rtc_irq_ctrl && (q40rtc_oldsecs != Q40_RTC_SECS))
{
- q40rtc_oldsecs = RTC_SECS;
+ q40rtc_oldsecs = Q40_RTC_SECS;
gen_rtc_irq_flags = RTC_UIE;
gen_rtc_interrupt(0);
}
diff --git a/arch/m68k/sun3/Makefile b/arch/m68k/sun3/Makefile
index 9eacdffafa8c..5e356bb09709 100644
--- a/arch/m68k/sun3/Makefile
+++ b/arch/m68k/sun3/Makefile
@@ -4,9 +4,9 @@
export-objs := sun3_ksyms.o
-obj-y := sun3_ksyms.o sun3ints.o sun3dvma.o sbus.o
+obj-y := sun3_ksyms.o sun3ints.o sun3dvma.o sbus.o idprom.o
-obj-$(CONFIG_SUN3) += config.o idprom.o mmu_emu.o leds.o dvma.o \
+obj-$(CONFIG_SUN3) += config.o mmu_emu.o leds.o dvma.o \
intersil.o
include $(TOPDIR)/Rules.make
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 06335706419a..3aaa166f5612 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -151,9 +151,6 @@ void __init config_sun3(void)
mach_default_handler = &sun3_default_handler;
mach_request_irq = sun3_request_irq;
mach_free_irq = sun3_free_irq;
-#ifdef CONFIG_VT
-// mach_keyb_init = sun3_keyb_init;
-#endif
enable_irq = sun3_enable_irq;
disable_irq = sun3_disable_irq;
mach_process_int = sun3_process_int;
diff --git a/arch/m68k/sun3/idprom.c b/arch/m68k/sun3/idprom.c
index 3b2c99d45644..b1dafface551 100644
--- a/arch/m68k/sun3/idprom.c
+++ b/arch/m68k/sun3/idprom.c
@@ -31,8 +31,8 @@ struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
{ "Sun 3/60", (SM_SUN3 | SM_3_60) },
{ "Sun 3/E", (SM_SUN3 | SM_3_E) },
/* Now, Sun3x's */
-{ "Sun 3/460 Series", (SM_SUN3 | SM_3_460) },
-{ "Sun 3/80", (SM_SUN3 | SM_3_80) },
+{ "Sun 3/460 Series", (SM_SUN3X | SM_3_460) },
+{ "Sun 3/80", (SM_SUN3X | SM_3_80) },
/* Then, Sun4's */
//{ "Sun 4/100 Series", (SM_SUN4 | SM_4_110) },
//{ "Sun 4/200 Series", (SM_SUN4 | SM_4_260) },
diff --git a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c
index 81ff083a3465..1015f247ae7e 100644
--- a/arch/m68k/sun3/intersil.c
+++ b/arch/m68k/sun3/intersil.c
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/rtc.h>
+#include <asm/errno.h>
#include <asm/system.h>
#include <asm/semaphore.h>
#include <asm/rtc.h>
diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index 4e41b6e712fa..1a94a66910a9 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -52,7 +52,8 @@ unsigned char pmeg_ctx[PMEGS_NUM];
/* pointers to the mm structs for each task in each
context. 0xffffffff is a marker for kernel context */
-struct mm_struct *ctx_alloc[CONTEXTS_NUM] = {0xffffffff, 0, 0, 0, 0, 0, 0, 0};
+struct mm_struct *ctx_alloc[CONTEXTS_NUM] = {(struct mm_struct *)0xffffffff,
+ 0, 0, 0, 0, 0, 0, 0};
/* has this context been mmdrop'd? */
static unsigned char ctx_avail = CONTEXTS_NUM-1;
@@ -176,7 +177,6 @@ void mmu_emu_init(unsigned long bootmem_end)
pmeg_alloc[sun3_get_segmap(seg)] = 2;
}
}
-
dvma_init();
@@ -275,7 +275,7 @@ unsigned long get_free_context(struct mm_struct *mm)
//todo: better allocation scheme? but is extra complexity worthwhile?
//todo: only clear old entries if necessary? how to tell?
-static inline void mmu_emu_map_pmeg (int context, int vaddr)
+inline void mmu_emu_map_pmeg (int context, int vaddr)
{
static unsigned char curr_pmeg = 128;
int i;
diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c
index c291b75452e1..a14b1c0d5b11 100644
--- a/arch/m68k/sun3/sun3dvma.c
+++ b/arch/m68k/sun3/sun3dvma.c
@@ -14,6 +14,8 @@
#include <asm/pgtable.h>
#include <asm/dvma.h>
+#undef DVMA_DEBUG
+
#ifdef CONFIG_SUN3X
extern void dvma_unmap_iommu(unsigned long baddr, int len);
#else
@@ -22,6 +24,10 @@ static inline void dvma_unmap_iommu(unsigned long a, int b)
}
#endif
+#ifdef CONFIG_SUN3
+extern void sun3_dvma_init(void);
+#endif
+
unsigned long iommu_use[IOMMU_TOTAL_ENTRIES];
#define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT)
@@ -39,6 +45,60 @@ static struct list_head hole_list;
static struct list_head hole_cache;
static struct hole initholes[64];
+#ifdef DVMA_DEBUG
+
+static unsigned long dvma_allocs = 0;
+static unsigned long dvma_frees = 0;
+static unsigned long long dvma_alloc_bytes = 0;
+static unsigned long long dvma_free_bytes = 0;
+
+static void print_use(void)
+{
+
+ int i;
+ int j = 0;
+
+ printk("dvma entry usage:\n");
+
+ for(i = 0; i < IOMMU_TOTAL_ENTRIES; i++) {
+ if(!iommu_use[i])
+ continue;
+
+ j++;
+
+ printk("dvma entry: %08lx len %08lx\n",
+ ( i << DVMA_PAGE_SHIFT) + DVMA_START,
+ iommu_use[i]);
+ }
+
+ printk("%d entries in use total\n", j);
+
+ printk("allocation/free calls: %lu/%lu\n", dvma_allocs, dvma_frees);
+ printk("allocation/free bytes: %Lx/%Lx\n", dvma_alloc_bytes,
+ dvma_free_bytes);
+}
+
+static void print_holes(struct list_head *holes)
+{
+
+ struct list_head *cur;
+ struct hole *hole;
+
+ printk("listing dvma holes\n");
+ list_for_each(cur, holes) {
+ hole = list_entry(cur, struct hole, list);
+
+ if((hole->start == 0) && (hole->end == 0) && (hole->size == 0))
+ continue;
+
+ printk("hole: start %08lx end %08lx size %08lx\n", hole->start, hole->end, hole->size);
+ }
+
+ printk("end of hole listing...\n");
+
+}
+#endif DVMA_DEBUG
+
static inline int refill(void)
{
@@ -93,7 +153,11 @@ static inline unsigned long get_baddr(int len, unsigned long align)
struct hole *hole;
if(list_empty(&hole_list)) {
- printk("out of dvma holes!\n");
+#ifdef DVMA_DEBUG
+ printk("out of dvma holes! (printing hole cache)\n");
+ print_holes(&hole_cache);
+ print_use();
+#endif
BUG();
}
@@ -111,11 +175,19 @@ static inline unsigned long get_baddr(int len, unsigned long align)
hole->end -= newlen;
hole->size -= newlen;
dvma_entry_use(hole->end) = newlen;
+#ifdef DVMA_DEBUG
+ dvma_allocs++;
+ dvma_alloc_bytes += newlen;
+#endif
return hole->end;
} else if(hole->size == newlen) {
list_del(&(hole->list));
list_add(&(hole->list), &hole_cache);
dvma_entry_use(hole->start) = newlen;
+#ifdef DVMA_DEBUG
+ dvma_allocs++;
+ dvma_alloc_bytes += newlen;
+#endif
return hole->start;
}
@@ -140,6 +212,11 @@ static inline int free_baddr(unsigned long baddr)
baddr &= DVMA_PAGE_MASK;
dvma_unmap_iommu(baddr, len);
+#ifdef DVMA_DEBUG
+ dvma_frees++;
+ dvma_free_bytes += len;
+#endif
+
list_for_each(cur, &hole_list) {
hole = list_entry(cur, struct hole, list);
@@ -240,8 +317,14 @@ inline unsigned long dvma_map_align(unsigned long kaddr, int len, int align)
void dvma_unmap(void *baddr)
{
-
- free_baddr((unsigned long)baddr);
+ unsigned long addr;
+
+ addr = (unsigned long)baddr;
+ /* check if this is a vme mapping */
+ if(!(addr & 0x00f00000))
+ addr |= 0xf00000;
+
+ free_baddr(addr);
return;
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index c81842f461ee..99a129fb59f6 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -18,6 +18,7 @@
#include <linux/seq_file.h>
extern void sun3_leds (unsigned char);
+static void sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp);
void sun3_disable_interrupts(void)
{
@@ -63,11 +64,6 @@ inline void sun3_do_irq(int irq, struct pt_regs *fp)
*sun3_intreg |= (1<<irq);
}
-int show_sun3_interrupts(struct seq_file *p, void *v)
-{
- return 0;
-}
-
static void sun3_int7(int irq, void *dev_id, struct pt_regs *fp)
{
sun3_do_irq(irq,fp);
@@ -95,13 +91,38 @@ static void sun3_int5(int irq, void *dev_id, struct pt_regs *fp)
/* handle requested ints, excepting 5 and 7, which always do the same
thing */
+void (*sun3_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = {
+ sun3_inthandle, sun3_inthandle, sun3_inthandle, sun3_inthandle,
+ sun3_inthandle, sun3_int5, sun3_inthandle, sun3_int7
+};
+
+static const char *dev_names[SYS_IRQS] = { NULL, NULL, NULL, NULL,
+ NULL, "timer", NULL, "int7 handler" };
static void *dev_ids[SYS_IRQS];
static void (*sun3_inthandler[SYS_IRQS])(int, void *, struct pt_regs *) = {
NULL, NULL, NULL, NULL, NULL, sun3_int5, NULL, sun3_int7
};
-static void (*sun3_vechandler[192])(int, void *, struct pt_regs *);
-static void *vec_ids[192];
-static char *vec_names[192];
+static void (*sun3_vechandler[SUN3_INT_VECS])(int, void *, struct pt_regs *);
+static void *vec_ids[SUN3_INT_VECS];
+static const char *vec_names[SUN3_INT_VECS];
+static int vec_ints[SUN3_INT_VECS];
+
+
+int show_sun3_interrupts(struct seq_file *p, void *v)
+{
+ int i;
+
+ for(i = 0; i < (SUN3_INT_VECS-1); i++) {
+ if(sun3_vechandler[i] != NULL) {
+ seq_printf(p, "vec %3d: %10u %s\n", i+64,
+ vec_ints[i],
+ (vec_names[i]) ? vec_names[i] :
+ "sun3_vechandler");
+ }
+ }
+
+ return 0;
+}
static void sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp)
{
@@ -119,14 +140,6 @@ static void sun3_vec255(int irq, void *dev_id, struct pt_regs *fp)
// intersil_clear();
}
-void (*sun3_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = {
- sun3_inthandle, sun3_inthandle, sun3_inthandle, sun3_inthandle,
- sun3_inthandle, sun3_int5, sun3_inthandle, sun3_int7
-};
-
-static char *dev_names[SYS_IRQS] = { NULL, NULL, NULL, NULL,
- NULL, "timer", NULL, NULL };
-
void sun3_init_IRQ(void)
{
int i;
@@ -177,6 +190,7 @@ int sun3_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_re
sun3_vechandler[vec] = handler;
vec_ids[vec] = dev_id;
vec_names[vec] = devname;
+ vec_ints[vec] = 0;
return 0;
}
@@ -223,7 +237,8 @@ void sun3_process_int(int irq, struct pt_regs *regs)
vec = irq - 64;
if(sun3_vechandler[vec] == NULL)
panic ("bad interrupt vector %d received\n",irq);
-
+
+ vec_ints[vec]++;
sun3_vechandler[vec](irq, vec_ids[vec], regs);
return;
} else {
diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
index 4addab9b6dfe..25ab5d9c085a 100644
--- a/arch/m68k/sun3x/config.c
+++ b/arch/m68k/sun3x/config.c
@@ -17,37 +17,30 @@
#include <asm/sun3xprom.h>
#include <asm/sun3ints.h>
#include <asm/setup.h>
+#include <asm/oplib.h>
#include "time.h"
volatile char *clock_va;
extern volatile unsigned char *sun3_intreg;
+extern void sun3_get_model(char *model);
-int __init sun3x_keyb_init(void)
-{
- return 0;
-}
-
-int sun3x_kbdrate(struct kbd_repeat *r)
-{
- return 0;
-}
-
-void sun3x_kbd_leds(unsigned int i)
+void sun3_leds(unsigned int i)
{
}
-void sun3_leds(unsigned int i)
+static int sun3x_get_hardware_list(char *buffer)
{
+
+ int len = 0;
-}
+ len += sprintf(buffer + len, "PROM Revision:\t%s\n",
+ romvec->pv_monid);
+
+ return len;
-/* should probably detect types of these eventually. */
-static void sun3x_get_model(char *model)
-{
- sprintf(model, "Sun3x");
}
/*
@@ -61,12 +54,6 @@ void __init config_sun3x(void)
mach_get_irq_list = show_sun3_interrupts;
mach_max_dma_address = 0xffffffff; /* we can DMA anywhere, whee */
-#ifdef CONFIG_VT
- mach_keyb_init = sun3x_keyb_init;
- mach_kbdrate = sun3x_kbdrate;
- mach_kbd_leds = sun3x_kbd_leds;
-#endif
-
mach_default_handler = &sun3_default_handler;
mach_sched_init = sun3x_sched_init;
mach_init_IRQ = sun3_init_IRQ;
diff --git a/arch/m68k/sun3x/prom.c b/arch/m68k/sun3x/prom.c
index 8baa5ab56ede..d738e0536a34 100644
--- a/arch/m68k/sun3x/prom.c
+++ b/arch/m68k/sun3x/prom.c
@@ -26,8 +26,6 @@ int (*sun3x_mayget)(void);
int (*sun3x_mayput)(int);
void (*sun3x_prom_reboot)(void);
e_vector sun3x_prom_abort;
-struct idprom *idprom;
-static struct idprom idprom_buffer;
struct linux_romvec *romvec;
/* prom vector table */
@@ -107,8 +105,6 @@ static struct console sun3x_debug = {
void sun3x_prom_init(void)
{
/* Read the vector table */
- int i;
-
sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR);
sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR);
@@ -118,13 +114,11 @@ void sun3x_prom_init(void)
sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT);
romvec = (struct linux_romvec *)SUN3X_PROM_BASE;
- /* make a copy of the idprom structure */
- for(i = 0; i < sizeof(struct idprom); i++)
- ((unsigned char *)(&idprom_buffer))[i] = ((unsigned char *)SUN3X_IDPROM)[i];
- idprom = &idprom_buffer;
+ idprom_init();
- if((idprom->id_machtype & SM_ARCH_MASK) != SM_SUN3X) {
- printk("Warning: machine reports strange type %02x\n");
+ if(!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
+ printk("Warning: machine reports strange type %02x\n",
+ idprom->id_machtype);
printk("Pretending it's a 3/80, but very afraid...\n");
idprom->id_machtype = SM_SUN3X | SM_3_80;
}
@@ -162,3 +156,19 @@ void prom_halt (void)
{
sun3x_halt();
}
+
+/* Get the idprom and stuff it into buffer 'idbuf'. Returns the
+ * format type. 'num_bytes' is the number of bytes that your idbuf
+ * has space for. Returns 0xff on error.
+ */
+unsigned char
+prom_get_idprom(char *idbuf, int num_bytes)
+{
+ int i;
+
+ /* make a copy of the idprom structure */
+ for(i = 0; i < num_bytes; i++)
+ idbuf[i] = ((char *)SUN3X_IDPROM)[i];
+
+ return idbuf[0];
+}
diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
index bd896d462b91..b72f3c2eb65d 100644
--- a/arch/m68k/sun3x/time.c
+++ b/arch/m68k/sun3x/time.c
@@ -79,6 +79,7 @@ unsigned long sun3x_gettimeoffset (void)
return 0L;
}
+#if 0
static void sun3x_timer_tick(int irq, void *dev_id, struct pt_regs *regs)
{
void (*vector)(int, void *, struct pt_regs *) = dev_id;
@@ -89,6 +90,7 @@ static void sun3x_timer_tick(int irq, void *dev_id, struct pt_regs *regs)
vector(irq, NULL, regs);
}
+#endif
void __init sun3x_sched_init(void (*vector)(int, void *, struct pt_regs *))
{
diff --git a/arch/m68k/vmlinux-std.lds b/arch/m68k/vmlinux-std.lds
index c8348f4d22a0..c0ac0012d92d 100644
--- a/arch/m68k/vmlinux-std.lds
+++ b/arch/m68k/vmlinux-std.lds
@@ -38,13 +38,14 @@ SECTIONS
_edata = .; /* End of data section */
+ /* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .text.init : { *(.text.init) }
- .data.init : { *(.data.init) }
+ .init.text : { *(.init.text) }
+ .init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
- .setup.init : { *(.setup.init) }
+ .init.setup : { *(.init.setup) }
__setup_end = .;
__initcall_start = .;
.initcall.init : {
@@ -60,10 +61,17 @@ SECTIONS
. = ALIGN(8192);
__init_end = .;
- init_task : { *(init_task) } /* The initial task and kernel stack */
+ .data.init_task : { *(.data.init_task) } /* The initial task and kernel stack */
_end = . ;
+ /* Sections to be discarded */
+ /DISCARD/ : {
+ *(.exit.text)
+ *(.exit.data)
+ *(.exitcall.exit)
+ }
+
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
diff --git a/arch/m68k/vmlinux-sun3.lds b/arch/m68k/vmlinux-sun3.lds
index 339641da5167..83aa0185079c 100644
--- a/arch/m68k/vmlinux-sun3.lds
+++ b/arch/m68k/vmlinux-sun3.lds
@@ -34,13 +34,14 @@ SECTIONS
/* End of data goes *here* so that freeing init code works properly. */
_edata = .;
+ /* will be freed after init */
. = ALIGN(8192); /* Init code and data */
__init_begin = .;
- .text.init : { *(.text.init) }
- .data.init : { *(.data.init) }
+ .init.text : { *(.init.text) }
+ .init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
- .setup.init : { *(.setup.init) }
+ .init.setup : { *(.init.setup) }
__setup_end = .;
__initcall_start = .;
.initcall.init : {
@@ -62,6 +63,13 @@ __init_begin = .;
_end = . ;
+ /* Sections to be discarded */
+ /DISCARD/ : {
+ *(.exit.text)
+ *(.exit.data)
+ *(.exitcall.exit)
+ }
+
.crap : {
/* Stabs debugging sections. */
*(.stab)
diff --git a/arch/ppc/configs/apus_defconfig b/arch/ppc/configs/apus_defconfig
index 8e615afae6f0..1dbe55052415 100644
--- a/arch/ppc/configs/apus_defconfig
+++ b/arch/ppc/configs/apus_defconfig
@@ -73,7 +73,6 @@ CONFIG_GEN_RTC=y
CONFIG_FB_CONSOLE=y
CONFIG_AMIGA=y
CONFIG_ZORRO=y
-CONFIG_AMIGAMOUSE=y
CONFIG_ABSTRACT_CONSOLE=y
CONFIG_FB=y
CONFIG_MOUSE=y
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index bb0c81ecddaa..7134c2c7534b 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -295,7 +295,7 @@ z2_open( struct inode *inode, struct file *filp )
current_device = device;
z2ram_size <<= Z2RAM_CHUNKSHIFT;
- set_capacity(z2ram_gendisk, z2ram_size >> 9;
+ set_capacity(z2ram_gendisk, z2ram_size >> 9);
}
return 0;
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 7dfa2d4850b7..2a148fecfc4a 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -57,7 +57,6 @@ obj-$(CONFIG_DTLK) += dtlk.o
obj-$(CONFIG_R3964) += n_r3964.o
obj-$(CONFIG_APPLICOM) += applicom.o
obj-$(CONFIG_SONYPI) += sonypi.o
-obj-$(CONFIG_ATARIMOUSE) += atarimouse.o
obj-$(CONFIG_RTC) += rtc.o
obj-$(CONFIG_GEN_RTC) += genrtc.o
obj-$(CONFIG_EFI_RTC) += efirtc.o
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 5a666f9a27b4..79ac0284783e 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -2054,8 +2054,8 @@ static inline int line_info(char *buf, struct serial_state *state)
return ret;
}
-int rs_read_proc(char *page, char **start, off_t off, int count,
- int *eof, void *data)
+static int rs_read_proc(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
{
int len = 0, l;
off_t begin = 0;
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 44ea3a167771..da7a0fd6e480 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -98,6 +98,8 @@
#define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
#define CHECK_DRIVER_INIT() (MACH_IS_ATARI && ATARIHW_PRESENT(TT_CLK))
+#define NVRAM_BYTES 50
+
/* On Ataris, the checksum is over all bytes except the checksum bytes
* themselves; these are at the very end */
#define ATARI_CKS_RANGE_START 0
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index d6ec963cba6b..70db6da59545 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -171,7 +171,7 @@ u8 ide_rate_filter (u8 mode, u8 speed)
BUG();
return min(speed, speed_max[mode]);
#else /* !CONFIG_BLK_DEV_IDEDMA */
- return min(speed, XFER_PIO_4);
+ return min(speed, (u8)XFER_PIO_4);
#endif /* CONFIG_BLK_DEV_IDEDMA */
}
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 45b9961e7b87..5abec452b8d5 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -181,13 +181,13 @@ spinlock_t ide_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
-#if defined(__mc68000__) || defined(CONFIG_APUS)
+#ifdef IDE_ARCH_LOCK
/*
* ide_lock is used by the Atari code to obtain access to the IDE interrupt,
* which is shared between several drivers.
*/
static int ide_intr_lock;
-#endif /* __mc68000__ || CONFIG_APUS */
+#endif /* IDE_ARCH_LOCK */
#ifdef CONFIG_IDEDMA_AUTO
int noautodma = 0;
@@ -1092,7 +1092,7 @@ void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
*/
/* for atari only */
- ide_release_lock(&ide_lock);
+ ide_release_lock(&ide_intr_lock);
hwgroup->busy = 0;
}
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
index a2e56f54b74e..d0a5b7617fd3 100644
--- a/drivers/input/keyboard/amikbd.c
+++ b/drivers/input/keyboard/amikbd.c
@@ -112,7 +112,7 @@ static int __init amikbd_init(void)
if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
return -EBUSY;
- init_input_dev(&amibkd_dev);
+ init_input_dev(&amikbd_dev);
amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
amikbd_dev.keycode = amikbd_keycode;
diff --git a/drivers/macintosh/mac_keyb.c b/drivers/macintosh/mac_keyb.c
index bddf7dc09678..e8573e12c575 100644
--- a/drivers/macintosh/mac_keyb.c
+++ b/drivers/macintosh/mac_keyb.c
@@ -247,14 +247,6 @@ static void init_turbomouse(int id);
static void init_microspeed(int id);
static void init_ms_a3(int id);
-#ifdef CONFIG_ADBMOUSE
-/* XXX: Hook for mouse driver */
-void (*adb_mouse_interrupt_hook)(unsigned char *, int);
-int adb_emulate_buttons = 0;
-int adb_button2_keycode = 0x7d; /* right control key */
-int adb_button3_keycode = 0x7c; /* right option key */
-#endif
-
extern struct kbd_struct kbd_table[];
extern void handle_scancode(unsigned char, int);
@@ -342,38 +334,6 @@ input_keycode(int keycode, int repeat)
if (!repeat)
del_timer(&repeat_timer);
-#ifdef CONFIG_ADBMOUSE
- /*
- * XXX: Add mouse button 2+3 fake codes here if mouse open.
- * Keep track of 'button' states here as we only send
- * single up/down events!
- * Really messy; might need to check if keyboard is in
- * VC_RAW mode.
- * Might also want to know how many buttons need to be emulated.
- * -> hide this as function in arch/m68k/mac ?
- */
- if (adb_emulate_buttons
- && (keycode == adb_button2_keycode
- || keycode == adb_button3_keycode)
- && (adb_mouse_interrupt_hook || console_loglevel == 10)) {
- int button;
- /* faked ADB packet */
- static unsigned char data[4] = { 0, 0x80, 0x80, 0x80 };
-
- button = keycode == adb_button2_keycode? 2: 3;
- if (data[button] != up_flag) {
- /* send a fake mouse packet */
- data[button] = up_flag;
- if (console_loglevel >= 8)
- printk("fake mouse event: %x %x %x\n",
- data[1], data[2], data[3]);
- if (adb_mouse_interrupt_hook)
- adb_mouse_interrupt_hook(data, 4);
- }
- return;
- }
-#endif /* CONFIG_ADBMOUSE */
-
if (kbd->kbdmode != VC_RAW) {
if (!up_flag && !dont_repeat[keycode]) {
last_keycode = keycode;
@@ -428,163 +388,6 @@ static void mac_put_queue(int ch)
}
}
-#ifdef CONFIG_ADBMOUSE
-static void
-mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll)
-{
- /* [ACA:23-Mar-97] Three button mouse support. This is designed to
- function with MkLinux DR-2.1 style X servers. It only works with
- three-button mice that conform to Apple's multi-button mouse
- protocol. */
-
- /*
- The X server for MkLinux DR2.1 uses the following unused keycodes to
- read the mouse:
-
- 0x7e This indicates that the next two keycodes should be interpreted
- as mouse information. The first following byte's high bit
- represents the state of the left button. The lower seven bits
- represent the x-axis acceleration. The lower seven bits of the
- second byte represent y-axis acceleration.
-
- 0x3f The x server interprets this keycode as a middle button
- release.
-
- 0xbf The x server interprets this keycode as a middle button
- depress.
-
- 0x40 The x server interprets this keycode as a right button
- release.
-
- 0xc0 The x server interprets this keycode as a right button
- depress.
-
- NOTES: There should be a better way of handling mice in the X server.
- The MOUSE_ESCAPE code (0x7e) should be followed by three bytes instead
- of two. The three mouse buttons should then, in the X server, be read
- as the high-bits of all three bytes. The x and y motions can still be
- in the first two bytes. Maybe I'll do this...
- */
-
- /*
- Handler 1 -- 100cpi original Apple mouse protocol.
- Handler 2 -- 200cpi original Apple mouse protocol.
-
- For Apple's standard one-button mouse protocol the data array will
- contain the following values:
-
- BITS COMMENTS
- data[0] = dddd 1100 ADB command: Talk, register 0, for device dddd.
- data[1] = bxxx xxxx First button and x-axis motion.
- data[2] = byyy yyyy Second button and y-axis motion.
-
- Handler 4 -- Apple Extended mouse protocol.
-
- For Apple's 3-button mouse protocol the data array will contain the
- following values:
-
- BITS COMMENTS
- data[0] = dddd 1100 ADB command: Talk, register 0, for device dddd.
- data[1] = bxxx xxxx Left button and x-axis motion.
- data[2] = byyy yyyy Second button and y-axis motion.
- data[3] = byyy bxxx Third button and fourth button. Y is additional
- high bits of y-axis motion. XY is additional
- high bits of x-axis motion.
-
- MacAlly 2-button mouse protocol.
-
- For MacAlly 2-button mouse protocol the data array will contain the
- following values:
-
- BITS COMMENTS
- data[0] = dddd 1100 ADB command: Talk, register 0, for device dddd.
- data[1] = bxxx xxxx Left button and x-axis motion.
- data[2] = byyy yyyy Right button and y-axis motion.
- data[3] = ???? ???? unknown
- data[4] = ???? ???? unknown
-
- */
- struct kbd_struct *kbd;
-
- /* If it's a trackpad, we alias the second button to the first.
- NOTE: Apple sends an ADB flush command to the trackpad when
- the first (the real) button is released. We could do
- this here using async flush requests.
- */
- switch (adb_mouse_kinds[(data[0]>>4) & 0xf])
- {
- case ADBMOUSE_TRACKPAD:
- data[1] = (data[1] & 0x7f) | ((data[1] & data[2]) & 0x80);
- data[2] = data[2] | 0x80;
- break;
- case ADBMOUSE_MICROSPEED:
- data[1] = (data[1] & 0x7f) | ((data[3] & 0x01) << 7);
- data[2] = (data[2] & 0x7f) | ((data[3] & 0x02) << 6);
- data[3] = (data[3] & 0x77) | ((data[3] & 0x04) << 5)
- | (data[3] & 0x08);
- break;
- case ADBMOUSE_TRACKBALLPRO:
- data[1] = (data[1] & 0x7f) | (((data[3] & 0x04) << 5)
- & ((data[3] & 0x08) << 4));
- data[2] = (data[2] & 0x7f) | ((data[3] & 0x01) << 7);
- data[3] = (data[3] & 0x77) | ((data[3] & 0x02) << 6);
- break;
- case ADBMOUSE_MS_A3:
- data[1] = (data[1] & 0x7f) | ((data[3] & 0x01) << 7);
- data[2] = (data[2] & 0x7f) | ((data[3] & 0x02) << 6);
- data[3] = ((data[3] & 0x04) << 5);
- break;
- case ADBMOUSE_MACALLY2:
- data[3] = (data[2] & 0x80) ? 0x80 : 0x00;
- data[2] |= 0x80; /* Right button is mapped as button 3 */
- nb=4;
- break;
- }
-
- if (adb_mouse_interrupt_hook)
- adb_mouse_interrupt_hook(data, nb);
-
- kbd = kbd_table + fg_console;
-
- /* Only send mouse codes when keyboard is in raw mode. */
- if (kbd->kbdmode == VC_RAW) {
- static unsigned char uch_ButtonStateSecond = 0x80;
- unsigned char uchButtonSecond;
-
- /* Send first button, second button and movement. */
- mac_put_queue(0x7e);
- mac_put_queue(data[1]);
- mac_put_queue(data[2]);
-
- /* [ACA: Are there any two-button ADB mice that use handler 1 or 2?] */
-
- /* Store the button state. */
- uchButtonSecond = (data[2] & 0x80);
-
- /* Send second button. */
- if (uchButtonSecond != uch_ButtonStateSecond) {
- mac_put_queue(0x3f | uchButtonSecond);
- uch_ButtonStateSecond = uchButtonSecond;
- }
-
- /* Macintosh 3-button mouse (handler 4). */
- if (nb >= 4) {
- static unsigned char uch_ButtonStateThird = 0x80;
- unsigned char uchButtonThird;
-
- /* Store the button state for speed. */
- uchButtonThird = (data[3] & 0x80);
-
- /* Send third button. */
- if (uchButtonThird != uch_ButtonStateThird) {
- mac_put_queue(0x40 | uchButtonThird);
- uch_ButtonStateThird = uchButtonThird;
- }
- }
- }
-}
-#endif /* CONFIG_ADBMOUSE */
-
static void
buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll)
{
@@ -708,11 +511,6 @@ void __init mackbd_init_hw(void)
memcpy(key_maps[8], macalt_map, sizeof(plain_map));
memcpy(key_maps[12], macctrl_alt_map, sizeof(plain_map));
-#ifdef CONFIG_ADBMOUSE
- /* initialize mouse interrupt hook */
- adb_mouse_interrupt_hook = NULL;
-#endif
-
led_request.complete = 1;
mackeyb_probe();
@@ -752,10 +550,6 @@ mackeyb_probe(void)
struct adb_request req;
int i;
-#ifdef CONFIG_ADBMOUSE
- adb_register(ADB_MOUSE, 0, &mouse_ids, mouse_input);
-#endif /* CONFIG_ADBMOUSE */
-
adb_register(ADB_KEYBOARD, 0, &keyboard_ids, keyboard_input);
adb_register(0x07, 0x1F, &buttons_ids, buttons_input);
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 824d64092271..ab84ceb3d1be 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -76,7 +76,7 @@ obj-$(CONFIG_NET) += Space.o setup.o net_init.o loopback.o
obj-$(CONFIG_SEEQ8005) += seeq8005.o
obj-$(CONFIG_ETHERTAP) += ethertap.o
obj-$(CONFIG_NET_SB1000) += sb1000.o
-obj-$(CONFIG_MAC8390) += daynaport.o 8390.o
+obj-$(CONFIG_MAC8390) += mac8390.o 8390.o
obj-$(CONFIG_APNE) += apne.o 8390.o
obj-$(CONFIG_PCMCIA_PCNET) += 8390.o
obj-$(CONFIG_SHAPER) += shaper.o
diff --git a/drivers/net/daynaport.c b/drivers/net/daynaport.c
deleted file mode 100644
index 01975e7c5a74..000000000000
--- a/drivers/net/daynaport.c
+++ /dev/null
@@ -1,922 +0,0 @@
-/* daynaport.c: A Macintosh 8390 based ethernet driver for linux. */
-/*
- Derived from code:
-
- Written 1993-94 by Donald Becker.
-
- Copyright 1993 United States Government as represented by the
- Director, National Security Agency.
-
- This software may be used and distributed according to the terms
- of the GNU General Public License, incorporated herein by reference.
-
- TODO:
-
- The block output routines may be wrong for non Dayna
- cards
-
- Fix this driver so that it will attempt to use the info
- (i.e. iobase, iosize) given to it by the new and improved
- NuBus code.
-
- Despite its misleading filename, this driver is not Dayna-specific
- anymore. */
-/* Cabletron E6100 card support added by Tony Mantler (eek@escape.ca) April 1999 */
-
-static const char *version =
- "daynaport.c: v0.02 1999-05-17 Alan Cox (Alan.Cox@linux.org) and others\n";
-static int version_printed;
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/nubus.h>
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/hwtest.h>
-#include <asm/macints.h>
-#include <linux/delay.h>
-
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include "8390.h"
-
-static int ns8390_probe1(struct net_device *dev, int word16, char *name, int id,
- int prom, struct nubus_dev *ndev);
-
-static int ns8390_open(struct net_device *dev);
-static void ns8390_no_reset(struct net_device *dev);
-static int ns8390_close_card(struct net_device *dev);
-
-/* Interlan */
-static void interlan_reset(struct net_device *dev);
-
-/* Dayna */
-static void dayna_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
- int ring_page);
-static void dayna_block_input(struct net_device *dev, int count,
- struct sk_buff *skb, int ring_offset);
-static void dayna_block_output(struct net_device *dev, int count,
- const unsigned char *buf, const int start_page);
-
-/* Sane (32-bit chunk memory read/write) */
-static void sane_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
- int ring_page);
-static void sane_block_input(struct net_device *dev, int count,
- struct sk_buff *skb, int ring_offset);
-static void sane_block_output(struct net_device *dev, int count,
- const unsigned char *buf, const int start_page);
-
-/* Slow Sane (16-bit chunk memory read/write) */
-static void slow_sane_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
- int ring_page);
-static void slow_sane_block_input(struct net_device *dev, int count,
- struct sk_buff *skb, int ring_offset);
-static void slow_sane_block_output(struct net_device *dev, int count,
- const unsigned char *buf, const int start_page);
-
-
-#define WD_START_PG 0x00 /* First page of TX buffer */
-#define WD03_STOP_PG 0x20 /* Last page +1 of RX ring */
-#define WD13_STOP_PG 0x40 /* Last page +1 of RX ring */
-
-#define CABLETRON_RX_START_PG 0x00 /* First page of RX buffer */
-#define CABLETRON_RX_STOP_PG 0x30 /* Last page +1 of RX ring */
-#define CABLETRON_TX_START_PG CABLETRON_RX_STOP_PG /* First page of TX buffer */
-
-
-#define DAYNA_MAC_BASE 0xf0007
-#define DAYNA_8390_BASE 0x80000 /* 3 */
-#define DAYNA_8390_MEM 0x00000
-#define DAYNA_MEMSIZE 0x04000 /* First word of each long ! */
-
-#define APPLE_8390_BASE 0xE0000
-#define APPLE_8390_MEM 0xD0000
-#define APPLE_MEMSIZE 8192 /* FIXME: need to dynamically check */
-
-#define KINETICS_MAC_BASE 0xf0004 /* first byte of each long */
-#define KINETICS_8390_BASE 0x80000
-#define KINETICS_8390_MEM 0x00000 /* first word of each long */
-#define KINETICS_MEMSIZE 8192 /* FIXME: need to dynamically check */
-/*#define KINETICS_MEMSIZE (0x10000/2) * CSA: on the board I have, at least */
-
-#define CABLETRON_8390_BASE 0x90000
-#define CABLETRON_8390_MEM 0x00000
-
-static int test_8390(volatile char *ptr, int scale)
-{
- int regd;
- int v;
-
- if(hwreg_present(&ptr[0x00])==0)
- return -EIO;
- if(hwreg_present(&ptr[0x0D<<scale])==0)
- return -EIO;
- if(hwreg_present(&ptr[0x0D<<scale])==0)
- return -EIO;
- ptr[0x00]=E8390_NODMA+E8390_PAGE1+E8390_STOP;
- regd=ptr[0x0D<<scale];
- ptr[0x0D<<scale]=0xFF;
- ptr[0x00]=E8390_NODMA+E8390_PAGE0;
- v=ptr[0x0D<<scale];
- if(ptr[0x0D<<scale]!=0)
- {
- ptr[0x0D<<scale]=regd;
- return -ENODEV;
- }
-/* printk("NS8390 found at %p scaled %d\n", ptr,scale);*/
- return 0;
-}
-/*
- * Identify the species of NS8390 card/driver we need
- */
-
-enum mac8390_type {
- NS8390_DAYNA,
- NS8390_INTERLAN,
- NS8390_KINETICS,
- NS8390_APPLE,
- NS8390_FARALLON,
- NS8390_ASANTE,
- NS8390_CABLETRON
-};
-
-static int __init ns8390_ident(struct nubus_dev* ndev)
-{
- /* This really needs to be tested and tested hard. */
-
- /* Summary of what we know so far --
- * SW: 0x0104 -- asante, 16 bit, back4_offsets
- * SW: 0x010b -- daynaport, 16 bit, fwrd4_offsets
- * SW: 0x010c -- farallon, 16 bit, back4_offsets, no long word access
- * SW: 0x011a -- focus, [no details yet]
- * SW: ?????? -- interlan, 16 bit, back4_offsets, funny reset
- * SW: ?????? -- kinetics, 8 bit, back4_offsets
- * -- so i've this hypothesis going that says DrSW&1 says whether the
- * map is forward or backwards -- and maybe DrSW&256 says what the
- * register spacing is -- for all cards that report a DrSW in some
- * range.
- * This would allow the "apple compatible" driver to drive many
- * seemingly different types of cards. More DrSW info is needed
- * to investigate this properly. [CSA, 21-May-1999]
- */
- /* Dayna ex Kinetics board */
- if(ndev->dr_sw == NUBUS_DRSW_DAYNA)
- return NS8390_DAYNA;
- if(ndev->dr_sw == NUBUS_DRSW_ASANTE)
- return NS8390_ASANTE;
- if(ndev->dr_sw == NUBUS_DRSW_FARALLON) /* farallon or sonic systems */
- return NS8390_FARALLON;
- if(ndev->dr_sw == NUBUS_DRSW_KINETICS)
- return NS8390_KINETICS;
- /* My ATI Engineering card with this combination crashes the */
- /* driver trying to xmit packets. Best not touch it for now. */
- /* - 1999-05-20 (funaho@jurai.org) */
- if(ndev->dr_sw == NUBUS_DRSW_FOCUS)
- return -1;
-
- /* Check the HW on this one, because it shares the same DrSW as
- the on-board SONIC chips */
- if(ndev->dr_hw == NUBUS_DRHW_CABLETRON)
- return NS8390_CABLETRON;
- /* does anyone have one of these? */
- if(ndev->dr_hw == NUBUS_DRHW_INTERLAN)
- return NS8390_INTERLAN;
-
- /* FIXME: what do genuine Apple boards look like? */
- return -1;
-}
-
-/*
- * Memory probe for 8390 cards
- */
-
-static int __init apple_8390_mem_probe(volatile unsigned short *p)
-{
- int i, j;
- /*
- * Algorithm.
- * 1. Check each block size of memory doesn't fault
- * 2. Write a value to it
- * 3. Check all previous blocks are unaffected
- */
-
- for(i=0;i<2;i++)
- {
- volatile unsigned short *m=p+4096*i;
- /* Unwriteable - we have a fully decoded card and the
- RAM end located */
-
- if(hwreg_present(m)==0)
- return 8192*i;
-
- *m=0xA5A0|i;
-
- for(j=0;j<i;j++)
- {
- /* Partial decode and wrap ? */
- if(p[4096*j]!=(0xA5A0|j))
- {
- /* This is the first misdecode, so it had
- one less page than we tried */
- return 8192*i;
- }
- j++;
- }
- /* Ok it still decodes.. move on 8K */
- }
- /*
- * We don't look past 16K. That should cover most cards
- * and above 16K there isnt really any gain.
- */
- return 16384;
- }
-
-/*
- * Probe for 8390 cards.
- * The ns8390_probe1() routine initializes the card and fills the
- * station address field.
- *
- * The NuBus interface has changed! We now scan for these somewhat
- * like how the PCI and Zorro drivers do. It's not clear whether
- * this is actually better, but it makes things more consistent.
- *
- * dev->mem_start points
- * at the memory ring, dev->mem_end gives the end of it.
- */
-
-int __init mac8390_probe(struct net_device *dev)
-{
- static int slots;
- volatile unsigned short *i;
- volatile unsigned char *p;
- int plen;
- int id;
- static struct nubus_dev* ndev;
-
- /* Find the first card that hasn't already been seen */
- while ((ndev = nubus_find_type(NUBUS_CAT_NETWORK,
- NUBUS_TYPE_ETHERNET, ndev)) != NULL) {
- /* Have we seen it already? */
- if (slots & (1<<ndev->board->slot))
- continue;
- slots |= 1<<ndev->board->slot;
-
- /* Is it one of ours? */
- if ((id = ns8390_ident(ndev)) != -1)
- break;
- }
-
- /* Hm. No more cards, then */
- if (ndev == NULL)
- return -ENODEV;
-
- dev = init_etherdev(dev, 0);
- if (!dev)
- return -ENOMEM;
- SET_MODULE_OWNER(dev);
-
- if (!version_printed) {
- printk(KERN_INFO "%s", version);
- version_printed = 1;
- }
-
- /*
- * Dayna specific init
- */
- if(id==NS8390_DAYNA)
- {
- dev->base_addr = (int)(ndev->board->slot_addr+DAYNA_8390_BASE);
- dev->mem_start = (int)(ndev->board->slot_addr+DAYNA_8390_MEM);
- dev->mem_end = dev->mem_start+DAYNA_MEMSIZE; /* 8K it seems */
-
- printk(KERN_INFO "%s: daynaport. testing board: ", dev->name);
-
- printk("memory - ");
-
- i = (void *)dev->mem_start;
- memset((void *)i,0xAA, DAYNA_MEMSIZE);
- while(i<(volatile unsigned short *)dev->mem_end)
- {
- if(*i!=0xAAAA)
- goto membad;
- *i=0x5678; /* make sure we catch byte smearing */
- if(*i!=0x5678)
- goto membad;
- i+=2; /* Skip a word */
- }
-
- printk("controller - ");
-
- p=(void *)dev->base_addr;
- plen=0;
-
- while(plen<0x3FF00)
- {
- if(test_8390(p,0)==0)
- break;
- if(test_8390(p,1)==0)
- break;
- if(test_8390(p,2)==0)
- break;
- if(test_8390(p,3)==0)
- break;
- plen++;
- p++;
- }
- if(plen==0x3FF00)
- goto membad;
- printk("OK\n");
- dev->irq = SLOT2IRQ(ndev->board->slot);
- if(ns8390_probe1(dev, 0, "dayna", id, -1, ndev)==0)
- return 0;
- }
- /* Cabletron */
- if (id==NS8390_CABLETRON) {
- int memsize = 16<<10; /* fix this */
-
- dev->base_addr=(int)(ndev->board->slot_addr+CABLETRON_8390_BASE);
- dev->mem_start=(int)(ndev->board->slot_addr+CABLETRON_8390_MEM);
- dev->mem_end=dev->mem_start+memsize;
- dev->irq = SLOT2IRQ(ndev->board->slot);
-
- /* The base address is unreadable if 0x00 has been written to the command register */
- /* Reset the chip by writing E8390_NODMA+E8390_PAGE0+E8390_STOP just to be sure */
- i = (void *)dev->base_addr;
- *i = 0x21;
-
- printk(KERN_INFO "%s: cabletron: testing board: ", dev->name);
- printk("%dK memory - ", memsize>>10);
- i=(void *)dev->mem_start;
- while(i<(volatile unsigned short *)(dev->mem_start+memsize))
- {
- *i=0xAAAA;
- if(*i!=0xAAAA)
- goto membad;
- *i=0x5555;
- if(*i!=0x5555)
- goto membad;
- i+=2; /* Skip a word */
- }
- printk("OK\n");
-
- if(ns8390_probe1(dev, 1, "cabletron", id, -1, ndev)==0)
- return 0;
- }
- /* Apple, Farallon, Asante */
- if(id==NS8390_APPLE || id==NS8390_FARALLON || id==NS8390_ASANTE)
- {
- int memsize;
-
- dev->base_addr=(int)(ndev->board->slot_addr+APPLE_8390_BASE);
- dev->mem_start=(int)(ndev->board->slot_addr+APPLE_8390_MEM);
-
- memsize = apple_8390_mem_probe((void *)dev->mem_start);
-
- dev->mem_end=dev->mem_start+memsize;
- dev->irq = SLOT2IRQ(ndev->board->slot);
-
- switch(id)
- {
- case NS8390_FARALLON:
- printk(KERN_INFO "%s: farallon: testing board: ", dev->name);
- break;
- case NS8390_ASANTE:
- printk(KERN_INFO "%s: asante: testing board: ", dev->name);
- break;
- case NS8390_APPLE:
- default:
- printk(KERN_INFO "%s: apple/clone: testing board: ", dev->name);
- break;
- }
-
- printk("%dK memory - ", memsize>>10);
-
- i=(void *)dev->mem_start;
- memset((void *)i,0xAA, memsize);
- while(i<(volatile unsigned short *)dev->mem_end)
- {
- if(*i!=0xAAAA)
- goto membad;
- *i=0x5555;
- if(*i!=0x5555)
- goto membad;
- i+=2; /* Skip a word */
- }
- printk("OK\n");
-
- switch (id)
- {
- case NS8390_FARALLON:
- if(ns8390_probe1(dev, 1, "farallon", id, -1, ndev)==0)
- return 0;
- break;
- case NS8390_ASANTE:
- if(ns8390_probe1(dev, 1, "asante", id, -1, ndev)==0)
- return 0;
- break;
- case NS8390_APPLE:
- default:
- if(ns8390_probe1(dev, 1, "apple/clone", id, -1, ndev)==0)
- return 0;
- break;
- }
- }
- /* Interlan */
- if(id==NS8390_INTERLAN)
- {
- /* As apple and asante */
- dev->base_addr=(int)(ndev->board->slot_addr+APPLE_8390_BASE);
- dev->mem_start=(int)(ndev->board->slot_addr+APPLE_8390_MEM);
- dev->mem_end=dev->mem_start+APPLE_MEMSIZE; /* 8K it seems */
- dev->irq = SLOT2IRQ(ndev->board->slot);
- if(ns8390_probe1(dev, 1, "interlan", id, -1, ndev)==0)
- return 0;
- }
- /* Kinetics (Shiva Etherport) */
- if(id==NS8390_KINETICS)
- {
- dev->base_addr=(int)(ndev->board->slot_addr+KINETICS_8390_BASE);
- dev->mem_start=(int)(ndev->board->slot_addr+KINETICS_8390_MEM);
- dev->mem_end=dev->mem_start+KINETICS_MEMSIZE; /* 8K it seems */
- dev->irq = SLOT2IRQ(ndev->board->slot);
- if(ns8390_probe1(dev, 0, "kinetics", id, -1, ndev)==0)
- return 0;
- }
-
- /* We should hopefully not get here */
- printk(KERN_ERR "Probe unsuccessful.\n");
- return -ENODEV;
-
- membad:
- printk(KERN_ERR "failed at %p in %p - %p.\n", i,
- (void *)dev->mem_start, (void *)dev->mem_end);
- return -ENODEV;
-}
-
-static int __init mac8390_ethernet_addr(struct nubus_dev* ndev, unsigned char addr[6])
-{
- struct nubus_dir dir;
- struct nubus_dirent ent;
-
- /* Get the functional resource for this device */
- if (nubus_get_func_dir(ndev, &dir) == -1)
- return -1;
- if (nubus_find_rsrc(&dir, NUBUS_RESID_MAC_ADDRESS, &ent) == -1)
- return -1;
-
- nubus_get_rsrc_mem(addr, &ent, 6);
- return 0;
-}
-
-static int __init ns8390_probe1(struct net_device *dev, int word16, char *model_name,
- int type, int promoff, struct nubus_dev *ndev)
-{
- static u32 fwrd4_offsets[16]={
- 0, 4, 8, 12,
- 16, 20, 24, 28,
- 32, 36, 40, 44,
- 48, 52, 56, 60
- };
- static u32 back4_offsets[16]={
- 60, 56, 52, 48,
- 44, 40, 36, 32,
- 28, 24, 20, 16,
- 12, 8, 4, 0
- };
- static u32 fwrd2_offsets[16]={
- 0, 2, 4, 6,
- 8, 10, 12, 14,
- 16, 18, 20, 22,
- 24, 26, 28, 30
- };
-
- unsigned char *prom = (unsigned char*) ndev->board->slot_addr + promoff;
-
- /* Allocate dev->priv and fill in 8390 specific dev fields. */
- if (ethdev_init(dev))
- {
- printk ("%s: unable to get memory for dev->priv.\n", dev->name);
- return -ENOMEM;
- }
-
- /* OK, we are certain this is going to work. Setup the device. */
-
- ei_status.name = model_name;
- ei_status.word16 = word16;
-
- if (type==NS8390_CABLETRON) {
- /* Cabletron card puts the RX buffer before the TX buffer */
- ei_status.tx_start_page = CABLETRON_TX_START_PG;
- ei_status.rx_start_page = CABLETRON_RX_START_PG;
- ei_status.stop_page = CABLETRON_RX_STOP_PG;
- ei_status.rmem_start = dev->mem_start;
- ei_status.rmem_end = dev->mem_start + CABLETRON_RX_STOP_PG*256;
- } else {
- ei_status.tx_start_page = WD_START_PG;
- ei_status.rx_start_page = WD_START_PG + TX_PAGES;
- ei_status.stop_page = (dev->mem_end - dev->mem_start)/256;
- ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
- ei_status.rmem_end = dev->mem_end;
- }
-
- if(promoff==-1) /* Use nubus resources ? */
- {
- if(mac8390_ethernet_addr(ndev, dev->dev_addr))
- {
- printk("mac_ns8390: MAC address not in resources!\n");
- return -ENODEV;
- }
- }
- else /* Pull it off the card */
- {
- int i=0;
- int x=1;
- /* These should go in the end I hope */
- if(type==NS8390_DAYNA)
- x=2;
- if(type==NS8390_INTERLAN || type==NS8390_KINETICS)
- x=4;
- while(i<6)
- {
- dev->dev_addr[i]=*prom;
- prom+=x;
- if(i)
- printk(":");
- printk("%02X",dev->dev_addr[i++]);
- }
- }
-
- printk(KERN_INFO "%s: %s in slot %X (type %s)\n",
- dev->name, ndev->board->name, ndev->board->slot, model_name);
- printk(KERN_INFO "MAC ");
- {
- int i;
- for (i = 0; i < 6; i++) {
- printk("%2.2x", dev->dev_addr[i]);
- if (i < 5)
- printk(":");
- }
- }
- printk(" IRQ %d, shared memory at %#lx-%#lx.\n",
- dev->irq, dev->mem_start, dev->mem_end-1);
-
- switch(type)
- {
- case NS8390_DAYNA: /* Dayna card */
- case NS8390_KINETICS: /* Kinetics -- 8 bit config, but 16 bit mem */
- /* 16 bit, 4 word offsets */
- ei_status.reset_8390 = &ns8390_no_reset;
- ei_status.block_input = &dayna_block_input;
- ei_status.block_output = &dayna_block_output;
- ei_status.get_8390_hdr = &dayna_get_8390_hdr;
- ei_status.reg_offset = fwrd4_offsets;
- break;
- case NS8390_CABLETRON: /* Cabletron */
- /* 16 bit card, register map is short forward */
- ei_status.reset_8390 = &ns8390_no_reset;
- /* Ctron card won't accept 32bit values read or written to it */
- ei_status.block_input = &slow_sane_block_input;
- ei_status.block_output = &slow_sane_block_output;
- ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
- ei_status.reg_offset = fwrd2_offsets;
- break;
- case NS8390_FARALLON:
- case NS8390_APPLE: /* Apple/Asante/Farallon */
- /* 16 bit card, register map is reversed */
- ei_status.reset_8390 = &ns8390_no_reset;
- ei_status.block_input = &slow_sane_block_input;
- ei_status.block_output = &slow_sane_block_output;
- ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
- ei_status.reg_offset = back4_offsets;
- break;
- case NS8390_ASANTE:
- /* 16 bit card, register map is reversed */
- ei_status.reset_8390 = &ns8390_no_reset;
- ei_status.block_input = &sane_block_input;
- ei_status.block_output = &sane_block_output;
- ei_status.get_8390_hdr = &sane_get_8390_hdr;
- ei_status.reg_offset = back4_offsets;
- break;
- case NS8390_INTERLAN: /* Interlan */
- /* 16 bit card, map is forward */
- ei_status.reset_8390 = &interlan_reset;
- ei_status.block_input = &sane_block_input;
- ei_status.block_output = &sane_block_output;
- ei_status.get_8390_hdr = &sane_get_8390_hdr;
- ei_status.reg_offset = back4_offsets;
- break;
-#if 0 /* i think this suffered code rot. my kinetics card has much
- * different settings. -- CSA [22-May-1999] */
- case NS8390_KINETICS: /* Kinetics */
- /* 8bit card, map is forward */
- ei_status.reset_8390 = &ns8390_no_reset;
- ei_status.block_input = &sane_block_input;
- ei_status.block_output = &sane_block_output;
- ei_status.get_8390_hdr = &sane_get_8390_hdr;
- ei_status.reg_offset = back4_offsets;
- break;
-#endif
- default:
- panic("Detected a card I can't drive - whoops\n");
- }
- dev->open = &ns8390_open;
- dev->stop = &ns8390_close_card;
-
- NS8390_init(dev, 0);
-
- return 0;
-}
-
-static int ns8390_open(struct net_device *dev)
-{
- int ret;
-
- ei_open(dev);
-
- /* At least on my card (a Focus Enhancements PDS card) I start */
- /* getting interrupts right away, so the driver needs to be */
- /* completely initialized before enabling the interrupt. */
- /* - funaho@jurai.org (1999-05-17) */
-
- /* Non-slow interrupt, works around issues with the SONIC driver */
- ret = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev);
- if (ret) {
- printk ("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
- return ret;
- }
- return 0;
-}
-
-static void ns8390_no_reset(struct net_device *dev)
-{
- if (ei_debug > 1)
- printk("Need to reset the NS8390 t=%lu...", jiffies);
- ei_status.txing = 0;
- if (ei_debug > 1) printk("reset not supported\n");
-}
-
-static int ns8390_close_card(struct net_device *dev)
-{
- if (ei_debug > 1)
- printk("%s: Shutting down ethercard.\n", dev->name);
- free_irq(dev->irq, dev);
- ei_close(dev);
- return 0;
-}
-
-/*
- * Interlan Specific Code Starts Here
- */
-
-static void interlan_reset(struct net_device *dev)
-{
- unsigned char *target=nubus_slot_addr(IRQ2SLOT(dev->irq));
- if (ei_debug > 1)
- printk("Need to reset the NS8390 t=%lu...", jiffies);
- ei_status.txing = 0;
- /* This write resets the card */
- target[0xC0000]=0;
- if (ei_debug > 1) printk("reset complete\n");
- return;
-}
-
-/*
- * Daynaport code (some is used by other drivers)
- */
-
-
-/* Grab the 8390 specific header. Similar to the block_input routine, but
- we don't need to be concerned with ring wrap as the header will be at
- the start of a page, so we optimize accordingly. */
-
-
-/* Block input and output are easy on shared memory ethercards, and trivial
- on the Daynaport card where there is no choice of how to do it.
- The only complications are that the ring buffer wraps.
-*/
-
-static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count)
-{
- volatile unsigned short *ptr;
- unsigned short *target=to;
- from<<=1; /* word, skip overhead */
- ptr=(unsigned short *)(dev->mem_start+from);
- /*
- * Leading byte?
- */
- if (from&2) {
- *((char *)target)++ = *(((char *)ptr++)-1);
- count--;
- }
- while(count>=2)
- {
- *target++=*ptr++; /* Copy and */
- ptr++; /* skip cruft */
- count-=2;
- }
- /*
- * Trailing byte ?
- */
- if(count)
- {
- /* Big endian */
- unsigned short v=*ptr;
- *((char *)target)=v>>8;
- }
-}
-
-static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count)
-{
- volatile unsigned short *ptr;
- const unsigned short *src=from;
- to<<=1; /* word, skip overhead */
- ptr=(unsigned short *)(dev->mem_start+to);
- /*
- * Leading byte?
- */
- if (to&2) { /* avoid a byte write (stomps on other data) */
- ptr[-1] = (ptr[-1]&0xFF00)|*((unsigned char *)src)++;
- ptr++;
- count--;
- }
- while(count>=2)
- {
- *ptr++=*src++; /* Copy and */
- ptr++; /* skip cruft */
- count-=2;
- }
- /*
- * Trailing byte ?
- */
- if(count)
- {
- /* Big endian */
- unsigned short v=*src;
- /* card doesn't like byte writes */
- *ptr=(*ptr&0x00FF)|(v&0xFF00);
- }
-}
-
-static void dayna_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
-{
- unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
- dayna_memcpy_fromcard(dev, (void *)hdr, hdr_start, 4);
- /* Register endianism - fix here rather than 8390.c */
- hdr->count=(hdr->count&0xFF)<<8|(hdr->count>>8);
-}
-
-static void dayna_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
-{
- unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
- unsigned long xfer_start = xfer_base+dev->mem_start;
-
- /*
- * Note the offset maths is done in card memory space which
- * is word per long onto our space.
- */
-
- if (xfer_start + count > ei_status.rmem_end)
- {
- /* We must wrap the input move. */
- int semi_count = ei_status.rmem_end - xfer_start;
- dayna_memcpy_fromcard(dev, skb->data, xfer_base, semi_count);
- count -= semi_count;
- dayna_memcpy_fromcard(dev, skb->data + semi_count,
- ei_status.rmem_start - dev->mem_start, count);
- }
- else
- {
- dayna_memcpy_fromcard(dev, skb->data, xfer_base, count);
- }
-}
-
-static void dayna_block_output(struct net_device *dev, int count, const unsigned char *buf,
- int start_page)
-{
- long shmem = (start_page - WD_START_PG)<<8;
-
- dayna_memcpy_tocard(dev, shmem, buf, count);
-}
-
-/*
- * Cards with full width memory
- */
-
-
-static void sane_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
-{
- unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
- memcpy((void *)hdr, (char *)dev->mem_start+hdr_start, 4);
- /* Register endianism - fix here rather than 8390.c */
- hdr->count=(hdr->count&0xFF)<<8|(hdr->count>>8);
-}
-
-static void sane_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
-{
- unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
- unsigned long xfer_start = xfer_base+dev->mem_start;
-
- if (xfer_start + count > ei_status.rmem_end)
- {
- /* We must wrap the input move. */
- int semi_count = ei_status.rmem_end - xfer_start;
- memcpy(skb->data, (char *)dev->mem_start+xfer_base, semi_count);
- count -= semi_count;
- memcpy(skb->data + semi_count,
- (char *)ei_status.rmem_start, count);
- }
- else
- {
- memcpy(skb->data, (char *)dev->mem_start+xfer_base, count);
- }
-}
-
-
-static void sane_block_output(struct net_device *dev, int count, const unsigned char *buf,
- int start_page)
-{
- long shmem = (start_page - WD_START_PG)<<8;
-
- memcpy((char *)dev->mem_start+shmem, buf, count);
-}
-
-static void word_memcpy_tocard(void *tp, const void *fp, int count)
-{
- volatile unsigned short *to = tp;
- const unsigned short *from = fp;
-
- count++;
- count/=2;
-
- while(count--)
- *to++=*from++;
-}
-
-static void word_memcpy_fromcard(void *tp, const void *fp, int count)
-{
- unsigned short *to = tp;
- const volatile unsigned short *from = fp;
-
- count++;
- count/=2;
-
- while(count--)
- *to++=*from++;
-}
-
-static void slow_sane_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
-{
- unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
- word_memcpy_fromcard((void *)hdr, (char *)dev->mem_start+hdr_start, 4);
- /* Register endianism - fix here rather than 8390.c */
- hdr->count=(hdr->count&0xFF)<<8|(hdr->count>>8);
-}
-
-static void slow_sane_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
-{
- unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
- unsigned long xfer_start = xfer_base+dev->mem_start;
-
- if (xfer_start + count > ei_status.rmem_end)
- {
- /* We must wrap the input move. */
- int semi_count = ei_status.rmem_end - xfer_start;
- word_memcpy_fromcard(skb->data, (char *)dev->mem_start+xfer_base, semi_count);
- count -= semi_count;
- word_memcpy_fromcard(skb->data + semi_count,
- (char *)ei_status.rmem_start, count);
- }
- else
- {
- word_memcpy_fromcard(skb->data, (char *)dev->mem_start+xfer_base, count);
- }
-}
-
-static void slow_sane_block_output(struct net_device *dev, int count, const unsigned char *buf,
- int start_page)
-{
- long shmem = (start_page - WD_START_PG)<<8;
-
- word_memcpy_tocard((char *)dev->mem_start+shmem, buf, count);
-#if 0
- long shmem = (start_page - WD_START_PG)<<8;
- volatile unsigned short *to=(unsigned short *)(dev->mem_start+shmem);
- volatile int p;
- unsigned short *bp=(unsigned short *)buf;
-
- count=(count+1)/2;
-
- while(count--)
- {
- *to++=*bp++;
- for(p=0;p<10;p++)
- p++;
- }
-#endif
-}
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c
new file mode 100644
index 000000000000..0608cb442a37
--- /dev/null
+++ b/drivers/net/mac8390.c
@@ -0,0 +1,752 @@
+/* mac8390.c: New driver for 8390-based Nubus (or Nubus-alike)
+ Ethernet cards on Linux */
+/* Based on the former daynaport.c driver, by Alan Cox. Some code
+ taken from or inspired by skeleton.c by Donald Becker, acenic.c by
+ Jes Sorensen, and ne2k-pci.c by Donald Becker and Paul Gortmaker.
+
+ This software may be used and distributed according to the terms of
+ the GNU Public License, incorporated herein by reference. */
+
+/* 2000-02-28: support added for Dayna and Kinetics cards by
+ A.G.deWijn@phys.uu.nl */
+/* 2000-04-04: support added for Dayna2 by bart@etpmod.phys.tue.nl */
+/* 2001-04-18: support for DaynaPort E/LC-M by rayk@knightsmanor.org */
+/* 2001-05-15: support for Cabletron ported from old daynaport driver
+ * and fixed access to Sonic Sys card which masquerades as a Farallon
+ * by rayk@knightsmanor.org */
+
+#include <linux/version.h>
+#include <linux/module.h>
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/types.h>
+#include <linux/fcntl.h>
+#include <linux/interrupt.h>
+#include <linux/ptrace.h>
+#include <linux/ioport.h>
+#include <linux/nubus.h>
+#include <linux/in.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/hwtest.h>
+#include <asm/macints.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include "8390.h"
+
+#if (LINUX_VERSION_CODE < 0x02030e)
+#define net_device device
+#endif
+
+#define WD_START_PG 0x00 /* First page of TX buffer */
+#define CABLETRON_RX_START_PG 0x00 /* First page of RX buffer */
+#define CABLETRON_RX_STOP_PG 0x30 /* Last page +1 of RX ring */
+#define CABLETRON_TX_START_PG CABLETRON_RX_STOP_PG /* First page of TX buffer */
+
+/* Unfortunately it seems we have to hardcode these for the moment */
+/* Shouldn't the card know about this? Does anyone know where to read it off the card? Do we trust the data provided by the card? */
+
+#define DAYNA_8390_BASE 0x80000
+#define DAYNA_8390_MEM 0x00000
+
+#define KINETICS_8390_BASE 0x80000
+#define KINETICS_8390_MEM 0x00000
+
+#define CABLETRON_8390_BASE 0x90000
+#define CABLETRON_8390_MEM 0x00000
+
+enum mac8390_type {
+ MAC8390_NONE = -1,
+ MAC8390_APPLE,
+ MAC8390_ASANTE,
+ MAC8390_FARALLON, /* Apple, Asante, and Farallon are all compatible */
+ MAC8390_CABLETRON,
+ MAC8390_DAYNA,
+ MAC8390_INTERLAN,
+ MAC8390_KINETICS,
+ MAC8390_FOCUS,
+ MAC8390_SONICSYS,
+ MAC8390_DAYNA2,
+ MAC8390_DAYNA3,
+};
+
+static const char * cardname[] = {
+ "apple",
+ "asante",
+ "farallon",
+ "cabletron",
+ "dayna",
+ "interlan",
+ "kinetics",
+ "focus",
+ "sonic systems",
+ "dayna2",
+ "dayna_lc",
+};
+
+static int word16[] = {
+ 1, /* apple */
+ 1, /* asante */
+ 1, /* farallon */
+ 1, /* cabletron */
+ 0, /* dayna */
+ 1, /* interlan */
+ 0, /* kinetics */
+ 1, /* focus (??) */
+ 1, /* sonic systems */
+ 1, /* dayna2 */
+ 1, /* dayna-lc */
+};
+
+/* on which cards do we use NuBus resources? */
+static int useresources[] = {
+ 1, /* apple */
+ 1, /* asante */
+ 1, /* farallon */
+ 0, /* cabletron */
+ 0, /* dayna */
+ 0, /* interlan */
+ 0, /* kinetics */
+ 0, /* focus (??) */
+ 1, /* sonic systems */
+ 1, /* dayna2 */
+ 1, /* dayna-lc */
+};
+
+static const char __initdata * version =
+ "mac8390.c: v0.4 2001-05-15 David Huggins-Daines <dhd@debian.org> and others\n";
+
+extern int mac8390_probe(struct net_device * dev);
+extern enum mac8390_type mac8390_ident(struct nubus_dev * dev);
+extern int mac8390_memsize(unsigned long membase);
+extern int mac8390_memtest(struct net_device * dev);
+extern int mac8390_initdev(struct net_device * dev, struct nubus_dev * ndev,
+ enum mac8390_type type);
+
+static int mac8390_open(struct net_device * dev);
+static int mac8390_close(struct net_device * dev);
+static void mac8390_no_reset(struct net_device *dev);
+
+/* Sane (32-bit chunk memory read/write) - Apple/Asante/Farallon do this*/
+static void sane_get_8390_hdr(struct net_device *dev,
+ struct e8390_pkt_hdr *hdr, int ring_page);
+static void sane_block_input(struct net_device * dev, int count,
+ struct sk_buff * skb, int ring_offset);
+static void sane_block_output(struct net_device * dev, int count,
+ const unsigned char * buf, const int start_page);
+
+/* dayna_memcpy to and from card */
+static void dayna_memcpy_fromcard(struct net_device *dev, void *to,
+ int from, int count);
+static void dayna_memcpy_tocard(struct net_device *dev, int to,
+ const void *from, int count);
+
+/* Dayna - Dayna/Kinetics use this */
+static void dayna_get_8390_hdr(struct net_device *dev,
+ struct e8390_pkt_hdr *hdr, int ring_page);
+static void dayna_block_input(struct net_device *dev, int count,
+ struct sk_buff *skb, int ring_offset);
+static void dayna_block_output(struct net_device *dev, int count,
+ const unsigned char *buf, int start_page);
+
+#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
+#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
+
+/* Slow Sane (16-bit chunk memory read/write) Cabletron uses this */
+static void slow_sane_get_8390_hdr(struct net_device *dev,
+ struct e8390_pkt_hdr *hdr, int ring_page);
+static void slow_sane_block_input(struct net_device *dev, int count,
+ struct sk_buff *skb, int ring_offset);
+static void slow_sane_block_output(struct net_device *dev, int count,
+ const unsigned char *buf, int start_page);
+static void word_memcpy_tocard(void *tp, const void *fp, int count);
+static void word_memcpy_fromcard(void *tp, const void *fp, int count);
+
+enum mac8390_type __init mac8390_ident(struct nubus_dev * dev)
+{
+ if (dev->dr_sw == NUBUS_DRSW_ASANTE)
+ return MAC8390_ASANTE;
+ if (dev->dr_sw == NUBUS_DRSW_FARALLON)
+ return MAC8390_FARALLON;
+ if (dev->dr_sw == NUBUS_DRSW_KINETICS)
+ return MAC8390_KINETICS;
+ if (dev->dr_sw == NUBUS_DRSW_DAYNA)
+ return MAC8390_DAYNA;
+ if (dev->dr_sw == NUBUS_DRSW_DAYNA2)
+ return MAC8390_DAYNA2;
+ if (dev->dr_sw == NUBUS_DRSW_DAYNA_LC)
+ return MAC8390_DAYNA3;
+ if (dev->dr_hw == NUBUS_DRHW_CABLETRON)
+ return MAC8390_CABLETRON;
+ return MAC8390_NONE;
+}
+
+int __init mac8390_memsize(unsigned long membase)
+{
+ unsigned long flags;
+ int i, j;
+
+ save_flags(flags); cli();
+ /* Check up to 32K in 4K increments */
+ for (i = 0; i < 8; i++) {
+ volatile unsigned short *m = (unsigned short *) (membase + (i * 0x1000));
+
+ /* Unwriteable - we have a fully decoded card and the
+ RAM end located */
+ if (hwreg_present(m) == 0)
+ break;
+
+ /* write a distinctive byte */
+ *m = 0xA5A0 | i;
+ /* check that we read back what we wrote */
+ if (*m != (0xA5A0 | i))
+ break;
+
+ /* check for partial decode and wrap */
+ for (j = 0; j < i; j++) {
+ volatile unsigned short *p = (unsigned short *) (membase + (j * 0x1000));
+ if (*p != (0xA5A0 | j))
+ break;
+ }
+ }
+ restore_flags(flags);
+ /* in any case, we stopped once we tried one block too many,
+ or once we reached 32K */
+ return i * 0x1000;
+}
+
+static int probed __initdata = 0;
+
+int __init mac8390_probe(struct net_device * dev)
+{
+ volatile unsigned short *i;
+ int boards_found = 0;
+ int version_disp = 0;
+ struct nubus_dev * ndev = NULL;
+
+ struct nubus_dir dir;
+ struct nubus_dirent ent;
+ int offset;
+
+ enum mac8390_type cardtype;
+
+ if (probed)
+ return -ENODEV;
+ probed++;
+
+ /* probably should check for Nubus instead */
+
+ if (!MACH_IS_MAC)
+ return -ENODEV;
+
+ while ((ndev = nubus_find_type(NUBUS_CAT_NETWORK, NUBUS_TYPE_ETHERNET, ndev))) {
+
+ dev = NULL;
+
+ if ((cardtype = mac8390_ident(ndev)) == MAC8390_NONE)
+ continue;
+
+ dev = init_etherdev(dev, 0);
+ if (dev == NULL) {
+ printk(KERN_ERR "Unable to allocate etherdev"
+ "structure!\n");
+ return -ENOMEM;
+ }
+
+ if (version_disp == 0) {
+ version_disp = 1;
+ printk(version);
+ }
+
+ dev->irq = SLOT2IRQ(ndev->board->slot);
+ /* This is getting to be a habit */
+ dev->base_addr = ndev->board->slot_addr | ((ndev->board->slot&0xf) << 20);
+
+ /* Get some Nubus info - we will trust the card's idea
+ of where its memory and registers are. */
+
+ if (nubus_get_func_dir(ndev, &dir) == -1) {
+ printk(KERN_ERR "%s: Unable to get Nubus functional"
+ " directory for slot %X!\n",
+ dev->name, ndev->board->slot);
+ continue;
+ }
+
+ /* Get the MAC address */
+ if ((nubus_find_rsrc(&dir, NUBUS_RESID_MAC_ADDRESS, &ent)) == -1) {
+ printk(KERN_INFO "%s: Couldn't get MAC address!\n",
+ dev->name);
+ continue;
+ } else {
+ nubus_get_rsrc_mem(dev->dev_addr, &ent, 6);
+ /* Some Sonic Sys cards masquerade as Farallon */
+ if (cardtype == MAC8390_FARALLON &&
+ dev->dev_addr[0] == 0x0 &&
+ dev->dev_addr[1] == 0x40 &&
+ dev->dev_addr[2] == 0x10) {
+ /* This is really Sonic Sys card */
+ cardtype = MAC8390_SONICSYS;
+ }
+ }
+
+ if (useresources[cardtype] == 1) {
+ nubus_rewinddir(&dir);
+ if (nubus_find_rsrc(&dir, NUBUS_RESID_MINOR_BASEOS, &ent) == -1) {
+ printk(KERN_ERR "%s: Memory offset resource"
+ " for slot %X not found!\n",
+ dev->name, ndev->board->slot);
+ continue;
+ }
+ nubus_get_rsrc_mem(&offset, &ent, 4);
+ dev->mem_start = dev->base_addr + offset;
+ /* yes, this is how the Apple driver does it */
+ dev->base_addr = dev->mem_start + 0x10000;
+ nubus_rewinddir(&dir);
+ if (nubus_find_rsrc(&dir, NUBUS_RESID_MINOR_LENGTH, &ent) == -1) {
+ printk(KERN_INFO "%s: Memory length resource"
+ " for slot %X not found"
+ ", probing\n",
+ dev->name, ndev->board->slot);
+ offset = mac8390_memsize(dev->mem_start);
+ } else {
+ nubus_get_rsrc_mem(&offset, &ent, 4);
+ }
+ dev->mem_end = dev->mem_start + offset;
+ } else {
+ switch (cardtype) {
+ case MAC8390_KINETICS:
+ case MAC8390_DAYNA: /* it's the same */
+ dev->base_addr =
+ (int)(ndev->board->slot_addr +
+ DAYNA_8390_BASE);
+ dev->mem_start =
+ (int)(ndev->board->slot_addr +
+ DAYNA_8390_MEM);
+ dev->mem_end =
+ dev->mem_start +
+ mac8390_memsize(dev->mem_start);
+ break;
+ case MAC8390_CABLETRON:
+ dev->base_addr =
+ (int)(ndev->board->slot_addr +
+ CABLETRON_8390_BASE);
+ dev->mem_start =
+ (int)(ndev->board->slot_addr +
+ CABLETRON_8390_MEM);
+ /* The base address is unreadable if 0x00
+ * has been written to the command register
+ * Reset the chip by writing E8390_NODMA +
+ * E8390_PAGE0 + E8390_STOP just to be
+ * sure
+ */
+ i = (void *)dev->base_addr;
+ *i = 0x21;
+ dev->mem_end =
+ dev->mem_start +
+ mac8390_memsize(dev->mem_start);
+ break;
+
+ default:
+ printk(KERN_ERR "Card type %s is"
+ " unsupported, sorry\n",
+ cardname[cardtype]);
+ return -ENODEV;
+ }
+ }
+
+ /* Do the nasty 8390 stuff */
+ if (mac8390_initdev(dev, ndev, cardtype))
+ continue;
+ boards_found++;
+ }
+
+ /* We're outta here */
+ if (boards_found > 0)
+ return 0;
+ else
+ return -ENODEV;
+}
+
+#ifdef MODULE
+#if LINUX_VERSION_CODE > 0x20118
+MODULE_AUTHOR("David Huggins-Daines <dhd@debian.org> and others");
+MODULE_DESCRIPTION("Macintosh NS8390-based Nubus Ethernet driver");
+MODUEL_LICENSE("GPL");
+#endif
+
+int init_module(void)
+{
+ if (mac8390_probe(NULL)) {
+ printk(KERN_NOTICE "mac8390.c: No useable cards found, driver NOT installed.\n");
+ return -ENODEV;
+ }
+ lock_8390_module();
+ return 0;
+}
+
+void cleanup_module(void)
+{
+ /* FIXME: should probably keep track of net_device structs
+ somewhere and unregister them here? */
+ unlock_8390_module();
+}
+
+#endif /* MODULE */
+
+int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * ndev,
+ enum mac8390_type type)
+{
+ static u32 fwrd4_offsets[16]={
+ 0, 4, 8, 12,
+ 16, 20, 24, 28,
+ 32, 36, 40, 44,
+ 48, 52, 56, 60
+ };
+ static u32 back4_offsets[16]={
+ 60, 56, 52, 48,
+ 44, 40, 36, 32,
+ 28, 24, 20, 16,
+ 12, 8, 4, 0
+ };
+ static u32 fwrd2_offsets[16]={
+ 0, 2, 4, 6,
+ 8, 10, 12, 14,
+ 16, 18, 20, 22,
+ 24, 26, 28, 30
+ };
+
+ int access_bitmode;
+
+ /* 8390 specific init for dev - allocates dev->priv */
+ if (ethdev_init(dev)) {
+ printk(KERN_ERR "%s: Unable to allocate memory for dev->priv!\n", dev->name);
+ return -ENOMEM;
+ }
+
+ /* Now fill in our stuff */
+ dev->open = &mac8390_open;
+ dev->stop = &mac8390_close;
+
+ /* GAR, ei_status is actually a macro even though it looks global */
+ ei_status.name = cardname[type];
+ ei_status.word16 = word16[type];
+
+ /* Cabletron's TX/RX buffers are backwards */
+ if (type == MAC8390_CABLETRON) {
+ ei_status.tx_start_page = CABLETRON_TX_START_PG;
+ ei_status.rx_start_page = CABLETRON_RX_START_PG;
+ ei_status.stop_page = CABLETRON_RX_STOP_PG;
+ dev->rmem_start = dev->mem_start;
+ dev->rmem_end = dev->mem_start + CABLETRON_RX_STOP_PG*256;
+ } else {
+ ei_status.tx_start_page = WD_START_PG;
+ ei_status.rx_start_page = WD_START_PG + TX_PAGES;
+ ei_status.stop_page = (dev->mem_end - dev->mem_start)/256;
+ dev->rmem_start = dev->mem_start + TX_PAGES*256;
+ dev->rmem_end = dev->mem_end;
+ }
+
+ /* Fill in model-specific information and functions */
+ switch(type) {
+ case MAC8390_SONICSYS:
+ /* 16 bit card, register map is reversed */
+ ei_status.reset_8390 = &mac8390_no_reset;
+ ei_status.block_input = &slow_sane_block_input;
+ ei_status.block_output = &slow_sane_block_output;
+ ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
+ ei_status.reg_offset = back4_offsets;
+ access_bitmode = 0;
+ break;
+ case MAC8390_FARALLON:
+ case MAC8390_APPLE:
+ case MAC8390_ASANTE:
+ case MAC8390_DAYNA2:
+ case MAC8390_DAYNA3:
+ /* 32 bit card, register map is reversed */
+ /* sane */
+ ei_status.reset_8390 = &mac8390_no_reset;
+ ei_status.block_input = &sane_block_input;
+ ei_status.block_output = &sane_block_output;
+ ei_status.get_8390_hdr = &sane_get_8390_hdr;
+ ei_status.reg_offset = back4_offsets;
+ access_bitmode = 1;
+ break;
+ case MAC8390_CABLETRON:
+ /* 16 bit card, register map is short forward */
+ ei_status.reset_8390 = &mac8390_no_reset;
+ ei_status.block_input = &slow_sane_block_input;
+ ei_status.block_output = &slow_sane_block_output;
+ ei_status.get_8390_hdr = &slow_sane_get_8390_hdr;
+ ei_status.reg_offset = fwrd2_offsets;
+ access_bitmode = 0;
+ break;
+ case MAC8390_DAYNA:
+ case MAC8390_KINETICS:
+ /* 16 bit memory */
+ /* dayna and similar */
+ ei_status.reset_8390 = &mac8390_no_reset;
+ ei_status.block_input = &dayna_block_input;
+ ei_status.block_output = &dayna_block_output;
+ ei_status.get_8390_hdr = &dayna_get_8390_hdr;
+ ei_status.reg_offset = fwrd4_offsets;
+ access_bitmode = 0;
+ break;
+ default:
+ printk(KERN_ERR "Card type %s is unsupported, sorry\n", cardname[type]);
+ return -ENODEV;
+ }
+
+ NS8390_init(dev, 0);
+
+ /* Good, done, now spit out some messages */
+ printk(KERN_INFO "%s: %s in slot %X (type %s)\n",
+ dev->name, ndev->board->name, ndev->board->slot, cardname[type]);
+ printk(KERN_INFO "MAC ");
+ {
+ int i;
+ for (i = 0; i < 6; i++) {
+ printk("%2.2x", dev->dev_addr[i]);
+ if (i < 5)
+ printk(":");
+ }
+ }
+ printk(" IRQ %d, shared memory at %#lx-%#lx, %d-bit access.\n",
+ dev->irq, dev->mem_start, dev->mem_end-1,
+ access_bitmode?32:16);
+ return 0;
+}
+
+static int mac8390_open(struct net_device *dev)
+{
+ ei_open(dev);
+ if (request_irq(dev->irq, ei_interrupt, 0, "8390 Ethernet", dev)) {
+ printk ("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+ return -EAGAIN;
+ }
+ MOD_INC_USE_COUNT;
+ return 0;
+}
+
+static int mac8390_close(struct net_device *dev)
+{
+ free_irq(dev->irq, dev);
+ ei_close(dev);
+ MOD_DEC_USE_COUNT;
+ return 0;
+}
+
+static void mac8390_no_reset(struct net_device *dev)
+{
+ ei_status.txing = 0;
+ if (ei_debug > 1)
+ printk("reset not supported\n");
+ return;
+}
+
+/* dayna_memcpy_fromio/dayna_memcpy_toio */
+/* directly from daynaport.c by Alan Cox */
+static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count)
+{
+ volatile unsigned short *ptr;
+ unsigned short *target=to;
+ from<<=1; /* word, skip overhead */
+ ptr=(unsigned short *)(dev->mem_start+from);
+ /* Leading byte? */
+ if (from&2) {
+ *((char *)target)++ = *(((char *)ptr++)-1);
+ count--;
+ }
+ while(count>=2)
+ {
+ *target++=*ptr++; /* Copy and */
+ ptr++; /* skip cruft */
+ count-=2;
+ }
+ /* Trailing byte? */
+ if(count)
+ {
+ /* Big endian */
+ unsigned short v=*ptr;
+ *((char *)target)=v>>8;
+ }
+}
+
+static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count)
+{
+ volatile unsigned short *ptr;
+ const unsigned short *src=from;
+ to<<=1; /* word, skip overhead */
+ ptr=(unsigned short *)(dev->mem_start+to);
+ /* Leading byte? */
+ if (to&2) { /* avoid a byte write (stomps on other data) */
+ ptr[-1] = (ptr[-1]&0xFF00)|*((unsigned char *)src)++;
+ ptr++;
+ count--;
+ }
+ while(count>=2)
+ {
+ *ptr++=*src++; /* Copy and */
+ ptr++; /* skip cruft */
+ count-=2;
+ }
+ /* Trailing byte? */
+ if(count)
+ {
+ /* Big endian */
+ unsigned short v=*src;
+ /* card doesn't like byte writes */
+ *ptr=(*ptr&0x00FF)|(v&0xFF00);
+ }
+}
+
+/* sane block input/output */
+static void sane_get_8390_hdr(struct net_device *dev,
+ struct e8390_pkt_hdr *hdr, int ring_page)
+{
+ unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
+ memcpy_fromio((void *)hdr, (char *)dev->mem_start + hdr_start, 4);
+ /* Fix endianness */
+ hdr->count = swab16(hdr->count);
+}
+
+static void sane_block_input(struct net_device *dev, int count,
+ struct sk_buff *skb, int ring_offset)
+{
+ unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
+ unsigned long xfer_start = xfer_base + dev->mem_start;
+
+ if (xfer_start + count > dev->rmem_end) {
+ /* We must wrap the input move. */
+ int semi_count = dev->rmem_end - xfer_start;
+ memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base, semi_count);
+ count -= semi_count;
+ memcpy_toio(skb->data + semi_count, (char *)dev->rmem_start, count);
+ } else {
+ memcpy_fromio(skb->data, (char *)dev->mem_start + xfer_base, count);
+ }
+}
+
+static void sane_block_output(struct net_device *dev, int count,
+ const unsigned char *buf, int start_page)
+{
+ long shmem = (start_page - WD_START_PG)<<8;
+
+ memcpy_toio((char *)dev->mem_start + shmem, buf, count);
+}
+
+/* dayna block input/output */
+static void dayna_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
+{
+ unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
+
+ dayna_memcpy_fromcard(dev, (void *)hdr, hdr_start, 4);
+ /* Fix endianness */
+ hdr->count=(hdr->count&0xFF)<<8|(hdr->count>>8);
+}
+
+static void dayna_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
+{
+ unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
+ unsigned long xfer_start = xfer_base+dev->mem_start;
+
+ /* Note the offset math is done in card memory space which is word
+ per long onto our space. */
+
+ if (xfer_start + count > dev->rmem_end)
+ {
+ /* We must wrap the input move. */
+ int semi_count = dev->rmem_end - xfer_start;
+ dayna_memcpy_fromcard(dev, skb->data, xfer_base, semi_count);
+ count -= semi_count;
+ dayna_memcpy_fromcard(dev, skb->data + semi_count,
+ dev->rmem_start - dev->mem_start, count);
+ }
+ else
+ {
+ dayna_memcpy_fromcard(dev, skb->data, xfer_base, count);
+ }
+}
+
+static void dayna_block_output(struct net_device *dev, int count, const unsigned char *buf,
+ int start_page)
+{
+ long shmem = (start_page - WD_START_PG)<<8;
+
+ dayna_memcpy_tocard(dev, shmem, buf, count);
+}
+
+/* Cabletron block I/O */
+static void slow_sane_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
+ int ring_page)
+{
+ unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
+ word_memcpy_fromcard((void *)hdr, (char *)dev->mem_start+hdr_start, 4);
+ /* Register endianism - fix here rather than 8390.c */
+ hdr->count = (hdr->count&0xFF)<<8|(hdr->count>>8);
+}
+
+static void slow_sane_block_input(struct net_device *dev, int count, struct sk_buff *skb,
+ int ring_offset)
+{
+ unsigned long xfer_base = ring_offset - (WD_START_PG<<8);
+ unsigned long xfer_start = xfer_base+dev->mem_start;
+
+ if (xfer_start + count > dev->rmem_end)
+ {
+ /* We must wrap the input move. */
+ int semi_count = dev->rmem_end - xfer_start;
+ word_memcpy_fromcard(skb->data, (char *)dev->mem_start +
+ xfer_base, semi_count);
+ count -= semi_count;
+ word_memcpy_fromcard(skb->data + semi_count,
+ (char *)dev->rmem_start, count);
+ }
+ else
+ {
+ word_memcpy_fromcard(skb->data, (char *)dev->mem_start +
+ xfer_base, count);
+ }
+}
+
+static void slow_sane_block_output(struct net_device *dev, int count, const unsigned char *buf,
+ int start_page)
+{
+ long shmem = (start_page - WD_START_PG)<<8;
+
+ word_memcpy_tocard((char *)dev->mem_start + shmem, buf, count);
+}
+
+static void word_memcpy_tocard(void *tp, const void *fp, int count)
+{
+ volatile unsigned short *to = tp;
+ const unsigned short *from = fp;
+
+ count++;
+ count/=2;
+
+ while(count--)
+ *to++=*from++;
+}
+
+static void word_memcpy_fromcard(void *tp, const void *fp, int count)
+{
+ unsigned short *to = tp;
+ const volatile unsigned short *from = fp;
+
+ count++;
+ count/=2;
+
+ while(count--)
+ *to++=*from++;
+}
+
+
diff --git a/drivers/net/sun3_82586.c b/drivers/net/sun3_82586.c
index 0fad42a4021c..cdd2252d83cf 100644
--- a/drivers/net/sun3_82586.c
+++ b/drivers/net/sun3_82586.c
@@ -279,14 +279,14 @@ static void alloc586(struct net_device *dev)
int __init sun3_82586_probe(struct net_device *dev)
{
- unsigned long ioaddr, iopte;
+ unsigned long ioaddr;
static int found = 0;
- /* check that this machine has an onboard lance */
+ /* check that this machine has an onboard 82586 */
switch(idprom->id_machtype) {
case SM_SUN3|SM_3_160:
case SM_SUN3|SM_3_260:
- /* these machines have lance */
+ /* these machines have 82586 */
break;
default:
@@ -296,22 +296,8 @@ int __init sun3_82586_probe(struct net_device *dev)
if(found)
return -ENODEV;
- for(ioaddr = 0xfe00000; ioaddr < (0xfe00000 +
- SUN3_PMEG_SIZE); ioaddr += SUN3_PTE_SIZE) {
-
- iopte = sun3_get_pte(ioaddr);
- if(!(iopte & SUN3_PAGE_TYPE_IO)) /* this an io page? */
- continue;
-
- if(((iopte & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT) ==
- IE_OBIO) {
- found = 1;
- break;
- }
- }
-
- if(!found)
- return 0;
+ ioaddr = (unsigned long)ioremap(IE_OBIO, PAGE_SIZE);
+ found = 1;
SET_MODULE_OWNER(dev);
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index b15e13f0a9e4..9a9814b6da3f 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -279,33 +279,16 @@ int __init sun3lance_probe( struct net_device *dev )
static int __init lance_probe( struct net_device *dev)
{
- unsigned long ioaddr, iopte;
+ unsigned long ioaddr;
struct lance_private *lp;
int i;
static int did_version;
- int found = 0;
volatile unsigned short *ioaddr_probe;
unsigned short tmp1, tmp2;
#ifdef CONFIG_SUN3
- /* LANCE_OBIO can be found within the IO pmeg with some effort */
- for(ioaddr = 0xfe00000; ioaddr < (0xfe00000 +
- SUN3_PMEG_SIZE); ioaddr += SUN3_PTE_SIZE) {
-
- iopte = sun3_get_pte(ioaddr);
- if(!(iopte & SUN3_PAGE_TYPE_IO)) /* this an io page? */
- continue;
-
- if(((iopte & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT) ==
- LANCE_OBIO) {
- found = 1;
- break;
- }
- }
-
- if(!found)
- return 0;
+ ioaddr = (unsigned long)ioremap(LANCE_OBIO, PAGE_SIZE);
#else
ioaddr = SUN3X_LANCE;
#endif
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
index 2071ce5ffa10..d6cfff7ff8fa 100644
--- a/drivers/nubus/nubus.c
+++ b/drivers/nubus/nubus.c
@@ -8,7 +8,6 @@
*/
#include <linux/config.h>
-#include <linux/ptrace.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c
index 40ca15bb075b..5271a4a7af26 100644
--- a/drivers/nubus/proc.c
+++ b/drivers/nubus/proc.c
@@ -17,7 +17,6 @@
icons) these files will provide "cooked" data. Otherwise they will
simply provide raw access (read-only of course) to the ROM. */
-#include <linux/ptrace.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/nubus.h>
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 0ec4aea5fa74..856b7c47c837 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -42,7 +42,7 @@ obj-$(CONFIG_OKTAGON_SCSI) += NCR53C9x.o oktagon_esp.o oktagon_io.o
obj-$(CONFIG_ATARI_SCSI) += atari_scsi.o
obj-$(CONFIG_MAC_SCSI) += mac_scsi.o
obj-$(CONFIG_SCSI_MAC_ESP) += mac_esp.o NCR53C9x.o
-obj-$(CONFIG_SUN3_SCSI) += sun3_scsi.o
+obj-$(CONFIG_SUN3_SCSI) += sun3_scsi.o sun3_scsi_vme.o
obj-$(CONFIG_MVME16x_SCSI) += mvme16x.o 53c7xx.o
obj-$(CONFIG_BVME6000_SCSI) += bvme6000.o 53c7xx.o
obj-$(CONFIG_SCSI_SIM710) += sim710.o
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index ab3b99d73e24..1dd34aeb225e 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -270,6 +270,9 @@ static Scsi_Host_Template *the_template = NULL;
#define HOSTNO instance->host_no
#define H_NO(cmd) (cmd)->host->host_no
+#define SGADDR(buffer) (void *)(((unsigned long)page_address((buffer)->page)) + \
+ (buffer)->offset)
+
#ifdef SUPPORT_TAGS
/*
@@ -476,10 +479,10 @@ static void merge_contiguous_buffers( Scsi_Cmnd *cmd )
for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
cmd->SCp.buffers_residual &&
- virt_to_phys(cmd->SCp.buffer[1].address) == endaddr; ) {
+ virt_to_phys(SGADDR(&(cmd->SCp.buffer[1]))) == endaddr; ) {
MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
- cmd->SCp.buffer[1].address, endaddr);
+ SGADDR(&(cmd->SCp.buffer[1])), endaddr);
#if (NDEBUG & NDEBUG_MERGING)
++cnt;
#endif
@@ -514,12 +517,13 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd)
if (cmd->use_sg) {
cmd->SCp.buffer = (struct scatterlist *) cmd->buffer;
cmd->SCp.buffers_residual = cmd->use_sg - 1;
- cmd->SCp.ptr = (char *) cmd->SCp.buffer->address;
+ cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer);
cmd->SCp.this_residual = cmd->SCp.buffer->length;
+
/* ++roman: Try to merge some scatter-buffers if they are at
* contiguous physical addresses.
*/
- merge_contiguous_buffers( cmd );
+// merge_contiguous_buffers( cmd );
} else {
cmd->SCp.buffer = NULL;
cmd->SCp.buffers_residual = 0;
@@ -613,11 +617,11 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
status = NCR5380_read(STATUS_REG);
if (!(status & SR_REQ))
- printk(KERN_DEBUG "scsi%d: REQ not asserted, phase unknown.\n", HOSTNO);
+ printk("scsi%d: REQ not asserted, phase unknown.\n", HOSTNO);
else {
for (i = 0; (phases[i].value != PHASE_UNKNOWN) &&
(phases[i].value != (status & PHASE_MASK)); ++i);
- printk(KERN_DEBUG "scsi%d: phase %s\n", HOSTNO, phases[i].name);
+ printk("scsi%d: phase %s\n", HOSTNO, phases[i].name);
}
}
@@ -751,11 +755,8 @@ static void NCR5380_print_status (struct Scsi_Host *instance)
static
char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length);
-#ifndef NCR5380_proc_info
-static
-#endif
-int NCR5380_proc_info (char *buffer, char **start, off_t offset,
- int length, int hostno, int inout)
+static int NCR5380_proc_info (char *buffer, char **start, off_t offset,
+ int length, int hostno, int inout)
{
char *pos = buffer;
struct Scsi_Host *instance;
@@ -910,10 +911,7 @@ static void __init NCR5380_init (struct Scsi_Host *instance, int flags)
*/
/* Only make static if a wrapper function is used */
-#ifndef NCR5380_queue_command
-static
-#endif
-int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
+static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
{
SETUP_HOSTDATA(cmd->host);
Scsi_Cmnd *tmp;
@@ -1211,7 +1209,7 @@ static void NCR5380_dma_complete( struct Scsi_Host *instance )
HOSTNO, NCR5380_read(BUS_AND_STATUS_REG),
NCR5380_read(STATUS_REG));
- if((sun3scsi_dma_finish(hostdata->connected->request->cmd))) {
+ if((sun3scsi_dma_finish(rq_data_dir(hostdata->connected->request)))) {
printk("scsi%d: overrun in UDC counter -- not prepared to deal with this!\n", HOSTNO);
printk("please e-mail sammy@sammy.net with a description of how this\n");
printk("error was produced.\n");
@@ -1315,11 +1313,14 @@ static void NCR5380_intr (int irq, void *dev_id, struct pt_regs *regs)
{
/* MS: Ignore unknown phase mismatch interrupts (caused by EOP interrupt) */
if (basr & BASR_PHASE_MATCH)
- printk(KERN_NOTICE "scsi%d: unknown interrupt, "
+ INT_PRINTK("scsi%d: unknown interrupt, "
"BASR 0x%x, MR 0x%x, SR 0x%x\n",
HOSTNO, basr, NCR5380_read(MODE_REG),
NCR5380_read(STATUS_REG));
(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
+#ifdef SUN3_SCSI_VME
+ dregs->csr |= CSR_DMA_ENABLE;
+#endif
}
} /* if !(SELECTION || PARITY) */
} /* BASR & IRQ */
@@ -1329,6 +1330,9 @@ static void NCR5380_intr (int irq, void *dev_id, struct pt_regs *regs)
"BASR 0x%X, MR 0x%X, SR 0x%x\n", HOSTNO, basr,
NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG));
(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
+#ifdef SUN3_SCSI_VME
+ dregs->csr |= CSR_DMA_ENABLE;
+#endif
}
if (!done) {
@@ -1691,7 +1695,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
#ifndef SUPPORT_TAGS
hostdata->busy[cmd->target] |= (1 << cmd->lun);
#endif
-
+#ifdef SUN3_SCSI_VME
+ dregs->csr |= CSR_INTR;
+#endif
initialize_SCp(cmd);
@@ -1918,19 +1924,18 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
printk("scsi%d: transfer_dma without setup!\n", HOSTNO);
BUG();
}
-
hostdata->dma_len = c;
DMA_PRINTK("scsi%d: initializing DMA for %s, %d bytes %s %p\n",
HOSTNO, (p & SR_IO) ? "reading" : "writing",
- c, (p & SR_IO) ? "to" : "from", d);
+ c, (p & SR_IO) ? "to" : "from", *data);
/* netbsd turns off ints here, why not be safe and do it too */
save_flags(flags);
cli();
/* send start chain */
- sun3_udc_write(UDC_CHN_START, UDC_CSR);
+ sun3scsi_dma_start(c, *data);
if (p & SR_IO) {
NCR5380_write(TARGET_COMMAND_REG, 1);
@@ -1946,6 +1951,10 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
NCR5380_write(START_DMA_SEND_REG, 0);
}
+#ifdef SUN3_SCSI_VME
+ dregs->csr |= CSR_DMA_ENABLE;
+#endif
+
restore_flags(flags);
sun3_dma_active = 1;
@@ -1984,6 +1993,10 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
unsigned char phase, tmp, extended_msg[10], old_phase=0xff;
Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected;
+#ifdef SUN3_SCSI_VME
+ dregs->csr |= CSR_INTR;
+#endif
+
while (1) {
tmp = NCR5380_read(STATUS_REG);
/* We only have a valid SCSI phase when REQ is asserted */
@@ -2000,7 +2013,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
count = cmd->SCp.buffer->length;
- d = cmd->SCp.buffer->address;
+ d = SGADDR(cmd->SCp.buffer);
} else {
count = cmd->SCp.this_residual;
d = cmd->SCp.ptr;
@@ -2010,13 +2023,16 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
if((count > SUN3_DMA_MINSIZE) && (sun3_dma_setup_done
!= cmd))
{
- if((cmd->request->cmd == 0) || (cmd->request->cmd == 1)) {
+ if(cmd->request->flags & REQ_CMD) {
sun3scsi_dma_setup(d, count,
- cmd->request->cmd);
+ rq_data_dir(cmd->request));
sun3_dma_setup_done = cmd;
}
}
#endif
+#ifdef SUN3_SCSI_VME
+ dregs->csr |= CSR_INTR;
+#endif
}
@@ -2052,7 +2068,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
++cmd->SCp.buffer;
--cmd->SCp.buffers_residual;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
- cmd->SCp.ptr = cmd->SCp.buffer->address;
+ cmd->SCp.ptr = SGADDR(cmd->SCp.buffer);
/* ++roman: Try to merge some scatter-buffers if
* they are at contiguous physical addresses.
@@ -2132,7 +2148,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
NCR5380_write(SELECT_ENABLE_REG, 0); /* disable reselects */
NCR5380_transfer_pio(instance, &phase, &len, &data);
cmd->SCp.Message = tmp;
-
+
switch (tmp) {
/*
* Linking lets us reduce the time required to get the
@@ -2338,6 +2354,9 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
/* Wait for bus free to avoid nasty timeouts */
while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
barrier();
+#ifdef SUN3_SCSI_VME
+ dregs->csr |= CSR_DMA_ENABLE;
+#endif
return;
/*
* The SCSI data pointer is *IMPLICITLY* saved on a disconnect
@@ -2607,24 +2626,22 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
/* engage dma setup for the command we just saw */
{
void *d;
- unsigned long count;
+ unsigned long count;
- if (!tmp->SCp.this_residual && tmp->SCp.buffers_residual) {
- count = tmp->SCp.buffer->length;
- d = tmp->SCp.buffer->address;
- } else {
- count = tmp->SCp.this_residual;
- d = tmp->SCp.ptr;
- }
-#ifdef REAL_DMA
- /* setup this command for dma if not already */
- if((count > SUN3_DMA_MINSIZE) && (sun3_dma_setup_done
- != tmp))
- {
- sun3scsi_dma_setup(d, count,
- tmp->request->cmd);
- sun3_dma_setup_done = tmp;
- }
+ if (!tmp->SCp.this_residual && tmp->SCp.buffers_residual) {
+ count = tmp->SCp.buffer->length;
+ d = SGADDR(tmp->SCp.buffer);
+ } else {
+ count = tmp->SCp.this_residual;
+ d = tmp->SCp.ptr;
+ }
+#ifdef REAL_DMA
+ /* setup this command for dma if not already */
+ if((count > SUN3_DMA_MINSIZE) && (sun3_dma_setup_done != tmp))
+ {
+ sun3scsi_dma_setup(d, count, rq_data_dir(tmp->request));
+ sun3_dma_setup_done = tmp;
+ }
#endif
}
#endif
@@ -2675,10 +2692,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
* called where the loop started in NCR5380_main().
*/
-#ifndef NCR5380_abort
-static
-#endif
-int NCR5380_abort (Scsi_Cmnd *cmd)
+static int NCR5380_abort (Scsi_Cmnd *cmd)
{
struct Scsi_Host *instance = cmd->host;
SETUP_HOSTDATA(instance);
@@ -2872,7 +2886,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
*
*/
-int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
+static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
{
SETUP_HOSTDATA(cmd->host);
int i;
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index 457a5518b34e..502f764b4233 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -1,7 +1,7 @@
/*
* Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
*
- * Sun3 DMA routines added by Sam Creasey (sammy@oh.verio.com)
+ * Sun3 DMA routines added by Sam Creasey (sammy@sammy.net)
*
* Adapted from mac_scsinew.c:
*/
@@ -79,8 +79,10 @@
#include "sun3_scsi.h"
#include "NCR5380.h"
+/* #define OLDDMA */
+
#define USE_WRAPPER
-#define RESET_BOOT
+/*#define RESET_BOOT */
#define DRIVER_SETUP
#define NDEBUG 0
@@ -93,7 +95,7 @@
#undef DRIVER_SETUP
#endif
-#undef SUPPORT_TAGS
+/* #define SUPPORT_TAGS */
#define ENABLE_IRQ() enable_irq( IRQ_SUN3_SCSI );
@@ -103,12 +105,17 @@ static inline unsigned char sun3scsi_read(int reg);
static inline void sun3scsi_write(int reg, int value);
static int setup_can_queue = -1;
+MODULE_PARM(setup_can_queue, "i");
static int setup_cmd_per_lun = -1;
+MODULE_PARM(setup_cmd_per_lun, "i");
static int setup_sg_tablesize = -1;
+MODULE_PARM(setup_sg_tablesize, "i");
#ifdef SUPPORT_TAGS
static int setup_use_tagged_queuing = -1;
+MODULE_PARM(setup_use_tagged_queuing, "i");
#endif
static int setup_hostid = -1;
+MODULE_PARM(setup_hostid, "i");
static Scsi_Cmnd *sun3_dma_setup_done = NULL;
@@ -125,7 +132,9 @@ static Scsi_Cmnd *sun3_dma_setup_done = NULL;
static volatile unsigned char *sun3_scsi_regp;
static volatile struct sun3_dma_regs *dregs;
+#ifdef OLDDMA
static unsigned char *dmabuf = NULL; /* dma memory buffer */
+#endif
static struct sun3_udc_regs *udc_regs = NULL;
static unsigned char *sun3_dma_orig_addr = NULL;
static unsigned long sun3_dma_orig_count = 0;
@@ -187,8 +196,7 @@ static struct Scsi_Host *default_instance;
int sun3scsi_detect(Scsi_Host_Template * tpnt)
{
- unsigned long ioaddr, iopte;
- int count = 0;
+ unsigned long ioaddr;
static int called = 0;
struct Scsi_Host *instance;
@@ -222,28 +230,9 @@ int sun3scsi_detect(Scsi_Host_Template * tpnt)
tpnt->this_id = 7;
}
- /* Taken from Sammy's lance driver: */
- /* IOBASE_SUN3_SCSI can be found within the IO pmeg with some effort */
- for(ioaddr = 0xfe00000; ioaddr < (0xfe00000 + SUN3_PMEG_SIZE);
- ioaddr += SUN3_PTE_SIZE) {
-
- iopte = sun3_get_pte(ioaddr);
- if(!(iopte & SUN3_PAGE_TYPE_IO)) /* this an io page? */
- continue;
-
- if(((iopte & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT) ==
- IOBASE_SUN3_SCSI) {
- count = 1;
- break;
- }
- }
-
- if(!count) {
- printk("No Sun3 NCR5380 found!\n");
- return 0;
- }
-
+ ioaddr = (unsigned long)ioremap(IOBASE_SUN3_SCSI, PAGE_SIZE);
sun3_scsi_regp = (unsigned char *)ioaddr;
+
dregs = (struct sun3_dma_regs *)(((unsigned char *)ioaddr) + 8);
if((udc_regs = dvma_malloc(sizeof(struct sun3_udc_regs)))
@@ -259,7 +248,7 @@ int sun3scsi_detect(Scsi_Host_Template * tpnt)
#endif
#ifdef SUPPORT_TAGS
if (setup_use_tagged_queuing < 0)
- setup_use_tagged_queuing = DEFAULT_USE_TAGGED_QUEUING;
+ setup_use_tagged_queuing = USE_TAGGED_QUEUING;
#endif
instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
@@ -309,16 +298,25 @@ int sun3scsi_detect(Scsi_Host_Template * tpnt)
dregs->fifo_count = 0;
called = 1;
+
+#ifdef RESET_BOOT
+ sun3_scsi_reset_boot(instance);
+#endif
+
return 1;
}
+#ifdef MODULE
int sun3scsi_release (struct Scsi_Host *shpnt)
{
if (shpnt->irq != IRQ_NONE)
free_irq (shpnt->irq, NULL);
+ iounmap(sun3_scsi_regp);
+
return 0;
}
+#endif
#ifdef RESET_BOOT
/*
@@ -340,7 +338,7 @@ static void sun3_scsi_reset_boot(struct Scsi_Host *instance)
printk( "Sun3 SCSI: resetting the SCSI bus..." );
/* switch off SCSI IRQ - catch an interrupt without IRQ bit set else */
- sun3_disable_irq( IRQ_SUN3_SCSI );
+// sun3_disable_irq( IRQ_SUN3_SCSI );
/* get in phase */
NCR5380_write( TARGET_COMMAND_REG,
@@ -360,7 +358,7 @@ static void sun3_scsi_reset_boot(struct Scsi_Host *instance)
barrier();
/* switch on SCSI IRQ again */
- sun3_enable_irq( IRQ_SUN3_SCSI );
+// sun3_enable_irq( IRQ_SUN3_SCSI );
printk( " done\n" );
}
@@ -426,8 +424,12 @@ static unsigned long sun3scsi_dma_setup(void *data, unsigned long count, int wri
#else
void *addr;
+ if(sun3_dma_orig_addr != NULL)
+ dvma_unmap(sun3_dma_orig_addr);
+
// addr = sun3_dvma_page((unsigned long)data, (unsigned long)dmabuf);
addr = (void *)dvma_map((unsigned long) data, count);
+
sun3_dma_orig_addr = addr;
sun3_dma_orig_count = count;
#endif
@@ -453,7 +455,6 @@ static unsigned long sun3scsi_dma_setup(void *data, unsigned long count, int wri
dregs->csr &= ~CSR_FIFO;
dregs->csr |= CSR_FIFO;
-
if(dregs->fifo_count != count) {
printk("scsi%d: fifo_mismatch %04x not %04x\n",
default_instance->host_no, dregs->fifo_count,
@@ -518,12 +519,20 @@ static inline unsigned long sun3scsi_dma_residual(struct Scsi_Host *instance)
static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, Scsi_Cmnd *cmd,
int write_flag)
{
- if((cmd->request->cmd == 0) || (cmd->request->cmd == 1))
+ if(cmd->request->flags & REQ_CMD)
return wanted;
else
return 0;
}
+static inline int sun3scsi_dma_start(unsigned long count, unsigned char *data)
+{
+
+ sun3_udc_write(UDC_CHN_START, UDC_CSR);
+
+ return 0;
+}
+
/* clean up after our dma is done */
static int sun3scsi_dma_finish(int write_flag)
{
@@ -532,7 +541,7 @@ static int sun3scsi_dma_finish(int write_flag)
int ret = 0;
sun3_dma_active = 0;
-
+#if 1
// check to empty the fifo on a read
if(!write_flag) {
int tmo = 200000; /* 2 sec */
@@ -541,13 +550,15 @@ static int sun3scsi_dma_finish(int write_flag)
if(dregs->csr & CSR_FIFO_EMPTY)
break;
- if(--tmo <= 0)
+ if(--tmo <= 0) {
+ printk("sun3scsi: fifo failed to empty!\n");
return 1;
-
+ }
udelay(10);
}
}
+#endif
count = sun3scsi_dma_count(default_instance);
#ifdef OLDDMA
@@ -587,6 +598,7 @@ static int sun3scsi_dma_finish(int write_flag)
}
dvma_unmap(sun3_dma_orig_addr);
+ sun3_dma_orig_addr = NULL;
#endif
sun3_udc_write(UDC_RESET, UDC_CSR);
dregs->fifo_count = 0;
diff --git a/drivers/scsi/sun3_scsi.h b/drivers/scsi/sun3_scsi.h
index b5db891c9266..230f8c31c9ab 100644
--- a/drivers/scsi/sun3_scsi.h
+++ b/drivers/scsi/sun3_scsi.h
@@ -1,7 +1,7 @@
/*
* Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
*
- * Sun3 DMA additions by Sam Creasey (sammy@oh.verio.com)
+ * Sun3 DMA additions by Sam Creasey (sammy@sammy.net)
*
* Adapted from mac_scsinew.h:
*/
@@ -36,6 +36,11 @@
#ifndef SUN3_NCR5380_H
#define SUN3_NCR5380_H
+#ifndef NULL
+#define NULL 0
+#endif
+
+
#define SUN3SCSI_PUBLIC_RELEASE 1
/*
@@ -45,17 +50,19 @@
#define IRQ_SUN3_SCSI 2
#define IOBASE_SUN3_SCSI 0x00140000
-int sun3scsi_abort (Scsi_Cmnd *);
-int sun3scsi_detect (Scsi_Host_Template *);
-int sun3scsi_release (struct Scsi_Host *);
-const char *sun3scsi_info (struct Scsi_Host *);
-int sun3scsi_reset(Scsi_Cmnd *, unsigned int);
-int sun3scsi_queue_command (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
-int sun3scsi_proc_info (char *buffer, char **start, off_t offset,
- int length, int hostno, int inout);
+#define IOBASE_SUN3_VMESCSI 0xff200000
-#ifndef NULL
-#define NULL 0
+static int sun3scsi_abort (Scsi_Cmnd *);
+static int sun3scsi_detect (Scsi_Host_Template *);
+static const char *sun3scsi_info (struct Scsi_Host *);
+static int sun3scsi_reset(Scsi_Cmnd *, unsigned int);
+static int sun3scsi_queue_command (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
+static int sun3scsi_proc_info (char *buffer, char **start, off_t offset,
+ int length, int hostno, int inout);
+#ifdef MODULE
+static int sun3scsi_release (struct Scsi_Host *);
+#else
+#define sun3scsi_release NULL
#endif
#ifndef CMD_PER_LUN
@@ -70,26 +77,36 @@ int sun3scsi_proc_info (char *buffer, char **start, off_t offset,
#define SG_TABLESIZE SG_NONE
#endif
+#ifndef MAX_TAGS
+#define MAX_TAGS 32
+#endif
+
#ifndef USE_TAGGED_QUEUING
-#define USE_TAGGED_QUEUING 0
+#define USE_TAGGED_QUEUING 1
#endif
#include <scsi/scsicam.h>
+#ifdef SUN3_SCSI_VME
+#define SUN3_SCSI_NAME "Sun3 NCR5380 VME SCSI"
+#else
+#define SUN3_SCSI_NAME "Sun3 NCR5380 SCSI"
+#endif
+
#define SUN3_NCR5380 { \
-name: "Sun3 NCR5380 SCSI", \
-detect: sun3scsi_detect, \
-release: sun3scsi_release, /* Release */ \
-info: sun3scsi_info, \
-queuecommand: sun3scsi_queue_command, \
-abort: sun3scsi_abort, \
-reset: sun3scsi_reset, \
-can_queue: CAN_QUEUE, /* can queue */ \
-this_id: 7, /* id */ \
-sg_tablesize: SG_ALL, /* sg_tablesize */ \
-cmd_per_lun: CMD_PER_LUN, /* cmd per lun */ \
-unchecked_isa_dma: 0, /* unchecked_isa_dma */ \
-use_clustering: DISABLE_CLUSTERING \
+.name = SUN3_SCSI_NAME, \
+.detect = sun3scsi_detect, \
+.release = sun3scsi_release, /* Release */ \
+.info = sun3scsi_info, \
+.queuecommand = sun3scsi_queue_command, \
+.abort = sun3scsi_abort, \
+.reset = sun3scsi_reset, \
+.can_queue = CAN_QUEUE, /* can queue */ \
+.this_id = 7, /* id */ \
+.sg_tablesize = SG_TABLESIZE, /* sg_tablesize */ \
+.cmd_per_lun = CMD_PER_LUN, /* cmd per lun */ \
+.unchecked_isa_dma = 0, /* unchecked_isa_dma */ \
+.use_clustering = DISABLE_CLUSTERING \
}
#ifndef HOSTS_C
@@ -124,13 +141,20 @@ use_clustering: DISABLE_CLUSTERING \
/* additional registers - mainly DMA control regs */
/* these start at regbase + 8 -- directly after the NCR regs */
struct sun3_dma_regs {
- unsigned short vmeregs[4]; /* unimpl vme stuff */
- unsigned short udc_data; /* udc dma data reg */
- unsigned short udc_addr; /* uda dma addr reg */
+ unsigned short dma_addr_hi; /* vme only */
+ unsigned short dma_addr_lo; /* vme only */
+ unsigned short dma_count_hi; /* vme only */
+ unsigned short dma_count_lo; /* vme only */
+ unsigned short udc_data; /* udc dma data reg (obio only) */
+ unsigned short udc_addr; /* uda dma addr reg (obio only) */
unsigned short fifo_data; /* fifo data reg, holds extra byte on
odd dma reads */
unsigned short fifo_count;
unsigned short csr; /* control/status reg */
+ unsigned short bpack_hi; /* vme only */
+ unsigned short bpack_lo; /* vme only */
+ unsigned short ivect; /* vme only */
+ unsigned short fifo_count_hi; /* vme only */
};
/* ucd chip specific regs - live in dvma space */
@@ -179,11 +203,21 @@ struct sun3_udc_regs {
#define CSR_SDB_INT 0x200 /* sbc interrupt pending */
#define CSR_DMA_INT 0x100 /* dma interrupt pending */
+#define CSR_LEFT 0xc0
+#define CSR_LEFT_3 0xc0
+#define CSR_LEFT_2 0x80
+#define CSR_LEFT_1 0x40
+#define CSR_PACK_ENABLE 0x20
+
+#define CSR_DMA_ENABLE 0x10
+
#define CSR_SEND 0x8 /* 1 = send 0 = recv */
#define CSR_FIFO 0x2 /* reset fifo */
#define CSR_INTR 0x4 /* interrupt enable */
#define CSR_SCSI 0x1
+#define VME_DATA24 0x3d00
+
// debugging printk's, taken from atari_scsi.h
/* Debugging printk definitions:
*
@@ -365,8 +399,6 @@ struct sun3_udc_regs {
#define NCR_PRINT_STATUS(mask) \
((NDEBUG & (mask)) ? NCR5380_print_status(instance) : (void)0)
-#define NDEBUG_ANY 0xffffffff
-
#endif /* ndef HOSTS_C */
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c
new file mode 100644
index 000000000000..f6f2b810f577
--- /dev/null
+++ b/drivers/scsi/sun3_scsi_vme.c
@@ -0,0 +1,567 @@
+/*
+ * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
+ *
+ * Sun3 DMA routines added by Sam Creasey (sammy@sammy.net)
+ *
+ * VME support added by Sam Creasey
+ *
+ * Adapted from sun3_scsi.c -- see there for other headers
+ *
+ * TODO: modify this driver to support multiple Sun3 SCSI VME boards
+ *
+ */
+
+#define AUTOSENSE
+
+#include <linux/types.h>
+#include <linux/stddef.h>
+#include <linux/ctype.h>
+#include <linux/delay.h>
+
+#include <linux/module.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/ioport.h>
+#include <linux/init.h>
+#include <linux/blk.h>
+
+#include <asm/io.h>
+#include <asm/system.h>
+
+#include <asm/sun3ints.h>
+#include <asm/dvma.h>
+#include <asm/idprom.h>
+#include <asm/machines.h>
+
+#define SUN3_SCSI_VME
+
+#undef SUN3_SCSI_DEBUG
+
+/* dma on! */
+#define REAL_DMA
+
+#include "scsi.h"
+#include "hosts.h"
+#include "sun3_scsi.h"
+#include "NCR5380.h"
+
+extern int sun3_map_test(unsigned long, char *);
+
+#define USE_WRAPPER
+/*#define RESET_BOOT */
+#define DRIVER_SETUP
+
+#define NDEBUG 0
+
+/*
+ * BUG can be used to trigger a strange code-size related hang on 2.1 kernels
+ */
+#ifdef BUG
+#undef RESET_BOOT
+#undef DRIVER_SETUP
+#endif
+
+/* #define SUPPORT_TAGS */
+
+//#define ENABLE_IRQ() enable_irq( SUN3_VEC_VMESCSI0 );
+#define ENABLE_IRQ()
+
+
+static void scsi_sun3_intr(int irq, void *dummy, struct pt_regs *fp);
+static inline unsigned char sun3scsi_read(int reg);
+static inline void sun3scsi_write(int reg, int value);
+
+static int setup_can_queue = -1;
+MODULE_PARM(setup_can_queue, "i");
+static int setup_cmd_per_lun = -1;
+MODULE_PARM(setup_cmd_per_lun, "i");
+static int setup_sg_tablesize = -1;
+MODULE_PARM(setup_sg_tablesize, "i");
+#ifdef SUPPORT_TAGS
+static int setup_use_tagged_queuing = -1;
+MODULE_PARM(setup_use_tagged_queuing, "i");
+#endif
+static int setup_hostid = -1;
+MODULE_PARM(setup_hostid, "i");
+
+static Scsi_Cmnd *sun3_dma_setup_done = NULL;
+
+#define AFTER_RESET_DELAY (HZ/2)
+
+/* ms to wait after hitting dma regs */
+#define SUN3_DMA_DELAY 10
+
+/* dvma buffer to allocate -- 32k should hopefully be more than sufficient */
+#define SUN3_DVMA_BUFSIZE 0xe000
+
+/* minimum number of bytes to do dma on */
+#define SUN3_DMA_MINSIZE 128
+
+static volatile unsigned char *sun3_scsi_regp;
+static volatile struct sun3_dma_regs *dregs;
+#ifdef OLDDMA
+static unsigned char *dmabuf = NULL; /* dma memory buffer */
+#endif
+static unsigned char *sun3_dma_orig_addr = NULL;
+static unsigned long sun3_dma_orig_count = 0;
+static int sun3_dma_active = 0;
+static unsigned long last_residual = 0;
+
+/*
+ * NCR 5380 register access functions
+ */
+
+static inline unsigned char sun3scsi_read(int reg)
+{
+ return( sun3_scsi_regp[reg] );
+}
+
+static inline void sun3scsi_write(int reg, int value)
+{
+ sun3_scsi_regp[reg] = value;
+}
+
+/*
+ * XXX: status debug
+ */
+static struct Scsi_Host *default_instance;
+
+/*
+ * Function : int sun3scsi_detect(Scsi_Host_Template * tpnt)
+ *
+ * Purpose : initializes mac NCR5380 driver based on the
+ * command line / compile time port and irq definitions.
+ *
+ * Inputs : tpnt - template for this SCSI adapter.
+ *
+ * Returns : 1 if a host adapter was found, 0 if not.
+ *
+ */
+
+static int sun3scsi_detect(Scsi_Host_Template * tpnt)
+{
+ unsigned long ioaddr, irq;
+ static int called = 0;
+ struct Scsi_Host *instance;
+ int i;
+ unsigned long addrs[3] = { IOBASE_SUN3_VMESCSI,
+ IOBASE_SUN3_VMESCSI + 0x4000,
+ 0 };
+ unsigned long vecs[3] = { SUN3_VEC_VMESCSI0,
+ SUN3_VEC_VMESCSI1,
+ 0 };
+ /* check that this machine has an onboard 5380 */
+ switch(idprom->id_machtype) {
+ case SM_SUN3|SM_3_160:
+ case SM_SUN3|SM_3_260:
+ break;
+
+ default:
+ return 0;
+ }
+
+ if(called)
+ return 0;
+
+ tpnt->proc_name = "Sun3 5380 VME SCSI";
+
+ /* setup variables */
+ tpnt->can_queue =
+ (setup_can_queue > 0) ? setup_can_queue : CAN_QUEUE;
+ tpnt->cmd_per_lun =
+ (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : CMD_PER_LUN;
+ tpnt->sg_tablesize =
+ (setup_sg_tablesize >= 0) ? setup_sg_tablesize : SG_TABLESIZE;
+
+ if (setup_hostid >= 0)
+ tpnt->this_id = setup_hostid;
+ else {
+ /* use 7 as default */
+ tpnt->this_id = 7;
+ }
+
+ ioaddr = 0;
+ for(i = 0; addrs[i] != 0; i++) {
+ unsigned char x;
+
+ ioaddr = (unsigned long)sun3_ioremap(addrs[i], PAGE_SIZE,
+ SUN3_PAGE_TYPE_VME16);
+ irq = vecs[i];
+ sun3_scsi_regp = (unsigned char *)ioaddr;
+
+ dregs = (struct sun3_dma_regs *)(((unsigned char *)ioaddr) + 8);
+
+ if(sun3_map_test((unsigned long)dregs, &x)) {
+ unsigned short oldcsr;
+
+ oldcsr = dregs->csr;
+ dregs->csr = 0;
+ udelay(SUN3_DMA_DELAY);
+ if(dregs->csr == 0x1400)
+ break;
+
+ dregs->csr = oldcsr;
+ }
+
+ iounmap((void *)ioaddr);
+ ioaddr = 0;
+ }
+
+ if(!ioaddr)
+ return 0;
+
+#ifdef SUPPORT_TAGS
+ if (setup_use_tagged_queuing < 0)
+ setup_use_tagged_queuing = USE_TAGGED_QUEUING;
+#endif
+
+ instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
+ if(instance == NULL)
+ return 0;
+
+ default_instance = instance;
+
+ instance->io_port = (unsigned long) ioaddr;
+ instance->irq = irq;
+
+ NCR5380_init(instance, 0);
+
+ instance->n_io_port = 32;
+
+ ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
+
+ if (request_irq(instance->irq, scsi_sun3_intr,
+ 0, "Sun3SCSI-5380VME", NULL)) {
+#ifndef REAL_DMA
+ printk("scsi%d: IRQ%d not free, interrupts disabled\n",
+ instance->host_no, instance->irq);
+ instance->irq = IRQ_NONE;
+#else
+ printk("scsi%d: IRQ%d not free, bailing out\n",
+ instance->host_no, instance->irq);
+ return 0;
+#endif
+ }
+
+ printk("scsi%d: Sun3 5380 VME at port %lX irq", instance->host_no, instance->io_port);
+ if (instance->irq == IRQ_NONE)
+ printk ("s disabled");
+ else
+ printk (" %d", instance->irq);
+ printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
+ instance->can_queue, instance->cmd_per_lun,
+ SUN3SCSI_PUBLIC_RELEASE);
+ printk("\nscsi%d:", instance->host_no);
+ NCR5380_print_options(instance);
+ printk("\n");
+
+ dregs->csr = 0;
+ udelay(SUN3_DMA_DELAY);
+ dregs->csr = CSR_SCSI | CSR_FIFO | CSR_INTR;
+ udelay(SUN3_DMA_DELAY);
+ dregs->fifo_count = 0;
+ dregs->fifo_count_hi = 0;
+ dregs->dma_addr_hi = 0;
+ dregs->dma_addr_lo = 0;
+ dregs->dma_count_hi = 0;
+ dregs->dma_count_lo = 0;
+
+ dregs->ivect = VME_DATA24 | (instance->irq & 0xff);
+
+ called = 1;
+
+#ifdef RESET_BOOT
+ sun3_scsi_reset_boot(instance);
+#endif
+
+ return 1;
+}
+
+#ifdef MODULE
+int sun3scsi_release (struct Scsi_Host *shpnt)
+{
+ if (shpnt->irq != IRQ_NONE)
+ free_irq (shpnt->irq, NULL);
+
+ iounmap(sun3_scsi_regp);
+
+ return 0;
+}
+#endif
+
+#ifdef RESET_BOOT
+/*
+ * Our 'bus reset on boot' function
+ */
+
+static void sun3_scsi_reset_boot(struct Scsi_Host *instance)
+{
+ unsigned long end;
+
+ NCR5380_local_declare();
+ NCR5380_setup(instance);
+
+ /*
+ * Do a SCSI reset to clean up the bus during initialization. No
+ * messing with the queues, interrupts, or locks necessary here.
+ */
+
+ printk( "Sun3 SCSI: resetting the SCSI bus..." );
+
+ /* switch off SCSI IRQ - catch an interrupt without IRQ bit set else */
+// sun3_disable_irq( IRQ_SUN3_SCSI );
+
+ /* get in phase */
+ NCR5380_write( TARGET_COMMAND_REG,
+ PHASE_SR_TO_TCR( NCR5380_read(STATUS_REG) ));
+
+ /* assert RST */
+ NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST );
+
+ /* The min. reset hold time is 25us, so 40us should be enough */
+ udelay( 50 );
+
+ /* reset RST and interrupt */
+ NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE );
+ NCR5380_read( RESET_PARITY_INTERRUPT_REG );
+
+ for( end = jiffies + AFTER_RESET_DELAY; time_before(jiffies, end); )
+ barrier();
+
+ /* switch on SCSI IRQ again */
+// sun3_enable_irq( IRQ_SUN3_SCSI );
+
+ printk( " done\n" );
+}
+#endif
+
+static const char * sun3scsi_info (struct Scsi_Host *spnt) {
+ return "";
+}
+
+// safe bits for the CSR
+#define CSR_GOOD 0x060f
+
+static void scsi_sun3_intr(int irq, void *dummy, struct pt_regs *fp)
+{
+ unsigned short csr = dregs->csr;
+
+ dregs->csr &= ~CSR_DMA_ENABLE;
+
+
+#ifdef SUN3_SCSI_DEBUG
+ printk("scsi_intr csr %x\n", csr);
+#endif
+
+ if(csr & ~CSR_GOOD) {
+ if(csr & CSR_DMA_BUSERR) {
+ printk("scsi%d: bus error in dma\n", default_instance->host_no);
+#ifdef SUN3_SCSI_DEBUG
+ printk("scsi: residual %x count %x addr %p dmaaddr %x\n",
+ dregs->fifo_count,
+ dregs->dma_count_lo | (dregs->dma_count_hi << 16),
+ sun3_dma_orig_addr,
+ dregs->dma_addr_lo | (dregs->dma_addr_hi << 16));
+#endif
+ }
+
+ if(csr & CSR_DMA_CONFLICT) {
+ printk("scsi%d: dma conflict\n", default_instance->host_no);
+ }
+ }
+
+ if(csr & (CSR_SDB_INT | CSR_DMA_INT))
+ NCR5380_intr(irq, dummy, fp);
+}
+
+/*
+ * Debug stuff - to be called on NMI, or sysrq key. Use at your own risk;
+ * reentering NCR5380_print_status seems to have ugly side effects
+ */
+
+/* this doesn't seem to get used at all -- sam */
+#if 0
+void sun3_sun3_debug (void)
+{
+ unsigned long flags;
+ NCR5380_local_declare();
+
+ if (default_instance) {
+ save_flags(flags);
+ cli();
+ NCR5380_print_status(default_instance);
+ restore_flags(flags);
+ }
+}
+#endif
+
+
+/* sun3scsi_dma_setup() -- initialize the dma controller for a read/write */
+static unsigned long sun3scsi_dma_setup(void *data, unsigned long count, int write_flag)
+{
+ void *addr;
+
+ if(sun3_dma_orig_addr != NULL)
+ dvma_unmap(sun3_dma_orig_addr);
+
+// addr = sun3_dvma_page((unsigned long)data, (unsigned long)dmabuf);
+ addr = (void *)dvma_map_vme((unsigned long) data, count);
+
+ sun3_dma_orig_addr = addr;
+ sun3_dma_orig_count = count;
+
+#ifdef SUN3_SCSI_DEBUG
+ printk("scsi: dma_setup addr %p count %x\n", addr, count);
+#endif
+
+// dregs->fifo_count = 0;
+#if 0
+ /* reset fifo */
+ dregs->csr &= ~CSR_FIFO;
+ dregs->csr |= CSR_FIFO;
+#endif
+ /* set direction */
+ if(write_flag)
+ dregs->csr |= CSR_SEND;
+ else
+ dregs->csr &= ~CSR_SEND;
+
+ /* reset fifo */
+// dregs->csr &= ~CSR_FIFO;
+// dregs->csr |= CSR_FIFO;
+
+ dregs->csr |= CSR_PACK_ENABLE;
+
+ dregs->dma_addr_hi = ((unsigned long)addr >> 16);
+ dregs->dma_addr_lo = ((unsigned long)addr & 0xffff);
+
+ dregs->dma_count_hi = 0;
+ dregs->dma_count_lo = 0;
+ dregs->fifo_count_hi = 0;
+ dregs->fifo_count = 0;
+
+#ifdef SUN3_SCSI_DEBUG
+ printk("scsi: dma_setup done csr %x\n", dregs->csr);
+#endif
+ return count;
+
+}
+
+static inline unsigned long sun3scsi_dma_residual(struct Scsi_Host *instance)
+{
+ return last_residual;
+}
+
+static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, Scsi_Cmnd *cmd,
+ int write_flag)
+{
+ if(cmd->request->flags & REQ_CMD)
+ return wanted;
+ else
+ return 0;
+}
+
+static int sun3scsi_dma_start(unsigned long count, char *data)
+{
+
+ unsigned short csr;
+
+ csr = dregs->csr;
+#ifdef SUN3_SCSI_DEBUG
+ printk("scsi: dma_start data %p count %x csr %x fifo %x\n", data, count, csr, dregs->fifo_count);
+#endif
+
+ dregs->dma_count_hi = (sun3_dma_orig_count >> 16);
+ dregs->dma_count_lo = (sun3_dma_orig_count & 0xffff);
+
+ dregs->fifo_count_hi = (sun3_dma_orig_count >> 16);
+ dregs->fifo_count = (sun3_dma_orig_count & 0xffff);
+
+// if(!(csr & CSR_DMA_ENABLE))
+// dregs->csr |= CSR_DMA_ENABLE;
+
+ return 0;
+}
+
+/* clean up after our dma is done */
+static int sun3scsi_dma_finish(int write_flag)
+{
+ unsigned short fifo;
+ int ret = 0;
+
+ sun3_dma_active = 0;
+
+ dregs->csr &= ~CSR_DMA_ENABLE;
+
+ fifo = dregs->fifo_count;
+ if(write_flag) {
+ if((fifo > 0) && (fifo < sun3_dma_orig_count))
+ fifo++;
+ }
+
+ last_residual = fifo;
+#ifdef SUN3_SCSI_DEBUG
+ printk("scsi: residual %x total %x\n", fifo, sun3_dma_orig_count);
+#endif
+ /* empty bytes from the fifo which didn't make it */
+ if((!write_flag) && (dregs->csr & CSR_LEFT)) {
+ unsigned char *vaddr;
+
+#ifdef SUN3_SCSI_DEBUG
+ printk("scsi: got left over bytes\n");
+#endif
+
+ vaddr = (unsigned char *)dvma_vmetov(sun3_dma_orig_addr);
+
+ vaddr += (sun3_dma_orig_count - fifo);
+ vaddr--;
+
+ switch(dregs->csr & CSR_LEFT) {
+ case CSR_LEFT_3:
+ *vaddr = (dregs->bpack_lo & 0xff00) >> 8;
+ vaddr--;
+
+ case CSR_LEFT_2:
+ *vaddr = (dregs->bpack_hi & 0x00ff);
+ vaddr--;
+
+ case CSR_LEFT_1:
+ *vaddr = (dregs->bpack_hi & 0xff00) >> 8;
+ break;
+ }
+
+
+ }
+
+ dvma_unmap(sun3_dma_orig_addr);
+ sun3_dma_orig_addr = NULL;
+
+ dregs->dma_addr_hi = 0;
+ dregs->dma_addr_lo = 0;
+ dregs->dma_count_hi = 0;
+ dregs->dma_count_lo = 0;
+
+ dregs->fifo_count = 0;
+ dregs->fifo_count_hi = 0;
+
+ dregs->csr &= ~CSR_SEND;
+
+// dregs->csr |= CSR_DMA_ENABLE;
+
+#if 0
+ /* reset fifo */
+ dregs->csr &= ~CSR_FIFO;
+ dregs->csr |= CSR_FIFO;
+#endif
+ sun3_dma_setup_done = NULL;
+
+ return ret;
+
+}
+
+#include "sun3_NCR5380.c"
+
+static Scsi_Host_Template driver_template = SUN3_NCR5380;
+
+#include "scsi_module.c"
+
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 0aea0993fa10..76607c5e190a 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -343,27 +343,28 @@ static void dma_mmu_get_scsi_one (struct NCR_ESP *esp, Scsi_Cmnd *sp)
static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
int sz = sp->SCp.buffers_residual;
- struct mmu_sglist *sg = (struct mmu_sglist *) sp->SCp.buffer;
+ struct scatterlist *sg = sp->SCp.buffer;
while (sz >= 0) {
- sg[sz].dvma_addr = dvma_map((unsigned long)sg[sz].addr, sg[sz].len);
- sz--;
+ sg[sz].dvma_address = dvma_map((unsigned long)page_address(sg[sz].page) +
+ sg[sz].offset, sg[sz].length);
+ sz--;
}
sp->SCp.ptr=(char *)((unsigned long)sp->SCp.buffer->dvma_address);
}
static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
- dvma_unmap(sp->SCp.have_data_in);
+ dvma_unmap((char *)sp->SCp.have_data_in);
}
static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
int sz = sp->use_sg - 1;
- struct mmu_sglist *sg = (struct mmu_sglist *)sp->buffer;
+ struct scatterlist *sg = (struct scatterlist *)sp->buffer;
while(sz >= 0) {
- dvma_unmap(sg[sz].dvma_addr);
+ dvma_unmap((char *)sg[sz].dvma_address);
sz--;
}
}
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index ec962ac3112e..ae682b076171 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -350,9 +350,8 @@ config FB_STI
console or the IODC BIOS.
config FB_MAC
- bool
+ bool "Generic Macintosh display support"
depends on FB && MAC
- default y
# bool ' Apple DAFB display support' CONFIG_FB_DAFB
config FB_HP300
diff --git a/drivers/video/fbcon.c b/drivers/video/fbcon.c
index e6916fa97b85..0b0db4edcfa0 100644
--- a/drivers/video/fbcon.c
+++ b/drivers/video/fbcon.c
@@ -627,7 +627,7 @@ static void fbcon_setup(int con, int init, int logo)
}
if (!fontwidthvalid(p,fontwidth(p))) {
-#ifdef CONFIG_FBCON_MAC
+#if defined(CONFIG_FBCON_MAC) && defined(CONFIG_MAC)
if (MACH_IS_MAC)
/* ++Geert: hack to make 6x11 fonts work on mac */
p->dispsw = &fbcon_mac;
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c
index 706eb0c6dc53..e3fed03b4445 100644
--- a/drivers/video/hpfb.c
+++ b/drivers/video/hpfb.c
@@ -78,29 +78,29 @@ static int hpfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *info)
{
- while (readw(fb_regs + 0x6002) & 0x4) udelay(1);
- writew(0, fb_regs + 0x60f0);
- writew(regno, fb_regs + 0x60b8);
- writew(red, fb_regs + 0x60b2);
- writew(green, fb_regs + 0x60b4);
- writew(blue, fb_regs + 0x60b6);
- writew(0xff, fb_regs + 0x60f0);
+ while (in_be16(fb_regs + 0x6002) & 0x4) udelay(1);
+ out_be16(fb_regs + 0x60f0, 0);
+ out_be16(fb_regs + 0x60b8, regno);
+ out_be16(fb_regs + 0x60b2, red);
+ out_be16(fb_regs + 0x60b4, green);
+ out_be16(fb_regs + 0x60b6, blue);
+ out_be16(fb_regs + 0x60f0, 0xff);
udelay(100);
- writew(0xffff, fb_regs + 0x60ba);
+ out_be16(fb_regs + 0x60ba, 0xffff);
return 0;
}
void hpfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
{
- while (readb(fb_regs + BUSY) & fb_bitmask);
- writeb(0x3, fb_regs + WMRR);
- writew(area->sx, fb_regs + SOURCE_X);
- writew(area->sy, fb_regs + SOURCE_Y);
- writew(area->dx, fb_regs + DEST_X);
- writew(area->dy, fb_regs + DEST_Y);
- writew(area->height, fb_regs + WHEIGHT);
- writew(area->width, fb_regs + WWIDTH);
- writeb(fb_bitmask, fb_regs + WMOVE);
+ while (in_8(fb_regs + BUSY) & fb_bitmask);
+ out_8(fb_regs + WMRR, 0x3);
+ out_be16(fb_regs + SOURCE_X, area->sx);
+ out_be16(fb_regs + SOURCE_Y, area->sy);
+ out_be16(fb_regs + DEST_X, area->dx);
+ out_be16(fb_regs + DEST_Y, area->dy);
+ out_be16(fb_regs + WHEIGHT, area->height);
+ out_be16(fb_regs + WWIDTH, area->width);
+ out_8(fb_regs + WMOVE, fb_bitmask);
}
static struct fb_ops hpfb_ops = {
@@ -121,38 +121,37 @@ int __init hpfb_init_one(unsigned long base)
{
unsigned long fboff;
- fboff = (readb(base + TOPCAT_FBOMSB) << 8)
- | readb(base + TOPCAT_FBOLSB);
+ fboff = (in_8(base + TOPCAT_FBOMSB) << 8) | in_8(base + TOPCAT_FBOLSB);
- hpfb_fix.smem_start = 0xf0000000 | (readb(base + fboff) << 16);
+ hpfb_fix.smem_start = 0xf0000000 | (in_8(base + fboff) << 16);
fb_regs = base;
#if 0
/* This is the magic incantation NetBSD uses to make Catseye boards work. */
- writeb(0, base+0x4800);
- writeb(0, base+0x4510);
- writeb(0, base+0x4512);
- writeb(0, base+0x4514);
- writeb(0, base+0x4516);
- writeb(0x90, base+0x4206);
+ out_8(base+0x4800, 0);
+ out_8(base+0x4510, 0);
+ out_8(base+0x4512, 0);
+ out_8(base+0x4514, 0);
+ out_8(base+0x4516, 0);
+ out_8(base+0x4206, 0x90);
#endif
/*
* Give the hardware a bit of a prod and work out how many bits per
* pixel are supported.
*/
- writeb(0xff, base + TC_WEN);
- writeb(0xff, base + TC_FBEN);
- writeb(0xff, hpfb_fix.smem_start);
- fb_bitmask = readb(hpfb_fix.smem_start);
+ out_8(base + TC_WEN, 0xff);
+ out_8(base + TC_FBEN, 0xff);
+ out_8(hpfb_fix.smem_start, 0xff);
+ fb_bitmask = in_8(hpfb_fix.smem_start);
/*
* Enable reading/writing of all the planes.
*/
- writeb(fb_bitmask, base + TC_WEN);
- writeb(fb_bitmask, base + TC_REN);
- writeb(fb_bitmask, base + TC_FBEN);
- writeb(0x1, base + TC_NBLANK);
+ out_8(base + TC_WEN, fb_bitmask);
+ out_8(base + TC_REN, fb_bitmask);
+ out_8(base + TC_FBEN, fb_bitmask);
+ out_8(base + TC_NBLANK, 0x1);
/*
* Let there be consoles..
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c
index 2a10b08b3f08..face29ba5423 100644
--- a/drivers/zorro/proc.c
+++ b/drivers/zorro/proc.c
@@ -51,7 +51,7 @@ proc_bus_zorro_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
struct proc_dir_entry *dp = PDE(ino);
struct zorro_dev *dev = dp->data;
struct ConfigDev cd;
- int pos = *ppos;
+ loff_t pos = *ppos;
if (pos >= sizeof(struct ConfigDev))
return 0;
diff --git a/drivers/zorro/zorro.ids b/drivers/zorro/zorro.ids
index 1f7378847c80..5bd4b05d4c45 100644
--- a/drivers/zorro/zorro.ids
+++ b/drivers/zorro/zorro.ids
@@ -4,7 +4,7 @@
# Maintained by Geert Uytterhoeven <zorro@linux-m68k.org>
# If you have any new entries, please send them to the maintainer.
#
-# $Id: zorro.ids,v 1.17 2001/10/25 08:21:39 geert Exp $
+# $Id: zorro.ids,v 1.19 2002/10/14 13:08:58 geert Exp $
#
# Manufacturers and Products. Please keep sorted.
@@ -364,7 +364,13 @@
1300 Warp Engine 40xx [Accelerator, SCSI Host Adapter and RAM Expansion]
089e ElBox Computer
0600 1200/4 [RAM Expansion]
- 1900 PowerFlyer [IDE Interface]
+ 0800 FastATA 1200 [IDE Interface]
+ 1200 FastATA 1200 [IDE Interface]
+ 1300 FastATA 1200 [IDE Interface]
+ 1800 FastATA 1200 [IDE Interface]
+ 1900 FastATA 4000 [IDE Interface]
+ 1d00 FastATA 4000 [IDE Interface]
+ 1e00 FastATA ZIV [IDE Interface]
0a00 Harms Professional
1000 030 Plus [Accelerator]
d000 3500 Professional [Accelerator and RAM Expansion]
diff --git a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h
index f3fa10674a9e..25ef68a2109f 100644
--- a/include/asm-m68k/checksum.h
+++ b/include/asm-m68k/checksum.h
@@ -26,8 +26,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
extern unsigned int csum_partial_copy_from_user(const char *src, char *dst,
int len, int sum, int *csum_err);
-#define csum_partial_copy_nocheck(src, dst, len, sum) \
- csum_partial_copy((src), (dst), (len), (sum))
+extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst,
+ int len, int sum);
/*
* This is a version of ip_compute_csum() optimized for IP headers,
diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h
index f7a6dcfabc4e..7a1653507f82 100644
--- a/include/asm-m68k/dvma.h
+++ b/include/asm-m68k/dvma.h
@@ -22,7 +22,8 @@ extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
#define dvma_malloc(x) dvma_malloc_align(x, 0)
#define dvma_map(x, y) dvma_map_align(x, y, 0)
-
+#define dvma_map_vme(x, y) (dvma_map(x, y) & 0xfffff)
+#define dvma_map_align_vme(x, y, z) (dvma_map_align (x, y, z) & 0xfffff)
extern unsigned long dvma_map_align(unsigned long kaddr, int len,
int align);
extern void *dvma_malloc_align(unsigned long len, unsigned long align);
@@ -52,6 +53,8 @@ extern void dvma_free(void *vaddr);
/* virt <-> phys conversions */
#define dvma_vtop(x) ((unsigned long)(x) & 0xffffff)
#define dvma_ptov(x) ((unsigned long)(x) | 0xf000000)
+#define dvma_vtovme(x) ((unsigned long)(x) & 0x00fffff)
+#define dvma_vmetov(x) ((unsigned long)(x) | 0xff00000)
#define dvma_vtob(x) dvma_vtop(x)
#define dvma_btov(x) dvma_ptov(x)
diff --git a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h
index 57aac63d8892..1a9bb3b97a4f 100644
--- a/include/asm-m68k/floppy.h
+++ b/include/asm-m68k/floppy.h
@@ -9,7 +9,7 @@
*
* Copyright (C) 1999, 2000, 2001
*
- * Sun3x support added 2/4/2000 Sam Creasey (sammy@oh.verio.com)
+ * Sun3x support added 2/4/2000 Sam Creasey (sammy@sammy.net)
*
*/
diff --git a/include/asm-m68k/hardirq.h b/include/asm-m68k/hardirq.h
index 6b2248372f78..5a5db2a7718e 100644
--- a/include/asm-m68k/hardirq.h
+++ b/include/asm-m68k/hardirq.h
@@ -7,24 +7,87 @@
/* entry.S is sensitive to the offsets of these fields */
typedef struct {
unsigned int __softirq_pending;
- unsigned int __local_irq_count;
- unsigned int __local_bh_count;
unsigned int __syscall_count;
struct task_struct * __ksoftirqd_task;
} ____cacheline_aligned irq_cpustat_t;
#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
-#define in_interrupt() (local_irq_count(smp_processor_id()) + local_bh_count(smp_processor_id()) != 0)
+/*
+ * We put the hardirq and softirq counter into the preemption
+ * counter. The bitmask has the following meaning:
+ *
+ * - bits 0-7 are the preemption count (max preemption depth: 256)
+ * - bits 8-15 are the softirq count (max # of softirqs: 256)
+ * - bits 16-23 are the hardirq count (max # of hardirqs: 256)
+ *
+ * - ( bit 26 is the PREEMPT_ACTIVE flag. )
+ *
+ * PREEMPT_MASK: 0x000000ff
+ * HARDIRQ_MASK: 0x0000ff00
+ * SOFTIRQ_MASK: 0x00ff0000
+ */
-#define in_irq() (local_irq_count(smp_processor_id()) != 0)
+#define PREEMPT_BITS 8
+#define SOFTIRQ_BITS 8
+#define HARDIRQ_BITS 8
-#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
-#define hardirq_endlock(cpu) do { } while (0)
+#define PREEMPT_SHIFT 0
+#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
+#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
-#define irq_enter(cpu) (local_irq_count(cpu)++)
-#define irq_exit(cpu) (local_irq_count(cpu)--)
+#define __MASK(x) ((1UL << (x))-1)
-#define synchronize_irq() barrier()
+#define PREEMPT_MASK (__MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
+#define HARDIRQ_MASK (__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
+#define SOFTIRQ_MASK (__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
+
+#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
+#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
+#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK))
+
+#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
+#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
+#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
+
+/*
+ * The hardirq mask has to be large enough to have
+ * space for potentially all IRQ sources in the system
+ * nesting on a single CPU:
+ */
+#if (1 << HARDIRQ_BITS) < NR_IRQS
+# error HARDIRQ_BITS is too low!
+#endif
+
+/*
+ * Are we doing bottom half or hardware interrupt processing?
+ * Are we in a softirq context? Interrupt context?
+ */
+#define in_irq() (hardirq_count())
+#define in_softirq() (softirq_count())
+#define in_interrupt() (irq_count())
+
+
+#define hardirq_trylock() (!in_interrupt())
+#define hardirq_endlock() do { } while (0)
+
+#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
+
+#if CONFIG_PREEMPT
+# define in_atomic() (preempt_count() != kernel_locked())
+# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
+#else
+# define in_atomic() (preempt_count() != 0)
+# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
+#endif
+#define irq_exit() \
+do { \
+ preempt_count() -= IRQ_EXIT_OFFSET; \
+ if (!in_interrupt() && softirq_pending(smp_processor_id())) \
+ do_softirq(); \
+ preempt_enable_no_resched(); \
+} while (0)
+
+#define synchronize_irq(irq) barrier()
#endif
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index d6fb3074ab77..6acb7ffdde15 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -280,18 +280,6 @@ static inline void isa_delay(void)
#endif /* CONFIG_PCI */
-/* Values for nocacheflag and cmode */
-#define IOMAP_FULL_CACHING 0
-#define IOMAP_NOCACHE_SER 1
-#define IOMAP_NOCACHE_NONSER 2
-#define IOMAP_WRITETHROUGH 3
-
-extern void iounmap(void *addr);
-
-extern void *__ioremap(unsigned long physaddr, unsigned long size,
- int cacheflag);
-extern void __iounmap(void *addr, unsigned long size);
-
extern inline void *ioremap(unsigned long physaddr, unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
diff --git a/include/asm-m68k/kmap_types.h b/include/asm-m68k/kmap_types.h
new file mode 100644
index 000000000000..3d43a7f936e8
--- /dev/null
+++ b/include/asm-m68k/kmap_types.h
@@ -0,0 +1,21 @@
+#ifndef __ASM_M68K_KMAP_TYPES_H
+#define __ASM_M68K_KMAP_TYPES_H
+
+#include <linux/config.h>
+
+enum km_type {
+ KM_BOUNCE_READ,
+ KM_SKB_SUNRPC_DATA,
+ KM_SKB_DATA_SOFTIRQ,
+ KM_USER0,
+ KM_USER1,
+ KM_BIO_SRC_IRQ,
+ KM_BIO_DST_IRQ,
+ KM_PTE0,
+ KM_PTE1,
+ KM_IRQ0,
+ KM_IRQ1,
+ KM_TYPE_NR
+};
+
+#endif /* __ASM_M68K_KMAP_TYPES_H */
diff --git a/include/asm-m68k/nubus.h b/include/asm-m68k/nubus.h
index b810d4c3bbe1..6f9ebbf07fc9 100644
--- a/include/asm-m68k/nubus.h
+++ b/include/asm-m68k/nubus.h
@@ -1,7 +1,7 @@
#ifndef _ASM_M68K_NUBUS_H
#define _ASM_M68K_NUBUS_H
-#include <asm/io.h>
+#include <asm/raw_io.h>
#define nubus_readb raw_inb
#define nubus_readw raw_inw
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index be5a7869742a..7ca3578dfa8f 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -124,6 +124,7 @@ extern __inline__ int get_order(unsigned long size)
#ifndef CONFIG_SUN3
+#define WANT_PAGE_VIRTUAL
#ifdef CONFIG_SINGLE_MEMORY_CHUNK
extern unsigned long m68k_memoffset;
diff --git a/include/asm-m68k/percpu.h b/include/asm-m68k/percpu.h
new file mode 100644
index 000000000000..0859d048faf5
--- /dev/null
+++ b/include/asm-m68k/percpu.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_M68K_PERCPU_H
+#define __ASM_M68K_PERCPU_H
+
+#include <asm-generic/percpu.h>
+
+#endif /* __ASM_M68K_PERCPU_H */
diff --git a/include/asm-m68k/poll.h b/include/asm-m68k/poll.h
index 32dcf6490669..c4b69c4a87e1 100644
--- a/include/asm-m68k/poll.h
+++ b/include/asm-m68k/poll.h
@@ -12,6 +12,7 @@
#define POLLRDBAND 128
#define POLLWRBAND 256
#define POLLMSG 0x0400
+#define POLLREMOVE 0x1000
struct pollfd {
int fd;
diff --git a/include/asm-m68k/q40_master.h b/include/asm-m68k/q40_master.h
index d44f30265717..9bce91505117 100644
--- a/include/asm-m68k/q40_master.h
+++ b/include/asm-m68k/q40_master.h
@@ -10,7 +10,6 @@
#define q40_master_addr 0xff000000
-#define q40_rtc_addr 0xff021ffc
#define IIRQ_REG 0x0 /* internal IRQ reg */
#define EIRQ_REG 0x4 /* external ... */
@@ -43,28 +42,25 @@
#define master_inb(_reg_) in_8((unsigned char *)q40_master_addr+_reg_)
#define master_outb(_b_,_reg_) out_8((unsigned char *)q40_master_addr+_reg_,_b_)
-
-/* define some Q40 specific ints */
-#include "q40ints.h"
-
/* RTC defines */
-#define Q40_RTC_BASE (q40_rtc_addr)
-
-#define RTC_YEAR (*(unsigned char *)(Q40_RTC_BASE+0))
-#define RTC_MNTH (*(unsigned char *)(Q40_RTC_BASE-4))
-#define RTC_DATE (*(unsigned char *)(Q40_RTC_BASE-8))
-#define RTC_DOW (*(unsigned char *)(Q40_RTC_BASE-12))
-#define RTC_HOUR (*(unsigned char *)(Q40_RTC_BASE-16))
-#define RTC_MINS (*(unsigned char *)(Q40_RTC_BASE-20))
-#define RTC_SECS (*(unsigned char *)(Q40_RTC_BASE-24))
-#define RTC_CTRL (*(unsigned char *)(Q40_RTC_BASE-28))
+#define Q40_RTC_BASE (0xff021ffc)
+#define Q40_RTC_YEAR (*(volatile unsigned char *)(Q40_RTC_BASE+0))
+#define Q40_RTC_MNTH (*(volatile unsigned char *)(Q40_RTC_BASE-4))
+#define Q40_RTC_DATE (*(volatile unsigned char *)(Q40_RTC_BASE-8))
+#define Q40_RTC_DOW (*(volatile unsigned char *)(Q40_RTC_BASE-12))
+#define Q40_RTC_HOUR (*(volatile unsigned char *)(Q40_RTC_BASE-16))
+#define Q40_RTC_MINS (*(volatile unsigned char *)(Q40_RTC_BASE-20))
+#define Q40_RTC_SECS (*(volatile unsigned char *)(Q40_RTC_BASE-24))
+#define Q40_RTC_CTRL (*(volatile unsigned char *)(Q40_RTC_BASE-28))
/* some control bits */
-#define RTC_READ 64 /* prepare for reading */
-#define RTC_WRITE 128
+#define Q40_RTC_READ 64 /* prepare for reading */
+#define Q40_RTC_WRITE 128
+/* define some Q40 specific ints */
+#include "q40ints.h"
/* misc defs */
#define DAC_LEFT ((unsigned char *)0xff008000)
diff --git a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h
index d794d0f2e557..ca4868f1d42c 100644
--- a/include/asm-m68k/raw_io.h
+++ b/include/asm-m68k/raw_io.h
@@ -11,6 +11,19 @@
#ifdef __KERNEL__
+/* Values for nocacheflag and cmode */
+#define IOMAP_FULL_CACHING 0
+#define IOMAP_NOCACHE_SER 1
+#define IOMAP_NOCACHE_NONSER 2
+#define IOMAP_WRITETHROUGH 3
+
+extern void iounmap(void *addr);
+
+extern void *__ioremap(unsigned long physaddr, unsigned long size,
+ int cacheflag);
+extern void __iounmap(void *addr, unsigned long size);
+
+
/* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
* two accesses to memory, which may be undesirable for some devices.
*/
diff --git a/include/asm-m68k/rtc.h b/include/asm-m68k/rtc.h
index b28f54735a72..674d7ccf8001 100644
--- a/include/asm-m68k/rtc.h
+++ b/include/asm-m68k/rtc.h
@@ -33,6 +33,36 @@ extern void gen_rtc_interrupt(unsigned long);
#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
+static inline void get_rtc_time(struct rtc_time *time)
+{
+ /*
+ * Only the values that we read from the RTC are set. We leave
+ * tm_wday, tm_yday and tm_isdst untouched. Even though the
+ * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
+ * by the RTC when initially set to a non-zero value.
+ */
+ mach_hwclk(0, time);
+}
+
+static inline int set_rtc_time(struct rtc_time *time)
+{
+ return mach_hwclk(1, time);
+}
+
+static inline int get_rtc_pll(struct rtc_pll_info *pll)
+{
+ if (mach_get_rtc_pll)
+ return mach_get_rtc_pll(pll);
+ else
+ return -EINVAL;
+}
+static inline int set_rtc_pll(struct rtc_pll_info *pll)
+{
+ if (mach_set_rtc_pll)
+ return mach_set_rtc_pll(pll);
+ else
+ return -EINVAL;
+}
#endif /* __KERNEL__ */
diff --git a/include/asm-m68k/softirq.h b/include/asm-m68k/softirq.h
index c35c800e3c0d..0c2f0e2044c6 100644
--- a/include/asm-m68k/softirq.h
+++ b/include/asm-m68k/softirq.h
@@ -6,14 +6,19 @@
*/
#include <asm/atomic.h>
+#include <asm/hardirq.h>
-#define cpu_bh_disable(cpu) do { local_bh_count(cpu)++; barrier(); } while (0)
-#define cpu_bh_enable(cpu) do { barrier(); local_bh_count(cpu)--; } while (0)
+#define local_bh_disable() \
+ do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0)
+#define __local_bh_enable() \
+ do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0)
-#define local_bh_disable() cpu_bh_disable(smp_processor_id())
-#define local_bh_enable() cpu_bh_enable(smp_processor_id())
-#define __local_bh_enable() local_bh_enable()
-
-#define in_softirq() (local_bh_count(smp_processor_id()) != 0)
+#define local_bh_enable() \
+do { \
+ __local_bh_enable(); \
+ if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \
+ do_softirq(); \
+ preempt_check_resched(); \
+} while (0)
#endif
diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h
index c30e1b6a50cb..94f257d93c23 100644
--- a/include/asm-m68k/sun3_pgalloc.h
+++ b/include/asm-m68k/sun3_pgalloc.h
@@ -95,14 +95,4 @@ static inline pgd_t * pgd_alloc(struct mm_struct *mm)
#define pgd_populate(mm, pmd, pte) BUG()
-
-/* Reserved PMEGs. */
-extern char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
-extern unsigned long pmeg_vaddr[SUN3_PMEGS_NUM];
-extern unsigned char pmeg_alloc[SUN3_PMEGS_NUM];
-extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM];
-
-
-#define check_pgt_cache() do { } while (0)
-
#endif /* SUN3_PGALLOC_H */
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h
index 408f33f9b440..5ce63422c57a 100644
--- a/include/asm-m68k/sun3ints.h
+++ b/include/asm-m68k/sun3ints.h
@@ -21,6 +21,8 @@
#include <asm/intersil.h>
#include <asm/oplib.h>
+#define SUN3_INT_VECS 192
+
void sun3_enable_irq(unsigned int irq);
void sun3_disable_irq(unsigned int irq);
int sun3_request_irq(unsigned int irq,
@@ -37,5 +39,11 @@ extern int show_sun3_interrupts(struct seq_file *, void *);
extern void sun3_process_int(int, struct pt_regs *);
extern volatile unsigned char* sun3_intreg;
+/* master list of VME vectors -- don't fuck with this */
+#define SUN3_VEC_FLOPPY 0x40
+#define SUN3_VEC_VMESCSI0 0x40
+#define SUN3_VEC_VMESCSI1 0x41
+#define SUN3_VEC_CG 0xA8
+
#endif /* SUN3INTS_H */
diff --git a/include/asm-m68k/sun3mmu.h b/include/asm-m68k/sun3mmu.h
index 7277c2b77b1d..72e65f3ebe60 100644
--- a/include/asm-m68k/sun3mmu.h
+++ b/include/asm-m68k/sun3mmu.h
@@ -161,6 +161,10 @@ extern __inline__ void sun3_put_context(unsigned char c)
return;
}
+extern void *sun3_ioremap(unsigned long phys, unsigned long size,
+ unsigned long type);
+
+extern int sun3_map_test(unsigned long addr, char *val);
#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-m68k/sun3xflop.h b/include/asm-m68k/sun3xflop.h
index 015bc0abbc9c..10db3451f5c7 100644
--- a/include/asm-m68k/sun3xflop.h
+++ b/include/asm-m68k/sun3xflop.h
@@ -3,7 +3,7 @@
* Derived partially from asm-sparc/floppy.h, which is:
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*
- * Sun3x version 2/4/2000 Sam Creasey (sammy@oh.verio.com)
+ * Sun3x version 2/4/2000 Sam Creasey (sammy@sammy.net)
*/
#ifndef __ASM_SUN3X_FLOPPY_H
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h
index 974db3b084b7..8fe94c6017fd 100644
--- a/include/asm-m68k/system.h
+++ b/include/asm-m68k/system.h
@@ -7,11 +7,6 @@
#include <asm/segment.h>
#include <asm/entry.h>
-#define prepare_arch_schedule(prev) do { } while(0)
-#define finish_arch_schedule(prev) do { } while(0)
-#define prepare_arch_switch(rq) do { } while(0)
-#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock)
-
/*
* switch_to(n) should switch tasks to task ptr, first checking that
* ptr isn't the current task, in which case it does nothing. This
@@ -52,24 +47,25 @@ asmlinkage void resume(void);
#define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
#else
#include <asm/hardirq.h>
-#define local_irq_enable() ({ \
- if (MACH_IS_Q40 || !local_irq_count(smp_processor_id())) \
- asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \
+#define local_irq_enable() ({ \
+ if (MACH_IS_Q40 || !hardirq_count()) \
+ asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \
})
#endif
#define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory")
#define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory")
#define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
+static inline int irqs_disabled(void)
+{
+ unsigned long flags;
+ local_save_flags(flags);
+ return flags & ~ALLOWINT;
+}
+
/* For spinlocks etc */
#define local_irq_save(x) ({ local_save_flags(x); local_irq_disable(); })
-#define cli() local_irq_disable()
-#define sti() local_irq_enable()
-#define save_flags(x) local_save_flags(x)
-#define restore_flags(x) local_irq_restore(x)
-#define save_and_cli(flags) do { save_flags(flags); cli(); } while(0)
-
/*
* Force strict CPU ordering.
* Not really required on m68k...
@@ -95,33 +91,29 @@ struct __xchg_dummy { unsigned long a[100]; };
#ifndef CONFIG_RMW_INSNS
static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
{
- unsigned long tmp, flags;
-
- save_flags(flags);
- cli();
-
- switch (size) {
- case 1:
- __asm__ __volatile__
- ("moveb %2,%0\n\t"
- "moveb %1,%2"
- : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
- break;
- case 2:
- __asm__ __volatile__
- ("movew %2,%0\n\t"
- "movew %1,%2"
- : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
- break;
- case 4:
- __asm__ __volatile__
- ("movel %2,%0\n\t"
- "movel %1,%2"
- : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
- break;
- }
- restore_flags(flags);
- return tmp;
+ unsigned long flags, tmp;
+
+ local_irq_save(flags);
+
+ switch (size) {
+ case 1:
+ tmp = *(u8 *)ptr;
+ *(u8 *)ptr = x;
+ break;
+ case 2:
+ tmp = *(u16 *)ptr;
+ *(u16 *)ptr = x;
+ break;
+ case 4:
+ tmp = *(u32 *)ptr;
+ *(u32 *)ptr = x;
+ break;
+ default:
+ BUG();
+ }
+
+ local_irq_restore(flags);
+ return tmp;
}
#else
static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h
index 64c9f51e0c63..55244ef06d37 100644
--- a/include/asm-m68k/thread_info.h
+++ b/include/asm-m68k/thread_info.h
@@ -18,8 +18,8 @@ struct thread_info {
#define INIT_THREAD_INFO(tsk) \
{ \
- task: &tsk, \
- exec_domain: &default_exec_domain, \
+ .task = &tsk, \
+ .exec_domain = &default_exec_domain, \
}
/* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */
@@ -60,6 +60,9 @@ extern int thread_flag_fixme(void);
case TIF_NEED_RESCHED: \
tsk->thread.work.need_resched = val; \
break; \
+ case TIF_SYSCALL_TRACE: \
+ tsk->thread.work.syscall_trace = val; \
+ break; \
default: \
thread_flag_fixme(); \
} \
@@ -74,6 +77,9 @@ extern int thread_flag_fixme(void);
case TIF_NEED_RESCHED: \
___res = tsk->thread.work.need_resched; \
break; \
+ case TIF_SYSCALL_TRACE: \
+ ___res = tsk->thread.work.syscall_trace;\
+ break; \
default: \
___res = thread_flag_fixme(); \
} \
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index 73a99d70a860..9bf9159327e5 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -20,7 +20,6 @@
*/
#ifndef CONFIG_SUN3
extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const));
-extern unsigned long mm_vtop_fallback (unsigned long) __attribute__ ((const));
extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const));
#else
extern inline unsigned long mm_vtop(unsigned long vaddr)
@@ -35,39 +34,22 @@ extern inline unsigned long mm_ptov(unsigned long paddr)
#endif
#ifdef CONFIG_SINGLE_MEMORY_CHUNK
-extern inline unsigned long virt_to_phys(volatile void *vaddr)
+static inline unsigned long virt_to_phys(void *vaddr)
{
- unsigned long voff = (unsigned long)vaddr - PAGE_OFFSET;
-
- if (voff < m68k_memory[0].size)
- return voff + m68k_memory[0].addr;
- return mm_vtop_fallback((unsigned long)vaddr);
+ return (unsigned long)vaddr - PAGE_OFFSET + m68k_memory[0].addr;
}
-extern inline void * phys_to_virt(unsigned long paddr)
+static inline void * phys_to_virt(unsigned long paddr)
{
- unsigned long poff = paddr - m68k_memory[0].addr;
-
- if (poff < m68k_memory[0].size)
- return (void *)(poff + PAGE_OFFSET);
-
-#ifdef CONFIG_AMIGA
- /*
- * if on an amiga and address is in first 16M, move it
- * to the ZTWO_VADDR range
- */
- if (MACH_IS_AMIGA && paddr < 16*1024*1024)
- return (void *)ZTWO_VADDR(paddr);
-#endif
- return (void *)paddr;
+ return (void *)(paddr - m68k_memory[0].addr + PAGE_OFFSET);
}
#else
-extern inline unsigned long virt_to_phys(volatile void * address)
+static inline unsigned long virt_to_phys(void *address)
{
return mm_vtop((unsigned long)address);
}
-extern inline void * phys_to_virt(unsigned long address)
+static inline void *phys_to_virt(unsigned long address)
{
return (void *) mm_ptov(address);
}
diff --git a/include/asm-m68k/zorro.h b/include/asm-m68k/zorro.h
index 69a200802019..31c26bf5007a 100644
--- a/include/asm-m68k/zorro.h
+++ b/include/asm-m68k/zorro.h
@@ -1,7 +1,7 @@
#ifndef _ASM_M68K_ZORRO_H
#define _ASM_M68K_ZORRO_H
-#include <asm/io.h>
+#include <asm/raw_io.h>
#define z_readb raw_inb
#define z_readw raw_inw
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index cbf710c5572d..396d4178b14c 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -7,12 +7,12 @@
#define PSMOUSE_MINOR 1
#define MS_BUSMOUSE_MINOR 2
#define ATIXL_BUSMOUSE_MINOR 3
-#define AMIGAMOUSE_MINOR 4
+/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
#define ATARIMOUSE_MINOR 5
#define SUN_MOUSE_MINOR 6
#define APOLLO_MOUSE_MINOR 7
#define PC110PAD_MINOR 9
-#define ADB_MOUSE_MINOR 10
+/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
#define WATCHDOG_MINOR 130 /* Watchdog timer */
#define TEMP_MINOR 131 /* Temperature Sensor */
#define RTC_MINOR 135
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 925920691a9b..429e72a2eadd 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -2,6 +2,7 @@
#define _LINUX_SEM_H
#include <linux/ipc.h>
+#include <asm/atomic.h>
/* semop flags */
#define SEM_UNDO 0x1000 /* undo the operation on exit */
diff --git a/lib/rwsem-spinlock.c b/lib/rwsem-spinlock.c
index 0a38eebfae79..8bd3c393b7c7 100644
--- a/lib/rwsem-spinlock.c
+++ b/lib/rwsem-spinlock.c
@@ -290,7 +290,7 @@ void __up_write(struct rw_semaphore *sem)
*/
void __downgrade_write(struct rw_semaphore *sem)
{
- rwsemtrace(sem,"Entering __rwsem_downgrade");
+ rwsemtrace(sem,"Entering __downgrade_write");
spin_lock(&sem->wait_lock);
@@ -300,7 +300,7 @@ void __downgrade_write(struct rw_semaphore *sem)
spin_unlock(&sem->wait_lock);
- rwsemtrace(sem,"Leaving __rwsem_downgrade");
+ rwsemtrace(sem,"Leaving __downgrade_write");
}
EXPORT_SYMBOL(init_rwsem);