aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/m68k/Kconfig.debug11
-rw-r--r--arch/m68k/Kconfig.devices46
-rw-r--r--arch/m68k/atari/ataints.c2
-rw-r--r--arch/m68k/atari/debug.c1
-rw-r--r--arch/m68k/configs/amiga_defconfig1
-rw-r--r--arch/m68k/configs/apollo_defconfig2
-rw-r--r--arch/m68k/configs/atari_defconfig3
-rw-r--r--arch/m68k/configs/multi_defconfig5
-rw-r--r--arch/m68k/configs/mvme16x_defconfig2
-rw-r--r--arch/m68k/emu/nfeth.c2
-rw-r--r--arch/m68k/hp300/config.c3
-rw-r--r--arch/m68k/include/asm/atarihw.h2
-rw-r--r--arch/m68k/include/asm/blinken.h8
-rw-r--r--arch/m68k/include/asm/mac_baboon.h6
-rw-r--r--arch/m68k/include/asm/mac_iop.h2
-rw-r--r--arch/m68k/include/asm/mac_oss.h23
-rw-r--r--arch/m68k/include/asm/mac_psc.h4
-rw-r--r--arch/m68k/include/asm/mac_via.h9
-rw-r--r--arch/m68k/include/asm/macintosh.h10
-rw-r--r--arch/m68k/include/asm/macints.h6
-rw-r--r--arch/m68k/include/asm/serial.h2
-rw-r--r--arch/m68k/include/asm/unistd.h10
-rw-r--r--arch/m68k/kernel/head.S117
-rw-r--r--arch/m68k/mac/baboon.c41
-rw-r--r--arch/m68k/mac/config.c93
-rw-r--r--arch/m68k/mac/iop.c8
-rw-r--r--arch/m68k/mac/macints.c197
-rw-r--r--arch/m68k/mac/oss.c157
-rw-r--r--arch/m68k/mac/psc.c17
-rw-r--r--arch/m68k/mac/via.c255
-rw-r--r--arch/m68k/mvme16x/config.c160
31 files changed, 577 insertions, 628 deletions
diff --git a/arch/m68k/Kconfig.debug b/arch/m68k/Kconfig.debug
index af4fd5f8f8d5..87233acef18b 100644
--- a/arch/m68k/Kconfig.debug
+++ b/arch/m68k/Kconfig.debug
@@ -10,6 +10,17 @@ config BOOTPARAM_STRING
10 default 'console=ttyS0,19200' 10 default 'console=ttyS0,19200'
11 depends on BOOTPARAM 11 depends on BOOTPARAM
12 12
13config EARLY_PRINTK
14 bool "Early printk" if EMBEDDED
15 depends on MVME16x || MAC
16 default y
17 help
18 Write kernel log output directly to a serial port.
19
20 This is useful for kernel debugging when your machine crashes very
21 early before the console code is initialized.
22 You should normally say N here, unless you want to debug such a crash.
23
13if !MMU 24if !MMU
14 25
15config FULLDEBUG 26config FULLDEBUG
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
index 6033f5d4e67e..04a3d9be90e9 100644
--- a/arch/m68k/Kconfig.devices
+++ b/arch/m68k/Kconfig.devices
@@ -8,8 +8,8 @@ config ARCH_MAY_HAVE_PC_FDC
8menu "Platform devices" 8menu "Platform devices"
9 9
10config HEARTBEAT 10config HEARTBEAT
11 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 11 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || Q40
12 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 12 default y if !AMIGA && !APOLLO && !ATARI && !Q40 && HP300
13 help 13 help
14 Use the power-on LED on your machine as a load meter. The exact 14 Use the power-on LED on your machine as a load meter. The exact
15 behavior is platform-dependent, but normally the flash frequency is 15 behavior is platform-dependent, but normally the flash frequency is
@@ -59,27 +59,6 @@ endmenu
59 59
60menu "Character devices" 60menu "Character devices"
61 61
62config ATARI_MFPSER
63 tristate "Atari MFP serial support"
64 depends on ATARI
65 ---help---
66 If you like to use the MFP serial ports ("Modem1", "Serial1") under
67 Linux, say Y. The driver equally supports all kinds of MFP serial
68 ports and automatically detects whether Serial1 is available.
69
70 To compile this driver as a module, choose M here.
71
72 Note for Falcon users: You also have an MFP port, it's just not
73 wired to the outside... But you could use the port under Linux.
74
75config ATARI_MIDI
76 tristate "Atari MIDI serial support"
77 depends on ATARI
78 help
79 If you want to use your Atari's MIDI port in Linux, say Y.
80
81 To compile this driver as a module, choose M here.
82
83config ATARI_DSP56K 62config ATARI_DSP56K
84 tristate "Atari DSP56k support (EXPERIMENTAL)" 63 tristate "Atari DSP56k support (EXPERIMENTAL)"
85 depends on ATARI && EXPERIMENTAL 64 depends on ATARI && EXPERIMENTAL
@@ -99,15 +78,6 @@ config AMIGA_BUILTIN_SERIAL
99 78
100 To compile this driver as a module, choose M here. 79 To compile this driver as a module, choose M here.
101 80
102config MULTIFACE_III_TTY
103 tristate "Multiface Card III serial support"
104 depends on AMIGA
105 help
106 If you want to use a Multiface III card's serial port in Linux,
107 answer Y.
108
109 To compile this driver as a module, choose M here.
110
111config HPDCA 81config HPDCA
112 tristate "HP DCA serial support" 82 tristate "HP DCA serial support"
113 depends on DIO && SERIAL_8250 83 depends on DIO && SERIAL_8250
@@ -122,13 +92,9 @@ config HPAPCI
122 If you want to use the internal "APCI" serial ports on an HP400 92 If you want to use the internal "APCI" serial ports on an HP400
123 machine, say Y here. 93 machine, say Y here.
124 94
125config DN_SERIAL
126 bool "Support for DN serial port (dummy)"
127 depends on APOLLO
128
129config SERIAL_CONSOLE 95config SERIAL_CONSOLE
130 bool "Support for serial port console" 96 bool "Support for serial port console"
131 depends on (AMIGA || ATARI || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || AMIGA_BUILTIN_SERIAL=y || MULTIFACE_III_TTY=y || SERIAL=y || SERIAL167 || DN_SERIAL) 97 depends on AMIGA_BUILTIN_SERIAL=y
132 ---help--- 98 ---help---
133 If you say Y here, it will be possible to use a serial port as the 99 If you say Y here, it will be possible to use a serial port as the
134 system console (the system console is the device which receives all 100 system console (the system console is the device which receives all
@@ -140,10 +106,10 @@ config SERIAL_CONSOLE
140 (/dev/tty0) will still be used as the system console by default, but 106 (/dev/tty0) will still be used as the system console by default, but
141 you can alter that using a kernel command line option such as 107 you can alter that using a kernel command line option such as
142 "console=ttyS1". (Try "man bootparam" or see the documentation of 108 "console=ttyS1". (Try "man bootparam" or see the documentation of
143 your boot loader (lilo or loadlin) about how to pass options to the 109 your boot loader about how to pass options to the kernel at boot
144 kernel at boot time.) 110 time.)
145 111
146 If you don't have a VGA card installed and you say Y here, the 112 If you don't have a graphical console and you say Y here, the
147 kernel will automatically use the first serial line, /dev/ttyS0, as 113 kernel will automatically use the first serial line, /dev/ttyS0, as
148 system console. 114 system console.
149 115
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 6d196dadfdbc..8048e1b7e552 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -82,8 +82,6 @@ __ALIGN_STR "\n\t"
82 82
83extern void atari_microwire_cmd(int cmd); 83extern void atari_microwire_cmd(int cmd);
84 84
85extern int atari_SCC_reset_done;
86
87static unsigned int atari_irq_startup(struct irq_data *data) 85static unsigned int atari_irq_startup(struct irq_data *data)
88{ 86{
89 unsigned int irq = data->irq; 87 unsigned int irq = data->irq;
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
index 5a484247e493..a547ba9683d1 100644
--- a/arch/m68k/atari/debug.c
+++ b/arch/m68k/atari/debug.c
@@ -202,7 +202,6 @@ static void __init atari_init_mfp_port(int cflag)
202 202
203static void __init atari_init_scc_port(int cflag) 203static void __init atari_init_scc_port(int cflag)
204{ 204{
205 extern int atari_SCC_reset_done;
206 static int clksrc_table[9] = 205 static int clksrc_table[9] =
207 /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ 206 /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
208 { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; 207 { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig
index dbb49fc6463b..e93fdae10b23 100644
--- a/arch/m68k/configs/amiga_defconfig
+++ b/arch/m68k/configs/amiga_defconfig
@@ -255,7 +255,6 @@ CONFIG_HID=m
255CONFIG_HIDRAW=y 255CONFIG_HIDRAW=y
256# CONFIG_USB_SUPPORT is not set 256# CONFIG_USB_SUPPORT is not set
257CONFIG_AMIGA_BUILTIN_SERIAL=y 257CONFIG_AMIGA_BUILTIN_SERIAL=y
258CONFIG_MULTIFACE_III_TTY=m
259CONFIG_SERIAL_CONSOLE=y 258CONFIG_SERIAL_CONSOLE=y
260CONFIG_EXT2_FS=y 259CONFIG_EXT2_FS=y
261CONFIG_EXT3_FS=y 260CONFIG_EXT3_FS=y
diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig
index 562b221f6951..66b26c1e848c 100644
--- a/arch/m68k/configs/apollo_defconfig
+++ b/arch/m68k/configs/apollo_defconfig
@@ -223,8 +223,6 @@ CONFIG_LOGO=y
223CONFIG_HID=m 223CONFIG_HID=m
224CONFIG_HIDRAW=y 224CONFIG_HIDRAW=y
225# CONFIG_USB_SUPPORT is not set 225# CONFIG_USB_SUPPORT is not set
226CONFIG_DN_SERIAL=y
227CONFIG_SERIAL_CONSOLE=y
228CONFIG_EXT2_FS=y 226CONFIG_EXT2_FS=y
229CONFIG_EXT3_FS=y 227CONFIG_EXT3_FS=y
230# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 228# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig
index 82978df637fa..151332515980 100644
--- a/arch/m68k/configs/atari_defconfig
+++ b/arch/m68k/configs/atari_defconfig
@@ -235,10 +235,7 @@ CONFIG_DMASOUND_ATARI=m
235CONFIG_HID=m 235CONFIG_HID=m
236CONFIG_HIDRAW=y 236CONFIG_HIDRAW=y
237# CONFIG_USB_SUPPORT is not set 237# CONFIG_USB_SUPPORT is not set
238CONFIG_ATARI_MFPSER=y
239CONFIG_ATARI_MIDI=y
240CONFIG_ATARI_DSP56K=m 238CONFIG_ATARI_DSP56K=m
241CONFIG_SERIAL_CONSOLE=y
242CONFIG_EXT2_FS=y 239CONFIG_EXT2_FS=y
243CONFIG_EXT3_FS=y 240CONFIG_EXT3_FS=y
244# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 241# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index ad9e85760e34..55d394edf633 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -318,13 +318,8 @@ CONFIG_DMASOUND_Q40=m
318CONFIG_HID=m 318CONFIG_HID=m
319CONFIG_HIDRAW=y 319CONFIG_HIDRAW=y
320# CONFIG_USB_SUPPORT is not set 320# CONFIG_USB_SUPPORT is not set
321CONFIG_ATARI_MFPSER=y
322CONFIG_ATARI_MIDI=y
323CONFIG_ATARI_DSP56K=m 321CONFIG_ATARI_DSP56K=m
324CONFIG_AMIGA_BUILTIN_SERIAL=y 322CONFIG_AMIGA_BUILTIN_SERIAL=y
325CONFIG_MULTIFACE_III_TTY=m
326CONFIG_SERIAL167=y
327CONFIG_DN_SERIAL=y
328CONFIG_SERIAL_CONSOLE=y 323CONFIG_SERIAL_CONSOLE=y
329CONFIG_EXT2_FS=y 324CONFIG_EXT2_FS=y
330CONFIG_EXT3_FS=y 325CONFIG_EXT3_FS=y
diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig
index c45aaf3b816f..cdb70d66e535 100644
--- a/arch/m68k/configs/mvme16x_defconfig
+++ b/arch/m68k/configs/mvme16x_defconfig
@@ -218,8 +218,6 @@ CONFIG_GEN_RTC_X=y
218CONFIG_HID=m 218CONFIG_HID=m
219CONFIG_HIDRAW=y 219CONFIG_HIDRAW=y
220# CONFIG_USB_SUPPORT is not set 220# CONFIG_USB_SUPPORT is not set
221CONFIG_SERIAL167=y
222CONFIG_SERIAL_CONSOLE=y
223CONFIG_EXT2_FS=y 221CONFIG_EXT2_FS=y
224CONFIG_EXT3_FS=y 222CONFIG_EXT3_FS=y
225# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 223# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
index c5748bb4ea71..a985a7e87d45 100644
--- a/arch/m68k/emu/nfeth.c
+++ b/arch/m68k/emu/nfeth.c
@@ -39,7 +39,7 @@ enum {
39#define MAX_UNIT 8 39#define MAX_UNIT 8
40 40
41/* These identify the driver base version and may not be removed. */ 41/* These identify the driver base version and may not be removed. */
42static const char version[] __devinitdata = 42static const char version[] __devinitconst =
43 KERN_INFO KBUILD_MODNAME ".c:v" DRV_VERSION " " DRV_RELDATE 43 KERN_INFO KBUILD_MODNAME ".c:v" DRV_VERSION " " DRV_RELDATE
44 " S.Opichal, M.Jurik, P.Stehlik\n" 44 " S.Opichal, M.Jurik, P.Stehlik\n"
45 KERN_INFO " http://aranym.org/\n"; 45 KERN_INFO " http://aranym.org/\n";
diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c
index 1c05a6260546..bf16af1edacf 100644
--- a/arch/m68k/hp300/config.c
+++ b/arch/m68k/hp300/config.c
@@ -24,7 +24,8 @@
24 24
25unsigned long hp300_model; 25unsigned long hp300_model;
26unsigned long hp300_uart_scode = -1; 26unsigned long hp300_uart_scode = -1;
27unsigned char ledstate; 27unsigned char hp300_ledstate;
28EXPORT_SYMBOL(hp300_ledstate);
28 29
29static char s_hp330[] __initdata = "330"; 30static char s_hp330[] __initdata = "330";
30static char s_hp340[] __initdata = "340"; 31static char s_hp340[] __initdata = "340";
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h
index 0392b28656ab..c0cb36350775 100644
--- a/arch/m68k/include/asm/atarihw.h
+++ b/arch/m68k/include/asm/atarihw.h
@@ -30,6 +30,8 @@ extern u_long atari_switches;
30extern int atari_rtc_year_offset; 30extern int atari_rtc_year_offset;
31extern int atari_dont_touch_floppy_select; 31extern int atari_dont_touch_floppy_select;
32 32
33extern int atari_SCC_reset_done;
34
33/* convenience macros for testing machine type */ 35/* convenience macros for testing machine type */
34#define MACH_IS_ST ((atari_mch_cookie >> 16) == ATARI_MCH_ST) 36#define MACH_IS_ST ((atari_mch_cookie >> 16) == ATARI_MCH_ST)
35#define MACH_IS_STE ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \ 37#define MACH_IS_STE ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \
diff --git a/arch/m68k/include/asm/blinken.h b/arch/m68k/include/asm/blinken.h
index 1a749cf7b06d..0626582a7db4 100644
--- a/arch/m68k/include/asm/blinken.h
+++ b/arch/m68k/include/asm/blinken.h
@@ -17,15 +17,15 @@
17 17
18#define HP300_LEDS 0xf001ffff 18#define HP300_LEDS 0xf001ffff
19 19
20extern unsigned char ledstate; 20extern unsigned char hp300_ledstate;
21 21
22static __inline__ void blinken_leds(int on, int off) 22static __inline__ void blinken_leds(int on, int off)
23{ 23{
24 if (MACH_IS_HP300) 24 if (MACH_IS_HP300)
25 { 25 {
26 ledstate |= on; 26 hp300_ledstate |= on;
27 ledstate &= ~off; 27 hp300_ledstate &= ~off;
28 out_8(HP300_LEDS, ~ledstate); 28 out_8(HP300_LEDS, ~hp300_ledstate);
29 } 29 }
30} 30}
31 31
diff --git a/arch/m68k/include/asm/mac_baboon.h b/arch/m68k/include/asm/mac_baboon.h
index c2a042b8c349..a2d32f6589f9 100644
--- a/arch/m68k/include/asm/mac_baboon.h
+++ b/arch/m68k/include/asm/mac_baboon.h
@@ -29,4 +29,10 @@ struct baboon {
29 */ 29 */
30}; 30};
31 31
32extern int baboon_present;
33
34extern void baboon_register_interrupts(void);
35extern void baboon_irq_enable(int);
36extern void baboon_irq_disable(int);
37
32#endif /* __ASSEMBLY **/ 38#endif /* __ASSEMBLY **/
diff --git a/arch/m68k/include/asm/mac_iop.h b/arch/m68k/include/asm/mac_iop.h
index a2c7e6fcca38..fde874a01e20 100644
--- a/arch/m68k/include/asm/mac_iop.h
+++ b/arch/m68k/include/asm/mac_iop.h
@@ -159,4 +159,6 @@ extern void iop_upload_code(uint, __u8 *, uint, __u16);
159extern void iop_download_code(uint, __u8 *, uint, __u16); 159extern void iop_download_code(uint, __u8 *, uint, __u16);
160extern __u8 *iop_compare_code(uint, __u8 *, uint, __u16); 160extern __u8 *iop_compare_code(uint, __u8 *, uint, __u16);
161 161
162extern void iop_register_interrupts(void);
163
162#endif /* __ASSEMBLY__ */ 164#endif /* __ASSEMBLY__ */
diff --git a/arch/m68k/include/asm/mac_oss.h b/arch/m68k/include/asm/mac_oss.h
index 3cf2b6ed685a..425fbff4f4d8 100644
--- a/arch/m68k/include/asm/mac_oss.h
+++ b/arch/m68k/include/asm/mac_oss.h
@@ -58,25 +58,6 @@
58 58
59#define OSS_POWEROFF 0x80 59#define OSS_POWEROFF 0x80
60 60
61/*
62 * OSS Interrupt levels for various sub-systems
63 *
64 * This mapping is laid out with two things in mind: first, we try to keep
65 * things on their own levels to avoid having to do double-dispatches. Second,
66 * the levels match as closely as possible the alternate IRQ mapping mode (aka
67 * "A/UX mode") available on some VIA machines.
68 */
69
70#define OSS_IRQLEV_DISABLED 0
71#define OSS_IRQLEV_IOPISM 1 /* ADB? */
72#define OSS_IRQLEV_SCSI IRQ_AUTO_2
73#define OSS_IRQLEV_NUBUS IRQ_AUTO_3 /* keep this on its own level */
74#define OSS_IRQLEV_IOPSCC IRQ_AUTO_4 /* matches VIA alternate mapping */
75#define OSS_IRQLEV_SOUND IRQ_AUTO_5 /* matches VIA alternate mapping */
76#define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */
77#define OSS_IRQLEV_VIA1 IRQ_AUTO_6 /* matches VIA alternate mapping */
78#define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */
79
80#ifndef __ASSEMBLY__ 61#ifndef __ASSEMBLY__
81 62
82struct mac_oss { 63struct mac_oss {
@@ -91,4 +72,8 @@ struct mac_oss {
91extern volatile struct mac_oss *oss; 72extern volatile struct mac_oss *oss;
92extern int oss_present; 73extern int oss_present;
93 74
75extern void oss_register_interrupts(void);
76extern void oss_irq_enable(int);
77extern void oss_irq_disable(int);
78
94#endif /* __ASSEMBLY__ */ 79#endif /* __ASSEMBLY__ */
diff --git a/arch/m68k/include/asm/mac_psc.h b/arch/m68k/include/asm/mac_psc.h
index 7808bb0b2323..e5c0d71d1543 100644
--- a/arch/m68k/include/asm/mac_psc.h
+++ b/arch/m68k/include/asm/mac_psc.h
@@ -211,6 +211,10 @@
211extern volatile __u8 *psc; 211extern volatile __u8 *psc;
212extern int psc_present; 212extern int psc_present;
213 213
214extern void psc_register_interrupts(void);
215extern void psc_irq_enable(int);
216extern void psc_irq_disable(int);
217
214/* 218/*
215 * Access functions 219 * Access functions
216 */ 220 */
diff --git a/arch/m68k/include/asm/mac_via.h b/arch/m68k/include/asm/mac_via.h
index a59665e1d41b..aeeedf8b2d25 100644
--- a/arch/m68k/include/asm/mac_via.h
+++ b/arch/m68k/include/asm/mac_via.h
@@ -254,6 +254,15 @@
254extern volatile __u8 *via1,*via2; 254extern volatile __u8 *via1,*via2;
255extern int rbv_present,via_alt_mapping; 255extern int rbv_present,via_alt_mapping;
256 256
257extern void via_register_interrupts(void);
258extern void via_irq_enable(int);
259extern void via_irq_disable(int);
260extern void via_nubus_irq_startup(int irq);
261extern void via_nubus_irq_shutdown(int irq);
262extern void via1_irq(unsigned int irq, struct irq_desc *desc);
263extern void via1_set_head(int);
264extern int via2_scsi_drq_pending(void);
265
257static inline int rbv_set_video_bpp(int bpp) 266static inline int rbv_set_video_bpp(int bpp)
258{ 267{
259 char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1; 268 char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
diff --git a/arch/m68k/include/asm/macintosh.h b/arch/m68k/include/asm/macintosh.h
index 12ebe43b008b..682a1a2ff55f 100644
--- a/arch/m68k/include/asm/macintosh.h
+++ b/arch/m68k/include/asm/macintosh.h
@@ -11,17 +11,11 @@
11extern void mac_reset(void); 11extern void mac_reset(void);
12extern void mac_poweroff(void); 12extern void mac_poweroff(void);
13extern void mac_init_IRQ(void); 13extern void mac_init_IRQ(void);
14extern int mac_irq_pending(unsigned int); 14
15extern void mac_irq_enable(struct irq_data *data); 15extern void mac_irq_enable(struct irq_data *data);
16extern void mac_irq_disable(struct irq_data *data); 16extern void mac_irq_disable(struct irq_data *data);
17 17
18/* 18/*
19 * Floppy driver magic hook - probably shouldn't be here
20 */
21
22extern void via1_set_head(int);
23
24/*
25 * Macintosh Table 19 * Macintosh Table
26 */ 20 */
27 21
@@ -48,7 +42,7 @@ struct mac_model
48#define MAC_ADB_IOP 6 42#define MAC_ADB_IOP 6
49 43
50#define MAC_VIA_II 1 44#define MAC_VIA_II 1
51#define MAC_VIA_IIci 2 45#define MAC_VIA_IICI 2
52#define MAC_VIA_QUADRA 3 46#define MAC_VIA_QUADRA 3
53 47
54#define MAC_SCSI_NONE 0 48#define MAC_SCSI_NONE 0
diff --git a/arch/m68k/include/asm/macints.h b/arch/m68k/include/asm/macints.h
index ebe1b70fe90c..92aa8a4c2d03 100644
--- a/arch/m68k/include/asm/macints.h
+++ b/arch/m68k/include/asm/macints.h
@@ -104,6 +104,9 @@
104#define IRQ_PSC4_3 (35) 104#define IRQ_PSC4_3 (35)
105#define IRQ_MAC_MACE_DMA IRQ_PSC4_3 105#define IRQ_MAC_MACE_DMA IRQ_PSC4_3
106 106
107/* OSS Level 4 interrupts */
108#define IRQ_MAC_SCC (33)
109
107/* Level 5 (PSC, AV Macs only) interrupts */ 110/* Level 5 (PSC, AV Macs only) interrupts */
108#define IRQ_PSC5_0 (40) 111#define IRQ_PSC5_0 (40)
109#define IRQ_PSC5_1 (41) 112#define IRQ_PSC5_1 (41)
@@ -131,9 +134,6 @@
131#define IRQ_BABOON_2 (66) 134#define IRQ_BABOON_2 (66)
132#define IRQ_BABOON_3 (67) 135#define IRQ_BABOON_3 (67)
133 136
134/* On non-PSC machines, the serial ports share an IRQ */
135#define IRQ_MAC_SCC IRQ_AUTO_4
136
137#define SLOT2IRQ(x) (x + 47) 137#define SLOT2IRQ(x) (x + 47)
138#define IRQ2SLOT(x) (x - 47) 138#define IRQ2SLOT(x) (x - 47)
139 139
diff --git a/arch/m68k/include/asm/serial.h b/arch/m68k/include/asm/serial.h
index 2b90d6e69070..7267536adbcc 100644
--- a/arch/m68k/include/asm/serial.h
+++ b/arch/m68k/include/asm/serial.h
@@ -25,9 +25,11 @@
25#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF 25#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
26#endif 26#endif
27 27
28#ifdef CONFIG_ISA
28#define SERIAL_PORT_DFNS \ 29#define SERIAL_PORT_DFNS \
29 /* UART CLK PORT IRQ FLAGS */ \ 30 /* UART CLK PORT IRQ FLAGS */ \
30 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ 31 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
31 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ 32 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
32 { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ 33 { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
33 { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ 34 { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
35#endif
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 303192fc9260..ea0b502f845e 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -132,10 +132,10 @@
132#define __NR_adjtimex 124 132#define __NR_adjtimex 124
133#define __NR_mprotect 125 133#define __NR_mprotect 125
134#define __NR_sigprocmask 126 134#define __NR_sigprocmask 126
135/*#define __NR_create_module 127*/ 135#define __NR_create_module 127
136#define __NR_init_module 128 136#define __NR_init_module 128
137#define __NR_delete_module 129 137#define __NR_delete_module 129
138/*#define __NR_get_kernel_syms 130*/ 138#define __NR_get_kernel_syms 130
139#define __NR_quotactl 131 139#define __NR_quotactl 131
140#define __NR_getpgid 132 140#define __NR_getpgid 132
141#define __NR_fchdir 133 141#define __NR_fchdir 133
@@ -172,7 +172,7 @@
172#define __NR_setresuid 164 172#define __NR_setresuid 164
173#define __NR_getresuid 165 173#define __NR_getresuid 165
174#define __NR_getpagesize 166 174#define __NR_getpagesize 166
175/*#define __NR_query_module 167*/ 175#define __NR_query_module 167
176#define __NR_poll 168 176#define __NR_poll 168
177#define __NR_nfsservctl 169 177#define __NR_nfsservctl 169
178#define __NR_setresgid 170 178#define __NR_setresgid 170
@@ -193,8 +193,8 @@
193#define __NR_capset 185 193#define __NR_capset 185
194#define __NR_sigaltstack 186 194#define __NR_sigaltstack 186
195#define __NR_sendfile 187 195#define __NR_sendfile 187
196/*#define __NR_getpmsg 188*/ /* some people actually want streams */ 196#define __NR_getpmsg 188 /* some people actually want streams */
197/*#define __NR_putpmsg 189*/ /* some people actually want streams */ 197#define __NR_putpmsg 189 /* some people actually want streams */
198#define __NR_vfork 190 198#define __NR_vfork 190
199#define __NR_ugetrlimit 191 199#define __NR_ugetrlimit 191
200#define __NR_mmap2 192 200#define __NR_mmap2 192
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 27622b3273c1..d197e7ff62c5 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -250,9 +250,8 @@
250 * USE_MFP: Use the ST-MFP port (Modem1) for serial debug. 250 * USE_MFP: Use the ST-MFP port (Modem1) for serial debug.
251 * 251 *
252 * Macintosh constants: 252 * Macintosh constants:
253 * MAC_SERIAL_DEBUG: Turns on serial debug output for the Macintosh. 253 * MAC_USE_SCC_A: Use SCC port A (modem) for serial debug and early console.
254 * MAC_USE_SCC_A: Use the SCC port A (modem) for serial debug. 254 * MAC_USE_SCC_B: Use SCC port B (printer) for serial debug and early console.
255 * MAC_USE_SCC_B: Use the SCC port B (printer) for serial debug (default).
256 */ 255 */
257 256
258#include <linux/linkage.h> 257#include <linux/linkage.h>
@@ -268,33 +267,25 @@
268 267
269#include <asm/machw.h> 268#include <asm/machw.h>
270 269
271/*
272 * Macintosh console support
273 */
274
275#ifdef CONFIG_FRAMEBUFFER_CONSOLE 270#ifdef CONFIG_FRAMEBUFFER_CONSOLE
276#define CONSOLE 271#define CONSOLE
277#define CONSOLE_PENGUIN 272#define CONSOLE_PENGUIN
278#endif 273#endif
279 274
280/* 275#ifdef CONFIG_EARLY_PRINTK
281 * Macintosh serial debug support; outputs boot info to the printer 276#define SERIAL_DEBUG
282 * and/or modem serial ports 277#else
283 */ 278#undef SERIAL_DEBUG
284#undef MAC_SERIAL_DEBUG 279#endif
285 280
286/* 281#else /* !CONFIG_MAC */
287 * Macintosh serial debug port selection; define one or both;
288 * requires MAC_SERIAL_DEBUG to be defined
289 */
290#define MAC_USE_SCC_A /* Macintosh modem serial port */
291#define MAC_USE_SCC_B /* Macintosh printer serial port */
292 282
293#endif /* CONFIG_MAC */ 283#define SERIAL_DEBUG
284
285#endif /* !CONFIG_MAC */
294 286
295#undef MMU_PRINT 287#undef MMU_PRINT
296#undef MMU_NOCACHE_KERNEL 288#undef MMU_NOCACHE_KERNEL
297#define SERIAL_DEBUG
298#undef DEBUG 289#undef DEBUG
299 290
300/* 291/*
@@ -655,11 +646,11 @@ ENTRY(__start)
655 lea %pc@(L(mac_rowbytes)),%a1 646 lea %pc@(L(mac_rowbytes)),%a1
656 movel %a0@,%a1@ 647 movel %a0@,%a1@
657 648
658#ifdef MAC_SERIAL_DEBUG 649#ifdef SERIAL_DEBUG
659 get_bi_record BI_MAC_SCCBASE 650 get_bi_record BI_MAC_SCCBASE
660 lea %pc@(L(mac_sccbase)),%a1 651 lea %pc@(L(mac_sccbase)),%a1
661 movel %a0@,%a1@ 652 movel %a0@,%a1@
662#endif /* MAC_SERIAL_DEBUG */ 653#endif
663 654
664#if 0 655#if 0
665 /* 656 /*
@@ -1427,7 +1418,7 @@ L(mmu_fixup_done):
1427 subl %d0,L(console_font) 1418 subl %d0,L(console_font)
1428 subl %d0,L(console_font_data) 1419 subl %d0,L(console_font_data)
1429#endif 1420#endif
1430#ifdef MAC_SERIAL_DEBUG 1421#ifdef SERIAL_DEBUG
1431 orl #0x50000000,L(mac_sccbase) 1422 orl #0x50000000,L(mac_sccbase)
1432#endif 1423#endif
14331: 14241:
@@ -1917,7 +1908,7 @@ mmu_030_print:
1917 jbne 30b 1908 jbne 30b
1918 1909
1919mmu_print_done: 1910mmu_print_done:
1920 puts "\n\n" 1911 puts "\n"
1921 1912
1922func_return mmu_print 1913func_return mmu_print
1923 1914
@@ -2768,7 +2759,7 @@ L(scc_initable_mac):
2768 .byte 9,0 /* no interrupts */ 2759 .byte 9,0 /* no interrupts */
2769 .byte 10,0 /* NRZ */ 2760 .byte 10,0 /* NRZ */
2770 .byte 11,0x50 /* use baud rate generator */ 2761 .byte 11,0x50 /* use baud rate generator */
2771 .byte 12,10,13,0 /* 9600 baud */ 2762 .byte 12,1,13,0 /* 38400 baud */
2772 .byte 14,1 /* Baud rate generator enable */ 2763 .byte 14,1 /* Baud rate generator enable */
2773 .byte 3,0xc1 /* enable receiver */ 2764 .byte 3,0xc1 /* enable receiver */
2774 .byte 5,0xea /* enable transmitter */ 2765 .byte 5,0xea /* enable transmitter */
@@ -2906,10 +2897,12 @@ func_start serial_init,%d0/%d1/%a0/%a1
2906#endif 2897#endif
2907#ifdef CONFIG_MAC 2898#ifdef CONFIG_MAC
2908 is_not_mac(L(serial_init_not_mac)) 2899 is_not_mac(L(serial_init_not_mac))
2909#ifdef MAC_SERIAL_DEBUG 2900
2910#if !defined(MAC_USE_SCC_A) && !defined(MAC_USE_SCC_B) 2901#ifdef SERIAL_DEBUG
2911#define MAC_USE_SCC_B 2902/* You may define either or both of these. */
2912#endif 2903#define MAC_USE_SCC_A /* Modem port */
2904#define MAC_USE_SCC_B /* Printer port */
2905
2913#define mac_scc_cha_b_ctrl_offset 0x0 2906#define mac_scc_cha_b_ctrl_offset 0x0
2914#define mac_scc_cha_a_ctrl_offset 0x2 2907#define mac_scc_cha_a_ctrl_offset 0x2
2915#define mac_scc_cha_b_data_offset 0x4 2908#define mac_scc_cha_b_data_offset 0x4
@@ -2940,7 +2933,7 @@ func_start serial_init,%d0/%d1/%a0/%a1
2940 jra 7b 2933 jra 7b
29418: 29348:
2942#endif /* MAC_USE_SCC_B */ 2935#endif /* MAC_USE_SCC_B */
2943#endif /* MAC_SERIAL_DEBUG */ 2936#endif /* SERIAL_DEBUG */
2944 2937
2945 jra L(serial_init_done) 2938 jra L(serial_init_done)
2946L(serial_init_not_mac): 2939L(serial_init_not_mac):
@@ -3011,7 +3004,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1
3011#ifdef CONFIG_MAC 3004#ifdef CONFIG_MAC
3012 is_not_mac(5f) 3005 is_not_mac(5f)
3013 3006
3014#ifdef MAC_SERIAL_DEBUG 3007#ifdef SERIAL_DEBUG
3015 3008
3016#ifdef MAC_USE_SCC_A 3009#ifdef MAC_USE_SCC_A
3017 movel %pc@(L(mac_sccbase)),%a1 3010 movel %pc@(L(mac_sccbase)),%a1
@@ -3029,7 +3022,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1
3029 moveb %d0,%a1@(mac_scc_cha_b_data_offset) 3022 moveb %d0,%a1@(mac_scc_cha_b_data_offset)
3030#endif /* MAC_USE_SCC_B */ 3023#endif /* MAC_USE_SCC_B */
3031 3024
3032#endif /* MAC_SERIAL_DEBUG */ 3025#endif /* SERIAL_DEBUG */
3033 3026
3034 jra L(serial_putc_done) 3027 jra L(serial_putc_done)
30355: 30285:
@@ -3248,33 +3241,39 @@ func_return putn
3248 3241
3249#ifdef CONFIG_MAC 3242#ifdef CONFIG_MAC
3250/* 3243/*
3251 * mac_serial_print 3244 * mac_early_print
3252 * 3245 *
3253 * This routine takes its parameters on the stack. It then 3246 * This routine takes its parameters on the stack. It then
3254 * turns around and calls the internal routine. This routine 3247 * turns around and calls the internal routines. This routine
3255 * is used until the Linux console driver initializes itself. 3248 * is used by the boot console.
3256 * 3249 *
3257 * The calling parameters are: 3250 * The calling parameters are:
3258 * void mac_serial_print(const char *str); 3251 * void mac_early_print(const char *str, unsigned length);
3259 * 3252 *
3260 * This routine does NOT understand variable arguments only 3253 * This routine does NOT understand variable arguments only
3261 * simple strings! 3254 * simple strings!
3262 */ 3255 */
3263ENTRY(mac_serial_print) 3256ENTRY(mac_early_print)
3264 moveml %d0/%a0,%sp@- 3257 moveml %d0/%d1/%a0,%sp@-
3265#if 1 3258 movew %sr,%sp@-
3266 move %sr,%sp@-
3267 ori #0x0700,%sr 3259 ori #0x0700,%sr
3268#endif 3260 movel %sp@(18),%a0 /* fetch parameter */
3269 movel %sp@(10),%a0 /* fetch parameter */ 3261 movel %sp@(22),%d1 /* fetch parameter */
3270 jra 2f 3262 jra 2f
32711: serial_putc %d0 32631:
32722: moveb %a0@+,%d0 3264#ifdef CONSOLE
3273 jne 1b 3265 console_putc %d0
3274#if 1
3275 move %sp@+,%sr
3276#endif 3266#endif
3277 moveml %sp@+,%d0/%a0 3267#ifdef SERIAL_DEBUG
3268 serial_putc %d0
3269#endif
3270 subq #1,%d1
32712: jeq 3f
3272 moveb %a0@+,%d0
3273 jne 1b
32743:
3275 movew %sp@+,%sr
3276 moveml %sp@+,%d0/%d1/%a0
3278 rts 3277 rts
3279#endif /* CONFIG_MAC */ 3278#endif /* CONFIG_MAC */
3280 3279
@@ -3409,10 +3408,10 @@ func_start console_put_stats,%a0/%d7
3409 * a0 = pointer to boot_info 3408 * a0 = pointer to boot_info
3410 * d7 = value of boot_info fields 3409 * d7 = value of boot_info fields
3411 */ 3410 */
3412 puts "\nMacLinux\n\n" 3411 puts "\nMacLinux\n"
3413 3412
3414#ifdef SERIAL_DEBUG 3413#ifdef SERIAL_DEBUG
3415 puts " vidaddr:" 3414 puts "\n vidaddr:"
3416 putn %pc@(L(mac_videobase)) /* video addr. */ 3415 putn %pc@(L(mac_videobase)) /* video addr. */
3417 3416
3418 puts "\n _stext:" 3417 puts "\n _stext:"
@@ -3423,19 +3422,21 @@ func_start console_put_stats,%a0/%d7
3423 lea %pc@(_end),%a0 3422 lea %pc@(_end),%a0
3424 putn %a0 3423 putn %a0
3425 3424
3426 puts "\ncpuid:" 3425 puts "\n cpuid:"
3427 putn %pc@(L(cputype)) 3426 putn %pc@(L(cputype))
3428 putc '\n'
3429 3427
3430#ifdef MAC_SERIAL_DEBUG 3428# ifdef CONFIG_MAC
3429 puts "\n sccbase:"
3431 putn %pc@(L(mac_sccbase)) 3430 putn %pc@(L(mac_sccbase))
3431# endif
3432# ifdef MMU_PRINT
3432 putc '\n' 3433 putc '\n'
3433#endif
3434# if defined(MMU_PRINT)
3435 jbsr mmu_print_machine_cpu_types 3434 jbsr mmu_print_machine_cpu_types
3436# endif /* MMU_PRINT */ 3435# endif
3437#endif /* SERIAL_DEBUG */ 3436#endif /* SERIAL_DEBUG */
3438 3437
3438 putc '\n'
3439
3439func_return console_put_stats 3440func_return console_put_stats
3440 3441
3441#ifdef CONSOLE_PENGUIN 3442#ifdef CONSOLE_PENGUIN
@@ -3896,11 +3897,11 @@ L(mac_dimensions):
3896 .long 0 3897 .long 0
3897L(mac_rowbytes): 3898L(mac_rowbytes):
3898 .long 0 3899 .long 0
3899#ifdef MAC_SERIAL_DEBUG 3900#ifdef SERIAL_DEBUG
3900L(mac_sccbase): 3901L(mac_sccbase):
3901 .long 0 3902 .long 0
3902#endif /* MAC_SERIAL_DEBUG */
3903#endif 3903#endif
3904#endif /* CONFIG_MAC */
3904 3905
3905#if defined (CONFIG_APOLLO) 3906#if defined (CONFIG_APOLLO)
3906LSRB0 = 0x10412 3907LSRB0 = 0x10412
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index b403924a1cad..3fe0e43d44f6 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -8,13 +8,8 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/mm.h>
12#include <linux/delay.h>
13#include <linux/init.h>
14#include <linux/irq.h> 11#include <linux/irq.h>
15 12
16#include <asm/traps.h>
17#include <asm/bootinfo.h>
18#include <asm/macintosh.h> 13#include <asm/macintosh.h>
19#include <asm/macints.h> 14#include <asm/macints.h>
20#include <asm/mac_baboon.h> 15#include <asm/mac_baboon.h>
@@ -23,7 +18,6 @@
23 18
24int baboon_present; 19int baboon_present;
25static volatile struct baboon *baboon; 20static volatile struct baboon *baboon;
26static unsigned char baboon_disabled;
27 21
28#if 0 22#if 0
29extern int macide_ack_intr(struct ata_channel *); 23extern int macide_ack_intr(struct ata_channel *);
@@ -89,51 +83,32 @@ static void baboon_irq(unsigned int irq, struct irq_desc *desc)
89 83
90void __init baboon_register_interrupts(void) 84void __init baboon_register_interrupts(void)
91{ 85{
92 baboon_disabled = 0;
93 irq_set_chained_handler(IRQ_NUBUS_C, baboon_irq); 86 irq_set_chained_handler(IRQ_NUBUS_C, baboon_irq);
94} 87}
95 88
96/* 89/*
97 * The means for masking individual baboon interrupts remains a mystery, so 90 * The means for masking individual Baboon interrupts remains a mystery.
98 * enable the umbrella interrupt only when no baboon interrupt is disabled. 91 * However, since we only use the IDE IRQ, we can just enable/disable all
92 * Baboon interrupts. If/when we handle more than one Baboon IRQ, we must
93 * either figure out how to mask them individually or else implement the
94 * same workaround that's used for NuBus slots (see nubus_disabled and
95 * via_nubus_irq_shutdown).
99 */ 96 */
100 97
101void baboon_irq_enable(int irq) 98void baboon_irq_enable(int irq)
102{ 99{
103 int irq_idx = IRQ_IDX(irq);
104
105#ifdef DEBUG_IRQUSE 100#ifdef DEBUG_IRQUSE
106 printk("baboon_irq_enable(%d)\n", irq); 101 printk("baboon_irq_enable(%d)\n", irq);
107#endif 102#endif
108 103
109 baboon_disabled &= ~(1 << irq_idx); 104 mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
110 if (!baboon_disabled)
111 mac_irq_enable(irq_get_irq_data(IRQ_NUBUS_C));
112} 105}
113 106
114void baboon_irq_disable(int irq) 107void baboon_irq_disable(int irq)
115{ 108{
116 int irq_idx = IRQ_IDX(irq);
117
118#ifdef DEBUG_IRQUSE 109#ifdef DEBUG_IRQUSE
119 printk("baboon_irq_disable(%d)\n", irq); 110 printk("baboon_irq_disable(%d)\n", irq);
120#endif 111#endif
121 112
122 baboon_disabled |= 1 << irq_idx; 113 mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
123 if (baboon_disabled)
124 mac_irq_disable(irq_get_irq_data(IRQ_NUBUS_C));
125}
126
127void baboon_irq_clear(int irq)
128{
129 int irq_idx = IRQ_IDX(irq);
130
131 baboon->mb_ifr &= ~(1 << irq_idx);
132}
133
134int baboon_irq_pending(int irq)
135{
136 int irq_idx = IRQ_IDX(irq);
137
138 return baboon->mb_ifr & (1 << irq_idx);
139} 114}
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index c247de02bc7e..f60ff5f59205 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -71,6 +71,31 @@ static void mac_get_model(char *str);
71static void mac_identify(void); 71static void mac_identify(void);
72static void mac_report_hardware(void); 72static void mac_report_hardware(void);
73 73
74#ifdef CONFIG_EARLY_PRINTK
75asmlinkage void __init mac_early_print(const char *s, unsigned n);
76
77static void __init mac_early_cons_write(struct console *con,
78 const char *s, unsigned n)
79{
80 mac_early_print(s, n);
81}
82
83static struct console __initdata mac_early_cons = {
84 .name = "early",
85 .write = mac_early_cons_write,
86 .flags = CON_PRINTBUFFER | CON_BOOT,
87 .index = -1
88};
89
90int __init mac_unregister_early_cons(void)
91{
92 /* mac_early_print can't be used after init sections are discarded */
93 return unregister_console(&mac_early_cons);
94}
95
96late_initcall(mac_unregister_early_cons);
97#endif
98
74static void __init mac_sched_init(irq_handler_t vector) 99static void __init mac_sched_init(irq_handler_t vector)
75{ 100{
76 via_init_clock(vector); 101 via_init_clock(vector);
@@ -164,6 +189,10 @@ void __init config_mac(void)
164 mach_beep = mac_mksound; 189 mach_beep = mac_mksound;
165#endif 190#endif
166 191
192#ifdef CONFIG_EARLY_PRINTK
193 register_console(&mac_early_cons);
194#endif
195
167 /* 196 /*
168 * Determine hardware present 197 * Determine hardware present
169 */ 198 */
@@ -192,7 +221,7 @@ void __init config_mac(void)
192 * inaccurate, so look here if a new Mac model won't run. Example: if 221 * inaccurate, so look here if a new Mac model won't run. Example: if
193 * a Mac crashes immediately after the VIA1 registers have been dumped 222 * a Mac crashes immediately after the VIA1 registers have been dumped
194 * to the screen, it probably died attempting to read DirB on a RBV. 223 * to the screen, it probably died attempting to read DirB on a RBV.
195 * Meaning it should have MAC_VIA_IIci here :-) 224 * Meaning it should have MAC_VIA_IICI here :-)
196 */ 225 */
197 226
198struct mac_model *macintosh_config; 227struct mac_model *macintosh_config;
@@ -267,7 +296,7 @@ static struct mac_model mac_data_table[] = {
267 .ident = MAC_MODEL_IICI, 296 .ident = MAC_MODEL_IICI,
268 .name = "IIci", 297 .name = "IIci",
269 .adb_type = MAC_ADB_II, 298 .adb_type = MAC_ADB_II,
270 .via_type = MAC_VIA_IIci, 299 .via_type = MAC_VIA_IICI,
271 .scsi_type = MAC_SCSI_OLD, 300 .scsi_type = MAC_SCSI_OLD,
272 .scc_type = MAC_SCC_II, 301 .scc_type = MAC_SCC_II,
273 .nubus_type = MAC_NUBUS, 302 .nubus_type = MAC_NUBUS,
@@ -276,7 +305,7 @@ static struct mac_model mac_data_table[] = {
276 .ident = MAC_MODEL_IIFX, 305 .ident = MAC_MODEL_IIFX,
277 .name = "IIfx", 306 .name = "IIfx",
278 .adb_type = MAC_ADB_IOP, 307 .adb_type = MAC_ADB_IOP,
279 .via_type = MAC_VIA_IIci, 308 .via_type = MAC_VIA_IICI,
280 .scsi_type = MAC_SCSI_OLD, 309 .scsi_type = MAC_SCSI_OLD,
281 .scc_type = MAC_SCC_IOP, 310 .scc_type = MAC_SCC_IOP,
282 .nubus_type = MAC_NUBUS, 311 .nubus_type = MAC_NUBUS,
@@ -285,7 +314,7 @@ static struct mac_model mac_data_table[] = {
285 .ident = MAC_MODEL_IISI, 314 .ident = MAC_MODEL_IISI,
286 .name = "IIsi", 315 .name = "IIsi",
287 .adb_type = MAC_ADB_IISI, 316 .adb_type = MAC_ADB_IISI,
288 .via_type = MAC_VIA_IIci, 317 .via_type = MAC_VIA_IICI,
289 .scsi_type = MAC_SCSI_OLD, 318 .scsi_type = MAC_SCSI_OLD,
290 .scc_type = MAC_SCC_II, 319 .scc_type = MAC_SCC_II,
291 .nubus_type = MAC_NUBUS, 320 .nubus_type = MAC_NUBUS,
@@ -294,7 +323,7 @@ static struct mac_model mac_data_table[] = {
294 .ident = MAC_MODEL_IIVI, 323 .ident = MAC_MODEL_IIVI,
295 .name = "IIvi", 324 .name = "IIvi",
296 .adb_type = MAC_ADB_IISI, 325 .adb_type = MAC_ADB_IISI,
297 .via_type = MAC_VIA_IIci, 326 .via_type = MAC_VIA_IICI,
298 .scsi_type = MAC_SCSI_OLD, 327 .scsi_type = MAC_SCSI_OLD,
299 .scc_type = MAC_SCC_II, 328 .scc_type = MAC_SCC_II,
300 .nubus_type = MAC_NUBUS, 329 .nubus_type = MAC_NUBUS,
@@ -303,7 +332,7 @@ static struct mac_model mac_data_table[] = {
303 .ident = MAC_MODEL_IIVX, 332 .ident = MAC_MODEL_IIVX,
304 .name = "IIvx", 333 .name = "IIvx",
305 .adb_type = MAC_ADB_IISI, 334 .adb_type = MAC_ADB_IISI,
306 .via_type = MAC_VIA_IIci, 335 .via_type = MAC_VIA_IICI,
307 .scsi_type = MAC_SCSI_OLD, 336 .scsi_type = MAC_SCSI_OLD,
308 .scc_type = MAC_SCC_II, 337 .scc_type = MAC_SCC_II,
309 .nubus_type = MAC_NUBUS, 338 .nubus_type = MAC_NUBUS,
@@ -318,7 +347,7 @@ static struct mac_model mac_data_table[] = {
318 .ident = MAC_MODEL_CLII, 347 .ident = MAC_MODEL_CLII,
319 .name = "Classic II", 348 .name = "Classic II",
320 .adb_type = MAC_ADB_IISI, 349 .adb_type = MAC_ADB_IISI,
321 .via_type = MAC_VIA_IIci, 350 .via_type = MAC_VIA_IICI,
322 .scsi_type = MAC_SCSI_OLD, 351 .scsi_type = MAC_SCSI_OLD,
323 .scc_type = MAC_SCC_II, 352 .scc_type = MAC_SCC_II,
324 .nubus_type = MAC_NUBUS, 353 .nubus_type = MAC_NUBUS,
@@ -327,7 +356,7 @@ static struct mac_model mac_data_table[] = {
327 .ident = MAC_MODEL_CCL, 356 .ident = MAC_MODEL_CCL,
328 .name = "Color Classic", 357 .name = "Color Classic",
329 .adb_type = MAC_ADB_CUDA, 358 .adb_type = MAC_ADB_CUDA,
330 .via_type = MAC_VIA_IIci, 359 .via_type = MAC_VIA_IICI,
331 .scsi_type = MAC_SCSI_OLD, 360 .scsi_type = MAC_SCSI_OLD,
332 .scc_type = MAC_SCC_II, 361 .scc_type = MAC_SCC_II,
333 .nubus_type = MAC_NUBUS, 362 .nubus_type = MAC_NUBUS,
@@ -336,7 +365,7 @@ static struct mac_model mac_data_table[] = {
336 .ident = MAC_MODEL_CCLII, 365 .ident = MAC_MODEL_CCLII,
337 .name = "Color Classic II", 366 .name = "Color Classic II",
338 .adb_type = MAC_ADB_CUDA, 367 .adb_type = MAC_ADB_CUDA,
339 .via_type = MAC_VIA_IIci, 368 .via_type = MAC_VIA_IICI,
340 .scsi_type = MAC_SCSI_OLD, 369 .scsi_type = MAC_SCSI_OLD,
341 .scc_type = MAC_SCC_II, 370 .scc_type = MAC_SCC_II,
342 .nubus_type = MAC_NUBUS, 371 .nubus_type = MAC_NUBUS,
@@ -351,7 +380,7 @@ static struct mac_model mac_data_table[] = {
351 .ident = MAC_MODEL_LC, 380 .ident = MAC_MODEL_LC,
352 .name = "LC", 381 .name = "LC",
353 .adb_type = MAC_ADB_IISI, 382 .adb_type = MAC_ADB_IISI,
354 .via_type = MAC_VIA_IIci, 383 .via_type = MAC_VIA_IICI,
355 .scsi_type = MAC_SCSI_OLD, 384 .scsi_type = MAC_SCSI_OLD,
356 .scc_type = MAC_SCC_II, 385 .scc_type = MAC_SCC_II,
357 .nubus_type = MAC_NUBUS, 386 .nubus_type = MAC_NUBUS,
@@ -360,7 +389,7 @@ static struct mac_model mac_data_table[] = {
360 .ident = MAC_MODEL_LCII, 389 .ident = MAC_MODEL_LCII,
361 .name = "LC II", 390 .name = "LC II",
362 .adb_type = MAC_ADB_IISI, 391 .adb_type = MAC_ADB_IISI,
363 .via_type = MAC_VIA_IIci, 392 .via_type = MAC_VIA_IICI,
364 .scsi_type = MAC_SCSI_OLD, 393 .scsi_type = MAC_SCSI_OLD,
365 .scc_type = MAC_SCC_II, 394 .scc_type = MAC_SCC_II,
366 .nubus_type = MAC_NUBUS, 395 .nubus_type = MAC_NUBUS,
@@ -369,7 +398,7 @@ static struct mac_model mac_data_table[] = {
369 .ident = MAC_MODEL_LCIII, 398 .ident = MAC_MODEL_LCIII,
370 .name = "LC III", 399 .name = "LC III",
371 .adb_type = MAC_ADB_IISI, 400 .adb_type = MAC_ADB_IISI,
372 .via_type = MAC_VIA_IIci, 401 .via_type = MAC_VIA_IICI,
373 .scsi_type = MAC_SCSI_OLD, 402 .scsi_type = MAC_SCSI_OLD,
374 .scc_type = MAC_SCC_II, 403 .scc_type = MAC_SCC_II,
375 .nubus_type = MAC_NUBUS, 404 .nubus_type = MAC_NUBUS,
@@ -497,7 +526,7 @@ static struct mac_model mac_data_table[] = {
497 .ident = MAC_MODEL_P460, 526 .ident = MAC_MODEL_P460,
498 .name = "Performa 460", 527 .name = "Performa 460",
499 .adb_type = MAC_ADB_IISI, 528 .adb_type = MAC_ADB_IISI,
500 .via_type = MAC_VIA_IIci, 529 .via_type = MAC_VIA_IICI,
501 .scsi_type = MAC_SCSI_OLD, 530 .scsi_type = MAC_SCSI_OLD,
502 .scc_type = MAC_SCC_II, 531 .scc_type = MAC_SCC_II,
503 .nubus_type = MAC_NUBUS, 532 .nubus_type = MAC_NUBUS,
@@ -524,7 +553,7 @@ static struct mac_model mac_data_table[] = {
524 .ident = MAC_MODEL_P520, 553 .ident = MAC_MODEL_P520,
525 .name = "Performa 520", 554 .name = "Performa 520",
526 .adb_type = MAC_ADB_CUDA, 555 .adb_type = MAC_ADB_CUDA,
527 .via_type = MAC_VIA_IIci, 556 .via_type = MAC_VIA_IICI,
528 .scsi_type = MAC_SCSI_OLD, 557 .scsi_type = MAC_SCSI_OLD,
529 .scc_type = MAC_SCC_II, 558 .scc_type = MAC_SCC_II,
530 .nubus_type = MAC_NUBUS, 559 .nubus_type = MAC_NUBUS,
@@ -533,7 +562,7 @@ static struct mac_model mac_data_table[] = {
533 .ident = MAC_MODEL_P550, 562 .ident = MAC_MODEL_P550,
534 .name = "Performa 550", 563 .name = "Performa 550",
535 .adb_type = MAC_ADB_CUDA, 564 .adb_type = MAC_ADB_CUDA,
536 .via_type = MAC_VIA_IIci, 565 .via_type = MAC_VIA_IICI,
537 .scsi_type = MAC_SCSI_OLD, 566 .scsi_type = MAC_SCSI_OLD,
538 .scc_type = MAC_SCC_II, 567 .scc_type = MAC_SCC_II,
539 .nubus_type = MAC_NUBUS, 568 .nubus_type = MAC_NUBUS,
@@ -565,7 +594,7 @@ static struct mac_model mac_data_table[] = {
565 .ident = MAC_MODEL_TV, 594 .ident = MAC_MODEL_TV,
566 .name = "TV", 595 .name = "TV",
567 .adb_type = MAC_ADB_CUDA, 596 .adb_type = MAC_ADB_CUDA,
568 .via_type = MAC_VIA_QUADRA, 597 .via_type = MAC_VIA_IICI,
569 .scsi_type = MAC_SCSI_OLD, 598 .scsi_type = MAC_SCSI_OLD,
570 .scc_type = MAC_SCC_II, 599 .scc_type = MAC_SCC_II,
571 .nubus_type = MAC_NUBUS, 600 .nubus_type = MAC_NUBUS,
@@ -574,7 +603,7 @@ static struct mac_model mac_data_table[] = {
574 .ident = MAC_MODEL_P600, 603 .ident = MAC_MODEL_P600,
575 .name = "Performa 600", 604 .name = "Performa 600",
576 .adb_type = MAC_ADB_IISI, 605 .adb_type = MAC_ADB_IISI,
577 .via_type = MAC_VIA_IIci, 606 .via_type = MAC_VIA_IICI,
578 .scsi_type = MAC_SCSI_OLD, 607 .scsi_type = MAC_SCSI_OLD,
579 .scc_type = MAC_SCC_II, 608 .scc_type = MAC_SCC_II,
580 .nubus_type = MAC_NUBUS, 609 .nubus_type = MAC_NUBUS,
@@ -645,8 +674,8 @@ static struct mac_model mac_data_table[] = {
645 }, { 674 }, {
646 .ident = MAC_MODEL_PB150, 675 .ident = MAC_MODEL_PB150,
647 .name = "PowerBook 150", 676 .name = "PowerBook 150",
648 .adb_type = MAC_ADB_PB1, 677 .adb_type = MAC_ADB_PB2,
649 .via_type = MAC_VIA_IIci, 678 .via_type = MAC_VIA_IICI,
650 .scsi_type = MAC_SCSI_OLD, 679 .scsi_type = MAC_SCSI_OLD,
651 .ide_type = MAC_IDE_PB, 680 .ide_type = MAC_IDE_PB,
652 .scc_type = MAC_SCC_QUADRA, 681 .scc_type = MAC_SCC_QUADRA,
@@ -732,17 +761,13 @@ static struct mac_model mac_data_table[] = {
732 * PowerBook Duos are pretty much like normal PowerBooks 761 * PowerBook Duos are pretty much like normal PowerBooks
733 * All of these probably have onboard SONIC in the Dock which 762 * All of these probably have onboard SONIC in the Dock which
734 * means we'll have to probe for it eventually. 763 * means we'll have to probe for it eventually.
735 *
736 * Are these really MAC_VIA_IIci? The developer notes for the
737 * Duos show pretty much the same custom parts as in most of
738 * the other PowerBooks which would imply MAC_VIA_QUADRA.
739 */ 764 */
740 765
741 { 766 {
742 .ident = MAC_MODEL_PB210, 767 .ident = MAC_MODEL_PB210,
743 .name = "PowerBook Duo 210", 768 .name = "PowerBook Duo 210",
744 .adb_type = MAC_ADB_PB2, 769 .adb_type = MAC_ADB_PB2,
745 .via_type = MAC_VIA_IIci, 770 .via_type = MAC_VIA_IICI,
746 .scsi_type = MAC_SCSI_OLD, 771 .scsi_type = MAC_SCSI_OLD,
747 .scc_type = MAC_SCC_QUADRA, 772 .scc_type = MAC_SCC_QUADRA,
748 .nubus_type = MAC_NUBUS, 773 .nubus_type = MAC_NUBUS,
@@ -751,7 +776,7 @@ static struct mac_model mac_data_table[] = {
751 .ident = MAC_MODEL_PB230, 776 .ident = MAC_MODEL_PB230,
752 .name = "PowerBook Duo 230", 777 .name = "PowerBook Duo 230",
753 .adb_type = MAC_ADB_PB2, 778 .adb_type = MAC_ADB_PB2,
754 .via_type = MAC_VIA_IIci, 779 .via_type = MAC_VIA_IICI,
755 .scsi_type = MAC_SCSI_OLD, 780 .scsi_type = MAC_SCSI_OLD,
756 .scc_type = MAC_SCC_QUADRA, 781 .scc_type = MAC_SCC_QUADRA,
757 .nubus_type = MAC_NUBUS, 782 .nubus_type = MAC_NUBUS,
@@ -760,7 +785,7 @@ static struct mac_model mac_data_table[] = {
760 .ident = MAC_MODEL_PB250, 785 .ident = MAC_MODEL_PB250,
761 .name = "PowerBook Duo 250", 786 .name = "PowerBook Duo 250",
762 .adb_type = MAC_ADB_PB2, 787 .adb_type = MAC_ADB_PB2,
763 .via_type = MAC_VIA_IIci, 788 .via_type = MAC_VIA_IICI,
764 .scsi_type = MAC_SCSI_OLD, 789 .scsi_type = MAC_SCSI_OLD,
765 .scc_type = MAC_SCC_QUADRA, 790 .scc_type = MAC_SCC_QUADRA,
766 .nubus_type = MAC_NUBUS, 791 .nubus_type = MAC_NUBUS,
@@ -769,7 +794,7 @@ static struct mac_model mac_data_table[] = {
769 .ident = MAC_MODEL_PB270C, 794 .ident = MAC_MODEL_PB270C,
770 .name = "PowerBook Duo 270c", 795 .name = "PowerBook Duo 270c",
771 .adb_type = MAC_ADB_PB2, 796 .adb_type = MAC_ADB_PB2,
772 .via_type = MAC_VIA_IIci, 797 .via_type = MAC_VIA_IICI,
773 .scsi_type = MAC_SCSI_OLD, 798 .scsi_type = MAC_SCSI_OLD,
774 .scc_type = MAC_SCC_QUADRA, 799 .scc_type = MAC_SCC_QUADRA,
775 .nubus_type = MAC_NUBUS, 800 .nubus_type = MAC_NUBUS,
@@ -778,7 +803,7 @@ static struct mac_model mac_data_table[] = {
778 .ident = MAC_MODEL_PB280, 803 .ident = MAC_MODEL_PB280,
779 .name = "PowerBook Duo 280", 804 .name = "PowerBook Duo 280",
780 .adb_type = MAC_ADB_PB2, 805 .adb_type = MAC_ADB_PB2,
781 .via_type = MAC_VIA_IIci, 806 .via_type = MAC_VIA_IICI,
782 .scsi_type = MAC_SCSI_OLD, 807 .scsi_type = MAC_SCSI_OLD,
783 .scc_type = MAC_SCC_QUADRA, 808 .scc_type = MAC_SCC_QUADRA,
784 .nubus_type = MAC_NUBUS, 809 .nubus_type = MAC_NUBUS,
@@ -787,7 +812,7 @@ static struct mac_model mac_data_table[] = {
787 .ident = MAC_MODEL_PB280C, 812 .ident = MAC_MODEL_PB280C,
788 .name = "PowerBook Duo 280c", 813 .name = "PowerBook Duo 280c",
789 .adb_type = MAC_ADB_PB2, 814 .adb_type = MAC_ADB_PB2,
790 .via_type = MAC_VIA_IIci, 815 .via_type = MAC_VIA_IICI,
791 .scsi_type = MAC_SCSI_OLD, 816 .scsi_type = MAC_SCSI_OLD,
792 .scc_type = MAC_SCC_QUADRA, 817 .scc_type = MAC_SCC_QUADRA,
793 .nubus_type = MAC_NUBUS, 818 .nubus_type = MAC_NUBUS,
@@ -864,8 +889,14 @@ static void __init mac_identify(void)
864 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B; 889 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
865 break; 890 break;
866 default: 891 default:
867 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC; 892 /* On non-PSC machines, the serial ports share an IRQ. */
868 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC; 893 if (macintosh_config->ident == MAC_MODEL_IIFX) {
894 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
895 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
896 } else {
897 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
898 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
899 }
869 break; 900 break;
870 } 901 }
871 902
diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index a5462cc0bfd6..7d8d46127ad9 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -115,7 +115,6 @@
115#include <asm/macintosh.h> 115#include <asm/macintosh.h>
116#include <asm/macints.h> 116#include <asm/macints.h>
117#include <asm/mac_iop.h> 117#include <asm/mac_iop.h>
118#include <asm/mac_oss.h>
119 118
120/*#define DEBUG_IOP*/ 119/*#define DEBUG_IOP*/
121 120
@@ -149,8 +148,6 @@ static struct listener iop_listeners[NUM_IOPS][NUM_IOP_CHAN];
149 148
150irqreturn_t iop_ism_irq(int, void *); 149irqreturn_t iop_ism_irq(int, void *);
151 150
152extern void oss_irq_enable(int);
153
154/* 151/*
155 * Private access functions 152 * Private access functions
156 */ 153 */
@@ -304,11 +301,10 @@ void __init iop_init(void)
304void __init iop_register_interrupts(void) 301void __init iop_register_interrupts(void)
305{ 302{
306 if (iop_ism_present) { 303 if (iop_ism_present) {
307 if (oss_present) { 304 if (macintosh_config->ident == MAC_MODEL_IIFX) {
308 if (request_irq(OSS_IRQLEV_IOPISM, iop_ism_irq, 0, 305 if (request_irq(IRQ_MAC_ADB, iop_ism_irq, 0,
309 "ISM IOP", (void *)IOP_NUM_ISM)) 306 "ISM IOP", (void *)IOP_NUM_ISM))
310 pr_err("Couldn't register ISM IOP interrupt\n"); 307 pr_err("Couldn't register ISM IOP interrupt\n");
311 oss_irq_enable(IRQ_MAC_ADB);
312 } else { 308 } else {
313 if (request_irq(IRQ_VIA2_0, iop_ism_irq, 0, "ISM IOP", 309 if (request_irq(IRQ_VIA2_0, iop_ism_irq, 0, "ISM IOP",
314 (void *)IOP_NUM_ISM)) 310 (void *)IOP_NUM_ISM))
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index ba220b70ab8c..5c1a6b2ff0af 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -26,10 +26,6 @@
26 * - slot 6: timer 1 (not on IIci) 26 * - slot 6: timer 1 (not on IIci)
27 * - slot 7: status of IRQ; signals 'any enabled int.' 27 * - slot 7: status of IRQ; signals 'any enabled int.'
28 * 28 *
29 * 2 - OSS (IIfx only?)
30 * - slot 0: SCSI interrupt
31 * - slot 1: Sound interrupt
32 *
33 * Levels 3-6 vary by machine type. For VIA or RBV Macintoshes: 29 * Levels 3-6 vary by machine type. For VIA or RBV Macintoshes:
34 * 30 *
35 * 3 - unused (?) 31 * 3 - unused (?)
@@ -42,21 +38,30 @@
42 * 38 *
43 * 6 - off switch (?) 39 * 6 - off switch (?)
44 * 40 *
45 * For OSS Macintoshes (IIfx only at this point): 41 * Machines with Quadra-like VIA hardware, except PSC and PMU machines, support
42 * an alternate interrupt mapping, as used by A/UX. It spreads ethernet and
43 * sound out to their own autovector IRQs and gives VIA1 a higher priority:
46 * 44 *
47 * 3 - Nubus interrupt 45 * 1 - unused (?)
48 * - slot 0: Slot $9
49 * - slot 1: Slot $A
50 * - slot 2: Slot $B
51 * - slot 3: Slot $C
52 * - slot 4: Slot $D
53 * - slot 5: Slot $E
54 * 46 *
55 * 4 - SCC IOP 47 * 3 - on-board SONIC
48 *
49 * 5 - Apple Sound Chip (ASC)
50 *
51 * 6 - VIA1
52 *
53 * For OSS Macintoshes (IIfx only), we apply an interrupt mapping similar to
54 * the Quadra (A/UX) mapping:
55 *
56 * 1 - ISM IOP (ADB)
56 * 57 *
57 * 5 - ISM IOP (ADB?) 58 * 2 - SCSI
58 * 59 *
59 * 6 - unused 60 * 3 - NuBus
61 *
62 * 4 - SCC IOP
63 *
64 * 6 - VIA1
60 * 65 *
61 * For PSC Macintoshes (660AV, 840AV): 66 * For PSC Macintoshes (660AV, 840AV):
62 * 67 *
@@ -100,88 +105,29 @@
100 * case. They're hidden behind the Nubus slot $C interrupt thus adding a 105 * case. They're hidden behind the Nubus slot $C interrupt thus adding a
101 * third layer of indirection. Why oh why did the Apple engineers do that? 106 * third layer of indirection. Why oh why did the Apple engineers do that?
102 * 107 *
103 * - We support "fast" and "slow" handlers, just like the Amiga port. The
104 * fast handlers are called first and with all interrupts disabled. They
105 * are expected to execute quickly (hence the name). The slow handlers are
106 * called last with interrupts enabled and the interrupt level restored.
107 * They must therefore be reentrant.
108 *
109 * TODO:
110 *
111 */ 108 */
112 109
113#include <linux/module.h>
114#include <linux/types.h> 110#include <linux/types.h>
115#include <linux/kernel.h> 111#include <linux/kernel.h>
116#include <linux/sched.h> 112#include <linux/sched.h>
117#include <linux/kernel_stat.h> 113#include <linux/interrupt.h>
118#include <linux/interrupt.h> /* for intr_count */ 114#include <linux/irq.h>
119#include <linux/delay.h> 115#include <linux/delay.h>
120#include <linux/seq_file.h>
121 116
122#include <asm/system.h>
123#include <asm/irq.h> 117#include <asm/irq.h>
124#include <asm/traps.h>
125#include <asm/bootinfo.h>
126#include <asm/macintosh.h> 118#include <asm/macintosh.h>
119#include <asm/macints.h>
127#include <asm/mac_via.h> 120#include <asm/mac_via.h>
128#include <asm/mac_psc.h> 121#include <asm/mac_psc.h>
122#include <asm/mac_oss.h>
123#include <asm/mac_iop.h>
124#include <asm/mac_baboon.h>
129#include <asm/hwtest.h> 125#include <asm/hwtest.h>
130#include <asm/errno.h>
131#include <asm/macints.h>
132#include <asm/irq_regs.h> 126#include <asm/irq_regs.h>
133#include <asm/mac_oss.h>
134 127
135#define SHUTUP_SONIC 128#define SHUTUP_SONIC
136 129
137/* 130/*
138 * VIA/RBV hooks
139 */
140
141extern void via_register_interrupts(void);
142extern void via_irq_enable(int);
143extern void via_irq_disable(int);
144extern void via_irq_clear(int);
145extern int via_irq_pending(int);
146
147/*
148 * OSS hooks
149 */
150
151extern void oss_register_interrupts(void);
152extern void oss_irq_enable(int);
153extern void oss_irq_disable(int);
154extern void oss_irq_clear(int);
155extern int oss_irq_pending(int);
156
157/*
158 * PSC hooks
159 */
160
161extern void psc_register_interrupts(void);
162extern void psc_irq_enable(int);
163extern void psc_irq_disable(int);
164extern void psc_irq_clear(int);
165extern int psc_irq_pending(int);
166
167/*
168 * IOP hooks
169 */
170
171extern void iop_register_interrupts(void);
172
173/*
174 * Baboon hooks
175 */
176
177extern int baboon_present;
178
179extern void baboon_register_interrupts(void);
180extern void baboon_irq_enable(int);
181extern void baboon_irq_disable(int);
182extern void baboon_irq_clear(int);
183
184/*
185 * console_loglevel determines NMI handler function 131 * console_loglevel determines NMI handler function
186 */ 132 */
187 133
@@ -190,10 +136,15 @@ irqreturn_t mac_debug_handler(int, void *);
190 136
191/* #define DEBUG_MACINTS */ 137/* #define DEBUG_MACINTS */
192 138
139static unsigned int mac_irq_startup(struct irq_data *);
140static void mac_irq_shutdown(struct irq_data *);
141
193static struct irq_chip mac_irq_chip = { 142static struct irq_chip mac_irq_chip = {
194 .name = "mac", 143 .name = "mac",
195 .irq_enable = mac_irq_enable, 144 .irq_enable = mac_irq_enable,
196 .irq_disable = mac_irq_disable, 145 .irq_disable = mac_irq_disable,
146 .irq_startup = mac_irq_startup,
147 .irq_shutdown = mac_irq_shutdown,
197}; 148};
198 149
199void __init mac_init_IRQ(void) 150void __init mac_init_IRQ(void)
@@ -239,8 +190,6 @@ void __init mac_init_IRQ(void)
239/* 190/*
240 * mac_irq_enable - enable an interrupt source 191 * mac_irq_enable - enable an interrupt source
241 * mac_irq_disable - disable an interrupt source 192 * mac_irq_disable - disable an interrupt source
242 * mac_clear_irq - clears a pending interrupt
243 * mac_irq_pending - returns the pending status of an IRQ (nonzero = pending)
244 * 193 *
245 * These routines are just dispatchers to the VIA/OSS/PSC routines. 194 * These routines are just dispatchers to the VIA/OSS/PSC routines.
246 */ 195 */
@@ -252,8 +201,6 @@ void mac_irq_enable(struct irq_data *data)
252 201
253 switch(irq_src) { 202 switch(irq_src) {
254 case 1: 203 case 1:
255 via_irq_enable(irq);
256 break;
257 case 2: 204 case 2:
258 case 7: 205 case 7:
259 if (oss_present) 206 if (oss_present)
@@ -262,6 +209,7 @@ void mac_irq_enable(struct irq_data *data)
262 via_irq_enable(irq); 209 via_irq_enable(irq);
263 break; 210 break;
264 case 3: 211 case 3:
212 case 4:
265 case 5: 213 case 5:
266 case 6: 214 case 6:
267 if (psc_present) 215 if (psc_present)
@@ -269,10 +217,6 @@ void mac_irq_enable(struct irq_data *data)
269 else if (oss_present) 217 else if (oss_present)
270 oss_irq_enable(irq); 218 oss_irq_enable(irq);
271 break; 219 break;
272 case 4:
273 if (psc_present)
274 psc_irq_enable(irq);
275 break;
276 case 8: 220 case 8:
277 if (baboon_present) 221 if (baboon_present)
278 baboon_irq_enable(irq); 222 baboon_irq_enable(irq);
@@ -287,8 +231,6 @@ void mac_irq_disable(struct irq_data *data)
287 231
288 switch(irq_src) { 232 switch(irq_src) {
289 case 1: 233 case 1:
290 via_irq_disable(irq);
291 break;
292 case 2: 234 case 2:
293 case 7: 235 case 7:
294 if (oss_present) 236 if (oss_present)
@@ -297,6 +239,7 @@ void mac_irq_disable(struct irq_data *data)
297 via_irq_disable(irq); 239 via_irq_disable(irq);
298 break; 240 break;
299 case 3: 241 case 3:
242 case 4:
300 case 5: 243 case 5:
301 case 6: 244 case 6:
302 if (psc_present) 245 if (psc_present)
@@ -304,10 +247,6 @@ void mac_irq_disable(struct irq_data *data)
304 else if (oss_present) 247 else if (oss_present)
305 oss_irq_disable(irq); 248 oss_irq_disable(irq);
306 break; 249 break;
307 case 4:
308 if (psc_present)
309 psc_irq_disable(irq);
310 break;
311 case 8: 250 case 8:
312 if (baboon_present) 251 if (baboon_present)
313 baboon_irq_disable(irq); 252 baboon_irq_disable(irq);
@@ -315,65 +254,27 @@ void mac_irq_disable(struct irq_data *data)
315 } 254 }
316} 255}
317 256
318void mac_clear_irq(unsigned int irq) 257static unsigned int mac_irq_startup(struct irq_data *data)
319{ 258{
320 switch(IRQ_SRC(irq)) { 259 int irq = data->irq;
321 case 1: 260
322 via_irq_clear(irq); 261 if (IRQ_SRC(irq) == 7 && !oss_present)
323 break; 262 via_nubus_irq_startup(irq);
324 case 2: 263 else
325 case 7: 264 mac_irq_enable(data);
326 if (oss_present) 265
327 oss_irq_clear(irq); 266 return 0;
328 else
329 via_irq_clear(irq);
330 break;
331 case 3:
332 case 5:
333 case 6:
334 if (psc_present)
335 psc_irq_clear(irq);
336 else if (oss_present)
337 oss_irq_clear(irq);
338 break;
339 case 4:
340 if (psc_present)
341 psc_irq_clear(irq);
342 break;
343 case 8:
344 if (baboon_present)
345 baboon_irq_clear(irq);
346 break;
347 }
348} 267}
349 268
350int mac_irq_pending(unsigned int irq) 269static void mac_irq_shutdown(struct irq_data *data)
351{ 270{
352 switch(IRQ_SRC(irq)) { 271 int irq = data->irq;
353 case 1: 272
354 return via_irq_pending(irq); 273 if (IRQ_SRC(irq) == 7 && !oss_present)
355 case 2: 274 via_nubus_irq_shutdown(irq);
356 case 7: 275 else
357 if (oss_present) 276 mac_irq_disable(data);
358 return oss_irq_pending(irq);
359 else
360 return via_irq_pending(irq);
361 case 3:
362 case 5:
363 case 6:
364 if (psc_present)
365 return psc_irq_pending(irq);
366 else if (oss_present)
367 return oss_irq_pending(irq);
368 break;
369 case 4:
370 if (psc_present)
371 return psc_irq_pending(irq);
372 break;
373 }
374 return 0;
375} 277}
376EXPORT_SYMBOL(mac_irq_pending);
377 278
378static int num_debug[8]; 279static int num_debug[8];
379 280
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index a4c82dab9ff1..6c4c882c126e 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * OSS handling 2 * Operating System Services (OSS) chip handling
3 * Written by Joshua M. Thompson (funaho@jurai.org) 3 * Written by Joshua M. Thompson (funaho@jurai.org)
4 * 4 *
5 * 5 *
@@ -30,8 +30,6 @@
30int oss_present; 30int oss_present;
31volatile struct mac_oss *oss; 31volatile struct mac_oss *oss;
32 32
33extern void via1_irq(unsigned int irq, struct irq_desc *desc);
34
35/* 33/*
36 * Initialize the OSS 34 * Initialize the OSS
37 * 35 *
@@ -51,10 +49,8 @@ void __init oss_init(void)
51 /* do this by setting the source's interrupt level to zero. */ 49 /* do this by setting the source's interrupt level to zero. */
52 50
53 for (i = 0; i <= OSS_NUM_SOURCES; i++) { 51 for (i = 0; i <= OSS_NUM_SOURCES; i++) {
54 oss->irq_level[i] = OSS_IRQLEV_DISABLED; 52 oss->irq_level[i] = 0;
55 } 53 }
56 /* If we disable VIA1 here, we never really handle it... */
57 oss->irq_level[OSS_VIA1] = OSS_IRQLEV_VIA1;
58} 54}
59 55
60/* 56/*
@@ -66,17 +62,13 @@ void __init oss_nubus_init(void)
66} 62}
67 63
68/* 64/*
69 * Handle miscellaneous OSS interrupts. Right now that's just sound 65 * Handle miscellaneous OSS interrupts.
70 * and SCSI; everything else is routed to its own autovector IRQ.
71 */ 66 */
72 67
73static void oss_irq(unsigned int irq, struct irq_desc *desc) 68static void oss_irq(unsigned int irq, struct irq_desc *desc)
74{ 69{
75 int events; 70 int events = oss->irq_pending &
76 71 (OSS_IP_IOPSCC | OSS_IP_SCSI | OSS_IP_IOPISM);
77 events = oss->irq_pending & (OSS_IP_SOUND|OSS_IP_SCSI);
78 if (!events)
79 return;
80 72
81#ifdef DEBUG_IRQS 73#ifdef DEBUG_IRQS
82 if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) { 74 if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) {
@@ -84,16 +76,20 @@ static void oss_irq(unsigned int irq, struct irq_desc *desc)
84 (int) oss->irq_pending); 76 (int) oss->irq_pending);
85 } 77 }
86#endif 78#endif
87 /* FIXME: how do you clear a pending IRQ? */
88 79
89 if (events & OSS_IP_SOUND) { 80 if (events & OSS_IP_IOPSCC) {
90 oss->irq_pending &= ~OSS_IP_SOUND; 81 oss->irq_pending &= ~OSS_IP_IOPSCC;
91 /* FIXME: call sound handler */ 82 generic_handle_irq(IRQ_MAC_SCC);
92 } else if (events & OSS_IP_SCSI) { 83 }
84
85 if (events & OSS_IP_SCSI) {
93 oss->irq_pending &= ~OSS_IP_SCSI; 86 oss->irq_pending &= ~OSS_IP_SCSI;
94 generic_handle_irq(IRQ_MAC_SCSI); 87 generic_handle_irq(IRQ_MAC_SCSI);
95 } else { 88 }
96 /* FIXME: error check here? */ 89
90 if (events & OSS_IP_IOPISM) {
91 oss->irq_pending &= ~OSS_IP_IOPISM;
92 generic_handle_irq(IRQ_MAC_ADB);
97 } 93 }
98} 94}
99 95
@@ -132,14 +128,29 @@ static void oss_nubus_irq(unsigned int irq, struct irq_desc *desc)
132 128
133/* 129/*
134 * Register the OSS and NuBus interrupt dispatchers. 130 * Register the OSS and NuBus interrupt dispatchers.
131 *
132 * This IRQ mapping is laid out with two things in mind: first, we try to keep
133 * things on their own levels to avoid having to do double-dispatches. Second,
134 * the levels match as closely as possible the alternate IRQ mapping mode (aka
135 * "A/UX mode") available on some VIA machines.
135 */ 136 */
136 137
138#define OSS_IRQLEV_IOPISM IRQ_AUTO_1
139#define OSS_IRQLEV_SCSI IRQ_AUTO_2
140#define OSS_IRQLEV_NUBUS IRQ_AUTO_3
141#define OSS_IRQLEV_IOPSCC IRQ_AUTO_4
142#define OSS_IRQLEV_VIA1 IRQ_AUTO_6
143
137void __init oss_register_interrupts(void) 144void __init oss_register_interrupts(void)
138{ 145{
139 irq_set_chained_handler(OSS_IRQLEV_SCSI, oss_irq); 146 irq_set_chained_handler(OSS_IRQLEV_IOPISM, oss_irq);
140 irq_set_chained_handler(OSS_IRQLEV_NUBUS, oss_nubus_irq); 147 irq_set_chained_handler(OSS_IRQLEV_SCSI, oss_irq);
141 irq_set_chained_handler(OSS_IRQLEV_SOUND, oss_irq); 148 irq_set_chained_handler(OSS_IRQLEV_NUBUS, oss_nubus_irq);
142 irq_set_chained_handler(OSS_IRQLEV_VIA1, via1_irq); 149 irq_set_chained_handler(OSS_IRQLEV_IOPSCC, oss_irq);
150 irq_set_chained_handler(OSS_IRQLEV_VIA1, via1_irq);
151
152 /* OSS_VIA1 gets enabled here because it has no machspec interrupt. */
153 oss->irq_level[OSS_VIA1] = IRQ_AUTO_6;
143} 154}
144 155
145/* 156/*
@@ -158,13 +169,13 @@ void oss_irq_enable(int irq) {
158 switch(irq) { 169 switch(irq) {
159 case IRQ_MAC_SCC: 170 case IRQ_MAC_SCC:
160 oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_IOPSCC; 171 oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_IOPSCC;
161 break; 172 return;
162 case IRQ_MAC_ADB: 173 case IRQ_MAC_ADB:
163 oss->irq_level[OSS_IOPISM] = OSS_IRQLEV_IOPISM; 174 oss->irq_level[OSS_IOPISM] = OSS_IRQLEV_IOPISM;
164 break; 175 return;
165 case IRQ_MAC_SCSI: 176 case IRQ_MAC_SCSI:
166 oss->irq_level[OSS_SCSI] = OSS_IRQLEV_SCSI; 177 oss->irq_level[OSS_SCSI] = OSS_IRQLEV_SCSI;
167 break; 178 return;
168 case IRQ_NUBUS_9: 179 case IRQ_NUBUS_9:
169 case IRQ_NUBUS_A: 180 case IRQ_NUBUS_A:
170 case IRQ_NUBUS_B: 181 case IRQ_NUBUS_B:
@@ -173,13 +184,11 @@ void oss_irq_enable(int irq) {
173 case IRQ_NUBUS_E: 184 case IRQ_NUBUS_E:
174 irq -= NUBUS_SOURCE_BASE; 185 irq -= NUBUS_SOURCE_BASE;
175 oss->irq_level[irq] = OSS_IRQLEV_NUBUS; 186 oss->irq_level[irq] = OSS_IRQLEV_NUBUS;
176 break; 187 return;
177#ifdef DEBUG_IRQUSE
178 default:
179 printk("%s unknown irq %d\n", __func__, irq);
180 break;
181#endif
182 } 188 }
189
190 if (IRQ_SRC(irq) == 1)
191 via_irq_enable(irq);
183} 192}
184 193
185/* 194/*
@@ -195,50 +204,14 @@ void oss_irq_disable(int irq) {
195#endif 204#endif
196 switch(irq) { 205 switch(irq) {
197 case IRQ_MAC_SCC: 206 case IRQ_MAC_SCC:
198 oss->irq_level[OSS_IOPSCC] = OSS_IRQLEV_DISABLED; 207 oss->irq_level[OSS_IOPSCC] = 0;
199 break; 208 return;
200 case IRQ_MAC_ADB:
201 oss->irq_level[OSS_IOPISM] = OSS_IRQLEV_DISABLED;
202 break;
203 case IRQ_MAC_SCSI:
204 oss->irq_level[OSS_SCSI] = OSS_IRQLEV_DISABLED;
205 break;
206 case IRQ_NUBUS_9:
207 case IRQ_NUBUS_A:
208 case IRQ_NUBUS_B:
209 case IRQ_NUBUS_C:
210 case IRQ_NUBUS_D:
211 case IRQ_NUBUS_E:
212 irq -= NUBUS_SOURCE_BASE;
213 oss->irq_level[irq] = OSS_IRQLEV_DISABLED;
214 break;
215#ifdef DEBUG_IRQUSE
216 default:
217 printk("%s unknown irq %d\n", __func__, irq);
218 break;
219#endif
220 }
221}
222
223/*
224 * Clear an OSS interrupt
225 *
226 * Not sure if this works or not but it's the only method I could
227 * think of based on the contents of the mac_oss structure.
228 */
229
230void oss_irq_clear(int irq) {
231 /* FIXME: how to do this on OSS? */
232 switch(irq) {
233 case IRQ_MAC_SCC:
234 oss->irq_pending &= ~OSS_IP_IOPSCC;
235 break;
236 case IRQ_MAC_ADB: 209 case IRQ_MAC_ADB:
237 oss->irq_pending &= ~OSS_IP_IOPISM; 210 oss->irq_level[OSS_IOPISM] = 0;
238 break; 211 return;
239 case IRQ_MAC_SCSI: 212 case IRQ_MAC_SCSI:
240 oss->irq_pending &= ~OSS_IP_SCSI; 213 oss->irq_level[OSS_SCSI] = 0;
241 break; 214 return;
242 case IRQ_NUBUS_9: 215 case IRQ_NUBUS_9:
243 case IRQ_NUBUS_A: 216 case IRQ_NUBUS_A:
244 case IRQ_NUBUS_B: 217 case IRQ_NUBUS_B:
@@ -246,36 +219,10 @@ void oss_irq_clear(int irq) {
246 case IRQ_NUBUS_D: 219 case IRQ_NUBUS_D:
247 case IRQ_NUBUS_E: 220 case IRQ_NUBUS_E:
248 irq -= NUBUS_SOURCE_BASE; 221 irq -= NUBUS_SOURCE_BASE;
249 oss->irq_pending &= ~(1 << irq); 222 oss->irq_level[irq] = 0;
250 break; 223 return;
251 } 224 }
252}
253
254/*
255 * Check to see if a specific OSS interrupt is pending
256 */
257 225
258int oss_irq_pending(int irq) 226 if (IRQ_SRC(irq) == 1)
259{ 227 via_irq_disable(irq);
260 switch(irq) {
261 case IRQ_MAC_SCC:
262 return oss->irq_pending & OSS_IP_IOPSCC;
263 break;
264 case IRQ_MAC_ADB:
265 return oss->irq_pending & OSS_IP_IOPISM;
266 break;
267 case IRQ_MAC_SCSI:
268 return oss->irq_pending & OSS_IP_SCSI;
269 break;
270 case IRQ_NUBUS_9:
271 case IRQ_NUBUS_A:
272 case IRQ_NUBUS_B:
273 case IRQ_NUBUS_C:
274 case IRQ_NUBUS_D:
275 case IRQ_NUBUS_E:
276 irq -= NUBUS_SOURCE_BASE;
277 return oss->irq_pending & (1 << irq);
278 break;
279 }
280 return 0;
281} 228}
diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
index e6c2d20f328d..6f026fc302fa 100644
--- a/arch/m68k/mac/psc.c
+++ b/arch/m68k/mac/psc.c
@@ -180,20 +180,3 @@ void psc_irq_disable(int irq) {
180#endif 180#endif
181 psc_write_byte(pIER, 1 << irq_idx); 181 psc_write_byte(pIER, 1 << irq_idx);
182} 182}
183
184void psc_irq_clear(int irq) {
185 int irq_src = IRQ_SRC(irq);
186 int irq_idx = IRQ_IDX(irq);
187 int pIFR = pIERbase + (irq_src << 4);
188
189 psc_write_byte(pIFR, 1 << irq_idx);
190}
191
192int psc_irq_pending(int irq)
193{
194 int irq_src = IRQ_SRC(irq);
195 int irq_idx = IRQ_IDX(irq);
196 int pIFR = pIERbase + (irq_src << 4);
197
198 return psc_read_byte(pIFR) & (1 << irq_idx);
199}
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index f1600ad26621..2d85662715fb 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -63,24 +63,50 @@ static int gIER,gIFR,gBufA,gBufB;
63#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF) 63#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF)
64#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8) 64#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8)
65 65
66/* To disable a NuBus slot on Quadras we make that slot IRQ line an output set 66
67 * high. On RBV we just use the slot interrupt enable register. On Macs with 67/*
68 * genuine VIA chips we must use nubus_disabled to keep track of disabled slot 68 * On Macs with a genuine VIA chip there is no way to mask an individual slot
69 * interrupts. When any slot IRQ is disabled we mask the (edge triggered) CA1 69 * interrupt. This limitation also seems to apply to VIA clone logic cores in
70 * or "SLOTS" interrupt. When no slot is disabled, we unmask the CA1 interrupt. 70 * Quadra-like ASICs. (RBV and OSS machines don't have this limitation.)
71 * So, on genuine VIAs, having more than one NuBus IRQ can mean trouble, 71 *
72 * because closing one of those drivers can mask all of the NuBus interrupts. 72 * We used to fake it by configuring the relevent VIA pin as an output
73 * Also, since we can't mask the unregistered slot IRQs on genuine VIAs, it's 73 * (to mask the interrupt) or input (to unmask). That scheme did not work on
74 * possible to get interrupts from cards that MacOS or the ROM has configured 74 * (at least) the Quadra 700. A NuBus card's /NMRQ signal is an open-collector
75 * but we have not. FWIW, "Designing Cards and Drivers for Macintosh II and 75 * circuit (see Designing Cards and Drivers for Macintosh II and Macintosh SE,
76 * Macintosh SE", page 9-8, says, a slot IRQ with no driver would crash MacOS. 76 * p. 10-11 etc) but VIA outputs are not (see datasheet).
77 *
78 * Driving these outputs high must cause the VIA to source current and the
79 * card to sink current when it asserts /NMRQ. Current will flow but the pin
80 * voltage is uncertain and so the /NMRQ condition may still cause a transition
81 * at the VIA2 CA1 input (which explains the lost interrupts). A side effect
82 * is that a disabled slot IRQ can never be tested as pending or not.
83 *
84 * Driving these outputs low doesn't work either. All the slot /NMRQ lines are
85 * (active low) OR'd together to generate the CA1 (aka "SLOTS") interrupt (see
86 * The Guide To Macintosh Family Hardware, 2nd edition p. 167). If we drive a
87 * disabled /NMRQ line low, the falling edge immediately triggers a CA1
88 * interrupt and all slot interrupts after that will generate no transition
89 * and therefore no interrupt, even after being re-enabled.
90 *
91 * So we make the VIA port A I/O lines inputs and use nubus_disabled to keep
92 * track of their states. When any slot IRQ becomes disabled we mask the CA1
93 * umbrella interrupt. Only when all slot IRQs become enabled do we unmask
94 * the CA1 interrupt. It must remain enabled even when cards have no interrupt
95 * handler registered. Drivers must therefore disable a slot interrupt at the
96 * device before they call free_irq (like shared and autovector interrupts).
97 *
98 * There is also a related problem when MacOS is used to boot Linux. A network
99 * card brought up by a MacOS driver may raise an interrupt while Linux boots.
100 * This can be fatal since it can't be handled until the right driver loads
101 * (if such a driver exists at all). Apparently related to this hardware
102 * limitation, "Designing Cards and Drivers", p. 9-8, says that a slot
103 * interrupt with no driver would crash MacOS (the book was written before
104 * the appearance of Macs with RBV or OSS).
77 */ 105 */
106
78static u8 nubus_disabled; 107static u8 nubus_disabled;
79 108
80void via_debug_dump(void); 109void via_debug_dump(void);
81void via_irq_enable(int irq);
82void via_irq_disable(int irq);
83void via_irq_clear(int irq);
84 110
85/* 111/*
86 * Initialize the VIAs 112 * Initialize the VIAs
@@ -100,7 +126,7 @@ void __init via_init(void)
100 126
101 /* IIci, IIsi, IIvx, IIvi (P6xx), LC series */ 127 /* IIci, IIsi, IIvx, IIvi (P6xx), LC series */
102 128
103 case MAC_VIA_IIci: 129 case MAC_VIA_IICI:
104 via1 = (void *) VIA1_BASE; 130 via1 = (void *) VIA1_BASE;
105 if (macintosh_config->ident == MAC_MODEL_IIFX) { 131 if (macintosh_config->ident == MAC_MODEL_IIFX) {
106 via2 = NULL; 132 via2 = NULL;
@@ -197,38 +223,17 @@ void __init via_init(void)
197 if (oss_present) 223 if (oss_present)
198 return; 224 return;
199 225
200 /* Some machines support an alternate IRQ mapping that spreads */ 226 if ((macintosh_config->via_type == MAC_VIA_QUADRA) &&
201 /* Ethernet and Sound out to their own autolevel IRQs and moves */ 227 (macintosh_config->adb_type != MAC_ADB_PB1) &&
202 /* VIA1 to level 6. A/UX uses this mapping and we do too. Note */ 228 (macintosh_config->adb_type != MAC_ADB_PB2) &&
203 /* that the IIfx emulates this alternate mapping using the OSS. */ 229 (macintosh_config->ident != MAC_MODEL_C660) &&
204 230 (macintosh_config->ident != MAC_MODEL_Q840)) {
205 via_alt_mapping = 0; 231 via_alt_mapping = 1;
206 if (macintosh_config->via_type == MAC_VIA_QUADRA) 232 via1[vDirB] |= 0x40;
207 switch (macintosh_config->ident) { 233 via1[vBufB] &= ~0x40;
208 case MAC_MODEL_C660: 234 } else {
209 case MAC_MODEL_Q840: 235 via_alt_mapping = 0;
210 /* not applicable */ 236 }
211 break;
212 case MAC_MODEL_P588:
213 case MAC_MODEL_TV:
214 case MAC_MODEL_PB140:
215 case MAC_MODEL_PB145:
216 case MAC_MODEL_PB160:
217 case MAC_MODEL_PB165:
218 case MAC_MODEL_PB165C:
219 case MAC_MODEL_PB170:
220 case MAC_MODEL_PB180:
221 case MAC_MODEL_PB180C:
222 case MAC_MODEL_PB190:
223 case MAC_MODEL_PB520:
224 /* not yet tested */
225 break;
226 default:
227 via_alt_mapping = 1;
228 via1[vDirB] |= 0x40;
229 via1[vBufB] &= ~0x40;
230 break;
231 }
232 237
233 /* 238 /*
234 * Now initialize VIA2. For RBV we just kill all interrupts; 239 * Now initialize VIA2. For RBV we just kill all interrupts;
@@ -248,22 +253,28 @@ void __init via_init(void)
248 via2[vACR] &= ~0x03; /* disable port A & B latches */ 253 via2[vACR] &= ~0x03; /* disable port A & B latches */
249 } 254 }
250 255
256 /* Everything below this point is VIA2 only... */
257
258 if (rbv_present)
259 return;
260
251 /* 261 /*
252 * Set vPCR for control line interrupts (but not on RBV) 262 * Set vPCR for control line interrupts.
263 *
264 * CA1 (SLOTS IRQ), CB1 (ASC IRQ): negative edge trigger.
265 *
266 * Macs with ESP SCSI have a negative edge triggered SCSI interrupt.
267 * Testing reveals that PowerBooks do too. However, the SE/30
268 * schematic diagram shows an active high NCR5380 IRQ line.
253 */ 269 */
254 if (!rbv_present) { 270
255 /* For all VIA types, CA1 (SLOTS IRQ) and CB1 (ASC IRQ) 271 pr_debug("VIA2 vPCR is 0x%02X\n", via2[vPCR]);
256 * are made negative edge triggered here. 272 if (macintosh_config->via_type == MAC_VIA_II) {
257 */ 273 /* CA2 (SCSI DRQ), CB2 (SCSI IRQ): indep. input, pos. edge */
258 if (macintosh_config->scsi_type == MAC_SCSI_OLD) { 274 via2[vPCR] = 0x66;
259 /* CB2 (IRQ) indep. input, positive edge */ 275 } else {
260 /* CA2 (DRQ) indep. input, positive edge */ 276 /* CA2 (SCSI DRQ), CB2 (SCSI IRQ): indep. input, neg. edge */
261 via2[vPCR] = 0x66; 277 via2[vPCR] = 0x22;
262 } else {
263 /* CB2 (IRQ) indep. input, negative edge */
264 /* CA2 (DRQ) indep. input, negative edge */
265 via2[vPCR] = 0x22;
266 }
267 } 278 }
268} 279}
269 280
@@ -378,34 +389,55 @@ void __init via_nubus_init(void)
378 via2[gBufB] |= 0x02; 389 via2[gBufB] |= 0x02;
379 } 390 }
380 391
381 /* Disable all the slot interrupts (where possible). */ 392 /*
393 * Disable the slot interrupts. On some hardware that's not possible.
394 * On some hardware it's unclear what all of these I/O lines do.
395 */
382 396
383 switch (macintosh_config->via_type) { 397 switch (macintosh_config->via_type) {
384 case MAC_VIA_II: 398 case MAC_VIA_II:
385 /* Just make the port A lines inputs. */ 399 case MAC_VIA_QUADRA:
386 switch(macintosh_config->ident) { 400 pr_debug("VIA2 vDirA is 0x%02X\n", via2[vDirA]);
387 case MAC_MODEL_II:
388 case MAC_MODEL_IIX:
389 case MAC_MODEL_IICX:
390 case MAC_MODEL_SE30:
391 /* The top two bits are RAM size outputs. */
392 via2[vDirA] &= 0xC0;
393 break;
394 default:
395 via2[vDirA] &= 0x80;
396 }
397 break; 401 break;
398 case MAC_VIA_IIci: 402 case MAC_VIA_IICI:
399 /* RBV. Disable all the slot interrupts. SIER works like IER. */ 403 /* RBV. Disable all the slot interrupts. SIER works like IER. */
400 via2[rSIER] = 0x7F; 404 via2[rSIER] = 0x7F;
401 break; 405 break;
406 }
407}
408
409void via_nubus_irq_startup(int irq)
410{
411 int irq_idx = IRQ_IDX(irq);
412
413 switch (macintosh_config->via_type) {
414 case MAC_VIA_II:
402 case MAC_VIA_QUADRA: 415 case MAC_VIA_QUADRA:
403 /* Disable the inactive slot interrupts by making those lines outputs. */ 416 /* Make the port A line an input. Probably redundant. */
404 if ((macintosh_config->adb_type != MAC_ADB_PB1) && 417 if (macintosh_config->via_type == MAC_VIA_II) {
405 (macintosh_config->adb_type != MAC_ADB_PB2)) { 418 /* The top two bits are RAM size outputs. */
406 via2[vBufA] |= 0x7F; 419 via2[vDirA] &= 0xC0 | ~(1 << irq_idx);
407 via2[vDirA] |= 0x7F; 420 } else {
421 /* Allow NuBus slots 9 through F. */
422 via2[vDirA] &= 0x80 | ~(1 << irq_idx);
408 } 423 }
424 /* fall through */
425 case MAC_VIA_IICI:
426 via_irq_enable(irq);
427 break;
428 }
429}
430
431void via_nubus_irq_shutdown(int irq)
432{
433 switch (macintosh_config->via_type) {
434 case MAC_VIA_II:
435 case MAC_VIA_QUADRA:
436 /* Ensure that the umbrella CA1 interrupt remains enabled. */
437 via_irq_enable(irq);
438 break;
439 case MAC_VIA_IICI:
440 via_irq_disable(irq);
409 break; 441 break;
410 } 442 }
411} 443}
@@ -531,25 +563,18 @@ void via_irq_enable(int irq) {
531 } else if (irq_src == 7) { 563 } else if (irq_src == 7) {
532 switch (macintosh_config->via_type) { 564 switch (macintosh_config->via_type) {
533 case MAC_VIA_II: 565 case MAC_VIA_II:
566 case MAC_VIA_QUADRA:
534 nubus_disabled &= ~(1 << irq_idx); 567 nubus_disabled &= ~(1 << irq_idx);
535 /* Enable the CA1 interrupt when no slot is disabled. */ 568 /* Enable the CA1 interrupt when no slot is disabled. */
536 if (!nubus_disabled) 569 if (!nubus_disabled)
537 via2[gIER] = IER_SET_BIT(1); 570 via2[gIER] = IER_SET_BIT(1);
538 break; 571 break;
539 case MAC_VIA_IIci: 572 case MAC_VIA_IICI:
540 /* On RBV, enable the slot interrupt. 573 /* On RBV, enable the slot interrupt.
541 * SIER works like IER. 574 * SIER works like IER.
542 */ 575 */
543 via2[rSIER] = IER_SET_BIT(irq_idx); 576 via2[rSIER] = IER_SET_BIT(irq_idx);
544 break; 577 break;
545 case MAC_VIA_QUADRA:
546 /* Make the port A line an input to enable the slot irq.
547 * But not on PowerBooks, that's ADB.
548 */
549 if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
550 (macintosh_config->adb_type != MAC_ADB_PB2))
551 via2[vDirA] &= ~(1 << irq_idx);
552 break;
553 } 578 }
554 } 579 }
555} 580}
@@ -569,60 +594,18 @@ void via_irq_disable(int irq) {
569 } else if (irq_src == 7) { 594 } else if (irq_src == 7) {
570 switch (macintosh_config->via_type) { 595 switch (macintosh_config->via_type) {
571 case MAC_VIA_II: 596 case MAC_VIA_II:
597 case MAC_VIA_QUADRA:
572 nubus_disabled |= 1 << irq_idx; 598 nubus_disabled |= 1 << irq_idx;
573 if (nubus_disabled) 599 if (nubus_disabled)
574 via2[gIER] = IER_CLR_BIT(1); 600 via2[gIER] = IER_CLR_BIT(1);
575 break; 601 break;
576 case MAC_VIA_IIci: 602 case MAC_VIA_IICI:
577 via2[rSIER] = IER_CLR_BIT(irq_idx); 603 via2[rSIER] = IER_CLR_BIT(irq_idx);
578 break; 604 break;
579 case MAC_VIA_QUADRA:
580 if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
581 (macintosh_config->adb_type != MAC_ADB_PB2))
582 via2[vDirA] |= 1 << irq_idx;
583 break;
584 } 605 }
585 } 606 }
586} 607}
587 608
588void via_irq_clear(int irq) {
589 int irq_src = IRQ_SRC(irq);
590 int irq_idx = IRQ_IDX(irq);
591 int irq_bit = 1 << irq_idx;
592
593 if (irq_src == 1) {
594 via1[vIFR] = irq_bit;
595 } else if (irq_src == 2) {
596 via2[gIFR] = irq_bit | rbv_clear;
597 } else if (irq_src == 7) {
598 /* FIXME: There is no way to clear an individual nubus slot
599 * IRQ flag, other than getting the device to do it.
600 */
601 }
602}
603
604/*
605 * Returns nonzero if an interrupt is pending on the given
606 * VIA/IRQ combination.
607 */
608
609int via_irq_pending(int irq)
610{
611 int irq_src = IRQ_SRC(irq);
612 int irq_idx = IRQ_IDX(irq);
613 int irq_bit = 1 << irq_idx;
614
615 if (irq_src == 1) {
616 return via1[vIFR] & irq_bit;
617 } else if (irq_src == 2) {
618 return via2[gIFR] & irq_bit;
619 } else if (irq_src == 7) {
620 /* Always 0 for MAC_VIA_QUADRA if the slot irq is disabled. */
621 return ~via2[gBufA] & irq_bit;
622 }
623 return 0;
624}
625
626void via1_set_head(int head) 609void via1_set_head(int head)
627{ 610{
628 if (head == 0) 611 if (head == 0)
@@ -631,3 +614,9 @@ void via1_set_head(int head)
631 via1[vBufA] |= VIA1A_vHeadSel; 614 via1[vBufA] |= VIA1A_vHeadSel;
632} 615}
633EXPORT_SYMBOL(via1_set_head); 616EXPORT_SYMBOL(via1_set_head);
617
618int via2_scsi_drq_pending(void)
619{
620 return via2[gIFR] & (1 << IRQ_IDX(IRQ_MAC_SCSIDRQ));
621}
622EXPORT_SYMBOL(via2_scsi_drq_pending);
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index 31a66d99cbca..c3fb3bdd7ed9 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -124,6 +124,163 @@ static void __init mvme16x_init_IRQ (void)
124#define PccSCCMICR 0x1d 124#define PccSCCMICR 0x1d
125#define PccSCCTICR 0x1e 125#define PccSCCTICR 0x1e
126#define PccSCCRICR 0x1f 126#define PccSCCRICR 0x1f
127#define PccTPIACKR 0x25
128
129#ifdef CONFIG_EARLY_PRINTK
130
131/**** cd2401 registers ****/
132#define CD2401_ADDR (0xfff45000)
133
134#define CyGFRCR (0x81)
135#define CyCCR (0x13)
136#define CyCLR_CHAN (0x40)
137#define CyINIT_CHAN (0x20)
138#define CyCHIP_RESET (0x10)
139#define CyENB_XMTR (0x08)
140#define CyDIS_XMTR (0x04)
141#define CyENB_RCVR (0x02)
142#define CyDIS_RCVR (0x01)
143#define CyCAR (0xee)
144#define CyIER (0x11)
145#define CyMdmCh (0x80)
146#define CyRxExc (0x20)
147#define CyRxData (0x08)
148#define CyTxMpty (0x02)
149#define CyTxRdy (0x01)
150#define CyLICR (0x26)
151#define CyRISR (0x89)
152#define CyTIMEOUT (0x80)
153#define CySPECHAR (0x70)
154#define CyOVERRUN (0x08)
155#define CyPARITY (0x04)
156#define CyFRAME (0x02)
157#define CyBREAK (0x01)
158#define CyREOIR (0x84)
159#define CyTEOIR (0x85)
160#define CyMEOIR (0x86)
161#define CyNOTRANS (0x08)
162#define CyRFOC (0x30)
163#define CyRDR (0xf8)
164#define CyTDR (0xf8)
165#define CyMISR (0x8b)
166#define CyRISR (0x89)
167#define CyTISR (0x8a)
168#define CyMSVR1 (0xde)
169#define CyMSVR2 (0xdf)
170#define CyDSR (0x80)
171#define CyDCD (0x40)
172#define CyCTS (0x20)
173#define CyDTR (0x02)
174#define CyRTS (0x01)
175#define CyRTPRL (0x25)
176#define CyRTPRH (0x24)
177#define CyCOR1 (0x10)
178#define CyPARITY_NONE (0x00)
179#define CyPARITY_E (0x40)
180#define CyPARITY_O (0xC0)
181#define Cy_5_BITS (0x04)
182#define Cy_6_BITS (0x05)
183#define Cy_7_BITS (0x06)
184#define Cy_8_BITS (0x07)
185#define CyCOR2 (0x17)
186#define CyETC (0x20)
187#define CyCtsAE (0x02)
188#define CyCOR3 (0x16)
189#define Cy_1_STOP (0x02)
190#define Cy_2_STOP (0x04)
191#define CyCOR4 (0x15)
192#define CyREC_FIFO (0x0F) /* Receive FIFO threshold */
193#define CyCOR5 (0x14)
194#define CyCOR6 (0x18)
195#define CyCOR7 (0x07)
196#define CyRBPR (0xcb)
197#define CyRCOR (0xc8)
198#define CyTBPR (0xc3)
199#define CyTCOR (0xc0)
200#define CySCHR1 (0x1f)
201#define CySCHR2 (0x1e)
202#define CyTPR (0xda)
203#define CyPILR1 (0xe3)
204#define CyPILR2 (0xe0)
205#define CyPILR3 (0xe1)
206#define CyCMR (0x1b)
207#define CyASYNC (0x02)
208#define CyLICR (0x26)
209#define CyLIVR (0x09)
210#define CySCRL (0x23)
211#define CySCRH (0x22)
212#define CyTFTC (0x80)
213
214static void cons_write(struct console *co, const char *str, unsigned count)
215{
216 volatile unsigned char *base_addr = (u_char *)CD2401_ADDR;
217 volatile u_char sink;
218 u_char ier;
219 int port;
220 u_char do_lf = 0;
221 int i = 0;
222
223 /* Ensure transmitter is enabled! */
224
225 port = 0;
226 base_addr[CyCAR] = (u_char)port;
227 while (base_addr[CyCCR])
228 ;
229 base_addr[CyCCR] = CyENB_XMTR;
230
231 ier = base_addr[CyIER];
232 base_addr[CyIER] = CyTxMpty;
233
234 while (1) {
235 if (pcc2chip[PccSCCTICR] & 0x20)
236 {
237 /* We have a Tx int. Acknowledge it */
238 sink = pcc2chip[PccTPIACKR];
239 if ((base_addr[CyLICR] >> 2) == port) {
240 if (i == count) {
241 /* Last char of string is now output */
242 base_addr[CyTEOIR] = CyNOTRANS;
243 break;
244 }
245 if (do_lf) {
246 base_addr[CyTDR] = '\n';
247 str++;
248 i++;
249 do_lf = 0;
250 }
251 else if (*str == '\n') {
252 base_addr[CyTDR] = '\r';
253 do_lf = 1;
254 }
255 else {
256 base_addr[CyTDR] = *str++;
257 i++;
258 }
259 base_addr[CyTEOIR] = 0;
260 }
261 else
262 base_addr[CyTEOIR] = CyNOTRANS;
263 }
264 }
265
266 base_addr[CyIER] = ier;
267}
268
269static struct console cons_info =
270{
271 .name = "sercon",
272 .write = cons_write,
273 .flags = CON_PRINTBUFFER | CON_BOOT,
274 .index = -1,
275};
276
277static void __init mvme16x_early_console(void)
278{
279 register_console(&cons_info);
280
281 printk(KERN_INFO "MVME16x: early console registered\n");
282}
283#endif
127 284
128void __init config_mvme16x(void) 285void __init config_mvme16x(void)
129{ 286{
@@ -183,6 +340,9 @@ void __init config_mvme16x(void)
183 pcc2chip[PccSCCMICR] = 0x10; 340 pcc2chip[PccSCCMICR] = 0x10;
184 pcc2chip[PccSCCTICR] = 0x10; 341 pcc2chip[PccSCCTICR] = 0x10;
185 pcc2chip[PccSCCRICR] = 0x10; 342 pcc2chip[PccSCCRICR] = 0x10;
343#ifdef CONFIG_EARLY_PRINTK
344 mvme16x_early_console();
345#endif
186 } 346 }
187} 347}
188 348